-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Description
While running notebook 'multi-person-openpose.ipynb' encountered an issue in the code
t = time.time()
net = cv2.dnn.readNetFromCaffe(protoFile, weightfile)
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
if device == "cpu":
net.setPreferableBackend(cv2.dnn.DNN_TARGET_CPU)
print("Using CPU device")
elif device == "gpu":
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
print("Using GPU device")
Fix the input Height and get the width according to the Aspect Ratio
inHeight = 368
inWidth = int((inHeight/frameHeight)*frameWidth)
inpBlob = cv2.dnn.blobFromImage(image1, 1.0 / 255, (inWidth, inHeight),
(0, 0, 0), swapRB=False, crop=False)
net.setInput(inpBlob)
output = net.forward()
print("Time Taken = {}".format(time.time() - t))
error Traceback (most recent call last)
in <cell line: 23>()
21 # inpBlob = np.squeeze(inpBlob,0)
22 net.setInput(inpBlob)
---> 23 output = net.forward()
24 # print("Time Taken = {}".format(time.time() - t))
error: OpenCV(4.7.0) /io/opencv/modules/core/src/matrix.cpp:1240: error: (-209:Sizes of input arguments do not match) Requested and source matrices have different count of elements in function 'reshape'
Please help me to solve this issue. Thanks in advance :)