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.