CV2 inference

I don’t know if this is the right place, but I would like to explain my problem to you. I am using opencv2 to be able to do an inference as it happens in Segnet. I’m using "fnc_resnet18.onnx"as the network model (imported in cv2.dnn.readNetFromONNX()).
What I would like to obtain is a result similar to those returned by the following functions available among the jetson libraries:

  • input.GetFrameRate()
  • output.GetFrameRate()
  • net.GetNetworkFPS()

Here is a small piece of my code:

net_onnx = cv2.dnn.readNetFromONNX(path_to_onnx)

    while True:
        # Capture frame-by-frame
        ret, frame =            
        (h, w) = frame.shape[:2]
        blob = cv2.dnn.blobFromImage(frame, 0.007843, (h, w), 127.5)

        detections = net_onnx.forward()

Any idea?



The inference time can be measured by the start and finish time of the below function:

detections = net_onnx.forward()

The input time should be similar to the performance of

Do you show the output with cv2.imshow(.)
If yes, the required time of this function is the output fps.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.