-
Notifications
You must be signed in to change notification settings - Fork 941
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
Implement mtcnn detect method #10
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10 +/- ##
=========================================
+ Coverage 98.09% 99.3% +1.21%
=========================================
Files 4 4
Lines 577 577
=========================================
+ Hits 566 573 +7
+ Misses 11 4 -7
Continue to review full report at Codecov.
|
Hi @timesler Just a thought, if you are planning on adding more face aligners in the future (other than MTCNN), maybe it would be a good idea to define a common interface for aligners where aligner |
@ldulcic definitely a good idea in the future. In addition, it is probably worthwhile also returning facial landmarks in addition to the bounding boxes if we get around to implementing multiple detection algorithms. The landmarks can then be used to perform proper face alignment (affine transformations) following detection. I will create a placeholder issue for these enhancements so it's not forgotten. Thanks for getting involved in the project! |
Instead of modifying the main detection-recognition pipeline that the repo was built for, I've exposed an additional method (
MTCNN.detect(self, img)
) that returns the bounding boxes and detection probabilities. The MTCNNforward
method has the same functionality as before, but it now calls the newdetect
method to get bounding boxes. The main motivation for this is that I want to keep the main path through the code as easy to use as possible, while allowing customisations for those happy to dig a little deeper (though not much).I think this structure makes sense for most use cases. For more general applications of MTCNN, such as face tracking, the new
detect
method should be ideal, and can be used in the following way (example also added to the docstring):A combination of the
MTCNN.detect
method and thefacenet_pytorch.extract_face
function can be used to replicate theforward
method, but gives more flexibility in terms of access to bounding boxes.@ldulcic I've changed the way the bounding boxes are returned here a fair bit, apologies if it no longer allows you to do what you need. I wasn't able to make the changes directly onto your PR #9 since it was made from the master branch in your fork of the repo rather than a new feature branch (and I wasn't sure if you were using the fork for your own work). Let me know if this change works for your needs.