How to modify the function to input multi-channel images for CNN training in MATLAB 2017a?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I'm trying to train a Convolutional Neural Network with the newly released functions in MATLAB 2017a.
The input consists of two gray-scale images with resolution 100*100, so I stack them as a two-channel image, thus the dimension of the image is 100*100*2.
Next, I designed the architecture of input layer as
layers = [imageInputLayer([100 100 2])
...(omit the rest)]
However, only 1 (gray-scale image) and 3 (color image) are valid for the number of channels (the third parameter in [100 100 2]).
So my settings are invalid and the error is
Error using nnet.cnn.layer.ImageInputLayer>iCheckInputSize (line 238)
Expected input image size to be a 2 or 3 element vector. For a 3-element vector, the third element
must be 3 or 1.
I will appreciate that if anybody can help to modify the built-in function, so users can input a multi-channel image, such as a 2-channel image or a 200-channel image. I've tried but got stuck.
2 commentaires
morteza ali ahmadi
le 17 Fév 2018
Modifié(e) : morteza ali ahmadi
le 17 Fév 2018
I also encountered this problem. Could you find a solution?
Réponses (3)
Zhiyi TANG
le 27 Mar 2018
Modifié(e) : Zhiyi TANG
le 27 Mar 2018
1 commentaire
hiba
le 6 Fév 2019
please con you explain more the sysnatxe of using imageInputLayer with 3 dimention image size [240* 240*155 ] thank yoiu
Muhammad Nabi
le 26 Mar 2018
I am having the same problem I have 4 2D feature images for the same label instance so my data set is [NxMx4] and I cant use a the CNN for it
2 commentaires
Salma Ali
le 25 Mai 2018
Hi, I would like to use multi-input images with different sizes to CNN, is there any function in Matlab to do that? I appreciate any help. Thanks.
Xin Zhang
le 21 Mai 2018
Hi, i am trying to iunput 4 channels (RGB+Nir) to the RCNN. Thanks to your work, it seems that the input of 4 channels is possible using the 'imageInputLayer'. But I got another question of how to make the input argument'trainingData' of the function 'trainFasterRCNNObjectDetector'? It requires as 'Labeled ground truth images, specified as a table with two or more columns. The first column must contain paths and file names to grayscale or truecolor (RGB) images'. How can we make the argument 'trainingData' as 2 channels or 4 channels? Hope to get your reply soon. Best regards,
1 commentaire
Voir également
Catégories
En savoir plus sur Image Data Workflows dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!