We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Python: 3.6.9 opencv-python==4.2.0.34
Rather than trying to build this project with so little documentation, I decided to directly import the model in cv2 python but no success so far.
import cv2
proto_path = 'deploy.prototxt' model_path = 'face_mask.caffemodel'
proto_path = 'deploy.prototxt'
model_path = 'face_mask.caffemodel'
model = cv2.dnn.readNetFromCaffe(proto_path, model_path)
image_file = 'sample_images/0000.jpg' img = cv2.imread(image_file)
image_file = 'sample_images/0000.jpg'
img = cv2.imread(image_file)
image_blob = cv2.dnn.blobFromImage(img)
model.setInput(image_blob)
prediction = model.forward()
Error: cv2.error: OpenCV(4.2.0) /io/opencv/modules/dnn/src/dnn.cpp:3084: error: (-215:Assertion failed) total(os[i]) > 0 in function 'getLayerShapesRecursively'
cv2.error: OpenCV(4.2.0) /io/opencv/modules/dnn/src/dnn.cpp:3084: error: (-215:Assertion failed) total(os[i]) > 0 in function 'getLayerShapesRecursively'
Did anyone had any success doing this or what else can be done to use the pre-trained model?
The text was updated successfully, but these errors were encountered:
Try image_blob = cv2.dnn.blobFromImage(img, 1, (224, 224), (127.5, 127.5, 127.5))
image_blob = cv2.dnn.blobFromImage(img, 1, (224, 224), (127.5, 127.5, 127.5))
deploy.prototxt indicates that the input should be a 224 x 224 image, and I got the 127.5 from here: https://github.com/didi/maskdetection/blob/master/lib/src/FaceMaskDetector.cpp#L72
Sorry, something went wrong.
No branches or pull requests
Python: 3.6.9
opencv-python==4.2.0.34
Rather than trying to build this project with so little documentation, I decided to directly import the model in cv2 python but no success so far.
import cv2
proto_path = 'deploy.prototxt'
model_path = 'face_mask.caffemodel'
model = cv2.dnn.readNetFromCaffe(proto_path, model_path)
image_file = 'sample_images/0000.jpg'
img = cv2.imread(image_file)
image_blob = cv2.dnn.blobFromImage(img)
model.setInput(image_blob)
prediction = model.forward()
Error:
cv2.error: OpenCV(4.2.0) /io/opencv/modules/dnn/src/dnn.cpp:3084: error: (-215:Assertion failed) total(os[i]) > 0 in function 'getLayerShapesRecursively'
Did anyone had any success doing this or what else can be done to use the pre-trained model?
The text was updated successfully, but these errors were encountered: