From 799cb0f6cfb56595535df2b7f6f32de7bfdd2697 Mon Sep 17 00:00:00 2001 From: "Samuel J. Woodward" Date: Mon, 6 Jan 2025 09:13:01 -0500 Subject: [PATCH] pickled_images is now created using a set comprehension, instead of a list comprehension as before. Like storage_images, all subsequent actions where set and not list actions, so it saves time re-creating the list as a set later on. --- deepface/modules/recognition.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deepface/modules/recognition.py b/deepface/modules/recognition.py index 4dc440f..d964693 100644 --- a/deepface/modules/recognition.py +++ b/deepface/modules/recognition.py @@ -165,7 +165,7 @@ def find( ) # embedded images - pickled_images = [representation["identity"] for representation in representations] + pickled_images = {representation["identity"] for representation in representations} # Get the list of images on storage storage_images = set(image_utils.yield_images(path=db_path)) @@ -186,8 +186,8 @@ def find( # Enforce data consistency amongst on disk images and pickle file if refresh_database: - new_images = storage_images - set(pickled_images) # images added to storage - old_images = set(pickled_images) - storage_images # images removed from storage + new_images = storage_images - pickled_images # images added to storage + old_images = pickled_images - storage_images # images removed from storage # detect replaced images for current_representation in representations: