Error while loading an object of class 'nnet.cnn.​layer.Imag​eInputLaye​r': Reference to non-existent field 'IsAverage​ImageMeanP​erChannel'​.

7 views (last 30 days)
Hi, I have a little bit of an interesting problem, my class had a challenge to see who could make an effective image classifier. I opted to go with a neural network, and it work very well when ran on my computer. However when I turned in the folder with the neccessary components, my professor told me that it wouldn't run when they tried. She emailed me the following error:
Warning: While loading an object of class 'nnet.cnn.layer.ImageInputLayer':
Reference to non-existent field 'IsAverageImageMeanPerChannel'.
> In pet_classifier (line 2)
In SammyMain (line 11)
Warning: Directory already exists.
> In pet_classifier (line 8)
In SammyMain (line 11)
Dot indexing is not supported for variables of this type.
Error in nnet.internal.cnn.SeriesNetwork/setupNetworkForHostPrediction (line 511)
this.Layers{el} = this.Layers{el}.setupForHostPrediction();
Error in SeriesNetwork/getPredictionEnvironment (line 870)
privateNetwork = this.PrivateNetwork.setupNetworkForHostPrediction();
Error in SeriesNetwork/predict (line 312)
predictEnvironment = this.getPredictionEnvironment(executionEnvironment);
Error in SeriesNetwork/classify (line 564)
scores = this.predict( X, varargin{:} );
Error in pet_classifier (line 28)
test = classify(net, testimages);
Error in SammyMain (line 11)
yguess = pet_classifier(Xtest);
The code for my program is as follows:
function yguess = pet_classifier(Xtest)
loadednet = load('petclassifiernet.mat', 'net');
net = loadednet.net;
[rtest,~] = size(Xtest);
mkdir('testimgs');
testpath = [pwd '/testimgs'];
for i = 1:rtest
image = mat2gray(reshape(Xtest(i,:),64,64));
if i < 10
num = ['000', int2str(i)];
elseif i < 100
num = ['00', int2str(i)];
elseif i < 1000
num = ['0', int2str(i)];
else
num = int2str(i);
end
filename = sprintf('testimage%s.jpg', num);
imgfile = fullfile(testpath, filename);
imwrite(image,imgfile);
end
testimages = imageDatastore(testpath);
test = classify(net, testimages);
[r,~] = size(test);
yguess = [];
for i = 1:r
if(test(i,1) == 'cat')
yguess = [yguess; -1];
elseif(test(i,1) == 'dog')
yguess = [yguess; 1];
else
disp('wrong');
end
end
end
And the folder I turned in contained my neural net saved as 'petclassifiernet.mat' and the function with the code as seen above. Does anyone know why the code runs on my computer but not when I turned it in?
  2 Comments
Samuel Tomp
Samuel Tomp on 14 May 2020
I forget the exact details, but I believe the issue was that my professor was running an older version of MATLAB. I believe I was running 2019a at the time and she was running some version older than 2018, I forget which exactrly.

Sign in to comment.

Answers (0)

Categories

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

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!