How it works...

You can obtain the model FLOPs count and the amount of memory consumed using the model.getFLOPs and model.getMemoryConsumption methods. Both methods take as input the specified blob shape. Per-layer inference time statistics are available after the forward pass is performed and can be obtained via the model.getPerfProfile method, which returns total inference time and per-layer timings, all in ticks.

The following output is expected:

gflops: 3.1904431360000003weights (mb): 27.994208 , blobs (mb): 45.92096inference (ms): 83.478832LAYER TIME (ms)conv1/7x7_s2 4.57conv1/relu_7x7 0.00pool1/3x3_s2 0.74pool1/norm1 1.49conv2/3x3_reduce 0.57conv2/relu_3x3_reduce 0.00conv2/3x3 11.53conv2/relu_3x3 0.00conv2/norm2 3.35pool2/3x3_s2 0.90 ...

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.