0
votes

Can someone share with me how to use the pycaffe interface to time each layer including some customized python layer?

I have observed there are timing operations in caffe source file: tools/caffe.cpp:

forward_timer.Start();
for (int i = 0; i < layers.size(); ++i) {
  timer.Start();
  layers[i]->Forward(bottom_vecs[i], top_vecs[i]);
  forward_time_per_layer[i] += timer.MicroSeconds();
}

but I don't know how to use it in the pycaffe interface.

There is official doc says:

Benchmarking: caffe time benchmarks model execution layer-by-layer through timing and synchronization. This is useful to check system performance and measure relative execution times for models.

caffe time -model examples/mnist/lenet_train_test.prototxt -weights examples/mnist/lenet_iter_10000.caffemodel -gpu 0 -iterations 10

but this is used at caffe command line, I'm actually running faster-rcnn, which contains python implementations, and called by python scripts, I dont know how to use it.

with command caffe time -model xxx.prototxt -weight caffemodel, it cannot find my python layers, how to set the path so caffe can find it?

EDIT: after adding python layer file path to PYTHONPATH, it can find the module, but some error happens, which does not happen when I did with python interface:

F0119 22:24:39.621578  9314 net.cpp:141] Check failed: param_size <= num_param_blobs (0 vs. -2) Too many params specified for layer proposal
*** Check failure stack trace: ***
    @     0x7efd9bde9daa  (unknown)
    @     0x7efd9bde9ce4  (unknown)
    @     0x7efd9bde96e6  (unknown)
    @     0x7efd9bdec687  (unknown)
    @     0x7efd9c4555b6  caffe::Net<>::Init()
    @     0x7efd9c45667b  caffe::Net<>::Net()
    @           0x408c0c  time()
    @           0x405bec  main
    @     0x7efd9a799f45  (unknown)
    @           0x4064f3  (unknown)
    @              (nil)  (unknown)
Aborted
1

1 Answers

0
votes

Just add timing lines to ForwardFromto() in net.cpp