-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
FastMtCnn Use of Gpu for Face Detection #1145
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3d87338
use GPU in fastMtCnn
aku-ato 2b7c0a7
Conditional use of GPU on FastMtCnn
aku-ato 345b671
Conditional use of GPU on FastMtCnn
aku-ato b4c16f6
Merge branch 'serengil:master' into master
aku-ato 131a7fb
move torch import from global in order to match optional dependency p…
aku-ato File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to import fast_mtcnn, we enforce users to install facenet_pytorch instead of torch. not sure installing facenet_pytorch will install torch, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review and feedback on the pull request. I appreciate your concern regarding the addition of new dependencies and the potential impact on the package size and user experience.
Regarding the dependency on
facenet_pytorch
, it's important to note that whilefacenet_pytorch
indeed does not directly require torch, it does requiretorchvision
. Thetorchvision
package, in turn, lists torch as one of its dependencies. Consequently, installingtorchvision
(as a requirement forfacenet_pytorch
) will ensure that torch is also installed if it is not already present in the environment.This chain of dependencies means that users will end up with torch installed as part of the process, indirectly satisfying the requirement for torch without explicitly listing it as a direct dependency for our project.
I hope this clarifies the dependency chain and addresses your concern. I am open to further discussion and suggestions on how we can improve this implementation.
Best regards,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay I can confirm that installing facenet-pytorch will install torchvision, and installing torchvision will install torch
But still putting
import torch
to the line 5 will throw exception for users who do not have facenet-pytorch. Because when i runpip install deepface
, it will not install torch (it is not a must dependency) and when i import deepface asfrom deepface import DeepFace
, then torch will be attempted to be imported but it will throw exception because I do not have that dependency. So, this change breaks deepface code as is.As you can see facenet_pytorch is imported in line 64 instead of global level: https://github.com/serengil/deepface/blob/master/deepface/detectors/FastMtCnn.py#L64
You may consider to import torch in that try except block. Otherwise, I cannot merge this PR because it will break the deepface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll do