Opencv cnn model benchmark

Hello Experts,

I am trying to run opencv CNN model for face recognition for the given frame. But would like to exactly profile time for recognizing the face in the given frame with respect to various sizes of the frame (1080/720p).

Is there any tool to measure the same ?

Hi,

Sorry for the late update.

If you are using python interface, you can use time module for profiling directly.

For example,

net = cv2.dnn.readNet(....)
blob = cv2.dnn.blobFromImage(...) # set for 1080p or 720p 
net.setInput(blob)

start_time = time.time()
outs = net.forward([...])
infer_time = time.time()-start_time

Thanks.

hi techguyz:
if you are using C interface, you can try gettimeofday function

#incluede<sys/time.h>

struct timevaltv_begin, tv_end;
gettimeofday(&tv_begin,NULL);

foo();

gettimeofday(&tv_end,NULL);

total_time = (double) (tv_begin.tv_usec – tv_end.tv_usec) / 1000;

printf(“%.3f ms/n”, total_time);

Hi @Jeffli

I am using python as of now… It takes me around 500 ms to process the 720p image using CNN in Jetson Nano.

Just too high for a GPU !!

Hi,

This because you are using a CPU implementation.
Let’s check the performance issue on Opencv2 inbuilt face recognition CNN model around 500 ms (poor performance) in Jetson Nano.. Help! directly.

Thanks.

hi techguyz:
build-in model is just demo, more quick inference time you should optimize model with TensorRT