-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimizations for deepface.recognition.find, Optimization and New Iterator Functionality in image_utils #1420
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…f time rather than on each iteration. exact_path is not created unless the file's ext is a valid image ext.
…a given path. The functionality is equivalent to list_images, but, instead of building then return a list, it yields the image path at each iteration.
…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.
… 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.
…ations on the object. If the order of the columns will need to be maintained in future versions, this should be restored to the original list.
serengil
reviewed
Jan 7, 2025
serengil
reviewed
Jan 7, 2025
serengil
reviewed
Jan 7, 2025
… IMAGE_EXTS and PIL_EXTS to match Python naming conventions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What has been done
With this PR, I have made optimizations and opinionated changes to
deepface.modules.recognition
as well asdeepface.commons.image_utils
. The optimizations include better use of sets, delayed object creation, and ahead of time creation for set objects used in tight loops.The modifications proposed in this PR are highly opinionated, so please feel free to request any modifications or to refuse it outright.
deepface.commons.image_utils
Modified
list_images
New
yield_images
list_images
but yields the exact_path instead of building and returning the listdeepface.modules.recognition
deepface.modules.recognition
Modified
deepface.commons.image_utils.yield_images
iteratorif refresh_database
is True'sh to prevent unnecessary object creationHow to test
The test in
deepface.tests.test_find.test_filetype_for_find_bulk_embeddings
checks the newdeepface.commons.image_utils.yield_images
for functionality and equivalence to the existingdeepface.commons.image_utils.list_images
function.