Hello,
I'm modeling a problem using Ceres 1.13.0: thanks for this amazing tool !
For my problem I am minimizing a cost function of 6 dimensions, which are a 2D position, and two 2D vectors. The loss function involving this 6D parameters is quite intricate and calls an external library.
The problem I'm facing is in the validity domain of this space:
- I have bounds: e.g., positions and vector lengths should be strictly bounded,
- And invalid parameter combinations: e.g., the position coordinates
should be smaller than the vector lengths, and the vectors have a
certain relationship regarding their inner angle.
I have problems with both:
- on bounds: the CostFunctor seems to evaluate at parameter values out
of the bounds I set using setParameter<Upper/Lower>Bound. This is
not accepted by the external library I'm using.
- on invalid combinations. I read about two strategies in the manual and
tried them both (http://ceres-solver.org/modeling_faqs.html):
i) returning false when outside of the valid manifold. This regularly
results in a "FAILURE (Residual and Jacobian evaluation failed.)". Can
this be avoided or should I simply not proceed this way ?
ii) projecting or clipping to the domain of validity. In the
CostFunctor, I clip values to the validity domain before calling my
external library. This gives convergence issues: I tried clipping and
wrapping around the unit circle in case of angles ... none really bring
satisfying results.
A more general observation is: my 6D space is not homogeneous. Imagine that 4 dimensions range from 0 to 1000, and the two others from 0 to Pi (angles). I see that "moving out of bounds" happens on the latter with a higher probability than on the former. Can this be handled somehow, e.g., with an parameterblock-adaptive step size ?
Additional info regarding my implementation:
- Trust Region method (as I'm working with bounds) with the defaults: LEVENBERG_MARQUARDT and SPARSE_NORMAL_CHOLESKY.
- Numerical differentiation (because incompatibility with external
library) wrapped in an AutoDiffCostFunction (following
http://ceres-solver.org/interfacing_with_autodiff.html)
- I'm tuning numeric_diff_options_.relative_step_size to (try to) get it to converge.
Thank you for your input.
Kind regards,
Kenneth
Hello,
I'm modeling a problem using Ceres 1.13.0: thanks for this amazing tool !
For my problem I am minimizing a cost function of 6 dimensions, which are a 2D position, and two 2D vectors. The loss function involving this 6D parameters is quite intricate and calls an external library.
The problem I'm facing is in the validity domain of this space:
- I have bounds: e.g., positions and vector lengths should be strictly bounded,
- And invalid parameter combinations: e.g., the position coordinates should be smaller than the vector lengths, and the vectors have a certain relationship regarding their inner angle.
I have problems with both:
- on bounds: the CostFunctor seems to evaluate at parameter values out of the bounds I set using setParameter<Upper/Lower>Bound. This is not accepted by the external library I'm using.
- on invalid combinations. I read about two strategies in the manual and tried them both (http://ceres-solver.org/modeling_faqs.html):
i) returning false when outside of the valid manifold. This regularly results in a "FAILURE (Residual and Jacobian evaluation failed.)". Can this be avoided or should I simply not proceed this way ?
ii) projecting or clipping to the domain of validity. In the CostFunctor, I clip values to the validity domain before calling my external library. This gives convergence issues: I tried clipping and wrapping around the unit circle in case of angles ... none really bring satisfying results.
A more general observation is: my 6D space is not homogeneous. Imagine that 4 dimensions range from 0 to 1000, and the two others from 0 to Pi (angles). I see that "moving out of bounds" happens on the latter with a higher probability than on the former. Can this be handled somehow, e.g., with an parameterblock-adaptive step size ?
Additional info regarding my implementation:
- Trust Region method (as I'm working with bounds) with the defaults: LEVENBERG_MARQUARDT and SPARSE_NORMAL_CHOLESKY.
- Numerical differentiation (because incompatibility with external library) wrapped in an AutoDiffCostFunction (following http://ceres-solver.org/interfacing_with_autodiff.html)
- I'm tuning numeric_diff_options_.relative_step_size to (try to) get it to converge.
Thank you for your input.
Kind regards,
Kenneth
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/d631619a-720c-4838-a1e6-d90efff62185%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
one thought here is, is it possible to reparameterize your problem with lower dimensional parameterization or a more simply constrained one?
On Wed, Oct 4, 2017 at 7:18 AM Sameer Agarwal <sameer...@google.com> wrote:Hi Kenneth,My replies are inline.On Tue, Oct 3, 2017 at 9:59 AM Kenneth V <kenneth...@gmail.com> wrote:Hello,
I'm modeling a problem using Ceres 1.13.0: thanks for this amazing tool !
For my problem I am minimizing a cost function of 6 dimensions, which are a 2D position, and two 2D vectors. The loss function involving this 6D parameters is quite intricate and calls an external library.
The problem I'm facing is in the validity domain of this space:
- I have bounds: e.g., positions and vector lengths should be strictly bounded,
- And invalid parameter combinations: e.g., the position coordinates should be smaller than the vector lengths, and the vectors have a certain relationship regarding their inner angle.Looks like you have an intricate set of constraints on your search space.
I have problems with both:
- on bounds: the CostFunctor seems to evaluate at parameter values out of the bounds I set using setParameter<Upper/Lower>Bound. This is not accepted by the external library I'm using.
are your starting values for each of the parameters feasible?
- on invalid combinations. I read about two strategies in the manual and tried them both (http://ceres-solver.org/modeling_faqs.html):
i) returning false when outside of the valid manifold. This regularly results in a "FAILURE (Residual and Jacobian evaluation failed.)". Can this be avoided or should I simply not proceed this way ?if you start with feasible values, this can work, but is not very good at complicated search spaces.ii) projecting or clipping to the domain of validity. In the CostFunctor, I clip values to the validity domain before calling my external library. This gives convergence issues: I tried clipping and wrapping around the unit circle in case of angles ... none really bring satisfying results.
yeah this just confuses the solver.
A more general observation is: my 6D space is not homogeneous. Imagine that 4 dimensions range from 0 to 1000, and the two others from 0 to Pi (angles). I see that "moving out of bounds" happens on the latter with a higher probability than on the former. Can this be handled somehow, e.g., with an parameterblock-adaptive step size ?
this is something that the LM algorithm should handle on its own, by scaling the different dimensions appropriately. This should ideally be reflected in the Jacobian values too.
Additional info regarding my implementation:
- Trust Region method (as I'm working with bounds) with the defaults: LEVENBERG_MARQUARDT and SPARSE_NORMAL_CHOLESKY.
- Numerical differentiation (because incompatibility with external library) wrapped in an AutoDiffCostFunction (following http://ceres-solver.org/interfacing_with_autodiff.html)
- I'm tuning numeric_diff_options_.relative_step_size to (try to) get it to converge.have you tried using the fancier ridders' method? which should do away with this tuning and give you much higher quality derivatives.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/40d01ad4-c309-4975-8202-72328f796fa9%40googlegroups.com.
Dear Sameer,
Any news on this question ?
Although I mostly got rid of the problem by:
- reparameterizing in a more homogeneous space (everything is carthesian coordinates now, no more angles),
- using RIDDERS.
To improve convergence and accuracy, I now took a dive into the code of the external library I'm using and made it Jet-compatible.
However, I now have the following surprising behavior:
Dear Sameer,
Any news on this question ?
Although I mostly got rid of the problem by:
- reparameterizing in a more homogeneous space (everything is carthesian coordinates now, no more angles),
- using RIDDERS.
To improve convergence and accuracy, I now took a dive into the code of the external library I'm using and made it Jet-compatible.
- Numerical differentiation is slow (RIDDERS) but converges to a reasonable result (even a very good one in simple cases).
However, I now have the following surprising behavior:
- Automatic differentiation (up to the fact that there is an underlying discrete image being looked up, using BiCubic interpolation as suggested in your documentation) is faster (about an order of magnitude) but is nowhere near an as good solution as the numerical variant (the loss is orders of magnitude off: there are much more iterations being done in shorter time, but the cost_change is ridiculously small ...).
My question: according to your experience, is this necessarily a bug, or could it be that auto-diff is not the best way to go for my problem (on which I don't want to bother you with more detail yet, unless you tell me to) ?
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/6eddf377-3105-42b0-9920-975156b39d6c%40googlegroups.com.
Kenneth I have not had a chance, work has been busy. My comments inline.On Fri, Oct 13, 2017 at 5:26 AM Kenneth V <kenneth...@gmail.com> wrote:Dear Sameer,
Any news on this question ?
Although I mostly got rid of the problem by:
- reparameterizing in a more homogeneous space (everything is carthesian coordinates now, no more angles),+1- using RIDDERS.
To improve convergence and accuracy, I now took a dive into the code of the external library I'm using and made it Jet-compatible.
- Numerical differentiation is slow (RIDDERS) but converges to a reasonable result (even a very good one in simple cases).
However, I now have the following surprising behavior:- Automatic differentiation (up to the fact that there is an underlying discrete image being looked up, using BiCubic interpolation as suggested in your documentation) is faster (about an order of magnitude) but is nowhere near an as good solution as the numerical variant (the loss is orders of magnitude off: there are much more iterations being done in shorter time, but the cost_change is ridiculously small ...).are you sure your implementations match?My question: according to your experience, is this necessarily a bug, or could it be that auto-diff is not the best way to go for my problem (on which I don't want to bother you with more detail yet, unless you tell me to) ?sounds like a bug to me. unless your function is noisy somehow, and ridders is getting around it.
Sameer
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/6eddf377-3105-42b0-9920-975156b39d6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUAM_snT6u0-7JTi6POOJYHs1ptFUpU1ADuv-5J9SQtjjg%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
On Fri, Oct 13, 2017 at 7:29 AM, 'Sameer Agarwal' via Ceres Solver <ceres-...@googlegroups.com> wrote:Kenneth I have not had a chance, work has been busy. My comments inline.On Fri, Oct 13, 2017 at 5:26 AM Kenneth V <kenneth...@gmail.com> wrote:Dear Sameer,
Any news on this question ?
Although I mostly got rid of the problem by:
- reparameterizing in a more homogeneous space (everything is carthesian coordinates now, no more angles),+1- using RIDDERS.
To improve convergence and accuracy, I now took a dive into the code of the external library I'm using and made it Jet-compatible.
- Numerical differentiation is slow (RIDDERS) but converges to a reasonable result (even a very good one in simple cases).
However, I now have the following surprising behavior:- Automatic differentiation (up to the fact that there is an underlying discrete image being looked up, using BiCubic interpolation as suggested in your documentation) is faster (about an order of magnitude) but is nowhere near an as good solution as the numerical variant (the loss is orders of magnitude off: there are much more iterations being done in shorter time, but the cost_change is ridiculously small ...).are you sure your implementations match?
My question: according to your experience, is this necessarily a bug, or could it be that auto-diff is not the best way to go for my problem (on which I don't want to bother you with more detail yet, unless you tell me to) ?sounds like a bug to me. unless your function is noisy somehow, and ridders is getting around it.
Though I wanted to add-- if you are calling an external library, then care must be taken to ensure the derivatives are propagated correctly from the external function. How are you bridging to the external library if you're using autodiff?
Sameer
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/6eddf377-3105-42b0-9920-975156b39d6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/ba21c9c0-c51a-42fe-b22d-0e73c70a2566%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/1db3a760-2f5e-4740-8923-e86749e41d8b%40googlegroups.com.
I'm checking all the computation done and see if Jets are properly bridged.
Nothing wrong found yet.
In my code I'm computing a variance of a large number of scalars (involving mean computation based on sums, divisions, squares, etc.).