retinaface perf

This commit is contained in:
Sefik Ilkin Serengil 2021-04-29 09:11:33 +03:00
parent 0bdc341ce7
commit f4c78457c2
2 changed files with 13 additions and 1 deletions

View File

@ -12,7 +12,7 @@ def detect_face(face_detector, img):
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #retinaface expects RGB but OpenCV read BGR img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #retinaface expects RGB but OpenCV read BGR
faces = RetinaFace.extract_faces(img_rgb, align = True) faces = RetinaFace.extract_faces(img_rgb, model = face_detector, align = True)
if len(faces) > 0: if len(faces) > 0:
face = faces[0][:, :, ::-1] face = faces[0][:, :, ::-1]

View File

@ -45,6 +45,18 @@ dataset = [
print("-----------------------------------------") print("-----------------------------------------")
if False:
print("Detector tests")
import matplotlib.pyplot as plt
detectors = ['opencv', 'ssd', 'dlib', 'mtcnn', 'retinaface']
#detectors = ['retinaface']
for detector in detectors:
img = DeepFace.detectFace("dataset/img1.jpg", detector_backend = detector)
plt.imshow(img)
plt.show()
print("-----------------------------------------")
print("Face detectors test") print("Face detectors test")
print("retinaface detector") print("retinaface detector")