diff --git a/README.md b/README.md index 2bbeeda..37b3279 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ Age model got ± 4.65 MAE; gender model got 97.44% accuracy, 96.29% precision an Face detection and alignment are important early stages of a modern face recognition pipeline. Experiments show that just alignment increases the face recognition accuracy almost 1%. [`OpenCV`](https://sefiks.com/2020/02/23/face-alignment-for-face-recognition-in-python-within-opencv/), [`SSD`](https://sefiks.com/2020/08/25/deep-face-detection-with-opencv-in-python/), [`Dlib`](https://sefiks.com/2020/07/11/face-recognition-with-dlib-in-python/), [`MTCNN`](https://sefiks.com/2020/09/09/deep-face-detection-with-mtcnn-in-python/), [`RetinaFace`](https://sefiks.com/2021/04/27/deep-face-detection-with-retinaface-in-python/), [`MediaPipe`](https://sefiks.com/2022/01/14/deep-face-detection-with-mediapipe/), [`YOLOv8 Face`](https://github.com/derronqi/yolov8-face) and [`YuNet`](https://github.com/ShiqiYu/libfacedetection) detectors are wrapped in deepface. -

+

All deepface functions accept an optional detector backend input argument. You can switch among those detectors with this argument. OpenCV is the default detector. diff --git a/deepface/detectors/YunetWrapper.py b/deepface/detectors/YunetWrapper.py index c36c182..cc3d3d3 100644 --- a/deepface/detectors/YunetWrapper.py +++ b/deepface/detectors/YunetWrapper.py @@ -1,21 +1,22 @@ -import cv2 import os +import cv2 import gdown from deepface.detectors import FaceDetector from deepface.commons import functions def build_model(): - url = "https://github.com/opencv/opencv_zoo/raw/main/models/face_detection_yunet/face_detection_yunet_2023mar.onnx" + url = ( + "https://github.com/opencv/opencv_zoo/raw/main/models/" + + "face_detection_yunet/face_detection_yunet_2023mar.onnx" + ) file_name = "face_detection_yunet_2023mar.onnx" home = functions.get_deepface_home() if os.path.isfile(home + f"/.deepface/weights/{file_name}") is False: print(f"{file_name} will be downloaded...") output = home + f"/.deepface/weights/{file_name}" gdown.download(url, output, quiet=False) - face_detector = cv2.FaceDetectorYN_create( - home + f"/.deepface/weights/{file_name}", "", (0, 0) - ) + face_detector = cv2.FaceDetectorYN_create(home + f"/.deepface/weights/{file_name}", "", (0, 0)) return face_detector @@ -72,7 +73,7 @@ def detect_face(detector, image, align=True, score_threshold=0.9): int(y_le / r), ) confidence = face[-1] - confidence = "{:.2f}".format(confidence) + confidence = f"{confidence:.2f}" detected_face = image[int(y) : int(y + h), int(x) : int(x + w)] img_region = [x, y, w, h] if align: diff --git a/icon/detector-portfolio-v5.jpg b/icon/detector-portfolio-v5.jpg new file mode 100644 index 0000000..e35cef1 Binary files /dev/null and b/icon/detector-portfolio-v5.jpg differ