-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplay.m
15 lines (14 loc) · 828 Bytes
/
replay.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
%categories=('0','1','2','3','4','5','6','7','8','9','-');
imds=imageDatastore('dataset\replay\','IncludeSubfolders',true,'LabelSource','foldernames');
imds.ReadFcn=@ filename;
%[training_data,testing_data]=splitEachLabel(imds,.7,'randomized');
[training_data,testing_data]=splitEachLabel(imds,.7,'randomized');
convnet=helperImportMatConvNet('imagenet-caffe-alex.mat');
featureLayer='fc7';
training_features = activations(convnet,training_data,featureLayer, ...
'MiniBatchSize',32,'OutputAs','columns');
testing_features = activations(convnet, testing_data,featureLayer, ...
'MiniBatchSize',32,'OutputAs','columns');
classifier=fitcecoc(training_features,training_data.Labels,...
'Learners','Linear','Coding','onevsall','ObservationsIn','columns');
labels=predict(classifier, testing_features');