Unknown Class in an Image Classification Problem

조회 수: 15 (최근 30일)
Andrea Daou
Andrea Daou 2020년 6월 13일
편집: Image Analyst 2022년 12월 28일
Hello,
I am using a pretrained model to classify my images (SqueezeNet). I have a database of images of n classes each one in a folder labeled by its name.
If I give an unknown object or scene image as an input, it will be classified as one of the n classes, which is clearly misleading!
How to determine "unknown class", knowing that I am using a pretrained model, instead of attributing a wrong class?
Thank you!

채택된 답변

Image Analyst
Image Analyst 2020년 6월 13일
Did you use classify()?
[YPred,scores] = classify(net,imds) predicts class labels for the image data in imds using the trained network, net.
You can look at the scores and if the score is too low, just call it unclassified instead of using the suggested classification.
  댓글 수: 3
Image Analyst
Image Analyst 2020년 6월 13일
What I would do it look at the images that you thought should be "unclassified" and see what their scores are. Then compare that histogram to the histogram of scores from images that you thought should be classified. You might find a value for score that differentiates unclassified from classified. Like if the unclassified images all have scores less than 0.7 and classified ones are all more than 0.7, just reclassify any image with a score of less than 0.7 from whatever class it suggested to "unclassified" or "unknown".
Andrea Daou
Andrea Daou 2020년 6월 15일
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 6월 13일
편집: Ameer Hamza 2020년 6월 13일
This is not a simple problem as it may seem. You can think of its like an attack/fool the model to give a wrong class. Read about recent papers related to adversarial machine learning and fooling attacks on deep learning models. One way to deal with this problem is to develop a network with n+1 classes and assign last class the label of "unknown class". Then you need to train the network with the correct images and the non-expected images. Nevertheless, it is currently an active field of research, and a lot of work is being done related to this. It cannot be trivially solved using some built-in functions. Read this paper for some context about this issue: https://arxiv.org/pdf/1909.08072.pdf. Especially refer to section 4.2.2, which mentions training the network using adversarial examples.
  댓글 수: 2
NASRIN AKTER
NASRIN AKTER 2022년 12월 27일
Hello
If I do a binary classification (classes 'a' and 'b') and then test with just one class (say, class 'a'), would that be wrong or confusing for the network?
Image Analyst
Image Analyst 2022년 12월 28일
편집: Image Analyst 2022년 12월 28일
@NASRIN AKTER no that would not confuse the network. Once you've trained the network, as long as you pass in an image of the proper dimensions it doesn't really care what you put into it. It's not "confused" although it may report your image as the wrong class (class b) for some images that are not clearly of class "a" type. Or if the image looks nothing like either class a or class b (let's say it is really from class c but you didn't give it any images from class c to train on), it will be forced to pick one class, which of course will be the wrong class.
But not sure what you mean by "confuse". Like I said, it will work but it may give an answer that doesn't necessarily agree with what you would say.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by