How to calculate time spent on every layer in CNN with caffe interface?
Q:
I was trying to calculate the time spent on every layer in fast-rcnn network. I found out that caffe cmd interface caffe time can do it. But the fast-rcnn is based on the python code, is there any function in the python interface can help me calculate the time ?
A:
python has profiling tools. You can look at timeit and the cProfile tool.
If you are looking for something more basic, you can use time module to measure time:
import time t = time.time() run_rcnn_script() dt = time.time()-t print "time spent in run_rcnn_script: ", dt, " sec."
A:
To calculate time spent at each layer
import timeit
t1=timeit.default_timer()
net.forward(start='start_layer_name',end='end_layer_name')
t2=timeit.default_timer()
print 'time is {}'.format(t2-t1)
浙公网安备 33010602011771号