How to solve the error: 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 dime

1 view (last 30 days)
I tried to use evaluatesemanticsegmentation function as follow:
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);
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 followed the same steps mentioned in:
www.mathworks.com/help/vision/ref/evaluatesemanticsegmentation.html
The files mentioned has the same two attached images, can anyone help me to fix this erro to calculate IoU?
  6 Comments
yasmin ismail
yasmin ismail on 8 Oct 2023
@Matt J I want to evaluate the IoU as shown in prevoiuse and the code should include many images as shown in Evaluate semantic segmentation data set against ground truth - MATLAB evaluateSemanticSegmentation (mathworks.com)
not only (gT7001_60.png) ,I still have error as shown above, please check my code above and you will understand what I mean and what i want to find
Matt J
Matt J on 8 Oct 2023
Edited: Matt J on 8 Oct 2023
Please stop re-iterating your original post and goals. We all understand you have a bigger task than the simplified code, but the simplified code contains key parts of the original code which you should be checking first. If it runs fine for you, then the problem is somewhere in your imds, because it is then obvious that the network fails only for particular images in the data store.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!