How to make loose function for validation and training togther for autoencoder

조회 수: 3 (최근 30일)
Hi
I am working autoencoder and I am looking to make loose function curve for training and validation together while training the model
I checked this Example of training autoencoder but only show loose curve for training
https://www.mathworks.com/help/deeplearning/ref/trainautoencoder.html
How to make Training and Validation loose curve togther while training the model
Herein my code
dataDir= fullfile('Data/');
exts = {'.jpg','.png','.tif','BMP'};
imds = imageDatastore(fullfile(dataDir),...
'IncludeSubfolders',true,'FileExtensions','.jpg','LabelSource','foldernames');
countEachLabel(imds);
[TrainData, TestData, ValidData] = splitEachLabel(imds, 0.10, 0.20);
size(TrainData);
countEachLabel(TrainData);
numImages = numel(TrainData.Files);
for i = 1:numImages
img = readimage(TrainData, i);
img=rgb2gray(img);
img3= im2double(img);
scale = 0.5;
img8 = imresize(img3,scale);
Train{idx} = (img8); %#ok<SAGROW>
end
numImages = numel(ValidData.Files);
for i = 1:numImages
img = readimage(ValidData, i);
img=rgb2gray(img);
img3= im2double(img);
scale = 0.5;
img8 = imresize(img3,scale);
Valid{idx} = (img8); %#ok<SAGROW>
end
hiddenSize = 50;
autoenc = trainAutoencoder(Valid,Train,hiddenSize,'MaxEpochs',100,...
'DecoderTransferFunction','purelin','EncoderTransferFunction','satlin','L2WeightRegularization',0.004,'SparsityRegularization',4,'SparsityProportion',0.15);

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by