Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including
Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
5 months ago
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.
Dec 19, 2022 at 6:15
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(
validation_split = 0.2
shallow CNN with fewer parameters to prevent overfitting.
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.
Dec 19, 2022 at 8:46
Nicolas Martin Nicolas Martin
4,454 1 1 gold badge 5 5 silver badges 15 15 bronze badges
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our
Accept all cookies
Necessary cookies only