Test it on the Peltarion Platform

A platform to build and deploy deep learning projects.

Even if you’re not an AI superstar.

TRY FOR FREE

Image encoding

Image encoding is used on features that are image files like jpg and png files. It makes features ready to be input into an image processing model.

Normalization

Image encoding allows to use normalization to rescale the color range of the images in the dataset.

Image transformation

Transformation lets you set the pixel width and height of the images that you want your models to work with. If the image feature of an example doesn’t match the specified size, it is transformed using the selected method before being submitted to the model.

There are 4 methods for transforming images on the platform:

Image transformation may happen at training time, if the dataset contains image examples of different resolutions. Transformation may also happen at inference time, if an image of arbitrary resolution is sent to a deployed model for prediction.
Both training and inference will apply the same transformation settings.

When normalization is used, it is applied after the images have been transformed, except when the Crop or pad method is used.
When Crop or pad is used, normalization is applied to the original images before transformation, so that the padded values are not affected by the normalization.

Crop and resize

Crop and resize is the default method.
It will first crop images around the center to obtain the target aspect ratio, then resize the result to get the target size.

Crop and resize example
Figure 1. Result of crop and resize inside the red box

This is a good compromise between the two other methods, since it avoids both distorting shapes and adding padding. However, some parts of the image might be discarded when cropping.

Crop or pad

Crop or pad simply draws a window of the specified size around the center of the image, and either crops the image if it goes outside of the window, or pads the image with black if it is smaller than the window.

Crop or pad example
Figure 2. Result of crop or pad inside the red box

Crop and pad can be used in cases where it’s critical to preserve the pixel size of the shapes in the image, or to avoid noise being introduced by the resizing algorithm.

Resize

Resize performs a straighforward resizing of the image to the specified resolution.

Resize example
Figure 3. Result of resize inside the red box

No part of the image is discarded since cropping never occurs. However, shapes may be distorted since the original aspect ratio is not preserved.

None

Selecting None disables image transformation, and each image is passed directly to the model.

In this case, models will infer the size of image features from the first example found in the dataset.

This method is not recommended, since you will have to make sure to always use images of the same size. If an image of a different size is submitted to a model, either during training or to get prediction, an error will occur.