Image data preprocessing

Image data comes in different forms such as photographs, satellite images, heat maps, and x-rays. Image data can also have different shapes, sizes and colors.

In the platform, there is no requirement on the resolution or color of the images that you upload, so you can mix any combination of images in the same dataset.

The platform supports images in the jpg/jpeg, png, and gif file formats. To import your data into the platform, you should follow the requirements of imported files.

To preprocess your data, there are different methods that you can apply. While some of the preprocessing methods are applicable on the platform, others should be applied before importing your data.

There are more methods that you can apply depending on your use case. Different methods can be useful for different use cases. Make sure that you apply the changes not only into your training data, but also to your test and validation data.

Off-platform image data preprocessing

These are methods that you can use to preprocess your data before importing your dataset to the platform. The method you choose to preprocess your image data is up to you. You can, for example, use python libraries to apply the following methods in your image data.

Histogram equalization

Histogram equalization helps you to improve the contrast of the images. It distributes the most frequent pixels more evenly. It is important to improve the contrast when the contrast is too low and hard to distinguish between two images.

Noise removal

There are many techniques that you can apply to reduce the noise in image data.

Thresholding

One common method you can apply is thresholding. Thresholding means to take a colored image, and turn all the pixels whose insenties are above a decided threshold to 1, and the ones below the threshold to 0. It simply means to turn a colored image into a binary (black and white) image.

Erosion and dilation

Some other common methods are erosion and dilation to reduce the noise in image data. In erosion, bright areas of the image shrinks and dark areas get bigger. In dilation, bright areas get bigger and dark areas shrink.

On-platform image data preprocessing

These are methods that you can use to preprocess your data before training your model.

Normalization

Image encoding allows the use of normalization to rescale the color range of the images in the dataset. This is one of the most common preprocessing techniques for images. Normalization rescales the values of the image and makes the training faster.

Color mode

The color mode is a conversion step that is performed before an image is sent to the model. Image files from various sources may be saved in two modes, for example, grayscale ("black and white") or color.

Color mode helps you to map your data from a high dimensional space to a lower dimension space. If you collapse the RGB channels into a single gray-scale channel, simply turn a colorful image into a grayscale image, you will reduce the dimensions. When your use case is not color sensitive, it can be a good approach to lower the dimensions, so your dataset can easier be processed.

Image transformation

The image transformation is a conversion step that is performed before training. Image 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.

There are 4 methods for transforming images on the platform: “crop and resize”, “crop or pad”, “resize”, and “none”.

Image augmentation

Image augmentation is another image transformation technique. It adds more variation to the training dataset through randomly transforming the images in certain ways, for example, flipping and zooming.

To use image augmentation, you should navigate to the Modeling view on the Peltarion Platform and add a Random transformation block to flip, rotate and zoom-in the images or a Random crop block to randomly crop the images. Both methods add variety to your dataset.

On the platform Image augmentation is its own block, that you add directly after the Input block for the image data.

Was this page helpful?
YesNo