How to make loose function for validation and training togther for autoencoder
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Image Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!