Open yigitbacakoglu opened 6 years ago
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.
@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
}
}
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 !
@rom1504 Thanks, that's a good idea. I'll do that.
I added it here: https://github.com/ageitgey/face_recognition/wiki/Common-Errors
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
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?
Description
The picture was taken with iphone8, Library says 'no face found' on this image.
Dimensions: 2320 × 3088px
But when I capture a screenshot on mac, this works well. Dimensions: 908x1218px
What I Did
Is it possible to consider ExifTags and rotate the picture if required in the library?