I'm using first_order_model for an expression transfer between an video and a static image.
Part of the algorithm makes a facial comparison to get the frame in the video where the face is best aligned with the foto.
This is made with:
def normalize_kp(kp): # original kp is (step 1)
kp = kp - kp.mean(axis=0, keepdims=True) # (step 2)
area = ConvexHull(kp[:, :2]).volume
area = np.sqrt(area)
kp[:, :2] = kp[:, :2] / area # (step 3)
return kp
normalized_kp_source = normalize_kp(get_landmarks(source))
normalized_kp_destination = normalize_kp(get_landmarks(destination))
diff = (np.abs(normalized_kp_source - normalized_kp_destination) ** 2).sum()
What I could not understand is how normalize_kp
works. I understand the result of putting the faces roughly in the same "size" and coordinate system.
Below, a comparison between the landmarks in each step of the normalisation:
The question:
How can I compare face alignment. How this normalization works?