0
$\begingroup$

Hi we have a problem on image classification where data is quite less. However we have some flexibility on the classification.We can change the number of classes in our problem by clubbing and splitting many classes.

So my question is that is there a relation between number of classes and the amount of data required to train.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Training a CNN with scarce data is challenging because of the lack of generalization needed to differentiate pictures.

So you need a quite good quantity of data (at least 20, but it depends on the data set) per class to make a good classification.

Nevertheless, you can apply 3 solutions:

  • Data Augmentation by applying various transformations (rotation, scaling, etc.) on your images to make them more numerous. Therefore you can use the ImageGenerator from Keras.

    from keras.preprocessing.image import ImageDataGenerator

    datagen = ImageDataGenerator( featurewise_center=True, featurewise_std_normalization=True, rotation_range=10, fill_mode='nearest', validation_split = 0.2 )

  • Use a shallow CNN with fewer parameters to prevent overfitting.

  • Use a dimensional reduction algorithm like UMAP to classify scarce data in an unsupervised way. You can apply UMAP directly or on the CNN output to improve the classification.

I recommend applying the 3 solutions because they are interesting and could be connected to each other to improve the results.

$\endgroup$
2
  • $\begingroup$ My question is not answered by this. I know that CNN may need lot of data. What I want is to know how the data requirement scales with the number of classes $\endgroup$
    – Hari
    Dec 19, 2022 at 8:49
  • $\begingroup$ It depends a lot on your dataset. I've answered your question by saying about 20 minimum per class as a raw order of magnitude, adding some tips to solve this situation. However, it could be more if the images are not very different from each other. $\endgroup$ Dec 19, 2022 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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