Architecture of convolutional autoencoders in Matlab 2019b

조회 수: 17 (최근 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 CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by