未经测试的Caffe训练

未经测试的Caffe训练

本文介绍了未经测试的Caffe训练的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Caffe 在已知的图像数据库上训练AlexNet.我正在进行基准测试,并希望排除测试阶段.

I am using Caffe to train AlexNet on a known image database. I am benchmarking and want to exclude a testing phase.

这是AlexNet的solver.prototxt:

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

虽然我还没有找到一个详细的文档来详细说明所有prototxt选项,但是Caffe教程中的注释表明此"test_interval"表示我们测试经过训练的网络之后的迭代次数.

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: ***

因此,我将test_interval设置为一百万,但是,当然,Caffe会在零迭代中测试网络.

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的文档在细节上有些匮乏.我最后被告知的是这种违反直觉的解决方案:

Caffe's documentation is somewhat scant on details. What I was finally told is this counterintuitive solution:

在您的solver.prototxt中,以test_itertest_interval

In your solver.prototxt, take the lines for test_iter and test_interval

test_iter: 1000
test_interval: 1000

,然后简单地忽略它们.如果您想在一开始就阻止测试,则可以添加一行作为 @shai建议:

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训练的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 12:00