Image semantic segmentation dimension layer why not match input and output
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!