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

No faces found #553

Open
yigitbacakoglu opened this issue Jul 3, 2018 · 7 comments
Open

No faces found #553

yigitbacakoglu opened this issue Jul 3, 2018 · 7 comments

Comments

@yigitbacakoglu
Copy link

yigitbacakoglu commented Jul 3, 2018

  • face_recognition version: latest
  • Python version: 3.4
  • Operating System: macos sierra

Description

The picture was taken with iphone8,
Library says 'no face found' on this image.

Dimensions: 2320 × 3088px
yigit3

But when I capture a screenshot on mac, this works well.
Dimensions: 908x1218px
yigit

What I Did

face_recognition ./known/ ./unknown/group.jpg
WARNING: No faces found in ./known/yigit3.jpg. Ignoring file.

Is it possible to consider ExifTags and rotate the picture if required in the library?

@ageitgey
Copy link
Owner

ageitgey commented Jul 4, 2018

You have to implement EXIF rotation yourself. If you Google, there are some python examples on stack overflow that work fine. I'd like to create a simple EXIF rotation python library sometime and add that feature here, but I haven't had time yet.

@DanielReyesDev
Copy link

DanielReyesDev commented Jul 6, 2018

@yigitbacakoglu Hey I'm developing an iOS App and a Backend server that use Django and face_recognition. So yesterday I realized about this problem with iOS cameras in general and I came with a solution about processing the Image in my iOS App before send it to server. More info here: https://stackoverflow.com/questions/10600613/ios-image-orientation-has-strange-behavior. So yes, it's an issue about iOS Cameras and you have to pre-process the image before pass it to face_recognition, but that's not an issue of face_recognition itself.
In swift I applied this method over the UIImage before send it to my backend and now It works as expected.

extension UIImage {
    func correctlyOrientedImage() -> UIImage {
        if self.imageOrientation == .up {
            return self
        }

        UIGraphicsBeginImageContextWithOptions(size, false, scale)
        draw(in: CGRect(x: 0, y: 0, width: size.width, height: size.height))
        let normalizedImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()

        return normalizedImage ?? self
    }
}

@rom1504
Copy link

rom1504 commented Sep 30, 2018

I just had this problem too. I took a few images from my google photos without thinking about this because google photos (and a lot of image displaying tools) auto rotate the images based on the exif, so you don't see the rotation.
I understand it takes a bit of time to add this to the library, but could you just add a notice in the README for now ?
So people don't get confused about getting poor results because of this problem.

Thank you for creating that really easy to use lib !

@ageitgey
Copy link
Owner

ageitgey commented Oct 8, 2018

@rom1504 Thanks, that's a good idea. I'll do that.

@ageitgey
Copy link
Owner

ageitgey commented Oct 8, 2018

I added it here: https://github.com/ageitgey/face_recognition/wiki/Common-Errors

@rom1504
Copy link

rom1504 commented Oct 8, 2018

for information, here is a way to rotate your images in python before using face_recognition https://github.com/hooram/ownphotos/blob/29e4fa855363e00fb2168cfa706ef870e23013e0/api/models.py#L254

@YubinXie
Copy link

I also notice that the package is bad at detecting rotated faces, while can be very common in real life. Is this because no rotation augmentation added during training?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants