Spaces:
Sleeping
Sleeping
Update method.py
Browse files
method.py
CHANGED
|
@@ -84,7 +84,11 @@ def face_crop(image_pil):
|
|
| 84 |
# Convert PIL.Image to OpenCV BGR format
|
| 85 |
img_rgb = np.array(image_pil)
|
| 86 |
img_bgr = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2BGR)
|
|
|
|
| 87 |
|
| 88 |
# Now pass to DeepFace
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
# Convert PIL.Image to OpenCV BGR format
|
| 85 |
img_rgb = np.array(image_pil)
|
| 86 |
img_bgr = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2BGR)
|
| 87 |
+
# print('face crop: ', img_bgr.shape, img_bgr)
|
| 88 |
|
| 89 |
# Now pass to DeepFace
|
| 90 |
+
try:
|
| 91 |
+
img = DeepFace.extract_faces(img_bgr, detector_backend=detectors[2])
|
| 92 |
+
return img
|
| 93 |
+
except:
|
| 94 |
+
pass
|