NeuralNetwork how to give in input and output

20 ビュー (過去 30 日間)
Kuno Bruswachtl
Kuno Bruswachtl 2021 年 12 月 29 日
コメント済み: Kuno Bruswachtl 2022 年 1 月 4 日
hello,
I know to most of you this question might be silly and stupid but I cannot find the correct answer anywhere. I am stuck in the model training process with CNNs where I cannont find out the following: How to give the trainnetwork function the input as well as the output. My input in that case is a 1D cell array (6570x1) and my output is a 3D(10x10x5) cell array. I am familiar with how to do that in python, where the fit-function takes in both, the input as well as the output argument. Is there a similar way to do this in Matlab? Since I don´t see any solution to this. thank you so much in advance.
  1 件のコメント
Kuno Bruswachtl
Kuno Bruswachtl 2021 年 12 月 29 日
or must I create the input and the output in a featuremap, where each cell corresponds to another cell?

サインインしてコメントする。

採用された回答

Srivardhan Gadila
Srivardhan Gadila 2022 年 1 月 2 日
As per my knowledge, the first approach is to use imageInputLayer as input layer of your network (I think with featureInputLayer as input layer it may not work) and prepare the training data according to the format mentioned in the images & responses sections of the trainNetwork function.
The following is a very basic example:
layers = [imageInputLayer([600 1 1])
resize3dLayer(OutputSize=[10 20 3])
regressionLayer];
analyzeNetwork(layers)
batchSize = 5;
xtrain = randn(600,1,1,batchSize);
ytrain = randn(10,20,3,batchSize);
options = trainingOptions("sgdm");
net = trainNetwork(xtrain,ytrain,layers,options)
The other way is to not use trainNetwork function and instead use dlnetwork & Deep Learning Custom Training Loops based workflow.
  5 件のコメント
Srivardhan Gadila
Srivardhan Gadila 2022 年 1 月 4 日
As per my knowledge, in summary only if your input layer is sequencInputLayer then you can use cell arrays, for all other input layers the training data should either be a datastore, a table or numeric arrays.
Kuno Bruswachtl
Kuno Bruswachtl 2022 年 1 月 4 日
alright, i guess I got it. Thank you for your help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by