Architecture of convolutional autoencoders in Matlab 2019b
40 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alberto Tellaeche
el 18 de Mzo. de 2020
Comentada: Jian Wang
el 29 de Mayo de 2021
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
0 comentarios
Respuesta aceptada
Mahesh Taparia
el 23 de Mzo. de 2020
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 comentarios
Mahesh Taparia
el 17 de Oct. de 2020
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
el 29 de Mayo de 2021
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!