mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix exception dlib_face_identify when image is not recognized by face_recognition module (#8552)
* Some images are not supported by face_recognition, so this patch treats the error messages instead throwing a traceback. Fixes #7867 * Makes lint happy
This commit is contained in:
parent
1a86fa5a02
commit
4ece4bf241
@ -58,8 +58,12 @@ class DlibFaceIdentifyEntity(ImageProcessingFaceEntity):
|
|||||||
|
|
||||||
self._faces = {}
|
self._faces = {}
|
||||||
for face_name, face_file in faces.items():
|
for face_name, face_file in faces.items():
|
||||||
image = face_recognition.load_image_file(face_file)
|
try:
|
||||||
self._faces[face_name] = face_recognition.face_encodings(image)[0]
|
image = face_recognition.load_image_file(face_file)
|
||||||
|
self._faces[face_name] = \
|
||||||
|
face_recognition.face_encodings(image)[0]
|
||||||
|
except IndexError as err:
|
||||||
|
_LOGGER.error("Failed to parse %s. Error: %s", face_file, err)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def camera_entity(self):
|
def camera_entity(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user