Error while loading an object of class 'nnet.cnn.layer.ImageInputLayer': Reference to non-existent field 'IsAverageImageMeanPerChannel'.
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Maria Delgado
el 14 de Mayo de 2020
Hello! Did you find a solution? I am encountering the same problem.
Thanks!
Respuestas (0)
Ver también
Categorías
Más información sobre Deep Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!