> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/datasets/versions/dataset-versions/image-preprocessing.md).

# Preprocess Images

Image preprocessing steps to prepare data for models, with guidance on when to use each one.

Preprocessing puts every image in your dataset into the same format (ex: the same size and orientation) before you train a model. Consistent inputs train faster and give more reliable results.

Preprocessing applies to every image in your Train, Valid, and Test sets. [Augmentations](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation.md) apply only to the Train set. When you deploy a model trained in Roboflow with Roboflow Inference, it applies the version's Resize, Static Crop, Auto-Contrast, and Grayscale steps to each input image for you, so your inference images match your training images.

You add preprocessing steps in two places:

* On the "Create New Version" page, in the "Preprocessing" section, click "Add Preprocessing Step". See [Create a Dataset Version](https://docs.roboflow.com/datasets/versions/dataset-versions/create-a-dataset-version.md).
* In training setup, open "Customize Training Recipe" and edit "Training Preprocessing". See [Train a Model](https://docs.roboflow.com/models/train/train-a-model).

Each option opens a preview of its effect on a sample image from your dataset. Auto-Orient and Resize are on by default, and most projects need nothing else to start.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-040f5284dabd8bcd0bcde0430ad1fe2f1689fea8%2Fpreprocessing-step-overview.png?alt=media" alt="The Preprocessing section of the Create New Version page with Auto-Orient applied and the Add Preprocessing Step button"><figcaption><p>The "Preprocessing" section on the "Create New Version" page.</p></figcaption></figure>

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-f1ca9c78723e0e7ffa5ae184379c083bcbf8e9c8%2Fpreprocessing-options-picker.png?alt=media" alt="The Preprocessing Options picker listing Tile, Isolate Objects, Static Crop, Dynamic Crop, Resize, Grayscale, Auto-Adjust Contrast, Modify Classes, Random Sample, Filter Null, and Filter by Tag"><figcaption><p>"Add Preprocessing Step" opens the list of preprocessing options.</p></figcaption></figure>

<table data-search="false"><thead><tr><th>Step</th><th>What it does</th></tr></thead><tbody><tr><td><a href="#auto-orient">Auto-Orient</a></td><td>Applies each image's EXIF rotation to its pixels, so every image is stored the way it displays.</td></tr><tr><td><a href="#resize">Resize</a></td><td>Scales every image to the same width and height.</td></tr><tr><td><a href="#grayscale">Grayscale</a></td><td>Converts images from color to a single gray channel.</td></tr><tr><td><a href="#auto-contrast">Auto-Contrast</a></td><td>Boosts contrast based on each image's histogram.</td></tr><tr><td><a href="#static-crop">Static Crop</a></td><td>Crops every image to the same region.</td></tr><tr><td><a href="#dynamic-crop">Dynamic Crop</a></td><td>Crops each image to the box of one class.</td></tr><tr><td><a href="#isolate-objects">Isolate Objects</a></td><td>Turns each bounding box into its own image for classification.</td></tr><tr><td><a href="#tile">Tile</a></td><td>Splits each image into smaller tiles.</td></tr><tr><td><a href="#modify-classes">Modify Classes</a></td><td>Renames, merges, or drops classes in this version only.</td></tr><tr><td><a href="#filter-null">Filter Null</a></td><td>Limits how many images without objects the version keeps.</td></tr><tr><td><a href="#filter-by-tag">Filter by Tag</a></td><td>Includes or excludes images by tag.</td></tr><tr><td><a href="#random-sample">Random Sample</a></td><td>Keeps a random share of each split.</td></tr></tbody></table>

## Auto-Orient

Cameras often save pixels in one fixed layout and store the intended rotation separately, in the image's EXIF orientation field. Photo viewers read that field and rotate the image on screen, but many training and inference tools ignore it. The same dataset can then contain images that a model reads sideways, with annotations that no longer line up with the objects.

Auto-Orient rotates the pixels to match the EXIF orientation, then removes the EXIF data. Every image is then stored the same way it displays.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-b8de68fb154d70a3752e5bed9220ffdf8a9bf0c4%2Fpreprocessing-example-auto-orient.png?alt=media" alt="A sideways stored image with an EXIF rotation, and the upright output with its annotations lined up"><figcaption><p>Example: the stored pixels are sideways, and the EXIF field says to rotate them 90° clockwise. After Auto-Orient, the pixels are upright and the annotations line up.</p></figcaption></figure>

Use it when:

* Almost always. It is on by default, and it matters most when images come from phones, several cameras, or any source with a mix of portrait and landscape photos.

Skip it when:

* Every image, in training and in production, comes from one controlled device that writes the same EXIF orientation, and you want to avoid rotating pixels at inference time. Your inference code must then read images exactly the way your training images were read.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-2a664b0c94607c3d3d1430e430a1ff4299c3493c%2Fpreprocessing-auto-orient-modal.png?alt=media" alt="The Auto-Orient modal with an example of four rotated images and the description"><figcaption><p>The Auto-Orient settings on the "Create New Version" page.</p></figcaption></figure>

## Resize

Resize scales every image to the width and height you set, and adjusts annotations to match. Smaller images train faster: an image twice as wide and twice as tall has four times as many pixels to process. Many model architectures also need every input to be the same size.

Pick a mode from the dropdown next to the size fields:

<table data-search="false"><thead><tr><th>Mode</th><th>What it does</th><th>Use it when</th></tr></thead><tbody><tr><td>Stretch to</td><td>Scales width and height separately to the exact size. No pixels are lost, but objects are squashed or stretched when the aspect ratio changes.</td><td>Your images already have the target aspect ratio, or you want to use every pixel and the model always sees images stretched the same way.</td></tr><tr><td>Fill (center crop)</td><td>Scales the image until it covers the target size, keeping its aspect ratio, then crops the center. A 2600x2080 image resized to 640x640 becomes 800x640, then loses 80 pixels on the left and right. Annotations in the cropped edges are cut off.</td><td>Objects sit near the center and the edges hold nothing you need.</td></tr><tr><td>Fit within</td><td>Scales the image down until it fits inside the target size, keeping its aspect ratio. No padding is added, so the output is not always the target size. A 2600x2080 image resized to 640x640 becomes about 640x512.</td><td>Your model accepts images of different sizes and you want to avoid distortion and padding.</td></tr><tr><td>Fit (reflect)</td><td>Scales the image to fit, keeping its aspect ratio, then fills the leftover space with a mirror image of the edges. Annotations are mirrored into the padding too. A 2600x2080 image resized to 416x416 becomes about 416x335, plus 81 pixels of reflected padding.</td><td>You want square images without distortion and without flat padding. Not available for keypoint detection, because mirroring swaps left and right keypoints.</td></tr><tr><td>Fit (black)</td><td>Same as Fit (reflect), but fills the leftover space with black pixels.</td><td>You want square images without distortion. This is the safest default for mixed aspect ratios.</td></tr><tr><td>Fit (white)</td><td>Same as Fit (reflect), but fills the leftover space with white pixels.</td><td>Same as Fit (black), when your backgrounds are light.</td></tr></tbody></table>

The "Create New Version" page and the API use longer names for the same modes:

* Fill (center crop): `Fill (with center crop) in`
* Fit (reflect): `Fit (reflect edges) in`
* Fit (black): `Fit (black edges) in`
* Fit (white): `Fit (white edges) in`

"Stretch to" and "Fit within" have the same name everywhere. The "Create New Version" page accepts sizes up to 2048 pixels per side. Anomaly detection supports only "Stretch to".

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-11dd8d0a3630fc04518773ba45c10e3009c56a3d%2Fpreprocessing-example-resize.png?alt=media" alt="One 1280 x 720 image resized to 640 x 640 in each of the six modes, with the bounding boxes adjusted in each"><figcaption><p>Example: a 1280 x 720 image resized to 640 x 640 in each mode. Fill crops the sides and cuts the boxes there. Fit within comes out 640 x 360. Fit (reflect) also mirrors the annotations into the padding.</p></figcaption></figure>

To choose a size:

* Start with your model's input size. Training setup fills in the size the selected model expects.
* Check your smallest objects. After resizing, small objects can shrink to a few pixels and become hard to detect. Use a larger size, or use [Tile](#tile) to split large images instead.
* Prefer shrinking over enlarging. Scaling small images up stretches their pixels and blurs edges. If your images vary in size but have similar aspect ratios, resize to the size of your smaller images.
* Handle mixed aspect ratios with a Fit mode. "Stretch to" teaches the model distorted shapes, and production images must be stretched the same way.
* Start small when you experiment. Smaller sizes train faster, so you can test ideas quickly, then train at a larger size for your final model.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-799d6360a574c3543b6781457fbfc7a480b6fd3b%2Fpreprocessing-resize-mode-options.png?alt=media" alt="The Resize modal on the Create New Version page with the mode list open and a 512 x 512 Stretch to preview"><figcaption><p>The six Resize modes on the "Create New Version" page, which uses the API values as labels. "Stretch to" squashes the image to 512 x 512.</p></figcaption></figure>

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-6d3d6acc6fb400191979d45e3487eaddf87154ad%2Fpreprocessing-resize-fit-black-edges.png?alt=media" alt="The Resize modal with Fit (black edges) in selected, showing the resized image letterboxed with black bars"><figcaption><p>"Fit (black edges) in" keeps the aspect ratio and pads the image with black.</p></figcaption></figure>

## Grayscale

Grayscale converts a three-channel color image into one gray channel. Each gray pixel is a weighted sum of the red, green, and blue values: Y = 0.2125 R + 0.7154 G + 0.0721 B. The weights follow how people perceive brightness in each color. A one-channel input means fewer computations and less memory per image, which helps most on edge devices like a Raspberry Pi or NVIDIA Jetson.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-49cbe4cda4d67a8d602f547b7050314f33f38875%2Fpreprocessing-example-grayscale.png?alt=media" alt="A color image and its grayscale output"><figcaption><p>Example: the same image before and after Grayscale.</p></figcaption></figure>

Use it when:

* Speed or memory matters and color is not a useful signal (ex: reading digits on a meter, finding cracks in concrete).
* The colors your model must tell apart contrast strongly in brightness (ex: black and white chess pieces).

Skip it when:

* Color separates classes that look alike otherwise (ex: yellow versus white lane lines, traffic light states, ripe versus unripe fruit).
* You want a model that tolerates color changes but still sees color at inference time. Use the [Grayscale augmentation](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/grayscale-augmentation.md) instead, which converts only some training images.

If you are unsure, generate two versions, one with Grayscale and one without, train on both, and compare.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-a64e2b59b5809081f10a00c554e8bf1506931162%2Fpreprocessing-grayscale-modal.png?alt=media" alt="The Grayscale preprocessing modal with an original color image and its grayscale version"><figcaption><p>The Grayscale preview.</p></figcaption></figure>

## Auto-Contrast

Auto-Contrast boosts contrast based on each image's histogram, the spread of its pixel brightness values. It does not brighten or darken the whole image by a fixed amount. It spreads brightness values apart so that edges between neighboring pixels become clearer, which helps models find object boundaries. The "Create New Version" page calls this step "Auto-Adjust Contrast".

Choose a type from the dropdown:

<table data-search="false"><thead><tr><th>Type</th><th>What it does</th><th>Use it when</th></tr></thead><tbody><tr><td>Stretching (Contrast Stretching)</td><td>Rescales brightness so the values between the 2nd and 98th percentiles span the full range.</td><td>Images are evenly lit but look flat or washed out.</td></tr><tr><td>Histogram (Histogram Equalization)</td><td>Spreads out the most common brightness values across the whole image, so all brightness levels appear about equally often.</td><td>Whole images are too dark or too bright.</td></tr><tr><td>Adaptive (Adaptive Equalization)</td><td>Applies equalization to small regions of the image separately (CLAHE), with a limit on how much contrast it adds. Details show up in both dark and bright areas.</td><td>Lighting varies within an image (ex: shadows, glare, backlit scenes).</td></tr></tbody></table>

The names in parentheses are the labels on the "Create New Version" page and the values the API accepts.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-e2cda80b71960ea43ed844c714eea0f7b7526033%2Fpreprocessing-example-auto-contrast.png?alt=media" alt="One image and its output with Contrast Stretching, Histogram Equalization, and Adaptive Equalization"><figcaption><p>Example: one evenly lit image with each type. Histogram and Adaptive Equalization change it the most.</p></figcaption></figure>

Use it when:

* Your images have low contrast or uneven lighting (ex: scanned documents for OCR, X-rays, foggy or night scenes).
* Lighting varies a lot from image to image and you want to normalize it.

Skip it when:

* Your images are already well exposed with consistent lighting. Extra contrast can amplify noise and compression artifacts in flat areas.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-cfa9f4136f3e849bb11e4134e403c2ab4fda0c1d%2Fpreprocessing-auto-contrast-contrast-stretching.png?alt=media" alt="The Auto-Adjust Contrast modal with Contrast Stretching selected and a slightly brighter adjusted preview"><figcaption><p>Contrast Stretching on the "Create New Version" page, where the step is named "Auto-Adjust Contrast".</p></figcaption></figure>

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-9f595523da7f00539fa03df6e1f3c05e09e4d82c%2Fpreprocessing-auto-contrast-histogram-equalization.png?alt=media" alt="The Auto-Adjust Contrast modal with Histogram Equalization selected and a darker, higher-contrast adjusted preview"><figcaption><p>Histogram Equalization.</p></figcaption></figure>

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-8ec3be3869cb19923304b157c3d0f2a12cf8b6aa%2Fpreprocessing-auto-contrast-adaptive-equalization.png?alt=media" alt="The Auto-Adjust Contrast modal with Adaptive Equalization selected and a strongly textured adjusted preview"><figcaption><p>Adaptive Equalization brings out local detail. On an evenly lit image like this one, it also exaggerates texture in flat walls.</p></figcaption></figure>

## Static Crop

Static Crop crops every image to the same region, set as percentages of the image width and height. In training setup, set "Horizontal Min" and "Horizontal Max" for the left and right edges, and "Vertical Min" and "Vertical Max" for the top and bottom. The "Create New Version" page has one two-handle slider per axis, "Horizontal Range" and "Vertical Range". The defaults keep the middle 25% to 75% on each axis. The app warns you when a range spans less than 35% of the image, since a crop that tight is often a mistake.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-b545e81ce5c14ecbb46ff55c85b6f16199b2e4ac%2Fpreprocessing-example-static-crop.png?alt=media" alt="An image with the default crop region outlined, and the 640 x 360 cropped output with boxes cut at the crop edges"><figcaption><p>Example: the default crop keeps the middle half of each axis. Boxes that cross the crop edge are cut to fit.</p></figcaption></figure>

Use it when:

* Your camera is fixed and the objects you care about always appear in the same part of the frame (ex: a conveyor belt that fills the bottom third of the image).
* Part of every frame holds nothing useful, such as a timestamp overlay or a static border.

Skip it when:

* Objects can appear anywhere in the frame, or the camera moves. The same crop applies at inference time, so the model never sees objects outside the region.

Static Crop is not available for keypoint detection.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-1ff224b9398e10ccad685245507bd67269cde27b%2Fpreprocessing-static-crop-modal.png?alt=media" alt="The Static Crop modal with Horizontal Range and Vertical Range sliders both set from 25% to 75%, and the cropped preview"><figcaption><p>The default Static Crop on the "Create New Version" page keeps the middle 25% to 75% on each axis.</p></figcaption></figure>

## Dynamic Crop

Dynamic Crop crops each image to the bounding box of a class you select. Each image must have exactly one box of that class, or it is left out of the version.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-0969d9a0de1672c66e20def5f41551e24653325e%2Fpreprocessing-example-dynamic-crop.png?alt=media" alt="An image with one box cropped to that box, and an image with two boxes left out of the version"><figcaption><p>Example: Dynamic Crop to the box class. The image with one box becomes a 600 x 398 crop. The image with two boxes is left out.</p></figcaption></figure>

Use it when:

* You are training the second model in a two-stage pipeline, where a first object detection model finds a region and a second object detection model looks inside it (ex: find a license plate, then detect each character on it).

Skip it when:

* You want a single model that works on full images. Dynamic Crop changes what the model sees, so at inference time you must crop images with the first model before sending them to the second. In a Workflow, use the [Dynamic Crop block](https://docs.roboflow.com/workflows/blocks/blocks/transformations/dynamic-crop) for this.

Dynamic Crop is available for object detection and instance segmentation projects.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-a7e058d9e90fa1b6d849d09ba8c23e2d455caa4f%2Fpreprocessing-dynamic-crop-modal.png?alt=media" alt="The Dynamic Crop modal with the class box selected and a warning that it is meant for the second stage of a two-stage process"><figcaption><p>The Dynamic Crop settings, with the class to crop to.</p></figcaption></figure>

## Isolate Objects

Isolate Objects crops each bounding box into its own image, labeled with the box's class. The result is a classification dataset, and the version no longer has bounding boxes.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-4c5656ccbc60b58955df20bf8081df4d7485dc04%2Fpreprocessing-example-isolate-objects.png?alt=media" alt="An image with two person boxes and two box boxes, and the four cropped images it produces"><figcaption><p>Example: one image with four boxes becomes four images, each labeled with its box's class.</p></figcaption></figure>

Use it when:

* You are building a two-stage pipeline, where an object detection model finds objects and a classification model identifies them. This works well when classes look alike and a detector struggles to tell them apart (ex: detect "bird", then classify the species).

Skip it when:

* You want to train an object detection model. Isolate Objects removes every bounding box from the version.

Isolate Objects is not available for classification, keypoint detection, or oriented object detection projects.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-3c3a56d441ec55619d6ce2d447f131452e93fcd9%2Fpreprocessing-isolate-objects-modal.png?alt=media" alt="The Isolate Objects modal with a cropped example object and a warning that it removes all bounding boxes"><figcaption><p>Isolate Objects warns that it removes every bounding box from the version.</p></figcaption></figure>

## Tile

Tile splits each image into smaller tiles, and each tile becomes its own image in the version. Small objects take up more of each tile, so the model gets more pixels to learn from. Tiling runs before resizing in the preprocessing pipeline.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-e5b2ce0954b44b3d44da2f4810de0ab8346d2037%2Fpreprocessing-example-tile.png?alt=media" alt="An image split by a 2 x 2 grid into four 640 x 360 tiles, with boxes cut at the tile edges"><figcaption><p>Example: a 2x2 grid turns one 1280 x 720 image into four 640 x 360 images. Boxes that cross a tile edge are cut in two.</p></figcaption></figure>

Use it when:

* You detect small objects in large images (ex: aerial and satellite imagery, microscopy, high-resolution inspection photos).
* Resizing your images to the model's input size would shrink objects to a few pixels.

Skip it when:

* Objects are large relative to the image. Tiling cuts them across tile borders.
* You cannot tile images at inference time. A model trained on tiles expects tiles. To tile at inference, use the [Image Slicer block](https://docs.roboflow.com/workflows/blocks/blocks/advanced-blocks/image-slicer) in a Workflow and merge the results with the [Detections Stitch block](https://docs.roboflow.com/workflows/blocks/blocks/advanced-blocks/detections-stitch). See [Detect Small Objects](https://docs.roboflow.com/workflows/tutorials/detect-small-objects) for a full example.

The default setting is a 2x2 grid. Choose a mode under "Tiling Mode":

<table data-search="false"><thead><tr><th>Mode</th><th>What it does</th><th>Settings</th></tr></thead><tbody><tr><td>Grid (Rows × Columns)</td><td>Splits each image into equal rows and columns. Tile size changes with the size of the image.</td><td>Rows, columns</td></tr><tr><td>Fixed Size</td><td>Cuts every tile at the exact pixel size you set, so no tile is resized or distorted. Set it to your model input size (ex: 640 x 640).</td><td>Tile Size, Overlap, Padding Color</td></tr><tr><td>Fixed Aspect Ratio</td><td>Cuts tiles that keep the width to height ratio you set. Each tile spans the full width or the full height of the image.</td><td>Aspect Ratio (w/h), Tile Spans, Overlap, Padding Color</td></tr></tbody></table>

Fixed Size and Fixed Aspect Ratio have two extra settings. "Overlap" is how much of each tile is shared with the next tile, in percent. Use it when objects sit on tile borders, so each object appears whole in at least one tile. "Padding Color" (black or white) fills the leftover space at the right and bottom edge of an image, because every tile comes out at full size.

Tiles must be at least 224 pixels on each side. In Fixed Aspect Ratio mode, images too small to make a tile that size are kept whole.

You cannot combine Fixed Size or Fixed Aspect Ratio with Isolate Objects or Dynamic Crop. Those steps crop each image on its own, so a tile of a set size no longer matches the image. Use Grid instead.

Tiling multiplies the number of images in your version: a 2x2 grid makes four images from each source image. Roboflow does not estimate the version size for Fixed Size and Fixed Aspect Ratio, because the number of tiles depends on the size of each image.

Tile is not available for keypoint detection.

{% hint style="info" %}
Fixed Size and Fixed Aspect Ratio are available in the app for selected workspaces. [Contact sales](https://roboflow.com/sales) to turn them on. The API accepts all three modes for any workspace.
{% endhint %}

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-d5428b53f9a5414f07e0f57357257afb96a674f2%2Fpreprocessing-tile-modal.png?alt=media" alt="The Tile modal with a 2 x 2 grid, the image split into four tiles, and a preview of one tile"><figcaption><p>A 2x2 grid and a preview of one tile.</p></figcaption></figure>

## Modify Classes

Modify Classes renames (remaps) or omits classes in the version you generate. Your project's annotations do not change, so you can try different class setups without relabeling.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-4ec9c1019bda5ba58f7fcae982fbc4da00a6b101%2Fpreprocessing-example-modify-classes.png?alt=media" alt="An image with person and box annotations, and the output where person is renamed worker and the box annotations are gone"><figcaption><p>Example: person remapped to worker, and box omitted.</p></figcaption></figure>

Use it to:

* Fix labeling mistakes, such as misspelled or duplicate class names (ex: remap "helmet" and "Helmet" to "helmet").
* Merge fine-grained classes into broader ones. If a model struggles to tell car models apart, remap every model to its make (ex: "Corolla" and "Camry" to "Toyota") and compare the results.
* Drop a class with too few examples to learn from. The [Dataset Health Check](https://docs.roboflow.com/datasets/versions/dataset-health-check.md) shows how many annotations each class has.
* Drop one of two overlapping classes. If every "lift" box sits inside a "dock" box, pick the class you care about and omit the other.
* Group classes from a merged dataset (ex: remap "car", "bus", and "truck" to "not-ambulance" when you only need to find ambulances).

Images left with no annotations after you omit classes count as null images for [Filter Null](#filter-null).

On the "Create New Version" page, clear "Include" next to a class to omit it, or type a new name under "Override" to remap it. Regular-expression controls appear for more than three classes in the Dataset Version builder, and for any class count in training setup. Enter a find pattern and replacement under "By Regular Expression:", then click "Apply" beside the fields and "Apply" in the dialog. Use the reset icon to clear the regular expression and restore all classes.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-bafc6042b250edcdb8c210f62c244caaf96954a1%2Fpreprocessing-modify-classes-modal.png?alt=media" alt="The Modify Classes modal on the Create New Version page with Include checkboxes, class names box and person, and empty Override fields"><figcaption><p>Modify Classes on the "Create New Version" page.</p></figcaption></figure>

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-c24153101f752dda61db3be434bc2dda8db317cd%2Fpreprocessing-modify-classes.png?alt=media" alt="Modify Classes in training setup, with a regular expression remapping circle to part and a reset button"><figcaption><p>Preview a class remap in training setup before applying it.</p></figcaption></figure>

## Filter Null

A null image is an image you marked as having no objects of interest (ex: an empty chessboard in a chess piece dataset). Filter Null sets the minimum share of images in the version that must have annotations, and removes null images at random until the version meets it.

<table data-search="false"><thead><tr><th>Setting</th><th>Result</th></tr></thead><tbody><tr><td>0% ("Keep all nulls")</td><td>No filtering. The version keeps every null image.</td></tr><tr><td>80%</td><td>At least 80% of images have annotations, and up to 20% are null.</td></tr><tr><td>100% ("Remove all nulls")</td><td>Every image must have annotations. The version keeps no null images.</td></tr></tbody></table>

The "Create New Version" page labels this setting "Minimum Percent of Outputs Annotated". In training setup, turning Filter Null on sets it to 100%.

Keep some null images. They teach the model that an image does not always contain an object, which cuts false positives on empty scenes. Too many null images make the model cautious, so it misses objects (lower recall). Filter Null helps when most of your dataset is empty frames (ex: footage from a camera where an object passes only now and then).

Filter Null only affects images marked null and images left without annotations after [Modify Classes](#modify-classes). It does not fix missing annotations: images that contain objects nobody labeled. A model trained on those learns to treat real objects as background, and training can fail. Before you use Filter Null, label every image, [mark empty images as null](https://docs.roboflow.com/datasets/annotate/annotate/use-roboflow-annotate.md#mark-null), and omit classes you do not need. The [Dataset Health Check](https://docs.roboflow.com/datasets/versions/dataset-health-check.md) shows how many null and unannotated images you have.

Filter Null is not available for classification projects.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-86b5bd344c9289fb7be6dc6a322d22dafa50b56b%2Fpreprocessing-filter-null-modal.png?alt=media" alt="The Filter Null modal with the Minimum Percent of Outputs Annotated slider set to 100%"><figcaption><p>"Minimum Percent of Outputs Annotated" at 100% removes every null image.</p></figcaption></figure>

## Filter by Tag

Filter by Tag includes or excludes images in the version based on their [Tags](https://docs.roboflow.com/datasets/manage/manage-datasets/add-tags-to-images.md). Use it to train on a subset of your data (ex: only images tagged "reviewed") or to leave out unwanted images.

Three options are available for each Tag:

* Require: only images with Required tags are included in the version.
* Exclude: images with Excluded tags are not included in the version.
* Allow: images with Allowed tags are included in the version, unless an Exclude or Require rule removes them.

In the Dataset Version builder, click an "Exclude", "Allow", or "Require" column heading to apply that choice to every tag. In training setup, use "Exclude All", "Allow All", or "Require All" and confirm. Click "Apply" to save.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-1832f44c076cc8d0727d5f54705637118c43a0ed%2Fpreprocessing-filter-by-tag-modal.png?alt=media" alt="The Filter by Tag modal with Exclude, Allow, and Require columns and the row Images Without Any Tags set to Allow"><figcaption><p>Filter by Tag on the "Create New Version" page.</p></figcaption></figure>

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-0d57d1ad34de9a2a1cf0871c2d2682cfa6f2438e%2Fpreprocessing-filter-tags.png?alt=media" alt="Filter by Tag in training setup with reviewed required and Exclude All, Allow All, Require All, and Reset controls"><figcaption><p>This filter includes images with the reviewed tag.</p></figcaption></figure>

## Random Sample

Random Sample keeps a random share of the images in each split. Set "Train Split", "Valid Split", and "Test Split" from 0% to 100%. The default of 100% keeps every image.

Use it when:

* You want quick experiments on a smaller dataset, such as testing training settings or checking that your pipeline works end to end before a full run.

Skip it when:

* You train the model you plan to deploy. Fewer images usually means lower accuracy.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-3f1d8f2295d63d0670cdfc5613c7634e2d32776e%2Fpreprocessing-random-sample-modal.png?alt=media" alt="The Random Sample modal with Train Split, Valid Split, and Test Split sliders all at 100%"><figcaption><p>The Random Sample settings.</p></figcaption></figure>
