@testing.parameterize(*testing.product_dict([ { 'size': (48, 96), 'scaled_size': (32, 64), 'y_offset': 8, 'x_offset': 16 }, { 'size': (16, 68), 'scaled_size': (16, 32), 'y_offset': 0, 'x_offset': 18 }, { 'size': (24, 16), 'scaled_size': (8, 16), 'y_offset': 8, 'x_offset': 0 }, { 'size': (47, 97), 'scaled_size': (32, 64), 'y_offset': 7, 'x_offset': 16 }, ], [ { 'fill': 128 }, { 'fill': (104, 117, 123) }, { 'fill': np.random.uniform(255, size=(3, 1, 1)) }, ], [ { 'interpolation': PIL.Image.NEAREST }, { 'interpolation': PIL.Image.BILINEAR }, { 'interpolation': PIL.Image.BICUBIC }, { 'interpolation': PIL.Image.LANCZOS }, ]))
@testing.parameterize(*(testing.product_dict([ { 'pick': 'prob', 'shapes': (1, 200), 'n_class': 200 }, { 'pick': 'res5', 'shapes': (1, 2048, 7, 7), 'n_class': None }, { 'pick': ['res2', 'conv1'], 'shapes': ((1, 256, 56, 56), (1, 64, 112, 112)), 'n_class': None }, ], [ { 'model_class': ResNet50 }, { 'model_class': ResNet101 }, { 'model_class': ResNet152 }, ], [{ 'arch': 'fb' }, { 'arch': 'he' }])))
from chainercv.utils import testing @testing.parameterize(*(testing.product_dict([ { 'pick': 'softmax', 'shapes': (1, 200), 'n_class': 200 }, { 'pick': 'conv1', 'shapes': (1, 1280, 7, 7), 'n_class': None }, { 'pick': ['expanded_conv_2', 'conv'], 'shapes': ((1, 24, 56, 56), (1, 32, 112, 112)), 'n_class': None }, ], [ { 'model_class': MobileNetV2 }, ], [ { 'arch': 'tf' }, ]))) class TestMobileNetCall(unittest.TestCase): def setUp(self): self.link = self.model_class(n_class=self.n_class,
@testing.parameterize(*testing.product_dict( [ { 'iterable': tuple }, { 'iterable': list }, ], [ { 'keys': 'item1', 'func': lambda in_data: 'transformed_' + in_data[1], 'expected_sample': 'transformed_item1(3)', }, { 'keys': ('item1', ), 'func': lambda in_data: ('transformed_' + in_data[1], ), 'expected_sample': ('transformed_item1(3)', ), }, { 'keys': ('item0', 'item2'), 'func': lambda in_data: ('transformed_' + in_data[0], 'transformed_' + in_data[2]), 'expected_sample': ('transformed_item0(3)', 'transformed_item2(3)'), }, ], )) class TestTransformDataset(unittest.TestCase):
from chainer.testing import attr from chainer import Variable from chainercv.links import SEResNeXt101 from chainercv.links import SEResNeXt50 from chainercv.utils import testing @testing.parameterize(*( testing.product_dict( [ {'pick': 'prob', 'shapes': (1, 200), 'n_class': 200}, {'pick': 'res5', 'shapes': (1, 2048, 7, 7), 'n_class': None}, {'pick': ['res2', 'conv1'], 'shapes': ((1, 256, 56, 56), (1, 64, 112, 112)), 'n_class': None}, ], [ {'model_class': SEResNeXt50}, {'model_class': SEResNeXt101}, ], ) )) class TestSEResNeXtCall(unittest.TestCase): def setUp(self): self.link = self.model_class( n_class=self.n_class, pretrained_model=None) self.link.pick = self.pick def check_call(self):