How to get encoder and decoder parts of autoencoder in order to stack them?

조회 수: 2 (최근 30일)
Hey,
I want to represent 128x128 images in a 1x64 vector, and for that I want to use autoencoders.
I have trained autoencoders in stages following the example in "Train Stacked Autoencoders for Image Classificatio".
However, I dont want to build a classifier, I want to build an autoencoder to embedd images.
(I tried build my own autoencoder with CNNs without using the built in autoencoder functions but I can't get good results for some reason)
Following the example I created two autoencoders, and added another one of my own instead of the softmax output and trained them:
encoder1 : 128x128 ->256-> 128x128
encoder2 : 256->128->256
encoder3 : 128->64->128
But how do I combine them?
If I use the "stack" function on these encoders like in the example:
stackednet = stack(encoder1,encoder2,encoder3)
I get this transformation :
128x128 -> 256 -> 128 -> 64
but what I want is this:
128x128 -> 256 -> 128 -> 64 ->128 -> 256 -> 128x128
So basicaly I need to stack this:
stackednet = stack(encoder1-encoder,encoder2-encoder,encoder3-encoder,encoder3-decoder,encoder2-decoder,encoder1-decoder)
Is there a way to extract the encoder and the decoder parts from an Autoencoder object and then stack them?

채택된 답변

David Willingham
David Willingham 2021년 6월 23일
Hi,
That example is using the older Neural Networks functionalilty. I'd recommend looking at one of the examples using the newer framework like this one here: Train Variational Autoencoder (VAE) to Generate Images.
  댓글 수: 1
ytzhak goussha
ytzhak goussha 2021년 6월 23일
Thank you for your reply,
I did try that one as well,
I mannaged to get the loss as low as 5 but then it stoped.
That is why I wanted to train the network like an onion, train the outer encoder-decoder first, and the move inwards, and finally stack all the encoders, and the decoders.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by