Skip to content

Commit

Permalink
storage_images is now built as a set with the new deepface.commons.im…
Browse files Browse the repository at this point in the history
…age_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.
  • Loading branch information
PyWoody committed Jan 6, 2025
1 parent 9dc261b commit 2ee02e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deepface/modules/recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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:
Expand Down

0 comments on commit 2ee02e0

Please sign in to comment.