We create image variations and further train our network model on top of them to increase the generalization power of the CNN. It is crucial to train our CNN with as many image variations as possible so as to increase the accuracy. We basically obtain more samples of the same image by flipping or rotating them. In this recipe, we will transform and create samples of images using a concrete implementation of ImageTransform in DL4J.
Creating image variations for training data
How to do it...
- Use FlipImageTransform to flip the images horizontally or vertically (randomly or not randomly):
ImageTransform flipTransform = new FlipImageTransform(new Random(seed));
- Use WarpImageTransform to warp the perspective of images deterministically...