-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reshape issue while running net.forward() #832
Comments
Looks like the code doesn't match to the model (anylonger). |
I have simply run the notebook below: |
Now I tried it under MS-Win10 in a Python virt-env using thhe Jupyter notebook as well. Via Google search I found e.g. this pointer: "https://stackoverflow.com/questions/75334101/layeroutputs-net-forwardoutput-layers-names-cv2-error-unknown-c-exception" Yes, I had manually installed With this version I got the Jupyter notebook to run successfully: |
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 :)
The text was updated successfully, but these errors were encountered: