-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgrd.m
42 lines (34 loc) · 902 Bytes
/
grd.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
%% max pooling
%% groundtruth
y1=imread('g1.jpg');
y1=imresize(y1,[256 256]);
figure
imshow(y1);
[gm,gn,go] = size(y1);
title('groundtruth image');
yp=[];
gnblockcolumn = 2;
gnblockrow = 2;
gdcol = fix(gn/gnblockcolumn);
gdrow = fix(gm/gnblockrow);
for inde = 1:gnblockrow* gnblockcolumn
[gr,gc] = ind2sub([gnblockrow,gnblockcolumn],inde );
groundsubimage = y1((gr-1)*gdrow+1:gr*gdrow, (gc-1)*gdcol+1:gc*gdcol,:);
subplot(gnblockrow,gnblockcolumn,inde);
imshow(groundsubimage)
feature=sif(groundsubimage,inde);
cc=feature;
yp=[yp feature];
end
%% groudtruth classification
inputs1=yp;
targets1=exp(inputs1);
hiddenLayerSize = 10;
net1 = patternnet(hiddenLayerSize);
[net1,tr1] = train(net1,inputs1,targets1);
outputs1 = net1(inputs1);
save outputs1
%% max pool for lower level classifier
max_pool=[];
kk=max(outputs1);
max_pool=[max_pool kk];