Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Person Detection using OpenVINO

Thakur__Tanmay
Beginner
1,093 Views

Wrote down the following code for person detection using the pretrained model person-detection-retail-0002

import cv2 as cv
from imutils.video import FPS
import numpy as np

net = cv.dnn.readNet('./models/human0002/32/person-detection-retail-0002.bin',
                     './models/human0002/32/person-detection-retail-0002.xml')

cap = cv.VideoCapture(0)
fps = FPS().start()
frame_width = 480  
frame_height = 640
while cv.waitKey(1) < 0:
    hasFrame, frame = cap.read()
    print(frame.shape)
    if not hasFrame:
        break                
    blob = cv.dnn.blobFromImage(frame, size = (544,992))
    net.setInput(blob,[544, 992, 992/frame_width, 544/frame_height, 992/frame_width, 544/frame_height])
    out = net.forward('image_id','label')
    print(out)
    fps.update()
    fps.stop()
    #print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
    print("{:.2f}".format(fps.fps()))

    cv.imshow('OpenVINO face detection', frame)

 

But get the following error:

 python3 human_com.py
(480, 640, 3)
Traceback (most recent call last):
  File "human_com.py", line 18, in <module>
    net.setInput(blob,[544, 992, 992/frame_width, 544/frame_height, 992/frame_width, 544/frame_height])
SystemError: <built-in method setInput of cv2.dnn_Net object at 0x7f046d8e0550> returned NULL without setting an error

 

Any solutions?

0 Kudos
1 Reply
Shubha_R_Intel
Employee
1,093 Views

Dear Thakur, Tanmay,

You are using OpenCV dnn and this is the wrong forum for that. This forum is for OpenVino questions, namely Model Optimizer and Inference Engine. Please direct your question to :

https://answers.opencv.org/questions/

 https://github.com/opencv/opencv

Thanks !

Shubha

0 Kudos
Reply