# Data augmentation based on the class type in the CNN model

I would like to use CNN model to classify images but some classes in my dataset have low amount of data.

Can I apply data augmentation based on the number of the images in the class?

For example, the classes that contain 10 images will be 50 after augmentation that means the number of images is increased 500%, and the classes that contain 20 images will be increased 250% to be 50 images and the classes that contains 30 images will be increased 166% to be 50 images.

So, I would like to increase the data based on the number of images in the class.

• With examples I meant training data. Sorry that was not correct. Here are two useful links: [1], [2]. Concerning the one example per batch I assume you use keras, since you tagged it. In Keras you can use the fit_generator, where you can write you own batch generator. [1]: stackoverflow.com/questions/45867942/… [2]: reference.wolfram.com/language/tutorial/… – Lau Jul 17 '18 at 8:49