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

7 ビュー (過去 30 日間)
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 件のコメント
Maria Delgado
Maria Delgado 2020 年 5 月 14 日
Hello! Did you find a solution? I am encountering the same problem.
Thanks!
Samuel Tomp
Samuel Tomp 2020 年 5 月 14 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by