Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图计算 fast-rcnn 网络中每一层所花费的时间。我发现 caffe cmd interfacecaffe time可以做到。但是fast-rcnn是基于python代码的,python界面有什么函数可以帮我计算时间吗?
caffe time
计算每一层花费的时间
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)
python 有分析工具。你可以看看timeit和cProfile工具。 如果您正在寻找更基本的东西,您可以使用time模块来测量时间:
timeit
cProfile
time
import time t = time.time() run_rcnn_script() dt = time.time()-t print "time spent in run_rcnn_script: ", dt, " sec."