Data Augmentation for Semantic Segmentation — Deep Learning — Idiot Developer

Image for post
Image for post

All the technological advancements in the field of Artificial Intelligence (AI) is facilitated due to the availability large amount of dataset and the computational hardware’s like GPU’s and TPU’s. In some fields like medical imaging, the availability of the huge amount of data is not possible, as it takes a good amount of efforts to collect the data and then labelling it requires the domain expertise. To, solve this issue, we use data augmentation. In this article, we will go through the process of applying data augmentation to any semantic segmentation dataset.


  1. What is Data Augmentation?
  2. Why do we use Data Augmentation?
  3. When not to use Data Augmentation?

What is Data Augmentation?

Data augmentation is the process of that enables you to increase the amount of training data by making some reasonable modifications or transformations in your existing data.

For example, we can augment an image by flipping it vertically or horizontally. We could rotate the image, crop it or even add some noise. All these are some of the most common forms of data augmentation.

Why do we use Data Augmentation?

We use data augmentation to increase the samples in the training dataset. Let us assume, we have a small training dataset and it is difficult to get more data, then we can use data augmentation to create new data from our existing data.

Data augmentation helps to reduce overfitting. Assume that you have a dataset full of images of dogs and most of the dogs were facing the right side. If we train a model on these images, it is reasonable to think that the model would believe that only these right-facing dogs were actually dogs not it may not very well classify left-facing dogs as being actual dogs. Now, this model would not work very well in the real-world. So, we would apply data augmentation and produce a variety of images with a different orientation, location, scale, brightness etc. These images would introduce variance and make the model more robust.

When not to use Data Augmentation?

In some cases, data augmentation techniques may not be appropriate. Let us continue with the example of the dog. It is reasonable to flip the dog image horizontally, but it would not be reasonable to flip it vertically. As in the real world, we would not be seeing many images of dogs flipped upside-down on their head.

Let’s say we have an image of STOP sign from the Traffic Sign dataset. It would not be reasonable to either flip it horizontally or vertically, as it would change the meaning of the image.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store