mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
raise error if refresh db is false and pkl is empty
This commit is contained in:
parent
3a1a4a06e3
commit
c04e51e472
@ -151,6 +151,11 @@ def find(
|
|||||||
# Get the list of images on storage
|
# Get the list of images on storage
|
||||||
storage_images = image_utils.list_images(path=db_path)
|
storage_images = image_utils.list_images(path=db_path)
|
||||||
|
|
||||||
|
if len(storage_images) == 0 and refresh_database is True:
|
||||||
|
raise ValueError(f"No item found in {db_path}")
|
||||||
|
if len(representations) == 0 and refresh_database is False:
|
||||||
|
raise ValueError(f"Nothing is found in {datastore_path}")
|
||||||
|
|
||||||
must_save_pickle = False
|
must_save_pickle = False
|
||||||
new_images = []
|
new_images = []
|
||||||
old_images = []
|
old_images = []
|
||||||
@ -164,11 +169,7 @@ def find(
|
|||||||
|
|
||||||
# Enforce data consistency amongst on disk images and pickle file
|
# Enforce data consistency amongst on disk images and pickle file
|
||||||
if refresh_database:
|
if refresh_database:
|
||||||
if len(storage_images) == 0:
|
|
||||||
raise ValueError(f"No item found in {db_path}")
|
|
||||||
|
|
||||||
new_images = list(set(storage_images) - set(pickled_images)) # images added to storage
|
new_images = list(set(storage_images) - set(pickled_images)) # images added to storage
|
||||||
|
|
||||||
old_images = list(set(pickled_images) - set(storage_images)) # images removed from storage
|
old_images = list(set(pickled_images) - set(storage_images)) # images removed from storage
|
||||||
|
|
||||||
# detect replaced images
|
# detect replaced images
|
||||||
|
Loading…
x
Reference in New Issue
Block a user