MATLAB Answers

Can anyone help me to use .mat for validation in CNN classification?

1 view (last 30 days)
close all;
clear all;
mynet = open('Gnet.mat');
% mynet = disp(mynet);
%test classifier using train samples
'IncludeSubfolders', true,...
'LabelSource', 'foldernames');
inputSize= [227 227 3];
augimdsTest=augmentedImageDatastore(inputSize, imdsTest, 'ColorPreprocessing', 'gray2rgb');
% %test classifier using test samples
[YPred, scores]=classify(mynet.Gnet, augimdsTest);
YTest=imdsTest.Labels; %expected result
Reference to non-existent field 'Gnet'.
Error in TESTALEXNET1 (line 14)
[YPred, scores]=classify(mynet.Gnet, augimdsTest);

Accepted Answer

Srivardhan Gadila
Srivardhan Gadila on 6 Aug 2019
mynetstrcut = load('Gnet.mat’'); %loads the structure
mynet = mynetstruct.Gnet; % here Gnet = name of your network (Gnet) and the network “Gnet” is stored in mynet
[YPred, scores] = classify(mynet,augimdsTest);
load Gnet; %provided only Gnet is saved in 'Gnet.mat'
[YPred, scores] = classify(Gnet,augimdsTest);

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Translated by