Caffe不会在SIGINT上创建快照

时间:2016-02-16 16:42:52

标签: neural-network deep-learning caffe

当我在终端中按 CTRL + C 时,caffe会停止训练,但不会拍摄快照。怎么解决? 我的解决者:

net: "course-work/testing/model.prototxt"
test_iter: 200
test_interval: 500

base_lr: 0.001
momentum: 0.9
weight_decay: 0.005
lr_policy: "fixed"

display: 50
max_iter: 60000

snapshot: 5000
snapshot_format: HDF5
snapshot_prefix: "course-work/testing/by_solver_lr0"
snapshot_after_train: true

solver_mode: CPU

Bash脚本:

TOOLS=./build/tools
NET_DIR=course-work/testing

$TOOLS/caffe train \
    --solver=$NET_DIR/solver_lr0.prototxt 2>&1 | tee $NET_DIR/1.log

2 个答案:

答案 0 :(得分:6)

通过tee和管道重定向caffe的输出可能会改变操作系统处理信号并将信号传输到进程的方式。请尽量避免| tee以确保SIGINT达到caffe。

请注意caffe tool有两个标记

DEFINE_string(sigint_effect, "stop",
             "Optional; action to take when a SIGINT signal is received: "
              "snapshot, stop or none.");
DEFINE_string(sighup_effect, "snapshot",
             "Optional; action to take when a SIGHUP signal is received: "
             "snapshot, stop or none.");

这些标记可以帮助您在SIGINTSIGHUP上定义caffe的行为。

答案 1 :(得分:1)

记录caffe输出的好方法是

GLOG_log_dir=/path/to/log/dir $CAFFE_ROOT/bin/caffe.bin train 
—solver=/path/to/solver.prototxt

这会对caffe输出进行实时记录,而SIGINT肯定会达到caffe。