serengil / deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
https://www.youtube.com/watch?v=WnUVYQP4h44&list=PLsS_1RYmYQQFdWqxQggXHynP1rqaYXv_E&index=1
MIT License
12.09k stars 2.05k forks source link

[FEATURE]: Configurable MediaPipe Detection parameters #1360

Closed tyasnk closed 3 days ago

tyasnk commented 6 days ago

Description

I use the Mediapipe backend as detector. I look at the source https://github.com/serengil/deepface/blob/master/deepface/models/face_detection/MediaPipe.py#L35 it hardcoded the min_detection_confidence param and also there is no model_selection param there.

It would be good if we can config them by using environment variable like this

face_detection = mp_face_detection.FaceDetection(
    min_detection_confidence=os.getenv("MEDIAPIPE_MIN_DETECTION_CONFIDENCE", 0.7),
    model_selection=os.getenv("MEDIAPIPE_MODEL_SELECTION", 0)
)

Additional Info

No response

serengil commented 6 days ago

Fair enough

serengil commented 3 days ago

@tyasnk do you mind to create a PR for this? you already written the most of the code.