Roboflow Docs
DashboardResourcesProducts
  • Product Documentation
  • Developer Reference
  • Changelog
  • Roboflow Documentation
  • Quickstart
  • Workspaces
    • Workspaces, Projects, and Models
    • Create a Workspace
    • Rename a Workspace
    • Delete a Workspace
  • Team Members
    • Invite a Team Member
    • Role-Based Access Control (RBAC)
    • Change a Team Member Role
    • Remove a Team Member
  • Single Sign On (SSO)
  • Workflows
    • What is Workflows?
    • Create a Workflow
    • Build a Workflow
    • Test a Workflow
    • Deploy a Workflow
    • Workflow Examples
      • Multimodal Model Workflow
    • Share a Workflow
    • Workflows AI Assistant
  • Enterprise Integrations
  • Workflow Blocks
    • Run a Model
      • Object Detection Model
      • Single-Label Classification Model
    • Visualize Predictions
      • Bounding Box Visualization
      • Label Visualization
      • Circle Visualization
      • Background Color Visualization
      • Classification Label Visualization
      • Crop Visualization
  • Dataset Management
    • Create a Project
    • Upload Images, Videos, and Annotations
      • Import Data from Cloud Providers
        • AWS S3 Bucket
        • Azure Blob Storage
        • Google Cloud Storage
      • Import from Roboflow Universe
    • Manage Datasets
      • Dataset Batches
      • Search a Dataset
      • Set Dataset Classes
      • Add Tags to Images
      • Create an Annotation Attribute
      • Download an Image
      • Delete an Image
    • Dataset Versions
      • Create a Dataset Version
      • Preprocess Images
      • Image Augmentation
        • Augmentation Types
          • Flip Augmentation
          • 90º Rotate Augmentation
          • Crop Augmentation
          • Rotation Augmentation
          • Shear Augmentation
          • Grayscale Augmentation
          • Hue Augmentation
          • Saturation Augmentation
          • Brightness Augmentation
          • Exposure Augmentation
          • Blur Augmentation
          • Noise Augmentation
          • Cutout Augmentation
          • Mosaic Augmentation
        • Add Augmentations to Images
      • Delete a Version
    • Dataset Analytics
    • Merge Projects
    • Rename a Project
    • Delete a Project
    • Project Folders
    • Make a Project Public
    • Download a Dataset
  • Annotate
    • Introduction to Roboflow Annotate
    • Annotate an Image
      • Keyboard Shortcuts
      • Comment on an Image
      • Annotation History
      • Similarity Search
    • AI Labeling
      • Label Assist
      • Smart Polygon
      • Box Prompting
      • Auto Label
    • Set Keypoint Skeletons
    • Annotate Keypoints
    • Annotate Multimodal Data
    • Collaborate on Labeling
    • Annotation Insights
  • Roboflow Labeling Services
  • Train
    • Train a Model
      • Train from a Universe Checkpoint
      • Train from Azure Vision
      • Train from Google Cloud
    • Roboflow Instant
    • Cancel a Training Job
    • Stop Training Early
    • View Training Results
    • View Trained Models
    • Evaluate Trained Models
  • Deploy
    • Deploy a Model or Workflow
    • Supported Models
    • Managed Deployments
    • Serverless Hosted API V2
      • Use in a Workflow
      • Use with the REST API
      • Run an Instant Model
    • Serverless Hosted API
      • Object Detection
      • Classification
      • Instance Segmentation
        • Semantic Segmentation
      • Keypoint Detection
      • Foundation Models
        • CLIP
        • OCR
        • YOLO-World
      • Video Inference
        • Use a Fine-Tuned Model
        • Use CLIP
        • Use Gaze Detection
        • API Reference
        • Video Inference JSON Output Format
      • Pre-Trained Model APIs
        • Blur People API
        • OCR API
        • Logistics API
        • Image Tagging API
        • People Detection API
        • Fish Detection API
        • Bird Detection API
        • PPE Detection API
        • Barcode Detection API
        • License Plate Detection API
        • Ceramic Defect Detection API
        • Metal Defect Detection API
    • Dedicated Deployments
      • Create a Dedicated Deployment
      • Make Requests to a Dedicated Deployment
      • Manage Dedicated Deployments with an API
    • Batch Processing
    • SDKs
      • Python inference-sdk
      • Web Browser
        • inferencejs Reference
        • inferencejs Requirements
      • Lens Studio
        • Changelog - Lens Studio
      • Luxonis OAK
    • Upload Custom Model Weights
    • Download Model Weights
    • Enterprise Deployment
      • License Server
      • Offline Mode
      • Kubernetes
      • Docker Compose
    • Device Manager
      • Add a Device
      • Add a Stream
      • View a Stream
    • Model Monitoring
      • Alerting
  • Universe
    • What is Roboflow Universe?
    • Find a Dataset on Universe
    • Explore Images in a Universe Dataset
    • Fork a Universe Dataset
    • Find a Model on Universe
    • Download a Universe Dataset
  • Set a Project Description
  • View Project Analytics
  • Support
    • Share a Workspace with Support
    • Delete Your Roboflow Account
    • Apply for Academic Credits
  • Billing
    • Premium Trial
    • Credits
      • View Credit Usage
      • Enable or Disable Flex Billing
      • Purchase Prepaid Credits
    • Plans
      • Purchase a Plan
      • Cancel a Plan
      • Update Billing Details
      • Update Payment Method
      • View Invoices
Powered by GitBook
On this page
  • Auto-Orient
  • Resize
  • Grayscale
  • Auto-Adjust Contrast
  • Advanced Preprocessing Features
  • Isolate Objects
  • Static Crop
  • Tile
  • Modify Classes
  • Filter Null
  • Filter by Tag

Was this helpful?

  1. Dataset Management
  2. Dataset Versions

Preprocess Images

Image preprocessing steps to prepare data for models.

PreviousCreate a Dataset VersionNextImage Augmentation

Last updated 17 days ago

Was this helpful?

Preprocessing ensures your dataset is in a standard format (e.g. all images are the same size). This step is essential to ensure your dataset is consistent before training a model.

Preprocessing applies to all images in your Train, Valid, and Test set (unlike , which only apply to the Train set).

The Roboflow platform offers the following preprocessing options:

  • Auto-Orient

  • Resize

  • Grayscale

  • Auto-Adjust Contrast

  • Isolate Objects

  • Static Crop

  • Tile

  • Modify Classes

  • Filter Null

  • Filter by Tag

Each option is described below.

Auto-Orient

Auto-orient strips your images of their EXIF data so that you see images displayed the same way they are stored on disk.

EXIF data determines the orientation of a given image. Applications (like Preview on Mac) use this data to display an image in a specific orientation, even if the orientation of how it is stored on disk differs. See front page Hacker News discussion on how this may silently ruin your object detection models.

  • Roboflow recommends defaulting to leaving this on and checking how your images in inference are being fed to your model.

Resize

Resize changes your images size and, optionally, scale to a desired set of dimensions. Annotations are adjusted proportionally (except in the case of “fill” below).

  • Stretch to: Stretch your images to a preferred pixel-by-pixel dimension. Annotations are scaled proportionally. Images are square, distorted, but no source image data is lost.

  • Fill (with center crop) in: The generated image is a centered crop of your desired output dimensions. For example, if the source image is 2600x2080 and the resize option is set to 640x640, the outputted resize is the central 640x640 of the source image. The aspect ratio is maintained, but source image data is lost.

  • Fit within: The dimensions of the source dimension are scaled to be the dimensions of the output image while maintaining the source image aspect ratio. For example, if a source image is 2600x2080 and the resize option is set to 640x640, the longer dimensions (2600) is scaled to 640 and the secondary dimension (2080) is scaled to ~512 pixels. Image aspect ratios and original data are maintained, but they are not square.

  • Fit (reflect edges) in: The dimensions of the source dimension are scaled to be the dimensions of the output image while maintaining the source image aspect ratio, and any newly created padding is a reflection of the source image. For example, if a source image is 2600x2080 and the resize option is set to 416x416, the longer dimensions (2600) is scaled to 416 and the secondary dimension (2080) is scaled to ~335.48 pixels. The remaining pixel area (416-335.48, or 80.52 pixels) are reflected pixels of the source image. Notably, Roboflow also reflects annotations by default. Images are square, padded, and aspect ratios plus original data are maintained.

  • Fit (black edges) in: The dimensions of the source dimension are scaled to be the dimensions of the output image while maintaining the source image aspect ratio, and any newly created padding is black area. For example, if a source image is 2600x2080 and the resize option is set to 416x416, the longer dimensions (2600) is scaled to 416 and the secondary dimension (2080) is scaled to ~335.48 pixels. The remaining pixel area (416-335.48, or 80.52 pixels) are black pixels. Images are square, black padded, and aspect ratios plus original data are maintained.

  • Fit (white edges) in: The dimensions of the source dimension are scaled to be the dimensions of the output image while maintaining the source image aspect ratio, and any newly created padding is white area. For example, if a source image is 2600x2080 and the resize option is set to 416x416, the longer dimensions (2600) is scaled to 416 and the secondary dimension (2080) is scaled to ~335.48 pixels. The remaining pixel area (416-335.48, or 80.52 pixels) are white pixels. Images are square, white padded, and aspect ratios plus original data are maintained.

Grayscale

Converts an image with RGB channels into an image with a single grayscale channel, which can save you memory. The value of each grayscale pixel is calculated as the weighted sum of the corresponding red, green and blue pixels: Y = 0.2125 R + 0.7154 G + 0.0721 B.

Auto-Adjust Contrast

Advanced Preprocessing Features

Isolate Objects

The Isolate Objects transform will crop and extract each bounding box into an individual image. This step converts Object Detection datasets into Classification datasets.

In cases where many classes in a dataset are similar, it is common to use two models in sequence. The first model (object detection) finds the object and the second model (classification) identifies what the object is. The Isolate Objects transformation is useful for creating the dataset necessary for training the second model.

Static Crop

Tile

Tiling can help when detecting small objects (especially in situations like aerial imagery and microscopy. The default setting is 2x2 tiling, however, you can adjust this as you see fit. Tiling is performed before resizing in the preprocessing pipeline.

Modify Classes

A preprocessing tool used to omit specific classes or remap (rename) classes when generating a new version of your dataset. These changes only apply to the version you generate. No changes will be made to your underlying dataset.

Filter Null

The Filter Null transformation allows users to require a share of images in a dataset to be annotated. Images marked as null annotation, or "unannotated" after applying the Modify Classes tool, are the only ones affected when using Filter Null.

This transformation is useful in the case where a large share of a dataset does not contain the objects of interest.

Be sure that you have properly annotated ALL images within your dataset, designated appropriate images as null annotation, and/or omitted any unnecessary classes prior to using this tool.

"Missing Annotations" occur when images are not annotated (leaving images unannotated will cause issues with the performance of your trained dataset, and can result in a failed training). Null annotations should only be applied when there is nothing present within that image that you wish for your model to detect.

Filter by Tag

Three options are available for each Tag:

  • Require: Only images with Required tags will be included in the version.

  • Exclude: Images with Excluded tags will not be included in the version.

  • Allow: Images with Allowed tags will be included in the version, conditional on Exclude and Require rules.

If you want to learn more about whether or not you should auto-orient your images, .

Currently, we only support downsizing. We provide some guidance for .

These weights are used by as they better represent human perception of red, green and blue than equal weights. (Via .)

Enhances an image with low contrast. We've explored .

Contrast Stretching: the image is rescaled to include all intensities that fall within the 2nd and 98th percentiles. .

Histogram Equalization: “spreads out the most frequent intensity values” in an image. The equalized image has a roughly uniform distribution, where all colors of pixels are approximately equally represented. .

Adaptive Equalization: Contrast Limited Adaptive Histogram Equalization (CLAHE). An algorithm for local contrast enhancement, that uses histograms computed over different tile regions of the image. Local details can therefore be enhanced even in regions that are darker or lighter than most of the image. (Via .)

The Filter by Tag transformation allows users to filter which images should or should not be included in a version based on which are applied. This transformation is useful for training a model on a new subset of data or excluding unwanted images from training.

Augmentations
this
check out our blog
what resize option may be best for your use case
CRT phosphors
Scikit-Image
whether you want to use contrast as a preprocessing step
See more
See more
Scikit-Image
The Difference Between Missing and Null Annotations
Tags
The static crop feature, and an example output.
The tiling tool and a preview (depicted in "grid") of the output .
Omitting the "Apple leaf" class.
Remapping the class "scratches" to "scratch".
Applying the Filter Null preprocessing step.
In this example, the resulting Version will only contain images that do not have the do-not-include tag.