mirror of
https://github.com/serengil/deepface.git
synced 2025-06-08 12:35:22 +00:00
Merge branch 'master' of https://github.com/serengil/deepface
This commit is contained in:
commit
a35b31d242
@ -1,17 +1,19 @@
|
|||||||
from retinaface import RetinaFace
|
#from retinaface import RetinaFace
|
||||||
import cv2
|
import cv2
|
||||||
|
|
||||||
def build_model():
|
def build_model():
|
||||||
|
from retinaface import RetinaFace
|
||||||
face_detector = RetinaFace.build_model()
|
face_detector = RetinaFace.build_model()
|
||||||
return face_detector
|
return face_detector
|
||||||
|
|
||||||
def detect_face(face_detector, img, align = True):
|
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
|
face = None
|
||||||
img_region = [0, 0, img.shape[0], img.shape[1]]
|
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)
|
faces = RetinaFace.extract_faces(img_rgb, model = face_detector, align = align)
|
||||||
|
|
||||||
if len(faces) > 0:
|
if len(faces) > 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user