No appropriate method, property, or field ‘Files’ for class ‘augmented?ImageDatas?tore’.

Technical Source
2 min readMay 26, 2021

--

Hi,

I am trying to apply “Train Deep Learning Network to Classify New Images”. I did test exactly according to

https://www.matlabsolutions.com/documentation/deeplearning/train-deep-learning-network-to-classify-new-images.php

But I always got some problem as:

“No appropriate method, property, or field ‘Files’ for class ‘augmentedImageDatastore’.

Error in googlenetJIAGUI (line 88)

valFrequency = floor(numel(augimdsTrain.Files)/miniBatchSize);”

When I ran:

%Train Network
pixelRange = [-30 30];
scaleRange = [0.9 1.1];
imageAugmenter = imageDataAugmenter( ...
'RandXReflection',true, ...
'RandXTranslation',pixelRange, ...
'RandYTranslation',pixelRange, ...
'RandXScale',scaleRange, ...
'RandYScale',scaleRange);
augimdsTrain = augmentedImageDatastore(inputSize(1:2),imdsTrain, ...
'DataAugmentation',imageAugmenter);
augimdsValidation = augmentedImageDatastore(inputSize(1:2),imdsValidation);%Specify the training options.
miniBatchSize = 10;
valFrequency = floor(numel(imdsValidation.Files)/miniBatchSize); %%valFrequency = floor(numel(augimdsTrain.Files)/miniBatchSize);
options = trainingOptions('sgdm', ...
'MiniBatchSize',miniBatchSize, ...
'MaxEpochs',6, ...
'InitialLearnRate',3e-4, ...
'Shuffle','every-epoch', ...
'ValidationData',augimdsValidation, ...
'ValidationFrequency',valFrequency, ...
'Verbose',false, ...
'Plots','training-progress');

I check inside of “augimdsTrain”, there is no “Files”. When I replace with the “valFrequency = floor(numel(augimdsTrain.Files)/miniBatchSize);” with “valFrequency = floor(numel(imdsValidation.Files)/miniBatchSize)” . “valFrequency = floor(numel(augimdsTrain.Files)/miniBatchSize);” It seems to work.

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

Hack way:

old_warning_state = warning('off', 'MATLAB:structOnObject');
temp = struct(augimdsValidation);
warning(old_warning_state);
valFrequency = floor(numel(temp.DatastoreInternal.Files)/miniBatchSize);

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet