takuya-takeuchi / FaceRecognitionDotNet

The world's simplest facial recognition api for .NET on Windows, MacOS and Linux
MIT License
1.25k stars 305 forks source link

Faces getting detected in images that are upside down #176

Open vyshak-vijayan opened 3 years ago

vyshak-vijayan commented 3 years ago

Thanks a lot for your library.It is helping me immensely. I just came across an issue when dealing with images in the wrong orientation I'm trying to detect faces in images with wrong orientation.In some cases a face is detected when the image is upside down.I'm using the Hog model. For example , please see the image below https://imgur.com/a/cIv0yZE

Here the face is detected for the image that is upside down. To solve this issue , i have tried comparing the Y coordinate of the eye and lip face points to check if the image is upside down.But every time the eye coordinate(Y) seems less than the lip coordinate(Y) even if the image is upside down.

Can you please advice

takuya-takeuchi commented 3 years ago

@vyshak-vijayan I checked the above image by face_recognition find_facial_features_in_picture.py.

image

This task is difficult. Because

If you can use image recognition: e.g. resnet, efficient-net or other models, you can classify face parts area. And it may return low confidence for each face part from upside down image. Especially, there are many completely different feature between human lip and hair. So deleted human lib model could reject human hair parts.

vyshak-vijayan commented 3 years ago

@takuya-takeuchi Thanks a lot for your response.Can't we check if the highest Y chin point is close to the bottom of the image or not inorder to identify if the image is flipped.

takuya-takeuchi commented 3 years ago

@vyshak-vijayan Not bad. But your idea requires that human face SHALL be above bottom of image. If a human face are close to top of image, this approach could not work.