hassan526 commited on
Commit
8f516cc
·
verified ·
1 Parent(s): ca7a857

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -389,12 +389,13 @@ def check_liveness(frame):
389
  if y2 >= image.height:
390
  y2 = image.height - 1
391
 
392
- face_crop = image.crop((x1, y1, x2, y2))
393
- face_image_ratio = face_crop.width / float(face_crop.height)
394
- resized_w = int(face_image_ratio * 150)
395
- resized_h = 150
396
-
397
- face_crop = face_crop.resize((int(resized_w), int(resized_h)))
 
398
 
399
  if angles is not None:
400
  yaw = angles[0]
 
389
  if y2 >= image.height:
390
  y2 = image.height - 1
391
 
392
+ if (x2 - x1) != 0 and (y2 - y1) != 0:
393
+ face_crop = image.crop((x1, y1, x2, y2))
394
+ face_image_ratio = face_crop.width / float(face_crop.height)
395
+ resized_w = int(face_image_ratio * 150)
396
+ resized_h = 150
397
+
398
+ face_crop = face_crop.resize((int(resized_w), int(resized_h)))
399
 
400
  if angles is not None:
401
  yaw = angles[0]