Overlapping parameter blocks for image problems

140 views
Skip to first unread message

Matthew Fisher

unread,
Jan 9, 2016, 1:20:52 PM1/9/16
to Ceres Solver
I am trying to use CERES for an imaging problem.  The unknowns are arranged in a 1024x1024 image.  The energy function is defined on each non-boundary pixel on a 5x5 grid.

I initially thought to model the problem where the energy function factory takes 5 parameter blocks corresponding to the five needed scanlines, i.e., U(-2, -2), U(-2, -1), U(-2, 0), U(-2, 1), U(-2, 2), where U is the unknown grid, the value inside the parens is the offset into U, and each parameter block runs for 5 pixels.

This produces aliasing in the parameter blocks however, which is apparently not allowed.

I could instead pass things in as 25 parameter blocks for each needed pixel, but I am guessing this is not expected (although will probably be my fallback).

I briefly looked at the idea of passing in the whole image as a single parameter block, but CERES was not able to handle this well.

What is the expected way to model these types of imaging problems in CERES?

Thanks,
--Matt

Sameer Agarwal

unread,
Jan 9, 2016, 1:30:54 PM1/9/16
to ceres-...@googlegroups.com
On Sat, Jan 9, 2016 at 10:20 AM Matthew Fisher <tech...@gmail.com> wrote:
I am trying to use CERES for an imaging problem.  The unknowns are arranged in a 1024x1024 image.  The energy function is defined on each non-boundary pixel on a 5x5 grid.

I initially thought to model the problem where the energy function factory takes 5 parameter blocks corresponding to the five needed scanlines, i.e., U(-2, -2), U(-2, -1), U(-2, 0), U(-2, 1), U(-2, 2), where U is the unknown grid, the value inside the parens is the offset into U, and each parameter block runs for 5 pixels.

This produces aliasing in the parameter blocks however, which is apparently not allowed.

Yes this is not going to work.
 

I could instead pass things in as 25 parameter blocks for each needed pixel, but I am guessing this is not expected (although will probably be my fallback).

This should work just fine.

I briefly looked at the idea of passing in the whole image as a single parameter block, but CERES was not able to handle this well.

This would not work, as the parameter block would be too huge and you are going to run into problems.

 

What is the expected way to model these types of imaging problems in CERES?

The cost function that depends on 25 parameter blocks/pixels is the right way to go here. You can look at the fields of experts denoising example code that ships with ceres


It supports multiple different window sizes too.

With 25 parameter blocks, you won't be able to use automatic differentiation unless you use DynamicAutoDiffCostFunction, which might be too slow. The denoising example uses analytic jacobians.

The other thing to consider is the choice of minimization algorithm. The Jacobian grows in size quite quickly. You can use the non-linear least squares minimizer with SPARSE_NORMAL_CHOLESKY, but as and when you move to larger images, this will become slow. 

Another choice depending on your problem would be to use the line search minimizer with LBFGS as the line search direction.

Sameer

 
Thanks,
--Matt

--
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/ef2a85bc-9331-4317-8cca-fb09c382ede6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Fisher

unread,
Jan 9, 2016, 1:45:28 PM1/9/16
to Ceres Solver
Even for ~1 million unknowns on the 3x3 version, we found that SPARSE_NORMAL_CHOLESKY works best, typically at least 2x+ better than any other solver.  We had sort of been thinking CGNR would do better but it was ~5x slower (it may not have been multithreading though, although the summary indicated it was using multiple threads.)  Cholesky still solves within a few minutes or so.

LBFGS didn't converge to a reasonable result even after many thousands of iterations, which surprised us a bit, but the problem seems to be setup correctly and solves fine with all the LM methods.

I'll try DynamicAutoDiffCostFunction on the 5x5 version.

--Matt

Sameer Agarwal

unread,
Jan 9, 2016, 1:57:08 PM1/9/16
to Ceres Solver
you might want to play with the rank of the lbfgs solver.
If sparse_normal_cholesky works for you, thats great. 


--
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.
Reply all
Reply to author
Forward
0 new messages