我在一个项目中使用ceres求解器,当我调用ceres::Solve函数时,该库开始输出这样的行:

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

我试图禁用这些中间步骤的日志记录,但是到目前为止,我还没有成功。我在类的构造函数上调用此行:
google::InitGoogleLogging("my-project");

调用求解器时设置的选项是:
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);

在我看来,ceres日志记录实际上已被禁用,但是其依赖库(即SuiteSparse)的日志记录却未被禁用。

有人对如何禁用此烦人的日志有想法吗?

最佳答案

我首先要验证您使用的是glog而不是miniglog(在构建ceres时检查CMake的输出),因为两者混合得不好。然后,您应该可以使用glog的command line flags设置详细程度。

另外,我认为SILENT应该是作用域,即options.logging_type = ceres::SILENT;
我正在使用miniglog,并且也看到了这些消息。

编辑:This recent patch也可以为您提供帮助。

10-08 08:10