Ceres Solver: unable to disable logging (google glog)

不羁岁月 提交于 2021-01-02 06:14:31

问题


I'm using ceres solver for a project, and when I call the ceres::Solve function, the library starts to output lines such as this one:

iterative_schur_complement_solver.cc:88 No parameter blocks left in the schur complement.
wall_time.cc:74 

IterativeSchurComplementSolver::Solve
                                   Delta   Cumulative
                           Total :    0.00001      0.00001

I tried to disable the logging of these intermediate steps but I had no success so far. I'm calling this line on the constructor of my class:

google::InitGoogleLogging("my-project");

The options set when I call the solver are:

ceres::Solver::Options options;
options.preconditioner_type = ceres::SCHUR_JACOBI;
options.linear_solver_type = ceres::ITERATIVE_SCHUR;
options.logging_type = SILENT;
options.minimizer_progress_to_stdout = false;
ceres::Solver::Summary summary;
ceres::Solve(options, &problem, &summary);

It seems to me that the ceres logging is effectively disabled but the logging of its dependent libraries (i.e: SuiteSparse) isn't.

Does someone have an idea on how to disable this annoying log?


回答1:


I would first verify that you are using glog and not miniglog (check through the output of CMake when you're building ceres), as the two don't mix well. Then you should be able to set the level of verbosity using glog's command line flags.

Also, I think the SILENT should be scoped, i.e., options.logging_type = ceres::SILENT;

I'm using miniglog and I see these messages also.

Edit: This recent patch may also help you.




回答2:


Try adding the line:

#define MAX_LOG_LEVEL -100

in the file logging.h just above #ifdef MAX_LOG_LEVEL

Make sure you set the level to -100 and not 100.
This works great!



来源:https://stackoverflow.com/questions/21410982/ceres-solver-unable-to-disable-logging-google-glog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!