question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

the align function may Shear the face image

See original GitHub issue
H = cv2.getAffineTransform(npLandmarks[npLandmarkIndices],
                                   imgDim * MINMAX_TEMPLATE[npLandmarkIndices]*scale + imgDim*(1-scale)/2)
        thumbnail = cv2.warpAffine(rgbImg, H, (imgDim, imgDim))

I got the following result: 002

Why not use least square? Y = MX M = (YXt)(XXt)-1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
davidsandbergcommented, Oct 10, 2016

Yes, I think this is a known problem which has been discussed for example here. To my knowledge it has not been really solved though. Have you tried this approach? Does it produce better results?

Another approach would be to not do any transformation at all but instead just use a bounding box and let the CNN handle any rotations etc within that box. Rotations can then be seen as a kind of data augumentation instead. I have tried this approach but using MTCNN for face alignment, and when training a Inception-Resnet-v1 network on this data I can get a model with accuracy ~0.975 on LFW. Not sure how much of the performance improvement that can be attributed to not having the shearing effect though.

0reactions
davidsandbergcommented, Oct 31, 2016

I’m pretty sure I ran into the same problem but now I’m not sure how it was solved. Could have been that it was fixed when upgrading to a newer version of slim, but I’m not sure. One option would be to upgrade to TF 0.11 and see if that fixes the problem. I will do that as well as soon as I’m done with some training. If the problem persists, please file a new issue specifically for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Face Alignment with OpenCV and Python - PyImageSearch
In this tutorial you'll learn how to perform facial alignment using OpenCV, Python, and computer vision techniques.
Read more >
The Math and Code Behind Aligning Faces - sabbir.dev
To rotate the image which is typically a 3-dimensional matrix, we have to transform the matrix with a rotation matrix, we may have...
Read more >
The Math and Code Behind Aligning Faces | Analytics Vidhya
Facial alignment is a prerequisite to many machine learning and deep ... with a rotation matrix, we may have to shear the matrix...
Read more >
Image Features and Image Alignment | Getting started with ...
In this video, we will learn about Image Features and how we can use them to align an image.❓FAQWhat is image alignment in...
Read more >
Alignment by Maximization of Mutual Information 1 Introduction
As the illumination changes the functional relationship between the model and image will change. Since we can not know beforehand what the imaging...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found