storage_images is now built as a set with the new deepface.commons.image_utils.yield_images generator function. Previously, storage_images was created with deepface.commons.image_utils.list_images as a list, then converted to a set while never being used as purely a list.

This commit is contained in:
Samuel J. Woodward 2025-01-06 09:11:23 -05:00
parent 9dc261b080
commit 2ee02e0003

View File

@ -168,7 +168,7 @@ def find(
pickled_images = [representation["identity"] for representation in representations]
# Get the list of images on storage
storage_images = image_utils.list_images(path=db_path)
storage_images = set(image_utils.yield_images(path=db_path))
if len(storage_images) == 0 and refresh_database is True:
raise ValueError(f"No item found in {db_path}")
@ -186,8 +186,8 @@ def find(
# Enforce data consistency amongst on disk images and pickle file
if refresh_database:
new_images = set(storage_images) - set(pickled_images) # images added to storage
old_images = set(pickled_images) - set(storage_images) # images removed from storage
new_images = storage_images - set(pickled_images) # images added to storage
old_images = set(pickled_images) - storage_images # images removed from storage
# detect replaced images
for current_representation in representations: