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

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyu2172 committed Mar 15, 2019
2 parents b0c733e + 80401b1 commit 0840f0c
Show file tree
Hide file tree
Showing 55 changed files with 991 additions and 811 deletions.
167 changes: 167 additions & 0 deletions .pfnci/config.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
configs {
key: "chainercv.py2.stable"
value {
requirement {
cpu: 32
memory: 64
}
time_limit: {
seconds: 900
}
command: "sh .pfnci/tests.sh"
environment_variables {
key: "PYTHON"
value: "2"
}
environment_variables {
key: "CHAINER"
value: "5.2.0"
}
}
}

configs {
key: "chainercv.py3.stable"
value {
requirement {
cpu: 32
memory: 64
}
time_limit: {
seconds: 900
}
command: "sh .pfnci/tests.sh"
environment_variables {
key: "PYTHON"
value: "3"
}
environment_variables {
key: "CHAINER"
value: "5.2.0"
}
}
}

configs {
key: "chainercv.py2.latest"
value {
requirement {
cpu: 32
memory: 64
}
time_limit: {
seconds: 900
}
command: "sh .pfnci/tests.sh"
environment_variables {
key: "PYTHON"
value: "2"
}
environment_variables {
key: "CHAINER"
value: "6.0.0b2"
}
}
}

configs {
key: "chainercv.py3.latest"
value {
requirement {
cpu: 32
memory: 64
}
time_limit: {
seconds: 900
}
command: "sh .pfnci/tests.sh"
environment_variables {
key: "PYTHON"
value: "3"
}
environment_variables {
key: "CHAINER"
value: "6.0.0b2"
}
}
}

configs {
key: "chainercv.py2.stable.gpu"
value {
requirement {
cpu: 4
memory: 16
gpu: 1
}
command: "sh .pfnci/tests_gpu.sh"
environment_variables {
key: "PYTHON"
value: "2"
}
environment_variables {
key: "CHAINER"
value: "5.2.0"
}
}
}

configs {
key: "chainercv.py3.stable.gpu"
value {
requirement {
cpu: 4
memory: 16
gpu: 1
}
command: "sh .pfnci/tests_gpu.sh"
environment_variables {
key: "PYTHON"
value: "3"
}
environment_variables {
key: "CHAINER"
value: "5.2.0"
}
}
}

configs {
key: "chainercv.py2.latest.gpu"
value {
requirement {
cpu: 4
memory: 16
gpu: 1
}
command: "sh .pfnci/tests_gpu.sh"
environment_variables {
key: "PYTHON"
value: "2"
}
environment_variables {
key: "CHAINER"
value: "6.0.0b2"
}
}
}

configs {
key: "chainercv.py3.latest.gpu"
value {
requirement {
cpu: 4
memory: 16
gpu: 1
}
command: "sh .pfnci/tests_gpu.sh"
environment_variables {
key: "PYTHON"
value: "3"
}
environment_variables {
key: "CHAINER"
value: "6.0.0b2"
}
}
}
24 changes: 24 additions & 0 deletions .pfnci/tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /usr/bin/env sh
set -eux

TEMP=$(mktemp -d)
mount -t tmpfs tmpfs ${TEMP}/ -o size=100%
apt-get install -y --no-install-recommends unzip
gsutil -q cp gs://chainercv-pfn-public-ci/datasets-tiny.zip ${TEMP}/
unzip -q ${TEMP}/datasets-tiny.zip -d ${TEMP}/
rm ${TEMP}/datasets-tiny.zip

docker run --interactive --rm \
--volume $(pwd):/chainercv/ --workdir /chainercv/ \
--volume ${TEMP}/.chainer/:/root/.chainer/ \
--env MPLBACKEND=agg \
hakuyume/chainercv:chainer${CHAINER}-devel \
sh -ex << EOD
pip${PYTHON} install --user pytest-xdist
pip${PYTHON} install --user -e .
python${PYTHON} -m pytest --color=no -n $(nproc) \
-m 'not pfnci_skip and not gpu and not mpi' tests/
mpiexec -n 2 --allow-run-as-root \
python${PYTHON} -m pytest --color=no \
-m 'not pfnci_skip and not gpu and mpi' tests/
EOD
20 changes: 20 additions & 0 deletions .pfnci/tests_gpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /usr/bin/env sh
set -eux

TEMP=$(mktemp -d)
mount -t tmpfs tmpfs ${TEMP}/ -o size=100%
mkdir -p ${TEMP}/.chainer

docker run --runtime=nvidia --interactive --rm \
--volume $(pwd):/chainercv/ --workdir /chainercv/ \
--volume ${TEMP}/.chainer/:/root/.chainer/ \
--env MPLBACKEND=agg \
hakuyume/chainercv:chainer${CHAINER}-devel \
sh -ex << EOD
pip${PYTHON} install --user -e .
python${PYTHON} -m pytest --color=no \
-m 'not pfnci_skip and gpu and not mpi' tests/
mpiexec -n 2 --allow-run-as-root \
python${PYTHON} -m pytest --color=no \
-m 'not pfnci_skip and gpu and mpi' tests/
EOD
89 changes: 33 additions & 56 deletions chainercv/evaluations/eval_detection_voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,12 @@ def eval_detection_voc(
The code is based on the evaluation code used in PASCAL VOC Challenge.
Args:
pred_bboxes (iterable of numpy.ndarray): An iterable of :math:`N`
sets of bounding boxes.
Its index corresponds to an index for the base dataset.
Each element of :obj:`pred_bboxes` is a set of coordinates
of bounding boxes. This is an array whose shape is :math:`(R, 4)`,
where :math:`R` corresponds
to the number of bounding boxes, which may vary among boxes.
The second axis corresponds to
:math:`y_{min}, x_{min}, y_{max}, x_{max}` of a bounding box.
pred_labels (iterable of numpy.ndarray): An iterable of labels.
Similar to :obj:`pred_bboxes`, its index corresponds to an
index for the base dataset. Its length is :math:`N`.
pred_scores (iterable of numpy.ndarray): An iterable of confidence
scores for predicted bounding boxes. Similar to :obj:`pred_bboxes`,
its index corresponds to an index for the base dataset.
Its length is :math:`N`.
gt_bboxes (iterable of numpy.ndarray): An iterable of ground truth
bounding boxes
whose length is :math:`N`. An element of :obj:`gt_bboxes` is a
bounding box whose shape is :math:`(R, 4)`. Note that the number of
bounding boxes in each image does not need to be same as the number
of corresponding predicted boxes.
gt_labels (iterable of numpy.ndarray): An iterable of ground truth
labels which are organized similarly to :obj:`gt_bboxes`.
gt_difficults (iterable of numpy.ndarray): An iterable of boolean
arrays which is organized similarly to :obj:`gt_bboxes`.
This tells whether the
corresponding ground truth bounding box is difficult or not.
pred_bboxes (iterable of numpy.ndarray): See the table below.
pred_labels (iterable of numpy.ndarray): See the table below.
pred_scores (iterable of numpy.ndarray): See the table below.
gt_bboxes (iterable of numpy.ndarray): See the table below.
gt_labels (iterable of numpy.ndarray): See the table below.
gt_difficults (iterable of numpy.ndarray): See the table below.
By default, this is :obj:`None`. In that case, this function
considers all bounding boxes to be not difficult.
iou_thresh (float): A prediction is correct if its Intersection over
Expand All @@ -55,6 +33,21 @@ def eval_detection_voc(
for calculating average precision. The default value is
:obj:`False`.
.. csv-table::
:header: name, shape, dtype, format
:obj:`pred_bboxes`, ":math:`[(R, 4)]`", :obj:`float32`, \
":math:`(y_{min}, x_{min}, y_{max}, x_{max})`"
:obj:`pred_labels`, ":math:`[(R,)]`", :obj:`int32`, \
":math:`[0, \#fg\_class - 1]`"
:obj:`pred_scores`, ":math:`[(R,)]`", :obj:`float32`, \
--
:obj:`gt_bboxes`, ":math:`[(R, 4)]`", :obj:`float32`, \
":math:`(y_{min}, x_{min}, y_{max}, x_{max})`"
:obj:`gt_labels`, ":math:`[(R,)]`", :obj:`int32`, \
":math:`[0, \#fg\_class - 1]`"
:obj:`gt_difficults`, ":math:`[(R,)]`", :obj:`bool`, --
Returns:
dict:
Expand Down Expand Up @@ -92,34 +85,18 @@ def calc_detection_voc_prec_rec(
The code is based on the evaluation code used in PASCAL VOC Challenge.
Args:
pred_bboxes (iterable of numpy.ndarray): An iterable of :math:`N`
sets of bounding boxes.
Its index corresponds to an index for the base dataset.
Each element of :obj:`pred_bboxes` is a set of coordinates
of bounding boxes. This is an array whose shape is :math:`(R, 4)`,
where :math:`R` corresponds
to the number of bounding boxes, which may vary among boxes.
The second axis corresponds to
:math:`y_{min}, x_{min}, y_{max}, x_{max}` of a bounding box.
pred_labels (iterable of numpy.ndarray): An iterable of labels.
Similar to :obj:`pred_bboxes`, its index corresponds to an
index for the base dataset. Its length is :math:`N`.
pred_scores (iterable of numpy.ndarray): An iterable of confidence
scores for predicted bounding boxes. Similar to :obj:`pred_bboxes`,
its index corresponds to an index for the base dataset.
Its length is :math:`N`.
gt_bboxes (iterable of numpy.ndarray): An iterable of ground truth
bounding boxes
whose length is :math:`N`. An element of :obj:`gt_bboxes` is a
bounding box whose shape is :math:`(R, 4)`. Note that the number of
bounding boxes in each image does not need to be same as the number
of corresponding predicted boxes.
gt_labels (iterable of numpy.ndarray): An iterable of ground truth
labels which are organized similarly to :obj:`gt_bboxes`.
gt_difficults (iterable of numpy.ndarray): An iterable of boolean
arrays which is organized similarly to :obj:`gt_bboxes`.
This tells whether the
corresponding ground truth bounding box is difficult or not.
pred_bboxes (iterable of numpy.ndarray): See the table in
:func:`chainercv.evaluations.eval_detection_voc`.
pred_labels (iterable of numpy.ndarray): See the table in
:func:`chainercv.evaluations.eval_detection_voc`.
pred_scores (iterable of numpy.ndarray): See the table in
:func:`chainercv.evaluations.eval_detection_voc`.
gt_bboxes (iterable of numpy.ndarray): See the table in
:func:`chainercv.evaluations.eval_detection_voc`.
gt_labels (iterable of numpy.ndarray): See the table in
:func:`chainercv.evaluations.eval_detection_voc`.
gt_difficults (iterable of numpy.ndarray): See the table in
:func:`chainercv.evaluations.eval_detection_voc`.
By default, this is :obj:`None`. In that case, this function
considers all bounding boxes to be not difficult.
iou_thresh (float): A prediction is correct if its Intersection over
Expand Down
38 changes: 17 additions & 21 deletions chainercv/evaluations/eval_instance_segmentation_voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,29 @@ def eval_instance_segmentation_voc(
.. _`FCIS`: https://arxiv.org/abs/1611.07709
Args:
pred_masks (iterable of numpy.ndarray): An iterable of :math:`N`
sets of masks. Its index corresponds to an index for the base
dataset. Each element of :obj:`pred_masks` is an object mask
and is an array whose shape is :math:`(R, H, W)`,
where :math:`R` corresponds
to the number of masks, which may vary among images.
pred_labels (iterable of numpy.ndarray): An iterable of labels.
Similar to :obj:`pred_masks`, its index corresponds to an
index for the base dataset. Its length is :math:`N`.
pred_scores (iterable of numpy.ndarray): An iterable of confidence
scores for predicted masks. Similar to :obj:`pred_masks`,
its index corresponds to an index for the base dataset.
Its length is :math:`N`.
gt_masks (iterable of numpy.ndarray): An iterable of ground truth
masks whose length is :math:`N`. An element of :obj:`gt_masks` is
an object mask whose shape is :math:`(R, H, W)`. Note that the
number of masks :math:`R` in each image does not need to be
same as the number of corresponding predicted masks.
gt_labels (iterable of numpy.ndarray): An iterable of ground truth
labels which are organized similarly to :obj:`gt_masks`. Its
length is :math:`N`.
pred_masks (iterable of numpy.ndarray): See the table below.
pred_labels (iterable of numpy.ndarray): See the table below.
pred_scores (iterable of numpy.ndarray): See the table below.
gt_masks (iterable of numpy.ndarray): See the table below.
gt_labels (iterable of numpy.ndarray): See the table below.
iou_thresh (float): A prediction is correct if its Intersection over
Union with the ground truth is above this value.
use_07_metric (bool): Whether to use PASCAL VOC 2007 evaluation metric
for calculating average precision. The default value is
:obj:`False`.
.. csv-table::
:header: name, shape, dtype, format
:obj:`pred_masks`, ":math:`[(R, H, W)]`", :obj:`bool`, --
:obj:`pred_labels`, ":math:`[(R,)]`", :obj:`int32`, \
":math:`[0, \#fg\_class - 1]`"
:obj:`pred_scores`, ":math:`[(R,)]`", :obj:`float32`, \
--
:obj:`gt_masks`, ":math:`[(R, H, W)]`", :obj:`bool`, --
:obj:`gt_labels`, ":math:`[(R,)]`", :obj:`int32`, \
":math:`[0, \#fg\_class - 1]`"
Returns:
dict:
Expand Down
Loading

0 comments on commit 0840f0c

Please sign in to comment.