How to train a deep neural network with 2 inputs

116 visualizzazioni (ultimi 30 giorni)
JIANG LIU
JIANG LIU il 20 Ago 2020
Risposto: Srivardhan Gadila il 23 Ago 2020
Hello, I just started to learn deep learning using Matlab. I had a problem with this two input model. Did I create the right model in Matlab? How to train the model (how to define the two input)?
Python:
class Deep_unfold_NN(torch.nn.Module ):
def __init__(self,x_size, y_size):
super(Deep_unfold_NN, self).__init__()
self.s1 = torch.nn.Sequential(torch.nn.Linear(x_size, x_size))
self.aux = torch.nn.Sequential(torch.nn.Linear(y_size, x_size) )
def forward(self,x,y,L):
for index in range(L):
x=self.s1(x)+self.aux(y)
return x
Matlab using deepNetworkDesigner ( L in the python code above is 4):
After the model is created, I exported it in Matlab and save the layers as layers1
input={Input_1_train,Input_2_train};
net_deepmimo = trainNetwork(input,Output,layers1,options);
The error information is :
Network: Invalid input layers. If the network has a sequence input layer, then it must not have any other input layers.
How should I build this model in Matlab?
Thank you very much.

Risposte (1)

Srivardhan Gadila
Srivardhan Gadila il 23 Ago 2020
As per my knowledge and above information, I think that you can use imageInputLayer instead of sequenceInputLayer. To define and train a deep learning network with multiple inputs, specify the network architecture using a layerGraph object and train using the trainNetwork function by specifying the multiple inputs using a combinedDatastore or transformedDatastore object. Also you have to use the following syntax of trainNetwork
If you are unable to train using trainNetwork then you can create a custom training loop using automatic differentiation. To learn more, see Define Custom Training Loops.

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by