How to modify the function to input multi-channel images for CNN training in MATLAB 2017a?

8 ビュー (過去 30 日間)
Zhiyi TANG
Zhiyi TANG 2017 年 6 月 19 日
コメント済み: Buzz_root 2021 年 2 月 19 日
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 件のコメント
morteza ali ahmadi
morteza ali ahmadi 2018 年 2 月 17 日
編集済み: morteza ali ahmadi 2018 年 2 月 17 日
I also encountered this problem. Could you find a solution?
Zhiyi TANG
Zhiyi TANG 2018 年 3 月 26 日
Finally, 2018a provides the feature of multi-layer input

サインインしてコメントする。

回答 (3 件)

Zhiyi TANG
Zhiyi TANG 2018 年 3 月 27 日
編集済み: Zhiyi TANG 2018 年 3 月 27 日
  1 件のコメント
hiba
hiba 2019 年 2 月 6 日
please con you explain more the sysnatxe of using imageInputLayer with 3 dimention image size [240* 240*155 ] thank yoiu

サインインしてコメントする。


Muhammad Nabi
Muhammad Nabi 2018 年 3 月 26 日
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 件のコメント
Zhiyi TANG
Zhiyi TANG 2018 年 3 月 26 日
Finally, 2018a provides the feature of multi-layer input
Salma Ali
Salma Ali 2018 年 5 月 25 日
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
Xin Zhang 2018 年 5 月 21 日
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,

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by