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

7 ビュー (過去 30 日間)
Sulochana S
Sulochana S 2019 年 8 月 3 日
コメント済み: Sulochana S 2019 年 8 月 13 日
close all;
clear all;
clc;
mynet = open('Gnet.mat');
% mynet = disp(mynet);
%test classifier using train samples
imdsTest=imageDatastore('E:\Postmanpack\Ppimplementation\Myxraytesting/',...
'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
accuracy=mean(YPred==YTest)
error
Reference to non-existent field 'Gnet'.
Error in TESTALEXNET1 (line 14)
[YPred, scores]=classify(mynet.Gnet, augimdsTest);
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 8 月 3 日
mynet_struct = load('Gnet.mat');
mynet = mynet_struct.mynet;
Sulochana S
Sulochana S 2019 年 8 月 13 日
Thanks for your clarifcation

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

採用された回答

Srivardhan Gadila
Srivardhan Gadila 2019 年 8 月 6 日
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);
Alternatively
load Gnet; %provided only Gnet is saved in 'Gnet.mat'
[YPred, scores] = classify(Gnet,augimdsTest);
  1 件のコメント
Sulochana S
Sulochana S 2019 年 8 月 13 日
Hi,
Thanks for your answer...it was working..

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by