From 2c2aaa0ede5f9919a56c252146d9abfcc3b03b5c Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Fri, 25 Jun 2021 16:01:47 +0300 Subject: [PATCH] retinaface is not a must dependency --- deepface/detectors/RetinaFaceWrapper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/deepface/detectors/RetinaFaceWrapper.py b/deepface/detectors/RetinaFaceWrapper.py index 647e8a6d6..6d2a8e4e2 100644 --- a/deepface/detectors/RetinaFaceWrapper.py +++ b/deepface/detectors/RetinaFaceWrapper.py @@ -1,17 +1,19 @@ -from retinaface import RetinaFace +#from retinaface import RetinaFace import cv2 def build_model(): + from retinaface import RetinaFace face_detector = RetinaFace.build_model() return face_detector def detect_face(face_detector, img, align = True): - + + from retinaface import RetinaFace + img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #retinaface expects RGB but OpenCV read BGR + face = None img_region = [0, 0, img.shape[0], img.shape[1]] - img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #retinaface expects RGB but OpenCV read BGR - faces = RetinaFace.extract_faces(img_rgb, model = face_detector, align = align) if len(faces) > 0: