How to Plot precision recall curve for semantic segmenttaion

조회 수: 3 (최근 30일)
evianita dewi
evianita dewi 2020년 1월 12일
댓글: Ismat Mohd Sulaiman 2021년 8월 9일
I have done training and testing for semantic segmentation. I want to make a graph of my precision recall. I have got precision and recall values when validating images. but i don't know how to plot percurve charts. The following is the code that I made
pic = 8;
I = readimage(imdsTest, pic); %ib
Ib = readimage(pxdsTest,pic);
BC = labeloverlay(I, Ib,'Colormap',cmap,'Transparency',0.5);
C = semanticseg(I, net);
B = labeloverlay(I,C,'Colormap',cmap,'Transparency',0.5);%cb
imshowpair (B, BC,'montage')
pixelLabelColorbar(cmap, classes)
title ('prediction vs groundtruth')
expectedResult = readimage(pxdsTest,pic);
actual = uint8(C);
expected = uint8(expectedResult);
imshowpair(actual,expected)
iou = bfscore(C,expectedResult);
[recall,precision,prediction]=bfscore(C,expectedResult)
table(classes',recall ,precision, iou)
the results of this program are as follows
ans =
Var1 recall precision iou
____________ _______ _________ _______
"crack" 0.34446 0.25696 0.34446
"background" 0.53501 0.60656 0.53501
to be able to make precision recall plots. What should I do? Please help me

답변 (1개)

Chinmay Budhiraja
Chinmay Budhiraja 2020년 6월 18일
Hi,
According to my understanding, you want to study the precision recall curve for a task. We use ROC curve (Receiver Operating Characteristic Curve) for the same. Consider the following example:
load simplecluster_dataset
net = patternnet(20);
net = train(net,simpleclusterInputs,simpleclusterTargets);
simpleclusterOutputs = sim(net,simpleclusterInputs);
plotroc(simpleclusterTargets,simpleclusterOutputs)
In semantic segmentation, generally a multi-dimensional image is converted into a vector first by flattening (you can use reshape for the same) the matrix and then roc is plotted. You can tweak the above sample according to your use case. Please refer to plotroc for more information.

카테고리

Help CenterFile Exchange에서 Visualize Deep Neural Networks에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by