MATLAB Answers

how to train deep learning network with multi-inputs

86 views (last 30 days)
Lina Chato
Lina Chato on 7 Nov 2019
Commented: Kenta on 31 Mar 2020
Hi I need to train a CNN with two different type of images, so I used the following code
inputSize = [64 64 64 4];
inputLayer = image3dInputLayer(inputSize,'Normalization','none','Name','input');
inputLayer2 = image3dInputLayer(inputSize,'Normalization','none','Name','input2');
when I used analyzeNetwork(lgraph), I got error that should only one input layer be used. So please is there any way I can use multi inputs in the matlab?
Also, if multi inputes is supported in matlab, how can define the two different inputs in the training process ( trainNetwork(dsTrain,lgraph,options);)
I appreciate your advice!

  1 Comment

Kenta on 31 Mar 2020
You can use multi-input CNN with "custom training loop" as it is started to be supported from 2019b. The below is an example. I hope it can help you.

Sign in to comment.

Accepted Answer

Sai Bhargav Avula
Sai Bhargav Avula on 14 Nov 2019
You can either use the CombinedDatastore or define a custom layer that can take multiple inputs. For defining a custom layer with multiple inputs you can follow the following link
Additionally the transformedDatastore will also serve the purpose.
Hope this helps !


Sign in to comment.

More Answers (0)

Translated by