【发布时间】:2019-12-05 18:23:41
【问题描述】:
我已经解决了总共 32 个类别的一个图像识别问题。我得到了结果并计算了它的平均精度。我需要绘制混淆矩阵。
【问题讨论】:
标签: matlab plot image-recognition confusion-matrix
我已经解决了总共 32 个类别的一个图像识别问题。我得到了结果并计算了它的平均精度。我需要绘制混淆矩阵。
【问题讨论】:
标签: matlab plot image-recognition confusion-matrix
我正在研究 YOLOv2,并为检测网络创建了一个混淆矩阵。希望这会有所帮助:)
testObjects 是真实标签,predLabels 是预测标签
TestData 是 imdsTest 的 imageDatastore()
testObjects = testData.UnderlyingDatastores{1, 1}.Files ; %'C:\Users\admin\Desktop\Img_Data\Flower1\Flower101.jpg'
testObjects = erase(testObjects,fullfile(pwd,imgFolderName)); %'\Flower1\Flower101.jpg'
testObjects = categorical(extractBetween(testObjects, "\","\")); % Flower1 - array
predLabels = zeros(2,1);
predLabels = categorical(predLabels); % Prelocation
for iPred = 1:length(testObjects)
[~, idxx] = max(cell2mat(detectionResults.Scores(iPred))); % max of all the bounding box scores
multiLabels = detectionResults.Labels{iPred,1}; % find label of max score
if isempty(multiLabels) == 1
predLabels(iPred,1) = {'NaN'};
predLabels(iPred,1) = standardizeMissing(predLabels(iPred,1),{'NaN'});
else
predLabels(iPred,1) = (multiLabels(idxx,1));
end
end
predLabels = removecats(predLabels);
plotconfusion (testObjects,predLabels) %confusionchart(testAsts,predLabels)
【讨论】: