Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Commit 0840f0c

Browse files
committed
merge
2 parents b0c733e + 80401b1 commit 0840f0c

File tree

55 files changed

+991
-811
lines changed

Some content is hidden

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

55 files changed

+991
-811
lines changed

.pfnci/config.pbtxt

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
configs {
2+
key: "chainercv.py2.stable"
3+
value {
4+
requirement {
5+
cpu: 32
6+
memory: 64
7+
}
8+
time_limit: {
9+
seconds: 900
10+
}
11+
command: "sh .pfnci/tests.sh"
12+
environment_variables {
13+
key: "PYTHON"
14+
value: "2"
15+
}
16+
environment_variables {
17+
key: "CHAINER"
18+
value: "5.2.0"
19+
}
20+
}
21+
}
22+
23+
configs {
24+
key: "chainercv.py3.stable"
25+
value {
26+
requirement {
27+
cpu: 32
28+
memory: 64
29+
}
30+
time_limit: {
31+
seconds: 900
32+
}
33+
command: "sh .pfnci/tests.sh"
34+
environment_variables {
35+
key: "PYTHON"
36+
value: "3"
37+
}
38+
environment_variables {
39+
key: "CHAINER"
40+
value: "5.2.0"
41+
}
42+
}
43+
}
44+
45+
configs {
46+
key: "chainercv.py2.latest"
47+
value {
48+
requirement {
49+
cpu: 32
50+
memory: 64
51+
}
52+
time_limit: {
53+
seconds: 900
54+
}
55+
command: "sh .pfnci/tests.sh"
56+
environment_variables {
57+
key: "PYTHON"
58+
value: "2"
59+
}
60+
environment_variables {
61+
key: "CHAINER"
62+
value: "6.0.0b2"
63+
}
64+
}
65+
}
66+
67+
configs {
68+
key: "chainercv.py3.latest"
69+
value {
70+
requirement {
71+
cpu: 32
72+
memory: 64
73+
}
74+
time_limit: {
75+
seconds: 900
76+
}
77+
command: "sh .pfnci/tests.sh"
78+
environment_variables {
79+
key: "PYTHON"
80+
value: "3"
81+
}
82+
environment_variables {
83+
key: "CHAINER"
84+
value: "6.0.0b2"
85+
}
86+
}
87+
}
88+
89+
configs {
90+
key: "chainercv.py2.stable.gpu"
91+
value {
92+
requirement {
93+
cpu: 4
94+
memory: 16
95+
gpu: 1
96+
}
97+
command: "sh .pfnci/tests_gpu.sh"
98+
environment_variables {
99+
key: "PYTHON"
100+
value: "2"
101+
}
102+
environment_variables {
103+
key: "CHAINER"
104+
value: "5.2.0"
105+
}
106+
}
107+
}
108+
109+
configs {
110+
key: "chainercv.py3.stable.gpu"
111+
value {
112+
requirement {
113+
cpu: 4
114+
memory: 16
115+
gpu: 1
116+
}
117+
command: "sh .pfnci/tests_gpu.sh"
118+
environment_variables {
119+
key: "PYTHON"
120+
value: "3"
121+
}
122+
environment_variables {
123+
key: "CHAINER"
124+
value: "5.2.0"
125+
}
126+
}
127+
}
128+
129+
configs {
130+
key: "chainercv.py2.latest.gpu"
131+
value {
132+
requirement {
133+
cpu: 4
134+
memory: 16
135+
gpu: 1
136+
}
137+
command: "sh .pfnci/tests_gpu.sh"
138+
environment_variables {
139+
key: "PYTHON"
140+
value: "2"
141+
}
142+
environment_variables {
143+
key: "CHAINER"
144+
value: "6.0.0b2"
145+
}
146+
}
147+
}
148+
149+
configs {
150+
key: "chainercv.py3.latest.gpu"
151+
value {
152+
requirement {
153+
cpu: 4
154+
memory: 16
155+
gpu: 1
156+
}
157+
command: "sh .pfnci/tests_gpu.sh"
158+
environment_variables {
159+
key: "PYTHON"
160+
value: "3"
161+
}
162+
environment_variables {
163+
key: "CHAINER"
164+
value: "6.0.0b2"
165+
}
166+
}
167+
}

.pfnci/tests.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /usr/bin/env sh
2+
set -eux
3+
4+
TEMP=$(mktemp -d)
5+
mount -t tmpfs tmpfs ${TEMP}/ -o size=100%
6+
apt-get install -y --no-install-recommends unzip
7+
gsutil -q cp gs://chainercv-pfn-public-ci/datasets-tiny.zip ${TEMP}/
8+
unzip -q ${TEMP}/datasets-tiny.zip -d ${TEMP}/
9+
rm ${TEMP}/datasets-tiny.zip
10+
11+
docker run --interactive --rm \
12+
--volume $(pwd):/chainercv/ --workdir /chainercv/ \
13+
--volume ${TEMP}/.chainer/:/root/.chainer/ \
14+
--env MPLBACKEND=agg \
15+
hakuyume/chainercv:chainer${CHAINER}-devel \
16+
sh -ex << EOD
17+
pip${PYTHON} install --user pytest-xdist
18+
pip${PYTHON} install --user -e .
19+
python${PYTHON} -m pytest --color=no -n $(nproc) \
20+
-m 'not pfnci_skip and not gpu and not mpi' tests/
21+
mpiexec -n 2 --allow-run-as-root \
22+
python${PYTHON} -m pytest --color=no \
23+
-m 'not pfnci_skip and not gpu and mpi' tests/
24+
EOD

.pfnci/tests_gpu.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /usr/bin/env sh
2+
set -eux
3+
4+
TEMP=$(mktemp -d)
5+
mount -t tmpfs tmpfs ${TEMP}/ -o size=100%
6+
mkdir -p ${TEMP}/.chainer
7+
8+
docker run --runtime=nvidia --interactive --rm \
9+
--volume $(pwd):/chainercv/ --workdir /chainercv/ \
10+
--volume ${TEMP}/.chainer/:/root/.chainer/ \
11+
--env MPLBACKEND=agg \
12+
hakuyume/chainercv:chainer${CHAINER}-devel \
13+
sh -ex << EOD
14+
pip${PYTHON} install --user -e .
15+
python${PYTHON} -m pytest --color=no \
16+
-m 'not pfnci_skip and gpu and not mpi' tests/
17+
mpiexec -n 2 --allow-run-as-root \
18+
python${PYTHON} -m pytest --color=no \
19+
-m 'not pfnci_skip and gpu and mpi' tests/
20+
EOD

chainercv/evaluations/eval_detection_voc.py

Lines changed: 33 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,12 @@ def eval_detection_voc(
1919
The code is based on the evaluation code used in PASCAL VOC Challenge.
2020
2121
Args:
22-
pred_bboxes (iterable of numpy.ndarray): An iterable of :math:`N`
23-
sets of bounding boxes.
24-
Its index corresponds to an index for the base dataset.
25-
Each element of :obj:`pred_bboxes` is a set of coordinates
26-
of bounding boxes. This is an array whose shape is :math:`(R, 4)`,
27-
where :math:`R` corresponds
28-
to the number of bounding boxes, which may vary among boxes.
29-
The second axis corresponds to
30-
:math:`y_{min}, x_{min}, y_{max}, x_{max}` of a bounding box.
31-
pred_labels (iterable of numpy.ndarray): An iterable of labels.
32-
Similar to :obj:`pred_bboxes`, its index corresponds to an
33-
index for the base dataset. Its length is :math:`N`.
34-
pred_scores (iterable of numpy.ndarray): An iterable of confidence
35-
scores for predicted bounding boxes. Similar to :obj:`pred_bboxes`,
36-
its index corresponds to an index for the base dataset.
37-
Its length is :math:`N`.
38-
gt_bboxes (iterable of numpy.ndarray): An iterable of ground truth
39-
bounding boxes
40-
whose length is :math:`N`. An element of :obj:`gt_bboxes` is a
41-
bounding box whose shape is :math:`(R, 4)`. Note that the number of
42-
bounding boxes in each image does not need to be same as the number
43-
of corresponding predicted boxes.
44-
gt_labels (iterable of numpy.ndarray): An iterable of ground truth
45-
labels which are organized similarly to :obj:`gt_bboxes`.
46-
gt_difficults (iterable of numpy.ndarray): An iterable of boolean
47-
arrays which is organized similarly to :obj:`gt_bboxes`.
48-
This tells whether the
49-
corresponding ground truth bounding box is difficult or not.
22+
pred_bboxes (iterable of numpy.ndarray): See the table below.
23+
pred_labels (iterable of numpy.ndarray): See the table below.
24+
pred_scores (iterable of numpy.ndarray): See the table below.
25+
gt_bboxes (iterable of numpy.ndarray): See the table below.
26+
gt_labels (iterable of numpy.ndarray): See the table below.
27+
gt_difficults (iterable of numpy.ndarray): See the table below.
5028
By default, this is :obj:`None`. In that case, this function
5129
considers all bounding boxes to be not difficult.
5230
iou_thresh (float): A prediction is correct if its Intersection over
@@ -55,6 +33,21 @@ def eval_detection_voc(
5533
for calculating average precision. The default value is
5634
:obj:`False`.
5735
36+
.. csv-table::
37+
:header: name, shape, dtype, format
38+
39+
:obj:`pred_bboxes`, ":math:`[(R, 4)]`", :obj:`float32`, \
40+
":math:`(y_{min}, x_{min}, y_{max}, x_{max})`"
41+
:obj:`pred_labels`, ":math:`[(R,)]`", :obj:`int32`, \
42+
":math:`[0, \#fg\_class - 1]`"
43+
:obj:`pred_scores`, ":math:`[(R,)]`", :obj:`float32`, \
44+
--
45+
:obj:`gt_bboxes`, ":math:`[(R, 4)]`", :obj:`float32`, \
46+
":math:`(y_{min}, x_{min}, y_{max}, x_{max})`"
47+
:obj:`gt_labels`, ":math:`[(R,)]`", :obj:`int32`, \
48+
":math:`[0, \#fg\_class - 1]`"
49+
:obj:`gt_difficults`, ":math:`[(R,)]`", :obj:`bool`, --
50+
5851
Returns:
5952
dict:
6053
@@ -92,34 +85,18 @@ def calc_detection_voc_prec_rec(
9285
The code is based on the evaluation code used in PASCAL VOC Challenge.
9386
9487
Args:
95-
pred_bboxes (iterable of numpy.ndarray): An iterable of :math:`N`
96-
sets of bounding boxes.
97-
Its index corresponds to an index for the base dataset.
98-
Each element of :obj:`pred_bboxes` is a set of coordinates
99-
of bounding boxes. This is an array whose shape is :math:`(R, 4)`,
100-
where :math:`R` corresponds
101-
to the number of bounding boxes, which may vary among boxes.
102-
The second axis corresponds to
103-
:math:`y_{min}, x_{min}, y_{max}, x_{max}` of a bounding box.
104-
pred_labels (iterable of numpy.ndarray): An iterable of labels.
105-
Similar to :obj:`pred_bboxes`, its index corresponds to an
106-
index for the base dataset. Its length is :math:`N`.
107-
pred_scores (iterable of numpy.ndarray): An iterable of confidence
108-
scores for predicted bounding boxes. Similar to :obj:`pred_bboxes`,
109-
its index corresponds to an index for the base dataset.
110-
Its length is :math:`N`.
111-
gt_bboxes (iterable of numpy.ndarray): An iterable of ground truth
112-
bounding boxes
113-
whose length is :math:`N`. An element of :obj:`gt_bboxes` is a
114-
bounding box whose shape is :math:`(R, 4)`. Note that the number of
115-
bounding boxes in each image does not need to be same as the number
116-
of corresponding predicted boxes.
117-
gt_labels (iterable of numpy.ndarray): An iterable of ground truth
118-
labels which are organized similarly to :obj:`gt_bboxes`.
119-
gt_difficults (iterable of numpy.ndarray): An iterable of boolean
120-
arrays which is organized similarly to :obj:`gt_bboxes`.
121-
This tells whether the
122-
corresponding ground truth bounding box is difficult or not.
88+
pred_bboxes (iterable of numpy.ndarray): See the table in
89+
:func:`chainercv.evaluations.eval_detection_voc`.
90+
pred_labels (iterable of numpy.ndarray): See the table in
91+
:func:`chainercv.evaluations.eval_detection_voc`.
92+
pred_scores (iterable of numpy.ndarray): See the table in
93+
:func:`chainercv.evaluations.eval_detection_voc`.
94+
gt_bboxes (iterable of numpy.ndarray): See the table in
95+
:func:`chainercv.evaluations.eval_detection_voc`.
96+
gt_labels (iterable of numpy.ndarray): See the table in
97+
:func:`chainercv.evaluations.eval_detection_voc`.
98+
gt_difficults (iterable of numpy.ndarray): See the table in
99+
:func:`chainercv.evaluations.eval_detection_voc`.
123100
By default, this is :obj:`None`. In that case, this function
124101
considers all bounding boxes to be not difficult.
125102
iou_thresh (float): A prediction is correct if its Intersection over

chainercv/evaluations/eval_instance_segmentation_voc.py

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,29 @@ def eval_instance_segmentation_voc(
2121
.. _`FCIS`: https://arxiv.org/abs/1611.07709
2222
2323
Args:
24-
pred_masks (iterable of numpy.ndarray): An iterable of :math:`N`
25-
sets of masks. Its index corresponds to an index for the base
26-
dataset. Each element of :obj:`pred_masks` is an object mask
27-
and is an array whose shape is :math:`(R, H, W)`,
28-
where :math:`R` corresponds
29-
to the number of masks, which may vary among images.
30-
pred_labels (iterable of numpy.ndarray): An iterable of labels.
31-
Similar to :obj:`pred_masks`, its index corresponds to an
32-
index for the base dataset. Its length is :math:`N`.
33-
pred_scores (iterable of numpy.ndarray): An iterable of confidence
34-
scores for predicted masks. Similar to :obj:`pred_masks`,
35-
its index corresponds to an index for the base dataset.
36-
Its length is :math:`N`.
37-
gt_masks (iterable of numpy.ndarray): An iterable of ground truth
38-
masks whose length is :math:`N`. An element of :obj:`gt_masks` is
39-
an object mask whose shape is :math:`(R, H, W)`. Note that the
40-
number of masks :math:`R` in each image does not need to be
41-
same as the number of corresponding predicted masks.
42-
gt_labels (iterable of numpy.ndarray): An iterable of ground truth
43-
labels which are organized similarly to :obj:`gt_masks`. Its
44-
length is :math:`N`.
24+
pred_masks (iterable of numpy.ndarray): See the table below.
25+
pred_labels (iterable of numpy.ndarray): See the table below.
26+
pred_scores (iterable of numpy.ndarray): See the table below.
27+
gt_masks (iterable of numpy.ndarray): See the table below.
28+
gt_labels (iterable of numpy.ndarray): See the table below.
4529
iou_thresh (float): A prediction is correct if its Intersection over
4630
Union with the ground truth is above this value.
4731
use_07_metric (bool): Whether to use PASCAL VOC 2007 evaluation metric
4832
for calculating average precision. The default value is
4933
:obj:`False`.
5034
35+
.. csv-table::
36+
:header: name, shape, dtype, format
37+
38+
:obj:`pred_masks`, ":math:`[(R, H, W)]`", :obj:`bool`, --
39+
:obj:`pred_labels`, ":math:`[(R,)]`", :obj:`int32`, \
40+
":math:`[0, \#fg\_class - 1]`"
41+
:obj:`pred_scores`, ":math:`[(R,)]`", :obj:`float32`, \
42+
--
43+
:obj:`gt_masks`, ":math:`[(R, H, W)]`", :obj:`bool`, --
44+
:obj:`gt_labels`, ":math:`[(R,)]`", :obj:`int32`, \
45+
":math:`[0, \#fg\_class - 1]`"
46+
5147
Returns:
5248
dict:
5349

0 commit comments

Comments
 (0)