- Regularization: Apply regularization techniques, such as dropout or L2 regularization, during training. Regularization helps prevent overfitting and encourages the model to learn more general features.
- Data Augmentation: Increase the diversity of your training dataset by applying data augmentation techniques, such as random rotations, translations, or scaling. This can help the model generalize better to unseen examples.
How to determine unknown class in CNN
4 views (last 30 days)
Show older comments
I'm training a CNN characterised by 3 classes.
As expected, when I introduce a new image (unknown-not belonging to any of the 3 classes),the model predicts it as any of the 3 classes, with a score that is around 0.98, so quite high. Since it is not possible to apply any type of threshold, is there a way to recognise the unknown class by means of the CNN?
I've read something related to open set NN, but I don't know if it is possible to apply it on Matlab and how.
0 Comments
Answers (1)
Vidip
on 2 Nov 2023
I understand you want to handle unknown classes in a Convolutional Neural Network (CNN). When you introduce a new image (unknown-not belonging to any of the 3 classes), the model predicts it as any of the 3 classes, with a score that is around 0.98. This might be because of overfitting as it can lead to high confidence predictions even when they are incorrect, especially for classes that the model was not exposed to during training. To mitigate the impact of overfitting and make more reliable predictions, you can consider the following steps:
After addressing overfitting and training a more robust model, you can set a threshold for your confidence score, if the highest predicted class probability is less than the threshold, classify the sample as the "unknown" class.
For further information, refer to the documentation links below:
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!