how to use multiple input layers in DAG net as shown in the figure

33 views (last 30 days)
I have DAG graph with two paths of layers inside it.
I am planning to feed this DAG with two types of data (D1, D2) but I can't do it as the DAG in matlab accept just one input layer.
I need to form a layer such as:
I noticed that there is a custom network that can provide a network with multiple inputs but how can I connect between this network and DAG graph? or how could I use DAG with two inputs?
Kenta on 29 Mar 2020
As of 2019b, you can use custom training loop which allows you to do multi-input CNN.
This shows a demo to classify images with two-path sequence layers using two kinds of input images.

Sign in to comment.

Accepted Answer

Mahmoud Afifi
Mahmoud Afifi on 10 Feb 2019
One idea is to feed the network with concatenated inputs (e.g., image1;image2) then create splitter layers that split each input. The problem here is that you have to feed the network with .mat files, not image paths. Another idea is to store your images as tiff files which can hold 4 channels. In this case, you can store a colored image (3 channel) and a grayscale one. Have a look at this example .. see twoStream.m file.
miao li
miao li on 20 May 2021
Hello, I have a question, how to separate each channel using 1X1 convolution? I think that each convolutional layer operates on 6 channels separately and then adds them, but the channels cannot be extracted.

Sign in to comment.

More Answers (5)

Mahmoud Afifi
Mahmoud Afifi on 28 Oct 2019
Edited: Mahmoud Afifi on 29 Oct 2019
I just released an example Matlab code of how to implemenet multiple-input CNN in Matlab 2019b. You can find it here:
please if it works for you, accept this answer.
  1 Comment
dinial utami
dinial utami on 14 Jun 2020
thank you for your helping Mr.
in the code you have share, has multiple input in layer. not in trainNetwork.
Mr, can you help if we has 3 input in different image for training set, we set 3 input layers, but we can't set 3 training set. in the reality we need 3 input layers, and 3 training set.
thank you Mr. Mahmoud Afifi

Sign in to comment.

Shounak Mitra
Shounak Mitra on 8 Oct 2018
Hi Marcello and Arjun,
Support for multiple Input layers are not supported as of the 18b release. We are working on it and it should be available soon.
Thanks Shounak
Bodo Rosenhahn
Bodo Rosenhahn on 16 May 2019
are multiple input /output layers for DAG networks supported in 19a ? Can you provide an example ?

Sign in to comment.

Bernhard Suhm
Bernhard Suhm on 12 Dec 2017
Modeling DAG graphs with multiple inputs and/or outputs is currently not supported in our deep learning framework, but we are working on it. So hold your breath for one of the next releases.
Marcello Venzi
Marcello Venzi on 20 Sep 2018
Hello, can you please comment if multiple input layers are now supported (as of maltab 2018b)? I could not find this option in the documentation.

Sign in to comment.

Yanhui Guo
Yanhui Guo on 24 Oct 2018
In the DAGNetwork file, I found the property: InputLayerIndices. In the fasterrcnn, I also found two input for this network. I am wondering if matlab2018b has an indirect way to support multiple inputs? Thanks.

sinan salim
sinan salim on 4 Aug 2020
hi is there any update to manage multi-input layer >>because i want use different classes each 2 classes have to be assign for separate input layer

Community Treasure Hunt

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

Start Hunting!

Translated by