forked from layumi/2016_person_re-ID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resnet52_market.m
executable file
·26 lines (25 loc) · 1011 Bytes
/
resnet52_market.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
function net = resnet52_market()
netStruct = load('./data/imagenet-resnet-50-dag.mat') ;
net = dagnn.DagNN.loadobj(netStruct) ;
net.removeLayer('fc1000');
net.removeLayer('prob');
for i = 1:numel(net.params)
if(mod(i,2)==0)
net.params(i).learningRate=0.02;
else net.params(i).learningRate=0.001;
end
net.params(i).weightDecay=1;
end
dropoutBlock = dagnn.DropOut('rate',0.9);
net.addLayer('dropout',dropoutBlock,{'pool5'},{'pool5d'},{});
fc751Block = dagnn.Conv('size',[1 1 2048 751],'hasBias',true,'stride',[1,1],'pad',[0,0,0,0]);
net.addLayer('fc751',fc751Block,{'pool5d'},{'prediction'},{'fc751f','fc751b'});
lossBlock = dagnn.Loss('loss', 'softmaxlog');
net.addLayer('softmaxloss',lossBlock,{'prediction','label'},'objective');
net.addLayer('top1err', dagnn.Loss('loss', 'classerror'), ...
{'prediction','label'}, 'top1err') ;
net.addLayer('top5err', dagnn.Loss('loss', 'topkerror', ...
'opts', {'topK',5}), ...
{'prediction','label'}, 'top5err') ;
net.initParams();
end