What is the “Exif Orientation attribute” that is a pitfall of image recognition systems?
Normally, image data taken with a digital camera is embedded with metadata such as
The dumb reason your fancy Computer Vision app isn't working: Exif Orientation
When you shoot with a digital camera or smartphone, information about the orientation of the photo, whether the camera is held vertically or horizontally, is embedded in the image as Exif. For example, if you read a goose photo (left) taken with a smartphone vertically as shown below in Photoshop (right), it will be displayed in the correct orientation.
When you browse Exif of a goose photo, it looks like the following image. If you look at the “Orientation” attribute that specifies the orientation of the image, it says “Rotate 90 CW (rotate 90 degrees clockwise)”. When this part is read by the image viewer, the photo is displayed in the correct orientation.
Exif is a format standardized in 1995 by the
Image recognition is very popular among machine learning libraries, and the Python face recognition library is one of the most popular machine learning libraries on GitHub . However, these image recognition libraries have been developed as a tool for professionals who manipulate data arrays, and are not intended for general-user-level uses such as “I want to adjust the orientation of images automatically”. As a result, Geitgey explained that many image recognition libraries do not refer to Exif as well as the old image viewer.
Geitgey pointed out, 'If you do not read the correct orientation of the photo, you can not correctly recognize what is reflected in the photo,' 'Exif processing problems are not limited to Python scripts written by beginners and students No, even Google's Google Vision API doesn't handle the Exif Orientation attribute correctly. '
For example, the following is a goose photo read by Google Vision. Since Google Vision does not process the orientation attribute of Exif included in the photo, the portrait photo is displayed in landscape orientation and image recognition is performed as it is. The three geese shown in the photo are detected as 'Animal' and 'Bird' respectively.
When Google Vision is loaded in the correct orientation, everything is correctly detected as “Goose”.
“Comments may be posted on GitHub that the open source library you are using is broken or inaccurate. However, the cause is“ loading the image displayed sideways or upside down. ” 'It's often a simple thing,' replied Geitgey.
Geitgey said, 'If you to read the image on the program written in Python, check the Orientation attribute of Exif, if necessary should rotate the orientation of the image,' said, NumPy array the image in the correct orientation to The following code to load is released on GitHub as a package management tool.
in Software, Posted by log1i_yk