When Should I Auto-Orient My Images?

When Should I Auto-Orient My Images?
The recommended Roboflow setting is "Auto-Orient: Enabled"

When should you auto-orient your images?

The short answer: almost always.

When an image is captured, it contains metadata that dictates the orientation by which it should be displayed relative to how the pixels are arranged on disk. This directive (stored in the EXIF orientation field) speeds up encoding the image at capture-time so cameras can efficiently sample data from their sensors without unwanted artifacts.

This means that most cameras store images' pixels exactly the same whether the camera is oriented in landscape or portrait mode. They just flip a bit to signal to the viewer whether to display the pixels as-is or to rotate them by 90 or 180 degrees when displaying the image.

Unfortunately, this can cause issues if the application displaying the images is unaware of the metadata and naively displays the image without respecting its EXIF orientation.

Left: EXIF Orientation mismatch between annotation and image, Right: Correct Exif Orientation

This is an easy thing to mess up (especially when programming our own image pipelines). And, in fact, is one of the most common bugs encountered in computer vision projects. If some of your images are stored on disk as x,y and some are y,x, you're going to be feeding your model bad info without even knowing it.

Fortunately, Roboflow fixes this problem for you by default. All you have to do is enable "Auto-Orient" in your pre-processing settings.

When not to auto-orient

So why do we even give you the option to turn this off? Well, in very specific circumstances, you may want to use this as a speed optimization.

One example would be if you're creating a mobile app that runs on a specific device where you know that all of your images will have the same EXIF orientation. To avoid having to rotate the pixel values at runtime, you may want to leave them in the same coordinate system. So long as you train your model with the same type of inputs (and your labeling tool properly deals with this), you shouldn't have any problems.


Want to be the first to know about new computer vision tutorials and content like our synthetic dataset creation guide? Subscribe to our updates 📬.

Roboflow accelerates your computer vision workflow through automated annotation quality assurance, universal annotation format conversion (like PASCAL VOC XML to COCO JSON and creating TFRecords ), team sharing and versioning, and easy integration with popular open source computer vision models. Getting started with your first 1GB of data is completely free.

Show Comments