Updating "constant" parameters between iterations

584 views
Skip to first unread message

Thomas Sharpless

unread,
Jun 16, 2016, 1:08:36 PM6/16/16
to Ceres Solver
Hi, just checking whether I am about to try something stupid.

I have a model with a variable number of formal parameters.  In the general case they are all independent, but in some cases several of them are linked by known functions.   
I would like to handle all cases with the same error function and the same parameter array structure.  For the special cases I would mark some parameter values as fixed and update them in an iteration callback function.  

 Is there anything wrong with this approach?

-- Tom


Sameer Agarwal

unread,
Jun 16, 2016, 1:41:06 PM6/16/16
to Ceres Solver
This is a very bad idea. The optimization algorithm depends on the problem being constant over the lifetime of the solve.


--
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/1769e2f4-9ad0-407f-bc28-a8bdb686f914%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Sharpless

unread,
Jun 16, 2016, 9:12:38 PM6/16/16
to ceres-...@googlegroups.com
Thanks, Sameer.

Does "keeping the problem constant" mean that all variable values seen by the error function must be parameters set by the optimizer?
Looks like I need a different error fn for each case, that recomputes the dependent parameters at every call.

-- Tom





--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/UVlf4jJJJ4Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAK0oyEocJpr08vXE024mYsNAkDtWxjJSpNEsLp5s01TnLuv%2Bbw%40mail.gmail.com.

Sameer Agarwal

unread,
Jun 17, 2016, 12:28:09 AM6/17/16
to ceres-...@googlegroups.com
Keeping the problem constant means that you do not change the behaviour of the cost functions during the solve. For example of your cost function depends on some static data, you should not change the value of these data using an iteration callback.
You can't actually change the values of the parameter blocks while the solver is working, because ceres makes an internal copy of the parameter block values and manipulates while the solver it running and copies it back into the parameter block if the solver terminates successfully.

I still do not quite understand what you are trying to do. If you want to tie some of the parameters together by some function, why would that require you to update the values using a parameter callback? can you describe what you are trying to do mathematically?

Thomas Sharpless

unread,
Jun 17, 2016, 10:10:49 AM6/17/16
to ceres-...@googlegroups.com
Hi Sameer,

It is a multi-view stereo problem.

I have multiple views taken with an array of cameras, usually mounted on a support that rotates around fixed axes, but sometimes hand-held.  The camera positions in the array are known well enough,  so in the fixed support case, array rotation fully determines the camera positions.  But when hand held, the array position must be estimated too.  In either case the rotation of the array must be estimated, and also the (fixed but not fully known) rotation and some lens parameters of each camera.  

The goal is to estimate alignment parameters of the photos.  The data are rays from photos toward scene points.  Each ray is labeled with a camera, a view and a scene point; each of those objects is a parameter block.  Each scene point is observed at least 4 times. I plan to do classic bundle adjustment with a focal plane error computed separately for each ray. I have good initial values for all parameters.

-- Tom

Sameer Agarwal

unread,
Jun 17, 2016, 10:27:22 AM6/17/16
to ceres-...@googlegroups.com
Thomas,
Comments inline.

On Fri, Jun 17, 2016 at 7:10 AM Thomas Sharpless <tksha...@gmail.com> wrote:
Hi Sameer,

It is a multi-view stereo problem.

I have multiple views taken with an array of cameras, usually mounted on a support that rotates around fixed axes, but sometimes hand-held.  The camera positions in the array are known well enough,  so in the fixed support case, array rotation fully determines the camera positions.  But when hand held, the array position must be estimated too.  In either case the rotation of the array must be estimated, and also the (fixed but not fully known) rotation and some lens parameters of each camera.  

If the relative position of the cameras in the array is fixed, why does it matter if the camera rig is hand held or is being rotated. Yes you need to estimate the rotation in the first case and rotation + translation in the second of the whole rig moving. 

This is straightforward to implement without requiring anything fancy. 

Lets call the position of the center of the array at each frame captured by the rig be S_i. Lets call the relative transformation from the center of the rig to the k^th camera be  P_k. If you know this, then it is fixed otherwise variable. 

So the actual position of each camera in the i^th frame is P_k S_i. 

So your cost functor should take these two transformation and the 3d position of the point as inputs and compute the projection into the image and compare it to your observed projection. 

And you have complete flexibility to set P_ks constant if you know them, part of S_i constant if its only rotating. If you do not know P_k precisely,  you can add another term to the optimization problem which penalizes its deviation from your best estimate for it.

Hope this helps,
Sameer


Reply all
Reply to author
Forward
0 new messages