LBFGS optimizer

hello everyone,
I was wondering if itk developers provided a registration example between two 3d images using LBFGS optimizer ? I already checked test examples and program throws the following exception when computing registration process:

*************************************************
  N=6   NUMBER OF CORRECTIONS=5       INITIAL VALUES F= 0   GNORM= 0
*************************************************
   I   NFN    FUNC        GNORM       STEPLENGTH
  THE SEARCH DIRECTION IS NOT A DESCENT DIRECTION
 IFLAG= -1  LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN OF LINE SEARCH: INFO= 0 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE INCORRECT OR INCORRECT TOLERANCESvnl_lbfgs: Error. Netlib routine lbfgs failed.

Thank you

Which test is that? Do the rest of the tests run fine?

hello @dzenanz,
in fact, I looked through unit tests in order to know how to use LBFGS optimizer.
This is how I set its parameters:

    optimizer->SetTrace( false );
    optimizer->SetMaximumNumberOfFunctionEvaluations( 1000 );
    optimizer->SetGradientConvergenceTolerance( 0.001 );
    optimizer->SetLineSearchAccuracy( 0.9 );
    optimizer->SetDefaultStepLength( 0.1 );

And I get the exception above. So I was wondering if anyone knows how to raise this exception… I mean, does this exception come from optimizer parameters? Or maybe the cost function? Or the metric that I use?

okay, never mind, my problem came from this line:

optimizer->SetGradientConvergenceTolerance( 0.001 );

I relaxed this parameter and set it to 0.1. My program runs perfectly fine now.

1 Like