我对caffe并不陌生,目前我正尝试将其与Alexnet一起使用。当我说使用时,我的意思是我不想训练网络,因此,我得到了here所述的'.caffemodel'
for Alexnet。
现在,我想使用caffe的时间功能来查看在TEST阶段执行每一层所花费的时间(我正在做的是在推断过程中获取每一层的执行时间)。
根据咖啡师的选择
usage: caffe <command> <args>
commands:
train train or finetune a model
test score a model
------------
time benchmark model execution time
collect collects layer data on specified device
compare collects layer data using inputs from other device
Flags from tools/caffe.cpp:
---------------------
-phase (Optional; network phase (TRAIN or TEST). Only used for 'time'.)
type: string default: ""
-sampling (Optional; Caffe test with sampling mode) type: bool
default: false
-------------------------
在测试阶段,我可以运行以下命令对Alexnet进行基准测试:
build/tools/caffe time -model models/bvlc_alexnet/train_val.prototxt -iterations 1000 -engine MKLDNN -phase TEST
但是当我这样做时,出现以下错误:
I0304 17:37:26.183619 29987 net.cpp:409] label_data_1_split does not need backward computation.
I0304 17:37:26.183625 29987 net.cpp:409] data does not need backward computation.
I0304 17:37:26.183629 29987 net.cpp:451] This network produces output accuracy
I0304 17:37:26.183635 29987 net.cpp:451] This network produces output loss
I0304 17:37:26.183647 29987 net.cpp:491] Network initialization done.
I0304 17:37:26.183732 29987 caffe.cpp:556] Performing Forward
I0304 17:37:26.287747 29987 caffe.cpp:561] Initial loss: 6.92452
I0304 17:37:26.287784 29987 caffe.cpp:563] Performing Backward
F0304 17:37:26.385227 29987 mkldnn_pooling_layer.cpp:464] Check failed: poolingBwd_pd
*** Check failure stack trace: ***
@ 0x7fe03e3980cd google::LogMessage::Fail()
@ 0x7fe03e399f33 google::LogMessage::SendToLog()
@ 0x7fe03e397c28 google::LogMessage::Flush()
@ 0x7fe03e39a999 google::LogMessageFatal::~LogMessageFatal()
@ 0x7fe03ead741c caffe::MKLDNNPoolingLayer<>::InitPoolingBwd()
@ 0x7fe03eac4ec2 caffe::MKLDNNPoolingLayer<>::Backward_cpu()
@ 0x7fe03e8f9b19 caffe::Net<>::Backward()
@ 0x5622d81a2530 (unknown)
@ 0x5622d8199353 (unknown)
@ 0x7fe03ab09b97 __libc_start_main
@ 0x5622d8198e1a (unknown)
我猜我使用命令的方式存在一些问题,可能需要为此更改.prototxt
文件。
如果有人能为我指出正确的方向,以便在测试阶段获得Alexnet的基准数字,我将不胜感激。
P.S:如果您不指定阶段就运行咖啡时间,我将无法发现会发生什么。它是否同时对TEST和TRAIN阶段进行了基准测试?