This repository has been archived by the owner on Jul 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #399 from yuyu2172/cub-label-test
Add return_bb option to CUBDatasets and add a test
- Loading branch information
Showing
4 changed files
with
79 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import unittest | ||
|
||
import numpy as np | ||
|
||
from chainer import testing | ||
from chainer.testing import attr | ||
|
||
from chainercv.datasets import cub_label_names | ||
from chainercv.datasets import CUBLabelDataset | ||
from chainercv.utils import assert_is_bbox | ||
from chainercv.utils import assert_is_label_dataset | ||
|
||
|
||
@testing.parameterize( | ||
{'return_bb': True}, | ||
{'return_bb': False} | ||
) | ||
class TestCUBLabelDataset(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.dataset = CUBLabelDataset(return_bb=self.return_bb) | ||
|
||
@attr.slow | ||
def test_cub_label_dataset(self): | ||
assert_is_label_dataset( | ||
self.dataset, len(cub_label_names), n_example=10) | ||
if self.return_bb: | ||
idx = np.random.choice(np.arange(10)) | ||
_, _, bb = self.dataset[idx] | ||
assert_is_bbox(bb[np.newaxis]) | ||
|
||
|
||
testing.run_module(__name__, __file__) |