continue if no face detected

This commit is contained in:
Sefik Ilkin Serengil 2021-11-13 11:22:28 +03:00 committed by GitHub
parent bd4e418cba
commit 1ad0ffc6d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,10 +137,12 @@ def analysis(db_path, model_name = 'VGG-Face', detector_backend = 'opencv', dist
resolution = img.shape; resolution_x = img.shape[1]; resolution_y = img.shape[0] resolution = img.shape; resolution_x = img.shape[1]; resolution_y = img.shape[0]
if freeze == False: if freeze == False:
#faces = face_cascade.detectMultiScale(img, 1.3, 5)
#faces stores list of detected_face and region pair try:
faces = FaceDetector.detect_faces(face_detector, detector_backend, img, align = False) #faces store list of detected_face and region pair
faces = FaceDetector.detect_faces(face_detector, detector_backend, img, align = False)
except: #to avoid exception if no face detected
faces = []
if len(faces) == 0: if len(faces) == 0:
face_included_frames = 0 face_included_frames = 0