フィルターのクリア

i have done image classification using cnn and used kfold validation. can any one help me "how to display the misclassified images in matlab?

1 回表示 (過去 30 日間)
i have done image classification using cnn. now i want to show and i want to display the misclassified images. and i have used 5fold validation for training cnn. And also can you tell me reason behind the missclassification.

回答 (1 件)

Siraj
Siraj 2023 年 9 月 20 日
Hi!
It is my understanding that you have trained a Convolutional Neural Network (CNN) for image classification using a 5-fold validation approach and wants to display the misclassified images.
To achieve the above goal, first, make predictions on the validation/testing set using the trained CNN model. This can be done by using the classify function. Then identify the misclassified images by comparing the predicted labels with the actual labels.
Retrieve the indexes of the misclassified images using the find function. Read the misclassified image data using readimage and display each misclassified image using the imshow function.
For a better understanding I’ve attached the code below.
% Train the network
net = trainNetwork(imdsTrain, layers, options);
% Make predictions on the validation set
YPred = classify(net, imdsValidation);
% Find misclassified images
wronglyPredicted = YPred ~= imdsValidation.Labels;
misclassified_image_indexes = find(wronglyPredicted);
% Display misclassified images with actual and predicted labels
for i = 1:numel(misclassified_image_indexes)
image_index = misclassified_image_indexes(i);
img = readimage(imdsValidation, image_index);
figure, imshow(img)
title("Actual label = " + char(imdsValidation.Labels(image_index)) + " Predicted Label = " + char(YPred(image_index)))
end
To gain a better understanding of thereadimage and find functions and how they are used to find and read misclassified images, you can refer to the following links:
Hope this helps.

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by