def test_crop(): img = _image() augmentor = Crop(size=(100, 200), resize=(200, 200)) result = augmentor(**{'image': img}) image = result['image'] _show_image(image) assert image.shape[0] == 100 assert image.shape[1] == 200 assert image.shape[2] == 3
PRE_PROCESSOR = Sequence([Resize(size=IMAGE_SIZE), PerImageStandardization()]) POST_PROCESSOR = None NETWORK = EasyDict() NETWORK.OPTIMIZER_CLASS = tf.train.MomentumOptimizer NETWORK.OPTIMIZER_KWARGS = {"momentum": 0.9} NETWORK.LEARNING_RATE_FUNC = tf.train.piecewise_constant NETWORK.LEARNING_RATE_KWARGS = { "values": [0.1, 0.01, 0.001, 0.0001], "boundaries": [40000, 60000, 80000], } NETWORK.IMAGE_SIZE = IMAGE_SIZE NETWORK.BATCH_SIZE = BATCH_SIZE NETWORK.DATA_FORMAT = DATA_FORMAT NETWORK.WEIGHT_DECAY_RATE = 0.0001 NETWORK.ACTIVATION_QUANTIZER = linear_mid_tread_half_quantizer NETWORK.ACTIVATION_QUANTIZER_KWARGS = {'bit': 2, 'max_value': 2} NETWORK.WEIGHT_QUANTIZER = binary_mean_scaling_quantizer NETWORK.WEIGHT_QUANTIZER_KWARGS = {} # dataset DATASET = EasyDict() DATASET.BATCH_SIZE = BATCH_SIZE DATASET.DATA_FORMAT = DATA_FORMAT DATASET.PRE_PROCESSOR = PRE_PROCESSOR DATASET.AUGMENTOR = Sequence([ Pad(2), Crop(size=IMAGE_SIZE), FlipLeftRight(), ])
NETWORK.LEARNING_RATE_FUNC = tf.train.polynomial_decay # TODO(wakiska): It is same as original yolov2 paper (batch size = 128). NETWORK.LEARNING_RATE_KWARGS = {"learning_rate": 1e-1, "decay_steps": 1600000, "power": 4.0, "end_learning_rate": 0.0} NETWORK.IMAGE_SIZE = IMAGE_SIZE NETWORK.BATCH_SIZE = BATCH_SIZE NETWORK.DATA_FORMAT = DATA_FORMAT NETWORK.WEIGHT_DECAY_RATE = 0.0005 NETWORK.ACTIVATION_QUANTIZER = linear_mid_tread_half_quantizer NETWORK.ACTIVATION_QUANTIZER_KWARGS = { 'bit': 2, 'max_value': 2.0, } NETWORK.WEIGHT_QUANTIZER = binary_channel_wise_mean_scaling_quantizer NETWORK.WEIGHT_QUANTIZER_KWARGS = {} NETWORK.QUANTIZE_FIRST_CONVOLUTION = True NETWORK.QUANTIZE_LAST_CONVOLUTION = False # dataset DATASET = EasyDict() DATASET.BATCH_SIZE = BATCH_SIZE DATASET.DATA_FORMAT = DATA_FORMAT DATASET.PRE_PROCESSOR = PRE_PROCESSOR DATASET.AUGMENTOR = Sequence([ Crop(size=IMAGE_SIZE, resize=256), FlipLeftRight(), Brightness((0.75, 1.25)), Color((0.75, 1.25)), Contrast((0.75, 1.25)), Hue((-10, 10)), ])