mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 03:55:21 +00:00
Feat: Configurable Mediapipe parameters
This commit is contained in:
parent
49c041945a
commit
5f1c51350a
@ -1,4 +1,5 @@
|
|||||||
# built-in dependencies
|
# built-in dependencies
|
||||||
|
import os
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
# 3rd party dependencies
|
# 3rd party dependencies
|
||||||
@ -7,8 +8,6 @@ import numpy as np
|
|||||||
# project dependencies
|
# project dependencies
|
||||||
from deepface.models.Detector import Detector, FacialAreaRegion
|
from deepface.models.Detector import Detector, FacialAreaRegion
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class MediaPipeClient(Detector):
|
class MediaPipeClient(Detector):
|
||||||
"""
|
"""
|
||||||
@ -34,9 +33,13 @@ class MediaPipeClient(Detector):
|
|||||||
) from e
|
) from e
|
||||||
|
|
||||||
mp_face_detection = mp.solutions.face_detection
|
mp_face_detection = mp.solutions.face_detection
|
||||||
|
|
||||||
|
min_detection_confidence = float(os.environ.get("MEDIAPIPE_MIN_DETECTION_CONFIDENCE", 0.7))
|
||||||
|
model_selection = float(os.environ.get("MEDIAPIPE_MODEL_SELECTION", 0))
|
||||||
|
|
||||||
face_detection = mp_face_detection.FaceDetection(
|
face_detection = mp_face_detection.FaceDetection(
|
||||||
min_detection_confidence=os.getenv("MEDIAPIPE_MIN_DETECTION_CONFIDENCE", 0.5),
|
min_detection_confidence=min_detection_confidence,
|
||||||
model_selection=os.getenv("MEDIAPIPE_MODEL_SELECTION", 1)
|
model_selection=model_selection
|
||||||
)
|
)
|
||||||
return face_detection
|
return face_detection
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user