[Insight-users] Re: Problems with understanding the parameters in
the amoeba optimizer
Karthik Krishnan
karthik.krishnan at kitware.com
Wed Nov 29 18:14:01 EST 2006
On 11/29/06, Arne Hansen <bsd.diverse at gmail.com> wrote:
>
> Okay, i have been investigeting the matter a bit more.
> It seems that it actually has an effect when i set the
> optimizer->SetMaximumNumberOfIterations
>
> It moves in intervals of 9. So if i set the MaximumNumberOfIterations = 1
> it corresponds to 17 iterations.
>
Not always.... Try to set the verbose flag on the amoeba optimizer to see
what's going on..
itkAmoebaOpt->GetOptimizer()->verbose = 2;
The amoeba is a simplex optimizer that optimizes by expanding / shrinking /
reflecting from the initial simplex.
The cost function is evaluated at each end point of the simplex. The larger
the number of endpoints (= no: of parameters in the cost function = no: of
paramters in your transform), the more the evaluations.
One iteration involves one or more combinations of operations on the simplex
(expand/reflect/shrink). The number of such combinations depends the
function evaluations. For instance if the contraction point is really good,
it would hold it there and that would be the end of that iteration. If it is
bad, it might try reflecting...
See the source of vnl_amoeba.cxx
So do not be worried if you do not see a direct mathematical relationship
between the number of cost-function evaluations and the number of parameters
in your transform.
-karthik
if i set it to 10 it corresponds to 26 and so on.
> In short:
> value:
> 1-9 : 17 iterations
> 10-18 : 26 iterations
> 19-27 : 35 iterations
> 28-36 : 44 iterations
> 37-46 : 53 iterations
> etc.
>
> I find this very odd.
> I read this reply made by Luis once:
>
> >* The Amoeba optimizer in ITK is a wrapper around the vnl
> *>* amoeba optimizer. Since VNL does not send any events during
> *>* the iterations of its optimizers, ITK implemented a trick in *>* the
> following way:
> *>*
> *>* itkAmoebaOptimizer wraps vnl_amoeba
> *>*
> *>* SingleValuedVnlCostFunctionAdaptor
> *>* wraps vnl_cost_function
> *>*
> *>*
> *>* vnl_amoeba calls the f() method of the vnl_cost_function,
> *>* that in turn calls the GetValue() method of the ITK
> *>* SingleValuedVnlCostFunctionAdaptor.
> *>*
> *>* The SingleValuedVnlCostFunctionAdaptor sends events that
> *>* are "observed" by the itkAmoebaOptimizer and resent as
> *>* iteration events.
> *>*
> * >* In this way, we get events *per evaluation* of the cost
> *>* function. Note that this is not completely equivalent
> *>* to events per iteration of the amoeba_optimizer,.... but
> *>* it is better than nothing.
> *>*
> *>* as a rule of thumb you could expect that N evaluations of
> *>* the cost_function are equivalent to one iteration of the
> *>* amoeba optimizer, where N is the dimensionality of the
> *>* parametric space of the cost function.
> *
> So i should expect that my amount of parameters is 9. The problem is that
> it is only 7, since i use the
> itkSimilarity3DTransform ie. (Rx,Ry,Rz,Tx,Ty,Tz,S = 7)
> So i cannot understand why the iteration count behaves like this.
>
> Any suggestions?
> * *
>
>
>
> 2006/11/29, Arne Hansen <bsd.diverse at gmail.com>:
> >
> > Hello.
> > I am using an amoeba optimizer to minimize overlap (itkKappaStatistic)
> > between 2 binary volumes.
> >
> > My problem is that it seems that when i set parameters
> > optimizer->SetMaximumNumberOfIterations(1);
> > optimizer->SetParametersConvergenceTolerance(10);
> > optimizer->SetFunctionConvergenceTolerance(10);
> >
> > they dont seem to have any affect at all. Even though i tell it to
> > maximal do 1 iteration, it still does 17 iterations in the first layer of my
> > itkMultiResolutionImageRegistrationMethod.
> >
> > Furthermore, as i am doing kappastatistic, the maximum function value is
> > of course 1 for perfectly
> > gemetric aligned images. So the function value is -1 all the
> > time(Because i told the optimizer to maximize and not nminimize. But still,
> > it does first convergeafter the 17 iterationss in the top pyramid. And the
> > same for the rest of the pyramid.
> > Here is the result from a 2-layered pyramid.......
> >
> >
> > Iteration count : 0
> >
> > ///////////////////////////////////////////////////////////
> >
> > Pyramid level0
> >
> > ///////////////////////////////////////////////////////////
> >
> > -1:
> >
> > //[]
> >
> > [0, 0, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.00025, 0, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0, 0.00025, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0, 0, 0.00025, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0, 0, 0, 0.025, 0, 0, 1]
> >
> > -1:
> >
> > [0, 0, 0, 0, 0.025, 0, 1]
> >
> > -1:
> >
> > [0, 0, 0, 0, 0, 0.025, 1]
> >
> > -1:
> >
> > [0, 0, 0, 0, 0, 0, 1.05]
> >
> > -1:
> >
> > [7.1428571429e-005, 7.1428571429e-005, 7.1428571429e-005,
> > 0.0071428571429, 0.0071428571429, 0.0071428571429, 1.0142857143]
> >
> > -1:
> >
> > [1.7857142857e-005, 1.7857142857e-005, 1.7857142857e-005,
> > 0.0017857142857, 0.0017857142857, 0.0017857142857, 1.0035714286]
> >
> > -1:
> >
> > [0.000125, 0.000125, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0, 0.000125, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0, 0, 0.0125, 0, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0, 0, 0, 0.0125, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0, 0, 0, 0, 0.0125, 1]
> >
> > -1:
> >
> > [0.000125, 0, 0, 0, 0, 0, 1.025]
> >
> > -1:
> >
> > [0.000125, 0, 0, 0, 0, 0, 1]
> >
> > Iteration count : 17
> >
> > ///////////////////////////////////////////////////////////
> >
> > Pyramid level1
> >
> > ///////////////////////////////////////////////////////////
> >
> > -1:
> >
> > [0.000125, 0.000125, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.00025, 0.000125, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0.00025, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0.000125, 0.00025, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0.000125, 0, 0.025, 0, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0.000125, 0, 0, 0.025, 0, 1]
> >
> > -1:
> >
> > [0.000125, 0.000125, 0, 0, 0, 0.025, 1]
> >
> > -0.97433615191:
> >
> > [0.000125, 0.000125, 0, 0, 0, 0, 1.05]
> >
> > -0.96254003621:
> >
> > [0.00016071428571, 0.00016071428571, 7.1428571429e-005, 0.0071428571429,
> > 0.0071428571429, 0.0071428571429, 0.95]
> >
> > -1:
> >
> > [0.00013392857143, 0.00013392857143, 1.7857142857e-005, 0.0017857142857,
> > 0.0017857142857, 0.0017857142857, 1.025]
> >
> > -1:
> >
> > [0.0001875, 0.0001875, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.0001875, 0.000125, 0.000125, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.0001875, 0.000125, 0, 0.0125, 0, 0, 1]
> >
> > -1:
> >
> > [0.0001875, 0.000125, 0, 0, 0.0125, 0, 1]
> >
> > -1:
> >
> > [0.0001875, 0.000125, 0, 0, 0, 0.0125, 1]
> >
> > -1:
> >
> > [0.0001875, 0.000125, 0, 0, 0, 0, 1]
> >
> > -1:
> >
> > [0.0001875, 0.000125, 0, 0, 0, 0, 1.025]
> >
> > ----------------------------Registration completed-------------------
> >
> >
> >
> > Result :
> >
> > Translation X = 0
> >
> > Translation Y = 0
> >
> > Translation Z = 0
> >
> > Rotation X = 0.70710678119
> >
> > Rotation Y = 0.70710678119
> >
> > Rotation Z = 0
> >
> > GetAngle = 0.0005303300921
> >
> > Offset = -0.021839980215 0.021839980215 -0.0025979353519
> >
> > Matrix =
> >
> > 0.99999992969 7.03125e-008 0.00037499998682
> >
> > 7.03125e-008 0.99999992969 -0.00037499998682
> >
> > -0.00037499998682 0.00037499998682 0.99999985938
> >
> > Offset =
> >
> > [-0.021839980215, 0.021839980215, -0.0025979353519]
> >
> > Culd someone help my. Than you very much
> >
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20061129/5b8c96e5/attachment.htm
More information about the Insight-users
mailing list