An m-by-n-by-1 image cannot be used as input image in the Fully Convolutional Network FCN ?

1 vue (au cours des 30 derniers jours)
Hi, Can you help? I am trying to use the FCN (fully convolutional network) layers for semantic segmentation. Here's the function I used:
lgraph = fcnLayers(InputImageSize, NumberOfClasses);
net = trainNetwork(dstrain,lgraph,options);
Here's the error I got:
Error using trainNetwork (line 184) The training images are of size 256×256×1 but the input layer expects images of size 256×256×3. Error in network_bx (line 114)
My question: I would like to know if FCN layer does not work on m×n×1 or grayscale images. If it does, can you help me to understand why I got the above error when I used images with the size m×m×1?
  2 commentaires
Matt J
Matt J le 8 Déc 2021
What did you give as InputImageSize?
Matt J
Matt J le 8 Déc 2021
Robert replied:
I used images of input size 256 × 256 × 1

Connectez-vous pour commenter.

Réponses (2)

Matt J
Matt J le 8 Déc 2021
I was able to modify the input size in deepNetworkDesigner. No idea what will happen when you try to train it.
  14 commentaires
Gobert
Gobert le 9 Déc 2021
Did you successfully train the fcn after doing your modifications?
Matt J
Matt J le 9 Déc 2021
I did not attempt to train. My GPU isn't that great.

Connectez-vous pour commenter.


yanqi liu
yanqi liu le 8 Déc 2021
yes,sir,may be change the data load,such as
imageSize = [256 256 3];
augimds = augmentedImageDatastore(imageSize,dstrain,'ColorPreprocessing','gray2rgb');
  1 commentaire
yanqi liu
yanqi liu le 9 Déc 2021
yes,sir,may be use
trainingImages = imageDatastore('train',...
'IncludeSubfolders',true,...
'LabelSource','foldernames','ReadFcn',@data_preporcess);
function data = data_preporcess(file)
data = imread(file);
if ndims(data) == 2
data = cat(3, data, data, data);
end
data = imresize(data, [256 256], 'bilinear');
data = double(data);

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by