From 9995343e248adbb1d7ed30b77bd0f63e25964d90 Mon Sep 17 00:00:00 2001 From: "Samuel J. Woodward" Date: Mon, 6 Jan 2025 09:34:23 -0500 Subject: [PATCH] delay creating pickled_images until necessary --- deepface/modules/recognition.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deepface/modules/recognition.py b/deepface/modules/recognition.py index fc6f35b..90e8c29 100644 --- a/deepface/modules/recognition.py +++ b/deepface/modules/recognition.py @@ -164,9 +164,6 @@ def find( f"Consider to delete {datastore_path}" ) - # embedded images - 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,6 +183,11 @@ def find( # Enforce data consistency amongst on disk images and pickle file if refresh_database: + # embedded images + pickled_images = { + representation["identity"] for representation in representations + } + new_images = storage_images - pickled_images # images added to storage old_images = pickled_images - storage_images # images removed from storage