exception handling for bulk representations

This commit is contained in:
Sefik Ilkin Serengil 2024-02-16 17:43:30 +00:00
parent 91f5b448ee
commit 91a220335a
2 changed files with 15 additions and 9 deletions

View File

@ -354,15 +354,21 @@ def __find_bulk_embeddings(
desc="Finding representations",
disable=silent,
):
img_objs = detection.extract_faces(
img_path=employee,
target_size=target_size,
detector_backend=detector_backend,
grayscale=False,
enforce_detection=enforce_detection,
align=align,
expand_percentage=expand_percentage,
)
try:
img_objs = detection.extract_faces(
img_path=employee,
target_size=target_size,
detector_backend=detector_backend,
grayscale=False,
enforce_detection=enforce_detection,
align=align,
expand_percentage=expand_percentage,
)
except ValueError as err:
logger.warn(
f"Exception while extracting faces from {employee}: {str(err)}. Skipping it."
)
img_objs = []
for img_obj in img_objs:
img_content = img_obj["face"]

BIN
tests/dataset/img39.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 KiB