How to determine unknown class in CNN

조회 수: 2 (최근 30일)
Gaia Cioffi
Gaia Cioffi 2022년 5월 12일
답변: Vidip 2023년 11월 2일
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.

답변 (1개)

Vidip
Vidip 2023년 11월 2일
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:
  1. 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.
  2. 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.
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:

카테고리

Help CenterFile Exchange에서 Recognition, Object Detection, and Semantic Segmentation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by