1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
6.89k stars 1.33k forks source link

Conversion from 3d to 2d? #233

Closed Deccan12 closed 3 years ago

Deccan12 commented 3 years ago

Can we convert detected 3d facial landmarks for still image to 2D directly or would these landmarks be different for 2D and 3D?

1adrianb commented 3 years ago

The are 3 configuration modes the codes run: 2D, 2.5D and 3D. The 2.5D ones are simply the projection of the 3D ones, so there (x.y) coordinated for the 2.5D and 3D ones is the same.

The 2D ones, due to historical reasons mainly, are annotated at the boundary of the face and they lose correspondence with the actual 2.5D ones for non-frontal faces. To better illustrate the differences between this 2 configurations please see: Fig. 4 vs Fig. 6 here: http://openaccess.thecvf.com/content_ICCV_2017/papers/Bulat_How_Far_Are_ICCV_2017_paper.pdf

Deccan12 commented 3 years ago

Thank you, that clears it up.

Deccan12 commented 3 years ago

The are 3 configuration modes the codes run: 2D, 2.5D and 3D. The 2.5D ones are simply the projection of the 3D ones, so there (x.y) coordinated for the 2.5D and 3D ones is the same.

The 2D ones, due to historical reasons mainly, are annotated at the boundary of the face and they lose correspondence with the actual 2.5D ones for non-frontal faces. To better illustrate the differences between this 2 configurations please see: Fig. 4 vs Fig. 6 here: http://openaccess.thecvf.com/content_ICCV_2017/papers/Bulat_How_Far_Are_ICCV_2017_paper.pdf

I ran the code for 100's of images with folloing 2 detectors:

fa2D = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, device='cpu', flip_input=True)

fa3D = face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, device='cpu', flip_input=True)

But for both of these configuration, i got exact same output, of dimensions (68,3), is it normal or am I missing anything? Shouldnt 2D and 3D landmarks be different atleast in dimensions?