Spaces:
Runtime error
Runtime error
Mohammed Innat
commited on
Commit
•
9c5e14a
1
Parent(s):
8eb6223
Update facedetect.py
Browse files- facedetect.py +3 -4
facedetect.py
CHANGED
@@ -1,20 +1,19 @@
|
|
1 |
import mediapipe as mp
|
2 |
from utils import read_n_resize
|
3 |
|
4 |
-
def mp_face_detect_fn(image):
|
5 |
mp_face_detection = mp.solutions.face_detection
|
6 |
mp_drawing = mp.solutions.drawing_utils
|
7 |
|
8 |
with mp_face_detection.FaceDetection(
|
9 |
-
min_detection_confidence=
|
10 |
-
|
11 |
|
12 |
resized_image_array = read_n_resize(image, read=False)
|
13 |
|
14 |
# Convert the BGR image to RGB and process it with MediaPipe Face Detection.
|
15 |
results = face_detection.process(resized_image_array)
|
16 |
|
17 |
-
|
18 |
annotated_image = resized_image_array.copy()
|
19 |
for detection in results.detections:
|
20 |
mp_drawing.draw_detection(annotated_image, detection)
|
|
|
1 |
import mediapipe as mp
|
2 |
from utils import read_n_resize
|
3 |
|
4 |
+
def mp_face_detect_fn(image, min_detect_conf=0.5):
|
5 |
mp_face_detection = mp.solutions.face_detection
|
6 |
mp_drawing = mp.solutions.drawing_utils
|
7 |
|
8 |
with mp_face_detection.FaceDetection(
|
9 |
+
min_detection_confidence=min_detect_conf, model_selection=0
|
10 |
+
) as face_detection:
|
11 |
|
12 |
resized_image_array = read_n_resize(image, read=False)
|
13 |
|
14 |
# Convert the BGR image to RGB and process it with MediaPipe Face Detection.
|
15 |
results = face_detection.process(resized_image_array)
|
16 |
|
|
|
17 |
annotated_image = resized_image_array.copy()
|
18 |
for detection in results.detections:
|
19 |
mp_drawing.draw_detection(annotated_image, detection)
|