Skip to content

Commit c622873

Browse files
authored
add dependent lib
1 parent 459d58c commit c622873

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+20136
-0
lines changed

grasp_detection/lib/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
all:
2+
python setup.py build_ext --inplace
3+
rm -rf build
4+
clean:
5+
rm -rf */*.pyc
6+
rm -rf */*.so
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function VOCopts = get_voc_opts(path)
2+
3+
tmp = pwd;
4+
cd(path);
5+
try
6+
addpath('VOCcode');
7+
VOCinit;
8+
catch
9+
rmpath('VOCcode');
10+
cd(tmp);
11+
error(sprintf('VOCcode directory not found under %s', path));
12+
end
13+
rmpath('VOCcode');
14+
cd(tmp);
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
function res = voc_eval(path, comp_id, test_set, output_dir)
2+
3+
VOCopts = get_voc_opts(path);
4+
VOCopts.testset = test_set;
5+
6+
for i = 1:length(VOCopts.classes)
7+
cls = VOCopts.classes{i};
8+
res(i) = voc_eval_cls(cls, VOCopts, comp_id, output_dir);
9+
end
10+
11+
fprintf('\n~~~~~~~~~~~~~~~~~~~~\n');
12+
fprintf('Results:\n');
13+
aps = [res(:).ap]';
14+
fprintf('%.1f\n', aps * 100);
15+
fprintf('%.1f\n', mean(aps) * 100);
16+
fprintf('~~~~~~~~~~~~~~~~~~~~\n');
17+
18+
function res = voc_eval_cls(cls, VOCopts, comp_id, output_dir)
19+
20+
test_set = VOCopts.testset;
21+
year = VOCopts.dataset(4:end);
22+
23+
addpath(fullfile(VOCopts.datadir, 'VOCcode'));
24+
25+
res_fn = sprintf(VOCopts.detrespath, comp_id, cls);
26+
27+
recall = [];
28+
prec = [];
29+
ap = 0;
30+
ap_auc = 0;
31+
32+
do_eval = (str2num(year) <= 2007) | ~strcmp(test_set, 'test');
33+
if do_eval
34+
% Bug in VOCevaldet requires that tic has been called first
35+
tic;
36+
[recall, prec, ap] = VOCevaldet(VOCopts, comp_id, cls, true);
37+
ap_auc = xVOCap(recall, prec);
38+
39+
% force plot limits
40+
ylim([0 1]);
41+
xlim([0 1]);
42+
43+
print(gcf, '-djpeg', '-r0', ...
44+
[output_dir '/' cls '_pr.jpg']);
45+
end
46+
fprintf('!!! %s : %.4f %.4f\n', cls, ap, ap_auc);
47+
48+
res.recall = recall;
49+
res.prec = prec;
50+
res.ap = ap;
51+
res.ap_auc = ap_auc;
52+
53+
save([output_dir '/' cls '_pr.mat'], ...
54+
'res', 'recall', 'prec', 'ap', 'ap_auc');
55+
56+
rmpath(fullfile(VOCopts.datadir, 'VOCcode'));
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function ap = xVOCap(rec,prec)
2+
% From the PASCAL VOC 2011 devkit
3+
4+
mrec=[0 ; rec ; 1];
5+
mpre=[0 ; prec ; 0];
6+
for i=numel(mpre)-1:-1:1
7+
mpre(i)=max(mpre(i),mpre(i+1));
8+
end
9+
i=find(mrec(2:end)~=mrec(1:end-1))+1;
10+
ap=sum((mrec(i)-mrec(i-1)).*mpre(i));
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------
2+
# Fast R-CNN
3+
# Copyright (c) 2015 Microsoft
4+
# Licensed under The MIT License [see LICENSE for details]
5+
# Written by Ross Girshick
6+
# --------------------------------------------------------
172 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)