face-frontalization icon indicating copy to clipboard operation
face-frontalization copied to clipboard

Try demo with my own photo

Open JordanPeltier opened this issue 8 years ago • 15 comments

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 ? :)

JordanPeltier avatar May 16 '16 16:05 JordanPeltier

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

dougsouza avatar May 16 '16 16:05 dougsouza

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

JordanPeltier avatar May 16 '16 17:05 JordanPeltier

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

dougsouza avatar May 16 '16 17:05 dougsouza

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

dougsouza avatar May 16 '16 17:05 dougsouza

Hi, So it may be my set up :

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

JordanPeltier avatar May 16 '16 17:05 JordanPeltier

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.

dougsouza avatar May 16 '16 17:05 dougsouza

Ok thanks for this reply !

JordanPeltier avatar May 16 '16 17:05 JordanPeltier

@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.

dougsouza avatar May 17 '16 23:05 dougsouza

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

JordanPeltier avatar May 18 '16 09:05 JordanPeltier

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

JordanPeltier avatar May 19 '16 14:05 JordanPeltier

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.

dougsouza avatar May 19 '16 14:05 dougsouza

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

JordanPeltier avatar May 19 '16 14:05 JordanPeltier

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

JordanPeltier avatar May 19 '16 14:05 JordanPeltier

@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/

dougsouza avatar May 19 '16 14:05 dougsouza

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

0x10cxR1 avatar Jul 06 '18 15:07 0x10cxR1