Skip to content
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

How to calculate the mean-face ? #1

Closed
yxswjtu opened this issue Feb 6, 2015 · 6 comments
Closed

How to calculate the mean-face ? #1

yxswjtu opened this issue Feb 6, 2015 · 6 comments
Labels

Comments

@yxswjtu
Copy link

yxswjtu commented Feb 6, 2015

Hi patrikhuber,could you please release the code of calculating the "mean_ibug_lfpw_68.txt"?The result is exciting! I'm just a beginner in this area.

@patrikhuber
Copy link
Owner

Hi,

The mean face can be calculated in a few different ways - for example, one can align the training landmark coordinates using Procrustes (center them, scale, rotate...). But for this case, it's actually sufficient to just calculate the mean of the landmarks of a few hundred images, and you'll have a pretty good mean face.

If you look at examples/landmark_detection.cpp, you can just use cv::mean to calculate the mean of trainingLandmarks. As mentioned above, make sure you use enough images (i.e. more than the 5 in the data/ folder).

@yxswjtu
Copy link
Author

yxswjtu commented Feb 7, 2015

Thank you for your answer!I used cv::mean to calculate the mean of landmarks,but the result is not so satisfied!I found the data in the mean_ibug_lfpw_68.txt is already normalized,could you please describe the detailed steps in your code?

@yxswjtu
Copy link
Author

yxswjtu commented Feb 11, 2015

Hi, Patrik Huber,I solved my problems using Procrustes analysis.Thank you for your suggestions!

发自我的 iPad

在 2015年2月7日,05:26,Patrik Huber notifications@github.com 写道:

Hi,

The mean face can be calculated in a few different ways - for example, one can align the training landmark coordinates using Procrustes (center them, scale, rotate...). But for this case, it's actually sufficient to just calculate the mean of the landmarks of a few hundred images, and you'll have a pretty good mean face.

If you look at https://github.com/patrikhuber/superviseddescent/blob/master/examples/landmark_detection.cpp, you can just use cv::mean to calculate the mean of trainingLandmarks. As mentioned above, make sure you use enough images (i.e. more than the 5 in the data/ folder).


Reply to this email directly or view it on GitHub.

@patrikhuber
Copy link
Owner

Hi,

I'm surprised your result was not satisfying - did you use enough (a few hundred) images, as I suggested?
The normalisation I used in mean_ibug_lfpw_68.txt was just a simple scaling into a [-1, +1] x [-1, +1] box - and I determined the scale factor by using the face box from a face detector and then calculating the optimal scale factor at training time (imagine different face detectors output different face box sizes - one might be trained on only a narrow view of the face, another one might have a box around the whole head).

I will put the code of our full landmark detection online soon, so all these steps will be retraceable.

I'm glad you could solve your issue!

@songminglong
Copy link

Hi, I just run your program with data in the project(5 images and its pts file), then I put these in command line:./landmark_detection -d path-to-traindataset -m path-to-meanfile -f path-to-harrcascade...but I have waited for two hours , and no results output! I want to know how many times the train-step needed? Thanks for your reply!

@patrikhuber
Copy link
Owner

Hi Xiao-Hu,
Sorry for the late reply, I was actually working on an update regarding this! I've just updated the library, it'll run much faster now. If you run ./landmark_detection ... again, it should finish in a few minutes now.

If you additionally compile with -fopenmp (/openmp on VS), it will be even faster and finish in a few seconds.

Let me know if you have any further problems.

PS: Next time, open a new issue, instead of replying in a closed issue - it will get done much faster :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants