-
Notifications
You must be signed in to change notification settings - Fork 303
Conversation
self.assertIsInstance(bbox, np.ndarray) | ||
self.assertEqual(bbox.dtype, np.float32) | ||
self.assertEqual(bbox.ndim, 2) | ||
self.assertEqual(bbox.shape[1], 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about checking if x_min < x_max
?
@@ -61,6 +61,8 @@ class VOCDetectionDataset(chainer.dataset.DatasetMixin): | |||
return_difficult (bool): If true, this dataset returns a boolean array | |||
that indicates whether bounding boxes are labeled as difficult | |||
or not. The default value is :obj:`False`. | |||
If :obj:`use_difficult` is :obj:`False`, this has to be | |||
:obj:`False`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about returning a false array as difficult
when use_difficult=False and return_difficult=True
?
|
||
@attr.slow | ||
def test_get_example(self): | ||
for i in np.random.randint(0, len(self.dataset), size=(10,)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use chainer.testing.condition.repeat
.
The maximum coordinates in bounding boxes should be smaller than height and width of an image. |
@@ -124,7 +125,12 @@ def get_example(self, i): | |||
label.append(voc_utils.voc_detection_label_names.index(name)) | |||
bbox = np.stack(bbox).astype(np.float32) | |||
label = np.stack(label).astype(np.int32) | |||
difficult = np.array(difficult, dtype=np.bool) | |||
if self.use_difficult: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
statement is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying that np.array(difficult, dtype=bool)
should be called after if return_difficult
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean that difficult = np.array(difficult, dtype=np.bool)
is enough. If use_difficult
is False, difficult
becomes [False, False, ... ]
because it skips difficult GTs (https://github.com/yuyu2172/chainercv/blob/52714429cc7b87c12a5f40a49f8a58c77149c66e/chainercv/datasets/voc/voc_detection_dataset.py#L116-L117). So, we can use difficult = np.array(difficult, dtype=np.bool)
to make a False array.
Perhaps, we can add a utility function @Hakuyume |
Nice. Should I close this PR? |
No. I want to merge this PR before mine. Now I'm checking this PR. So could you leave this PR open? |
OK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This test does not check the data downloader.