Dai
Dai

Reputation: 75

cv2.dnn issue with using SDD in deepface.analyze(): no attribute 'readNetFromCaffe'

I have installed opencv-python version 4.9.0.80 and deepface version 0.0.81. and it seems to cause an issue when I try to run DeepFace.analyze() with SSD detector backend:

DeepFace.analyze('Img.jpg', ['race'], detector_backend = 'ssd', enforce_detection= False, silent = False)

File ~/anaconda3/lib/python3.11/site-packages/deepface/detectors/SsdWrapper.py:46, in build_model()
     42     output = home + "/.deepface/weights/res10_300x300_ssd_iter_140000.caffemodel"
     44     gdown.download(url, output, quiet=False)
---> 46 face_detector = cv2.dnn.readNetFromCaffe(
     47     home + "/.deepface/weights/deploy.prototxt",
     48     home + "/.deepface/weights/res10_300x300_ssd_iter_140000.caffemodel",
     49 )
     51 eye_detector = OpenCvWrapper.build_cascade("haarcascade_eye")
     53 detector = {}

AttributeError: module 'cv2.dnn' has no attribute 'readNetFromCaffe'

Any help solving this issue would be greatly appreciated. I'm running this on python jupyter via anaconda3-notebook.

UPDATE (1/18/2024)

As per @Ro.oT and @johncasey, I've installed opencv-contrib, but it has not solved the issue:

pip3 list | grep opencv 
opencv-contrib-python        4.9.0.80
opencv-python                4.9.0.80

Upvotes: 0

Views: 121

Answers (0)

Related Questions