Multi Input Multi Sequence Neural Network

8 次查看(过去 30 天)
The question is how to define a multi input multi sequence neural network (NN) in Matlab?
There is a way to define multi sequence NN:
x1 = [4 5 6];
x2 = [4 5 6];
y1 = [1 2 3];
y2 = [1 2 3];
x = {[x1;x2]};
y={[y1;y2]};
net = fitnet(1);
net = train(net,x,y);
view(net)
https://www.mathworks.com/help/nnet/ug/multiple-sequences-with-dynamic-neural-networks.html
There is also a way to define multi input NN:
x1 = [4 5 6];
x2 = [4 5 6];
y1 = [1 2 3];
y2 = [1 2 3];
x = {x1;x2};
y=y1;
net = fitnet(1);
net.numinputs = 2;
net.inputConnect = [1 1; 0 0];
net = train(net,x,y);
view(net)
https://www.mathworks.com/matlabcentral/answers/355286-how-to-give-multiple-inputs-to-the-train-function-of-neural-network
When I try to combine these two conditions:
x1 = [4 5 6];
x2 = [4 5 6];
y1 = [1 2 3];
y2 = [1 2 3];
x = {{[x1;x2]};{[x1;x2]}};
y={y1;y2};
net = fitnet(1);
net.numinputs = 2;
net.inputConnect = [1 1; 0 0];
net = train(net,x,y);
view(net)
I get error:
Error using nntraining.setup>setupPerWorker (line 61)
Inputs X{1,1} is not numeric or logical.
Error in nntraining.setup (line 43)
[net,data,tr,err] = setupPerWorker(net,trainFcn,X,Xi,Ai,T,EW,enableConfigure);
Error in network/train (line 335)
[net,data,tr,err] = nntraining.setup(net,net.trainFcn,X,Xi,Ai,T,EW,enableConfigure,isComposite);

回答(1 个)

Kenta
Kenta 2021-9-10
编辑:Kenta 2021-9-10
As of now, you can use custom training loop for deep learning for the multi-input. This is a bit different from what you want, but I believe it helps you.
https://jp.mathworks.com/matlabcentral/fileexchange/74760-image-classification-using-cnn-with-multi-input-cnn

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by