-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Python bindings for Facemark Training Code #2197
base: 4.x
Are you sure you want to change the base?
Conversation
00b9255
to
4ca8e1a
Compare
hi @saiteja-talluri just out of curiosity (was mentor of a similar GSoC project in 2017) how does this training code differ from the facemark Kazemi training example (and backend functionality to apply the training) we did back then? You can see it at: https://github.com/sukhad-app/opencv_contrib/blob/face_alignment/modules/face/samples/sample_train_landmark_detector.cpp Or did you basically expand it for the other 2 models? |
hello @StevenPuttemans . There is no change in the training code as such, but the inheritance structure for the AAM, LBF and Kazemi are different, so creating python bindings became very difficult. So I basically changed the structure keeping the training logic same and added suitable functions so that the python users have same power as the C++ users. |
@saiteja-talluri thank you for the elaboration! Thumbs up for the nice work done. |
Any particular reason why this is not merged yet? It would be great to have this feature in the Python library. |
@@ -38,10 +38,15 @@ TEST(CV_Face_FacemarkKazemi, can_create_default) { | |||
TEST(CV_Face_FacemarkKazemi, can_loadTrainingData) { | |||
string filename = cvtest::findDataFile("face/lbpcascade_frontalface_improved.xml", true); | |||
string configfile_name = cvtest::findDataFile("face/config.xml", true); | |||
string modelfilename = "face_landmark_model.dat"; |
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.
Where the file is located?
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.
@saiteja-talluri can you share the file so that it can be merged?
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.
@asmorkalov Is there any other way we can merge this. The python bindings are pretty important. If the rest of the code is fine, can we skip the test_face_align.cpp code and merge the rest of it?
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.
@asmorkalov ,@vikasgupta-github
Where the file is located?
"face_landmark_model.dat" is the name of the output file, the trained kazemi model.
it will get created, where the script runs
(there is nothing to share or redistribute here)
(btw, when building opencv libs, cmake will also download a pretrained version into .cache)
can we merge it now, and add the missing input validation later ? (i'd even volunteer to do so :])
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.
I am not 100% sure, but it looks like an example face_landmark_model.dat file is here
CV_UNUSED(items); | ||
return false; | ||
} | ||
bool FacemarkKazemiImpl::addTrainingSample(InputArray image, std::vector<Point2f> & landmarks){ |
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.
Some asserts for input values can be useful here.
return faceDetector(image, faces, faceDetectorData); | ||
} | ||
bool FacemarkKazemiImpl::defaultFaceDetector(const Mat& image, std::vector<Rect>& faces){ |
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.
Some asserts for input values can be useful here.
Hi @saiteja-talluri. Can you provide further info so that it can be merged? This would be really useful |
This pull request contains my progress in the GSoC project on facial landmark detection.
This pull request does the following updates to the facemark api.
Examples for the python code for training and fitting can be found here - https://github.com/saiteja-talluri/GSoC-OpenCV
More detailed report of the project can be found here - https://gist.github.com/saiteja-talluri/1d0e4fc4c75774b936b99c7c52b65fe6/
Relevant tests have been updated post the modifications.