Asarkar07 commited on
Commit
8be4809
·
verified ·
1 Parent(s): 0a43963

Update method.py

Browse files
Files changed (1) hide show
  1. method.py +6 -2
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
- img = DeepFace.extract_faces(img_bgr, detector_backend=detectors[4])
90
- return img
 
 
 
 
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