How to fix error from evaluatesemanticsegmentation function?
이전 댓글 표시
I used the code for evaluation semantic segmentation in
as shown below:
clc
clear all
dataSetDir = fullfile(toolboxdir('vision'),'visiondata','triangleImages');
testImagesDir = fullfile(dataSetDir,'testImages');
testLabelsDir = fullfile(dataSetDir,'testLabels');
imds = imageDatastore(testImagesDir);
classNames = ["crack","background"];
labelIDs = [255 0];
pxdsTruth = pixelLabelDatastore(testLabelsDir,classNames,labelIDs);
data = load('triangleSegmentationNetwork');
net = data.net
pxdsResults = semanticseg(imds,net,"WriteLocation",tempdir);
metrics = evaluateSemanticSegmentation(pxdsResults,pxdsTruth)
I got the following error:
Error using semanticSegmentationMetrics>iAssertCategoricalsHaveSameCategories (line 1226)
The categorical data returned by dsResults and dsTruth must have the same categories.
Error in semanticSegmentationMetrics/processImages (line 589)
iAssertCategoricalsHaveSameCategories(act,exp,obj.ClassNames);
Error in semanticSegmentationMetrics/processImagesSerial (line 663)
m = processImages(obj,data);
Error in semanticSegmentationMetrics/computeMetrics (line 389)
metrics = processImagesSerial(obj);
Error in semanticSegmentationMetrics (line 195)
[obj, blockMetrics] = obj.computeMetrics();
Error in semanticSegmentationMetrics.compute (line 174)
[obj, blockMetrics] = semanticSegmentationMetrics(varargin{:});
Error in evaluateSemanticSegmentation (line 205)
[metrics, blockMetrics, canComputeBlockMetrics] = semanticSegmentationMetrics.compute(varargin{:});
Error in Gtruth2 (line 13)
metrics = evaluateSemanticSegmentation(pxdsResults,pxdsTruth)
I noted that I have different categories between Result and Truth, but I don’t know how to fix it. I named the attached file same as mentioned in the code on Evaluate semantic segmentation data set against ground truth - MATLAB evaluateSemanticSegmentation (mathworks.com) (triangleImages)
the attached (R7001-60.png) is from testImages folder , the attached (gT7001_60.png) is from testLables folder , both folders in (triangleImages) folder.
How to fix it?
댓글 수: 2
Natthapat Kijpoonphol
2023년 12월 14일
I got the same problem, anyone please can you help us ?
Walter Roberson
2023년 12월 14일
The stored images from data = load('triangleSegmentationNetwork'); are class "triangle" and "background" not "crack" and "background"
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Segmentation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!