Clear Filters
Clear Filters

how to extract missclassified pictures out of a file with a mixed dataset?

2 views (last 30 days)
Hi everyone, I am working with matlab and I have an AI model to classify street signs.
for i = 1:size(data, 1)
imageName = data.ImageNames{i};
% Annahme: Die Bildnamen sind in der ersten Spalte
classification = str2double(data.Classification{i});
% Annahme: Die Klassifikation ist in der zweiten Spalte
%Classified pictures are number 14. Everything else should be extracted into an other file
if classification ~= 14 srcPfad = fullfile(srcOrdner, [imageName '.png']);
zielPfad = fullfile(zielOrdner, [imageName '.png']);
copyfile(srcPfad, zielPfad);
end
end
With this code I am able to extract missclassified pictures out of a file. Now I am able to extract pictures, which have the same lable. I need to classify pictures with different labels. The problem is, that I do not know where the information about the correct label for each picture is safed and how it is possible to use the information in the if clause.
for i = 1:length(ds.Files)
img = readimage(ds, i);
% Klassifizieren Sie das Bild
predictedLabels = classify(GTSRBNet, img);
Classification{i} = predictedLabels;
% Labels speichern
fprintf('Bild %d wurde der Klasse %s zugeordnet.\n', i, predictedLabels)
% Speichern des Bildnamens
[~, ImageName, ~] = fileparts(ds.Files{i});
ImageNames{i} = ImageName;
end
This is the part where the classification happens and the output neurons are in the classoutput layer.
for all answers I am very thankful.
  1 Comment
Harald
Harald on 9 Oct 2023
Hi,
please use the code formatting options to make your question more readable.
Since we do not have access to your data (please consider posting it), we can't really tell how you can extract the correct label.
The instructor who gave you this assignment may be able to help you better than us.
Best wishes,
Harald

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 9 Oct 2023
If, for your test set, you don't know the correct classification, and all you know is that the images you extracted into a different folder do not have the classification number of 14, then there is no way to know for certain what the correct classification is. It might classify it as class #9 but if you don't know whether that is true or not, you're stuck with it. You might be able to look at some confidence scores in it's classification and if it's not very high, you might assume that the classification could perhaps be wrong, but you won't know for sure.

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!