【问题标题】:Caffe "Unknown solver type : SGD"Caffe“未知求解器类型:SGD”
【发布时间】:2019-10-17 18:29:57
【问题描述】:

在 Windows 10 下构建 Caffe(最新版本,仅 CPU 构建),用于 VS C++ 项目。让一切开始工作不得不麻烦。但是在创建Solver类的实例时,出现错误。

SolverParameter solverParam;
ReadSolverParamsFromTextFileOrDie("solver.prototxt", &solverParam);
boost::shared_ptr<Solver<float>> solver(SolverRegistry<float>::CreateSolver(solverParam));

输出:

WARNING: Logging before InitGoogleLogging() is written to STDERR
F0601 14:21:42.943118 10832 solver_factory.cpp:29] Check failed: registry.count(type) == 1 (0 vs. 1) Unknown solver type: SGD (known types: )
*** Check failure stack trace: ***

solver.prototxt 内容:

net: "model.prototxt"
base_lr: 0.02
lr_policy: "step"
gamma: 0.5
stepsize: 500000
display: 10
max_iter: 5000
snapshot: 1000000
snapshot_prefix: "XORProblem"
solver_mode: CPU
test_iter: 1
test_interval: 2000

是什么原因?

【问题讨论】:

    标签: c++ windows machine-learning caffe


    【解决方案1】:

    我通过将“caffe/solvers/sgd_solver.cpp”包含到“caffe.cpp”中解决了这个问题。

    【讨论】:

    • 您能详细说明一下吗?
    【解决方案2】:

    您似乎根本没有定义求解器的类型。
    尝试添加

    type: "SGD"
    

    到您的'solver.prototxt'

    求解器类型默认为"SGD",但有两种定义方式:一种是使用solver_type: SGD,另一种是使用type: "SGD"。第一个选项在 cmets 中被标记为“已弃用”,所以我想这会给您带来麻烦。
    尝试通过使用非弃用方法显式设置求解器类型来避免默认设置。

    更新:
    查看 windows 分支readme 似乎在 windows 下编译共享库存在一个未解决的问题,特别是求解器。
    我相信您遇到的问题与该问题有关。

    【讨论】:

    • 加上type "SGD" 没有任何改变。
    • @D.Stark 你确定你的构建顺利吗?你运行了所有的测试吗? caffe 似乎没有注册求解器。
    • 不,我不确定
    • @D.Stark make test 然后make runtest(或类似的东西)
    • 你的意思是构建库后运行的测试吗?在构建之前,我在 build_win.cmd 中指定了 RUN_TESTS=1。所有测试均成功。
    猜你喜欢
    • 2015-09-21
    • 2016-07-27
    • 1970-01-01
    • 2013-04-07
    • 1970-01-01
    • 1970-01-01
    • 2016-03-04
    • 2014-04-08
    • 1970-01-01
    相关资源
    最近更新 更多