mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 03:55:21 +00:00
Merge branch 'master' into fixyunet
This commit is contained in:
commit
fc09756cfc
@ -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.
|
||||
|
||||
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/detector-portfolio-v3.jpg" width="95%" height="95%"></p>
|
||||
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/detector-portfolio-v5.jpg" width="95%" height="95%"></p>
|
||||
|
||||
All deepface functions accept an optional detector backend input argument. You can switch among those detectors with this argument. OpenCV is the default detector.
|
||||
|
||||
|
@ -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:
|
||||
|
BIN
icon/detector-portfolio-v5.jpg
Normal file
BIN
icon/detector-portfolio-v5.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 200 KiB |
Loading…
x
Reference in New Issue
Block a user