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

Try demo with my own photo #5

Open
JordanPeltier opened this issue May 16, 2016 · 15 comments
Open

Try demo with my own photo #5

JordanPeltier opened this issue May 16, 2016 · 15 comments

Comments

@JordanPeltier
Copy link

Hi and thank you for this work.
I tried demo.py on my computer and it works well.
The I tried demo.py with a picture of myself (taken with my webcam) and the result is totally wrong.
Any ideas ? :)

@dougsouza
Copy link
Owner

dougsouza commented May 16, 2016

Hi @justidan,

Well, it may happen. This code has a limit for face position it can frontalize. What I can suggest is that you plot the landmarks detected in your face, if the points lay in the correct position (eyes, nose, mouth, jaw) everything should work. You can also try different photos of different angles and occlusion to see what happens.

It is also important to note cases where there is more than one face in the image, it is necessary to frontalize on by one.

Hope it helps

@JordanPeltier
Copy link
Author

The problem is that the facial landmarks are very good.
And I tried with different angles.
Let me show you :
figure_1
figure_2
figure_3
figure_4

@dougsouza
Copy link
Owner

That's really weird. Let me run some tests to see what is going on.

@dougsouza
Copy link
Owner

I have tested on your photo and it worked as expected. Which version of OpenCV are you using? Maybe there is some issue when calculating the camera matrix.

figure_2
figure_4

@JordanPeltier
Copy link
Author

Hi,
So it may be my set up :

cv2.version
'3.1.0'
dlib.version
'18.18.100'

@dougsouza
Copy link
Owner

Maybe it is. Dlib 18.18 is known to work, but to be honest, I haven't tested on OpenCV 3.1, only on 2.4 and 3.0.

@JordanPeltier
Copy link
Author

Ok thanks for this reply !

@dougsouza
Copy link
Owner

@justidan,

I experienced an issue similar to yours. It happened because the face was small compared to the image size. I still don't know why this happens, hope to investigate this soon.

@JordanPeltier
Copy link
Author

@dougsouza
Thanks for considering my issue.
I attach what i get with bigger face.
figure_1
figure_2
figure_4
figure_3

@JordanPeltier
Copy link
Author

@dougsouza
Do I have to preprocess the picture before using the frontalize code ? Like face detection, resize or something?

@dougsouza
Copy link
Owner

Yes, but that is already in the frontalization code. It is necessary to detect the face and pass the rectangle of the detection to the landmark detector, if you go through the code you'll see. If you reduce your photo and keep only your face, does it work better? You may also try to resize the whole to a smaller size to see what happens.

@JordanPeltier
Copy link
Author

I did some preprocessing, here the results :
figure_4
figure_2
figure_3
figure_1

@JordanPeltier
Copy link
Author

Ok, I tried as well with smaller pictures (the whole smaller) and it works much better !
Do you know if there is the same robustess issue in the original matlab code ?
Thanks a lot

@dougsouza
Copy link
Owner

@justidan,

I don't. In fact, I haven't used much the matlab code, also, using matlab is a little annoying when using dlib as a landmark detector since dlib runs in python. It is possible to use other detectors though, if you want to try, please refer to the original project page: http://www.openu.ac.il/home/hassner/projects/frontalize/

@0x10cxR1
Copy link

0x10cxR1 commented Jul 6, 2018

The code doesn't contain the crop and resize part. You need to do cropping and resizing according to the paper.

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

No branches or pull requests

3 participants