-
Notifications
You must be signed in to change notification settings - Fork 1
/
autoclust_detect.m
executable file
·68 lines (65 loc) · 2.52 KB
/
autoclust_detect.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
% Author: Carl Doersch (cdoersch at cs dot cmu dot edu)
%
% Fire the current detectors specified in ds.batch.round.detectors
% (whose ids are assumed to be found in ds.batch.roudn.selectedClust)
% on the image specified in ds.batch.round.iminds(dsidx). Write
% the results to ds.batch.round.topdetsmap{dsidx,:}. Also write
% a flag to ds.batch.round.topdetsmap(dsidx) so dsmapreduce can track
% the progress.
myaddpath;
%if(~dsfield(ds,'imgs'))
imgs=dsload('.ds.imgs');
%end
if(~dsfield(ds,'batch','round','detectors'))
dsload('ds.batch.round.detectors');
end
if(~dsfield(ds,'batch','round','selectedClust'))
dsload('ds.batch.round.selectedClust');
end
imind=ds.batch.round.iminds(dsidx);
im=im2double(getimg(ds,imind));
disp('detecting...');
dets=ds.batch.round.detectors.detectPresenceInImg(im);
disp('adding image to metadata...');
for(i=1:numel(dets.firstLevel.detections))
for(j=1:numel(dets.firstLevel.detections(i).metadata))
dets.firstLevel.detections(i).metadata(j).im=[ds.conf.gbz{ds.conf.currimset}.cutoutdir imgs{ds.conf.currimset}(imind).fullname];
end
end
%imidx=(dsidx-1)*numel(ds.batch.round.selectedClust);
ds.batch.round.tmpdsidx=dsidx;
numTopN = 20;
maxOverlap = 0.1;
disp('getResultData...');
indstosave='';
for(i=numel(ds.batch.round.selectedClust):-1:1)
clusti = (ds.batch.round.selectedClust(i));
[thisScores, imgMeta] = getResultData(dets, ...
i, maxOverlap);
if(numel(thisScores)>0)
res.scores = thisScores';
res.imgIds = ones(1, length(thisScores)) * imind;
res.meta = imgMeta;
ds.batch.round.topdetsmap{i,dsidx}=res;
%dssave(['ds.batch.round.topdetsmap{' num2str(dsidx) '}{' num2str(i) '}']);
indstosave=[indstosave ' ' num2str(i)];
%ds.batch.round.topdetsmap{dsidx,i}=[];
end
end
disp('saving...');
if(numel(indstosave)>0)
dssave(['ds.batch.round.topdetsmap{' indstosave '}{' num2str(dsidx) '}']);
end
%dssave(['ds.batch.round.negmin.detections{' ...
% '(1+(ds.batch.round.negmin.tmpdsidx-1)*numel(ds.batch.round.selectedClust)):' ...
% '((ds.batch.round.negmin.tmpdsidx)*numel(ds.batch.round.selectedClust))}']);
%dssave(['ds.batch.round.negmin.topdetsmap' ...
% '{ds.batch.round.negmin.tmpdsidx}{:}']);
% ds.batch.round.topdetsmap{imidx+i}=res;
%end
%avwafsbfbh
%dssave(['ds.batch.round.topdetsmap{' ...
% '(1+(ds.batch.round.tmpdsidx-1)*numel(ds.batch.round.selectedClust)):'...
% '((ds.batch.round.tmpdsidx)*numel(ds.batch.round.selectedClust))}']);
%ds.batch.round.topdetsmap={};
ds.batch.round.detectorflags{dsidx}=1;