wrong classification caffe google net model in matlab

3 次查看(过去 30 天)
Hi all,
I trained a google net model for two claases in Nvidia DIGITS which is working well in in DIGITS6.0 with 99.7 accuracy in test set.
Same model imported in matlab not able to classify properly. I am thinking it has to do something with mean image or binary.proto file.
I am not getting any error just wrong classification and i am sure my network is woking properly in DIGITS6.0 and python.
below is the matlab code
protofile = 'deploy.prototxt';
datafile = 'snapshot_iter_2295.caffemodel';
net = importCaffeNetwork(protofile,datafile);
inputSize = net.Layers(1).InputSize;
% image path
img = 'Test/Normal/0.JPEG';
im1 = imread(img);
im2 = rgb2gray(im1);
im = imresize(im2,inputSize(1:2)) ;
[label,score] = classify(net,im); % Classify the picture
Thanks
Nitin
  1 个评论
Piyush Dubey
Piyush Dubey 2019-10-10
Hi Nitin,
When you obtain 'im2' by using 'rgb2gray' function, the image size changes from [224 224 3] to [224 224]. When you try to classify it, you should get an error saying 'Incorrect input size. The input images must have a size of [224 224 3].'. Can you try classifying after removing the following line from your code:
im2 = rgb2gray(im1);
And changing the line where you resize the image im2 to the following:
im = imresize(im1, inputSize(1:2));
Also, see if the following link can help:

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by