1
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

Try under/ or oversampling and aditionally use data augmentation for your input data.

$\endgroup$
  • $\begingroup$ Should I apply oversampling on the training batches and testing batches or I can apply it only on testing batches? How can I make oversampling manually?!! $\endgroup$ – N.IT Jul 16 '18 at 20:47
2
$\begingroup$

I would not use data augmentation to only some classes. Maybe this brings a bias in your data set.

I would use weighted examples. So if the network sees a class that has less example, the gradient is amplified. Additionally you should be be pass at least one example of each class at one batch (if your number of classes allow it).

$\endgroup$
  • $\begingroup$ What is weighted examples? How can I pass at least one example of each class at one batch? $\endgroup$ – N.IT Jul 17 '18 at 8:30
  • 1
    $\begingroup$ 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/… $\endgroup$ – Lau Jul 17 '18 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.