Data augmentation can be used to rebalance classes. It is a technique for improving the dataset. It consists in using a sample of images of under-represented classes to generate new images and thus balance the dataset.
After performing the data augmentation and re-training the network, we can then re-examine the network with Saimple to observe if the data augmentation was effective, to show the impact of the data augmentation on the model and to determine if it made the network more robust. To perform a data augmentation, it is possible to use many input transformation methods such as :
- Resize the image: enlarge or shrink the image;
- Fill in pixels (i.e. fill in missing spaces in the resized image);
- Change the perspective of the image.
The graph below shows the distribution of classes after data augmentation. The orange color corresponds to the addition of images to reach 500 images per class.
For our example, we chose to balance the dataset at 500 images per class by changing the zoom, brightness and contrast of some images.
Some geometrical transformations, such as rotation, are not included for this use case.
Indeed, the model must not take into account panels that could be reflected either in a window (reflection) or in a puddle (upside down panels). Hence the interest to have another model to ensure that the panels detected are not in this type of case.
It should be noted that in this case study, the perspective transformation is voluntarily not taken into account, it will be used later to test the network and verify its classification methods i.e. its ability to generalize.