Architecture of convolutional autoencoders in Matlab 2019b

40 ビュー (過去 30 日間)
Alberto Tellaeche
Alberto Tellaeche 2020 年 3 月 18 日
コメント済み: Jian Wang 2021 年 5 月 29 日
Hello all,
I am very interested in training convolutional autoencoders in MATLAB 2019b.
I have found the instruction trainAutoencoder, but it does not allow to specify the convolutional layers architecture.
I want to design my autoencoder using Deep Network Designer tool, and then train it just as it is done with CNNs, FasterRCNN algorithms, etc, using my image dataset.
Is this possible? Is there any code oxample out there to do so?
Thank you all in advance,
Best,
Alberto

採用された回答

Mahesh Taparia
Mahesh Taparia 2020 年 3 月 23 日
Hi
You can define custom architecture of auoencoder using deep learning layers. You can refer to this documentation for the list of deep learning layers supported in MATLAB. For example, the autoencoder network can be defined as:
layers=[
imageInputLayer(size,"Name","imageinput",'Normalization','none') %size is the size of input
fullyConnectedLayer(9*R,"Name","fc_1") %R can be any number/ factor
leakyReluLayer(0.01,"Name","leakyrelu_1")
fullyConnectedLayer(6*R,"Name","fc_2")
leakyReluLayer(0.01,"Name","leakyrelu_3")
fullyConnectedLayer(3*R,"Name","fc_3")
leakyReluLayer(0.01,"Name","leakyrelu_4")
fullyConnectedLayer(R,"Name","fc_4")
batchNormalizationLayer("Name","batchnorm")
reluLayer('Name','relu1')
dropoutLayer('Name','drop')
fullyConnectedLayer(3*R,"Name","fc_4")
leakyReluLayer(0.01,"Name","leakyrelu_5")
fullyConnectedLayer(6*R,"Name","fc_4")
leakyReluLayer(0.01,"Name","leakyrelu_6")
fullyConnectedLayer(9*R,"Name","fc_4")
leakyReluLayer(0.01,"Name","leakyrelu_7")
fullyConnectedLayer(size,"Name","fc_5")
leakyReluLayer(0.01,"Name","leakyrelu_8")
regressionLayer("Name","regressionoutput")];
You can use 2D / 3D conv layer/ any other layer as per your architecture. After defining the network, you can train the model. For reference you can check this documentation for that.
For custom loss function, you can check this documentation.
Hope it will help!
  3 件のコメント
Mahesh Taparia
Mahesh Taparia 2020 年 10 月 17 日
Hi
You can replace the fully connected layer with convolution layer in the above code, then it will be a convolutional autoencoder. You can refer to this documentation of convolution layer for more details. You can change the layers as per your application.
Jian Wang
Jian Wang 2021 年 5 月 29 日
Hi, Mahesh Taparia. Thank you for your answer. I want to know how can I train the autoencoder in Matlab? I use the following code:
net = trainNetwork(X, X, AE_Layers, AE_options);
X is a array with 13457-by-7, i.e. 7 variables.
But it seems wrong when I get the reconstructed X by:
XReconstructed = predict(net, X);
XReconstructed is full of NANs. Whether the code is wrong? Thank you.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by