How are face normalization values calculated?

12 views
Skip to first unread message

Amir Mohammadi

unread,
Apr 17, 2018, 4:57:34 AM4/17/18
to bob-devel
A code sample is shown:
>>> face_eyes_norm = bob.ip.base.FaceEyesNorm(eyes_distance = 65, crop_size = (128, 128), eyes_center = (32, 63.5))
Then it says:

Now, we have set up our object to generate images of size (128, 128) that will put the left eye at the pixel position (32, 31) and the right eye at the position (32, 96).

How did it calculate the eye locations based on the eye distance and eyes_center? Is there code to automatically get this?

What exactly is eyes_center?

Thanks,
Amir

Sebastien Marcel

unread,
Apr 17, 2018, 5:15:04 AM4/17/18
to bob-devel
there was code for that in torch3vision in this class I believe http://torch3vision.idiap.ch/manual/bbxFace.html

it is on our internal svn or git -- I will dig for it

Amir Mohammadi

unread,
Apr 17, 2018, 5:24:56 AM4/17/18
to bob-...@googlegroups.com
Hi Sebastien,

I am not looking for different code. I am sure this is calculated in bob.ip.base. I am mainly wondering what does eyes_center mean and through which calculation one can go from those numbers to eye positions.

Thanks,
Amir

--
-- You received this message because you are subscribed to the Google Groups bob-devel group. To post to this group, send email to bob-...@googlegroups.com. To unsubscribe from this group, send email to bob-devel+...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/bob-devel or directly the project website at http://idiap.github.com/bob/
---
You received this message because you are subscribed to the Google Groups "bob-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bob-devel+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amir Mohammadi

unread,
Apr 17, 2018, 5:43:06 AM4/17/18
to bob-...@googlegroups.com
Ok I get it now. The eyes_center is the center of the eyes :)

left_eye = (32, 31)
right_eye = (32, 96)

eyes_center = (left_eye + right_eye)/2 = (32, 63.5)
eyes_distance = right_eye[1] - left_eye[1] = 96 - 31 = 65


This seems to assume that eyes have the same y (height) location
in the normalized image which is a good assumption :)

Thanks,
Amir

Manuel Günther

unread,
Apr 17, 2018, 12:14:50 PM4/17/18
to bob-devel
Amir,

the bob.ip.base.FaceEyesNorm has two different constructors, one using eye center and eye distance (this is what was copied from torch), and one taking the two eye locations directly (I have added this for convenience): https://www.idiap.ch/software/bob/docs/bob/docs/master/bob.ip.base/doc/py_api.html#bob.ip.base.FaceEyesNorm


Manuel

Amir Mohammadi

unread,
Apr 17, 2018, 12:19:16 PM4/17/18
to bob-...@googlegroups.com
The problem was I could not make the relation between these two form of accepting landmarks. This was not explained. The math that I showed explains it.

I was trying to convert these inputs: https://gitlab.idiap.ch/bob/bob.pad.face/blob/879d8824d78fa5b7029bc8621ff08552a5a32d2b/bob/pad/face/preprocessor/FaceCropAlign.py#L253 to the eye positions but I did not know how to do that.

Amir

--

Manuel Günther

unread,
Apr 17, 2018, 12:32:02 PM4/17/18
to bob-devel
For your reference, the complete math on how to obtain the rotation parameters is detailed in Section 2.1 in here: http://publications.idiap.ch/downloads/reports/2013/Gunther_Idiap-RR-13-2017.pdf

Just for completeness: the names "eye positions" and "FaceEyesNorm" are historical. Actually, you can choose **any** two locations which will be mapped. For example, you can use two corners of bounding boxes to be mapped to specific locations in the aligned image. I have done this in bob.bio.face, i.e., when the annotator only returned bounding boxes.

Manuel
Reply all
Reply to author
Forward
0 new messages