-
Notifications
You must be signed in to change notification settings - Fork 16
/
deepLearning_example.m
31 lines (24 loc) · 1.03 KB
/
deepLearning_example.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
load('./mat/deep_feat/AwA_overfeat.mat');
load('./mat/AwA100_word2vec.mat');
load('./mat/AwA_input.mat');
%%
wordattr = AwA100; %AwA85word;
% generate word-training and word-testing attribute matrix:
te_cls_attr = wordattr(logical(animal_cls.testing_cls_flag),:);
tr_cls_attr = wordattr(logical(~animal_cls.testing_cls_flag),:);
te_inst_attr = wordattr(test_img_label,:);
tr_inst_attr = wordattr(train_img_label,:);
%%
for id = 1:size(AwA100,2)
cmd =[sprintf(' -s 11 -c 10 ')];
model =liblineartrain(tr_inst_attr(:,id), sparse(tr_overfeat), cmd);
zslmodel100{id} =model;
[plxte]=liblinearpredict(te_inst_attr(:,id),sparse(te_overfeat),model);
% [plxtr]=liblinearpredict(tr_inst_attr(:,id),AwAfeat,model);
zslpL_Xte(:,id) = plxte;
% zslpL_Xtr(:,id) = plxtr;
end
%% try simply Nearest neighbour:
con_test_prototype = wordattr(logical(animal_cls.testing_cls_flag),:);
opts.top=500;
[conzsl_nrm_res,conzsl_euc_res]=Fu_ZSL_self_training_byNN(zslpL_Xte, con_test_prototype, test_img_label,zsl_label, opts);