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", desc="Finding representations",
disable=silent, disable=silent,
): ):
img_objs = detection.extract_faces( try:
img_path=employee, img_objs = detection.extract_faces(
target_size=target_size, img_path=employee,
detector_backend=detector_backend, target_size=target_size,
grayscale=False, detector_backend=detector_backend,
enforce_detection=enforce_detection, grayscale=False,
align=align, enforce_detection=enforce_detection,
expand_percentage=expand_percentage, 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: for img_obj in img_objs:
img_content = img_obj["face"] img_content = img_obj["face"]

BIN
tests/dataset/img39.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 KiB