Architecture of convolutional autoencoders in Matlab 2019b

18 次查看(过去 30 天)
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