Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for min face area not being proportional. #1374

Merged
merged 4 commits into from Apr 27, 2017

Conversation

montehurd
Copy link
Contributor

@montehurd montehurd commented Apr 26, 2017

The face area check was a bit off. The face bounds are unit values which need to be denormalized to image size to get the face's actual area in terms of the image's area. Then we can divide the actual face area by the image area to get a resolution-independent proportion.

Before

screen shot 2017-04-26 at 4 19 00 pm

After

screen shot 2017-04-26 at 4 56 56 pm

CGFloat imageArea = image.size.width * image.size.height;
CGFloat faceProportionOfImage = faceArea / MAX(imageArea, 0.0000001);
// Reminder: "0.0178" of the area of a 640x640 image would be roughly an 85x85 area.
BOOL faceIsBigEnough = (faceProportionOfImage >= 0.0178);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new proportional value of 0.0178 was chosen by simply increasing it until the test passed.

@montehurd montehurd force-pushed the bug/tiny-thumb-face-detection/T163965 branch from 679e4a7 to 20589d1 Compare April 27, 2017 08:20
@montehurd montehurd force-pushed the bug/tiny-thumb-face-detection/T163965 branch from 20589d1 to 0679d8c Compare April 27, 2017 08:21
CGFloat imageArea = image.size.width * image.size.height;
CGFloat faceProportionOfImage = faceArea / MAX(imageArea, 0.0000001);
// Reminder: "0.0178" of the area of a 640x640 image would be roughly 85x85.
isFaceBigEnough = (faceProportionOfImage >= 0.0178);
Copy link
Contributor Author

@montehurd montehurd Apr 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0178 was roughly the smallest value at which our minimum size face test passed. Proportionally it seemed about right.

@joewalsh joewalsh merged commit 4d29ea4 into develop Apr 27, 2017
@joewalsh joewalsh deleted the bug/tiny-thumb-face-detection/T163965 branch April 27, 2017 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants