how to train an autoencoder without trainAutoencoder function?

16 views (last 30 days)
I what train an autoencoder without trainAutoencoder function.
Then I got some problems.
The learning of the network stopped at a certain value, and the output image was different from the input.
Despite the nodes of the hidden layer being larger than the input size.
I must have overlooked, but I can not consider it.
The code and output.
rng('default')
% Load the training data into memory
[xTrainImages,tTrain] = digitTrainCellArrayData;
N = length(xTrainImages);
hiddenSize = 1000;
%%cell to array(alter cell into vector)
T = zeros(numel(xTrainImages),28*28);
for i = 1:numel(xTrainImages)
T(i,:) = xTrainImages{i}(:)';
end
X = T';
T = T';
%%neural networks setting and training
net = fitnet(hiddenSize);
net.trainFcn = 'trainscg';
net = configure(net,X,T);
net = train(net,X,T);
%%denoising images
h1 = figure;
h2 = figure;
figure(h1)
for i = 1:20
subplot(4,5,i);
imshow(xTrainImages{i})
end
figure(h2);
for i = 1:20
subplot(4,5,i);
imshow(reshape(net(xTrainImages{i}(:)),28,28));
end

Accepted Answer

taiyo hasegawa
taiyo hasegawa on 8 Sep 2018
I solved it after sparse learning.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!