Skip to content

Commit

Permalink
Merge pull request serengil#1362 from tyasnk/configurable-mediapipe-p…
Browse files Browse the repository at this point in the history
…arams

Configurable mediapipe params
  • Loading branch information
serengil authored Oct 10, 2024
2 parents cf7d428 + 8766a41 commit 075d32b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion deepface/models/face_detection/MediaPipe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# built-in dependencies
import os
from typing import Any, List

# 3rd party dependencies
Expand Down Expand Up @@ -32,7 +33,14 @@ def build_model(self) -> Any:
) from e

mp_face_detection = mp.solutions.face_detection
face_detection = mp_face_detection.FaceDetection(min_detection_confidence=0.7)

min_detection_confidence = float(os.environ.get("MEDIAPIPE_MIN_DETECTION_CONFIDENCE", 0.7))
model_selection = int(os.environ.get("MEDIAPIPE_MODEL_SELECTION", 0))

face_detection = mp_face_detection.FaceDetection(
min_detection_confidence=min_detection_confidence,
model_selection=model_selection
)
return face_detection

def detect_faces(self, img: np.ndarray) -> List[FacialAreaRegion]:
Expand Down

0 comments on commit 075d32b

Please sign in to comment.