forked from Ramiel1996/cnn-lstm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatExract.m
67 lines (40 loc) · 1.14 KB
/
featExract.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function [featVec] = featExract(imdir, cnn_net, cnn_layer)
im = imread(imdir) ;
im_ = imresize(im, cnn_net.meta.normalization.imageSize(1:2)) ;
% im_ = im_ - cnn_net.meta.normalization.averageImage ;
im_ = gpuArray(im_) ;
im_ = single(im_) ;
res = vl_simplenn(cnn_net, im_) ;
featVec = res(cnn_layer).x ;
featVec = featVec(:) ;
end
% x为显示的进度,必须在0到1之间h为所建立的waitbar的句柄,updated message为实时显示的信息,此语句经常地用于for循环中,如下所示:
% steps=100;
% hwait=waitbar(0,'请等待>>>>>>>>');
% for k=1:steps
% if steps-k<=5
% waitbar(k/steps,hwait,'即将完成');
% pause(0.05);
% else
% str=['正在运行中',num2str(k),'%'];
% waitbar(k/steps,hwait,str);
% pause(0.05);
% end
% end
% close(hwait); % 注意必须添加close函数
%
% steps=150;
% hwait=waitbar(0,'请等待>>>>>>>>');
% step=steps/100;
% for k=1:steps
% if steps-k<=5
% waitbar(k/steps,hwait,'即将完成');
% pause(0.05);
% else
% PerStr=fix(k/step);
% str=['正在运行中',num2str(PerStr),'%'];
% waitbar(k/steps,hwait,str);
% pause(0.05);
% end
% end
% close(hwait);