mirror of
https://github.com/serengil/deepface.git
synced 2025-06-06 19:45:21 +00:00
eye detector wasn't initialized for ssd backend
This commit is contained in:
parent
ad54c01b74
commit
08ce14e151
@ -40,19 +40,27 @@ def initialize_detector(detector_backend):
|
|||||||
|
|
||||||
home = str(Path.home())
|
home = str(Path.home())
|
||||||
|
|
||||||
|
#eye detector is common for opencv and ssd
|
||||||
|
if detector_backend == 'opencv' or detector_backend == 'ssd':
|
||||||
|
opencv_path = get_opencv_path()
|
||||||
|
eye_detector_path = opencv_path+"haarcascade_eye.xml"
|
||||||
|
|
||||||
|
if os.path.isfile(eye_detector_path) != True:
|
||||||
|
raise ValueError("Confirm that opencv is installed on your environment! Expected path ",eye_detector_path," violated.")
|
||||||
|
|
||||||
|
global eye_detector
|
||||||
|
eye_detector = cv2.CascadeClassifier(eye_detector_path)
|
||||||
|
|
||||||
|
#------------------------------
|
||||||
|
#face detectors
|
||||||
if detector_backend == 'opencv':
|
if detector_backend == 'opencv':
|
||||||
opencv_path = get_opencv_path()
|
opencv_path = get_opencv_path()
|
||||||
|
|
||||||
face_detector_path = opencv_path+"haarcascade_frontalface_default.xml"
|
face_detector_path = opencv_path+"haarcascade_frontalface_default.xml"
|
||||||
eye_detector_path = opencv_path+"haarcascade_eye.xml"
|
|
||||||
|
|
||||||
if os.path.isfile(face_detector_path) != True:
|
if os.path.isfile(face_detector_path) != True:
|
||||||
raise ValueError("Confirm that opencv is installed on your environment! Expected path ",face_detector_path," violated.")
|
raise ValueError("Confirm that opencv is installed on your environment! Expected path ",face_detector_path," violated.")
|
||||||
|
|
||||||
face_detector = cv2.CascadeClassifier(face_detector_path)
|
face_detector = cv2.CascadeClassifier(face_detector_path)
|
||||||
|
|
||||||
global eye_detector
|
|
||||||
eye_detector = cv2.CascadeClassifier(eye_detector_path)
|
|
||||||
|
|
||||||
elif detector_backend == 'ssd':
|
elif detector_backend == 'ssd':
|
||||||
|
|
||||||
|
@ -17,14 +17,14 @@ print("-----------------------------------------")
|
|||||||
|
|
||||||
print("Face detectors test")
|
print("Face detectors test")
|
||||||
|
|
||||||
print("opencv detector")
|
|
||||||
res = DeepFace.verify(dataset, detector_backend = 'opencv')
|
|
||||||
print(res)
|
|
||||||
|
|
||||||
print("ssd detector")
|
print("ssd detector")
|
||||||
res = DeepFace.verify(dataset, detector_backend = 'ssd')
|
res = DeepFace.verify(dataset, detector_backend = 'ssd')
|
||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
|
print("opencv detector")
|
||||||
|
res = DeepFace.verify(dataset, detector_backend = 'opencv')
|
||||||
|
print(res)
|
||||||
|
|
||||||
print("dlib detector")
|
print("dlib detector")
|
||||||
res = DeepFace.verify(dataset, detector_backend = 'dlib')
|
res = DeepFace.verify(dataset, detector_backend = 'dlib')
|
||||||
print(res)
|
print(res)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user