MATLAB: How to use multiple input layers in DAG net as shown in the figure

computer visionComputer Vision ToolboxDeep Learning Toolboximage processingImage Processing Toolboxmachine learningMATLABneural networkStatistics and Machine Learning Toolbox

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?

Best Answer

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 https://www.mathworks.com/matlabcentral/fileexchange/65065-two-stream-cnn-for-gender-recognition-using-hand-images?s_tid=FX_rc1_behav .. see twoStream.m file.
Related Question