trained stacked auto encoders

2 views (last 30 days)
Srinidhi Gorityala
Srinidhi Gorityala on 19 Jun 2020
Answered: Divya Gaddipati on 22 Jun 2020
Helo.. iam working on pothole dataset classification by using trained stacked auto encoders concept. Below i have attached the matlab code... in that code they have loaded the dataset using digitTrainCellArrayData but i want to load the pothole dataset .Could any one please help me with the code that how to load the dataset folder.
Thans in advance:)
% Load the training data into memory
[xTrainImages,tTrain] = digitTrainCellArrayData;
% Display some of the training images
clf
for i = 1:20
subplot(4,5,i);
imshow(xTrainImages{i});
end
rng('default')
hiddenSize1 = 100;
autoenc1 = trainAutoencoder(xTrainImages,hiddenSize1, ...
'MaxEpochs',400, ...
'L2WeightRegularization',0.004, ...
'SparsityRegularization',4, ...
'SparsityProportion',0.15, ...
'ScaleData', false);
view(autoenc1)
figure()
plotWeights(autoenc1);
feat1 = encode(autoenc1,xTrainImages);
hiddenSize2 = 50;
autoenc2 = trainAutoencoder(feat1,hiddenSize2, ...
'MaxEpochs',100, ...
'L2WeightRegularization',0.002, ...
'SparsityRegularization',4, ...
'SparsityProportion',0.1, ...
'ScaleData', false);
view(autoenc2)

Answers (1)

Divya Gaddipati
Divya Gaddipati on 22 Jun 2020
One way is to use imageDatastore.
datasetPath = fullfile('/path/to/dataset');
imds = imageDatastore(datasetPath, ...
'IncludeSubfolders',true,'LabelSource','foldernames');
Refer to the Load and Explore Image Data section in the following example:
For more information on imageDatastore, you can refer to the below link

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!