xyz / face_detection.py
andro-flock's picture
Upload folder using huggingface_hub
0d66750 verified
raw
history blame contribute delete
316 Bytes
# YuNet-face-detection
import cv2
from yunet2 import YuNet2
MODEL_PATH = "./yunet-ckpts/yunet_2023mar.onnx"
yunet_model = YuNet2(modelPath=MODEL_PATH)
def detect_faces(src_img):
cv2_img = cv2.imread(src_img)
annotated_image, bboxes = yunet_model.detect(cv2_img)
return annotated_image, bboxes