Training Network with Sequence input of different Nature

4 次查看(过去 30 天)
Hello,
I am curently working on an IA project in which I have inputs of different kind in input of my network. For exemple with 2 inputs, one is a sensor value and the other is an int value with another information.
Until now I was working with features inputs and I had one feature input for each inputs of my network (in the exemple my network had 2 feature inputs).
Now, I want to use sequences in input (one sequence of sensor values and one sequence of int values). However when I declare 2 sequence inputs with the network designer, the verification process tells me that I can't use multiple sequence input.
I looked the following topics but I did not find something that seem to match with my case.
Do you have any idea to help me on thios or should I create a custom sequence input layer ?
Thanks in advance
Mathieu

回答(1 个)

Milan Bansal
Milan Bansal 2023-12-29
Hi Mathieu, 
As per my understanding you are trying to build a neural network with multiple inputs (two different sequences) and facing an error while declaring two sequence input layers in the network.
A neural network in MATLAB cannot have two input layers in it. To build a neural network with multiple inputs, it is required to create the network architecture using "layerGraph" object. 
Please refer to the documentation below to learn more about "layerGraph" object. 
Please refer to the steps below for building a neural network with multiple sequence inputs: -
  1. Initially, define the main architecture of the neural network with "sequenceInputLayer" as input layer and other desired layers.
  2. Add a "concatenationLayer" in the network with the dimensions such that the second "sequenceInputLayer" can be connected to the main architecture later for another sequence input.
  3. Convert the network into Layer Graph.
  4. Create a "sequenceInputLayer" for sequence input and connect it to the second input of the "concatenationLayer". 
Please refer to the pseudo code in the code snippet below: -
layers = [ ...
sequenceInputLayer(inputSize)
lstmLayer(numHiddenUnits,'OutputMode','last')
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer]
lgraph = layerGraph(layers);
seqInput = sequenceInputLayer(inputSize);
lgraph = addLayers(lgraph,,'Name','seq');
lgraph = connectLayers(lgraph,"seq","cat/in2");
Please refer to the example in the documentation below to learn more about Training Neural Network with Multiple Inputs. 
Hope it helps!
  1 个评论
Pascal
Pascal 2024-2-16
Hi Milan,
while using multiple Inputs and combinations thereof, such as Images and Features (and Sequences with Features) works fine, I get the following errors when trying to use multiple Sequences Inputs:
Error received when using multiple Sequence Input Layers in Deep NEtwork Designer:
Error received when following your example and trying to manually add the second sequence input to the layer graph:
Is there any workaround for this problem, so that I can use multiple Sequence Inputs in the Network in Matlab?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Build Deep Neural Networks 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by