Preprocessing Images

Image preprocessing steps are essential to prepare data for models.

Preprocessing ensures your dataset is standardized, for example, by ensuring all images have consistent dimensions. This step is crucial to maintain dataset consistency before training a model.

Preprocessing is applied across all images in your Train, Validation, and Test sets (unlike augmentations, which apply only to the Train set).

The BinaExperts 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 in detail below.

Auto-Orient

The Auto-Orient option removes the EXIF data from your images, ensuring they are displayed in the same orientation as they are stored on disk.

EXIF data defines the orientation of an image. Some applications (such as Preview on Mac) use this data to display an image in a particular orientation, even if its storage orientation differs. This discrepancy can cause issues with object detection models. For more details, refer to the Hacker News discussion on this issue.

BinaExperts recommends keeping this option enabled and reviewing how your images are processed during inference.

For more insights on whether you should auto-orient your images, check out our blog.

Resize

The Resize option alters your images' dimensions, optionally scaling them to a specified size. Annotations are adjusted accordingly, except when using the “fill” option.

Currently, only downsizing is supported. Below are the available resizing methods:

Stretch to: Stretches the image to the desired dimensions, scaling annotations proportionally. The image will be square but distorted, with no loss of source image data.

Fill (with center crop): Crops the central portion of the source image to fit the desired dimensions. The aspect ratio is maintained, but some source image data will be lost.

Fit within: Resizes the image to fit within the desired dimensions while maintaining the original aspect ratio. Source image data is preserved, but the image may not be square.

Fit (reflect edges): Resizes the image to fit the desired dimensions while maintaining the original aspect ratio, with reflected padding to fill any remaining space. Annotations are reflected accordingly.

Fit (black edges): Similar to the previous option but with black padding instead of reflected content.

Fit (white edges): Similar to the previous option but with white padding instead of reflected content.

Grayscale

This option converts an image with RGB channels to a single grayscale channel, potentially saving memory. The grayscale value for each pixel is calculated as a weighted sum of the red, green, and blue pixel values:

Y=0.2125R+0.7154G+0.0721BY = 0.2125R + 0.7154G + 0.0721BY=0.2125R+0.7154G+0.0721B

These weights are derived from the human perception of red, green, and blue, and are commonly used in display technology.

Auto-Adjust Contrast

Auto-Adjust Contrast enhances images with low contrast. BinaExperts offers the following methods for contrast adjustment:

Contrast Stretching: Rescales pixel intensities between the 2nd and 98th percentiles.

Histogram Equalization: Redistributes the most frequent intensity values, resulting in a more uniform pixel distribution.

Adaptive Equalization: Applies Contrast Limited Adaptive Histogram Equalization (CLAHE), which enhances local contrast in image regions. This is useful for improving details in images with high variability in brightness.

Advanced Preprocessing Features

These features are available for Public Workspaces, licensed Starter Plan, and Enterprise accounts. Users on Sandbox Workspaces needing access to these features should contact sales.

Isolate Objects

The Isolate Objects transformation crops and extracts each object bounding box into individual images. This is useful for converting object detection datasets into classification datasets.

For datasets where many classes are similar, it is common to use two models in sequence: the first for object detection and the second for classification. This transformation helps create the dataset for the second model.

Tile

Tiling can be useful for detecting small objects, especially in scenarios like aerial imagery or microscopy. The default is 2x2 tiling, but this can be adjusted as needed.

Filter by Tag

The Filter by Tag option allows users to include or exclude images based on their assigned tags. This is helpful for training models on a specific subset of data or excluding unwanted images from the dataset.

Last updated