未经测试的 Caffe 训练 [英] Caffe training without testing
问题描述
我正在使用 Caffe 在已知图像数据库上训练 AlexNet.我正在进行基准测试并希望排除测试阶段.
这是 AlexNet 的 solver.prototxt
:
net: "models/bvlc_alexnet/train_val.prototxt"test_iter:1000测试间隔:1000base_lr:0.01lr_policy: "步骤"伽玛:0.1步长:100000显示:20max_iter:450000动量:0.9weight_decay:0.0005快照:10000快照前缀:模型/bvlc_alexnet/caffe_alexnet_train"求解器模式:GPU
虽然我从未找到详细说明所有 prototxt 选项的权威文档,但 Caffe 教程中的注释表明test_interval
"表示我们测试训练网络后的迭代次数.
我想我可以将它设置为零以关闭测试.没有.
<块引用>F1124 14:42:54.691428 18772 solver.cpp:140] 检查失败:param_.test_interval() >0(0 对 0)*** 检查失败堆栈跟踪:***
所以我将 test_interval
设置为一百万,但当然,Caffe 在迭代零时测试网络.
I1124 14:59:12.787899 18905 solver.cpp:340] 迭代 0,测试网络 (#0)I1124 14:59:15.698724 18905solver.cpp:408] 测试网络输出 #0:准确度 = 0.003
如何在训练时关闭测试?
Caffe 的文档有些缺乏细节.最后告诉我的是这个违反直觉的解决方案:
在您的solver.prototxt 中,取test_iter
和test_interval
test_iter: 1000测试间隔:1000
并简单地省略它们.如果您想在开始时阻止测试,您可以添加一行 @shai 建议:
test_initialization: false
I am using Caffe to train AlexNet on a known image database. I am benchmarking and want to exclude a testing phase.
Here is the solver.prototxt
for AlexNet:
net: "models/bvlc_alexnet/train_val.prototxt"
test_iter: 1000
test_interval: 1000
base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 100000
display: 20
max_iter: 450000
momentum: 0.9
weight_decay: 0.0005
snapshot: 10000
snapshot_prefix: "models/bvlc_alexnet/caffe_alexnet_train"
solver_mode: GPU
While I have never found a definitive doc that detailed all of the prototxt options, comments within Caffe tutorials indicate this "test_interval
" represents the number of iterations after which we test the trained network.
I figured that I might set it to zero to turn off testing. Nope.
F1124 14:42:54.691428 18772 solver.cpp:140] Check failed: param_.test_interval() > 0 (0 vs. 0) *** Check failure stack trace: ***
So I set the test_interval
to one million, but still of course, Caffe tests the network at iteration zero.
I1124 14:59:12.787899 18905 solver.cpp:340] Iteration 0, Testing net (#0) I1124 14:59:15.698724 18905 solver.cpp:408] Test net output #0: accuracy = 0.003
How do I turn testing off while training?
Caffe's documentation is somewhat scant on details. What I was finally told is this counterintuitive solution:
In your solver.prototxt, take the lines for test_iter
and test_interval
test_iter: 1000
test_interval: 1000
and simply omit them. If you'd like to prevent the test at the beginning, you would add a line as @shai suggested:
test_initialization: false
这篇关于未经测试的 Caffe 训练的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!