필터 지우기
필터 지우기

How can I calculate the IoU between the original image and the predicted one as shown in attached image?

조회 수: 21 (최근 30일)
How can I calculate the IoU between the original image and the predicted one as shown in attached image?

답변 (1개)

Shreeya
Shreeya 2023년 9월 28일
I understand that you want to calculate the IoU score between the original and predicted images using MATLAB. You can use the "evaluatesemanticsegmentation" function for this purpose. The input argument provided to the function are "dsResults" and "dsTruth" which refer to the predicted and ground truth images respectively. The output is a semantic segmentaion metrics object with GlobalAccuracy, MeanAccuracy, MeanIoU, and WeightedIoU as the default metrics.
You can refer to the documentaion linked below for more details: https://www.mathworks.com/help/vision/ref/evaluatesemanticsegmentation.html#d126e248885
Hope this helps!
  댓글 수: 3
yasmin ismail
yasmin ismail 2023년 10월 3일
@Shreeya how can I apply semantic segemnetation or any method by matlab to calculate the IoU bewtwwen the attached groundTruth(crack) ande the attacehed nodel outPut?
yasmin ismail
yasmin ismail 2023년 10월 8일
@Shreeya I created an image truth and I tried to use evaluatesemanticsegmentation function as shown in
destinationTestLabels = "D:\Matlab pics\matlab practices21\Phd analysis\trial meyhods\GroundTruth\crack\testLabels";
destinationTestImages = "D:\Matlab pics\matlab practices21\Phd analysis\trial meyhods\GroundTruth\crack\testImages";
testImagesDir = fullfile(destinationTestImages,'testImages');
testLabelsDir = fullfile(destinationTestLabels,'testLabels');
pixelLabelID = [1 0];
classNames = ["crack" "background"];
imds = imageDatastore(destinationTestImages);
pxdstest11 = pixelLabelDatastore(destinationTestLabels,classNames,pixelLabelID,"FileExtensions",".png");
data = load('triangleSegmentationNetwork');
net = data.net
pxdsResults = semanticseg(imds,net,"WriteLocation",tempdir);
metrics = evaluateSemanticSegmentation(pxdsResults,pxdsTruth);
metrics
metrics.ClassMetrics
Then I got the following error:
Error using SeriesNetwork/activations (line 817)
The spatial dimension sizes [313 316 3] of the input images to layer 'imageinput' must be greater than
or equal to the corresponding minimum input dimension sizes of the layer [32 32 1].
Error in semanticseg>iPredictDAGSeriesNetwork (line 609)
allScores = activations(net, X, layerName, ...
Error in semanticseg>iClassifyImagePixels (line 556)
allScores = iPredictDAGSeriesNetwork(X, net, params);
Error in semanticseg>iProcessImageDatastoreSerially (line 938)
L = iClassifyImagePixels(X{i}, net, params);
Error in semanticseg (line 265)
filenames = iProcessImageDatastoreSerially(ds, net, params);
Error in Gtruth3 (line 11)
pxdsResults = semanticseg(imds,net,"WriteLocation",tempdir);
I already hve two files testImages and testLabels and each will contain 100 or more of groundTruth and testImages and all shoud enter semantic segemnation not only the attached images ,
How can I fix it to calculate IoU??

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by