Image semantic segmentation dimension layer why not match input and output
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Raúl Rivera
am 18 Feb. 2024
Bearbeitet: Matt J
am 18 Feb. 2024
Hello , I want to apply a semantic segmentation algorithm to a batch of images , to which I want to detect their failures (7 types of them) with a cnn, so I used Image labeler to detect 7 classes of failures for 80 images (dont know if thats enough data, the size of the images is [743 1324 3], but the output does not match. How can I make them match. I attach the code I use and linked the files of images and its labels.Thanks
load pixel_label_training.mat
%[imds,pxdsTruth] = pixelLabelTrainingData(gTruth.mat)
trainingData = combine(imds,pxdsTruth);
inputSize=[743 1324 3]
imgLayer = imageInputLayer(inputSize)
filterSize = 4;
numFilters = 30;
conv = convolution2dLayer(filterSize,numFilters,'Padding',1);
relu = reluLayer();
poolSize = 2;
maxPoolDownsample2x = maxPooling2dLayer(poolSize,'Stride',2,'Padding',[1 1]);
downsamplingLayers = [
conv
relu
maxPoolDownsample2x
conv
relu
maxPoolDownsample2x
]
filterSize = 1;
transposedConvUpsample2x = transposedConv2dLayer(filterSize,numFilters,'Stride',2,'Cropping',1)
upsamplingLayers = [
transposedConvUpsample2x
relu
transposedConvUpsample2x
relu
]
numClasses = 7;
conv1x1 = convolution2dLayer(1,numClasses);
finalLayers = [
conv1x1
softmaxLayer()
pixelClassificationLayer()
]
net = [
imgLayer
downsamplingLayers
upsamplingLayers
finalLayers
]
opts = trainingOptions('sgdm', ...
'InitialLearnRate',1e-3, ...
'MaxEpochs',100, ...
'MiniBatchSize',1);
net = trainNetwork(trainingData,net,opts);
images:Images
labels: pixelLabelData
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!