def test_hue(self): for max_delta in [0.05, 0.10, 0.15]: options = preprocess_pb2.Preprocess() text_format.Merge( r""" random_hue_prob: 1.0 random_hue_max_delta: %.2lf """ % (max_delta), options) self._preprocess(options, "hue_%.2lf" % (max_delta))
def test_brightness(self): for max_delta in [0.4, 0.8]: options = preprocess_pb2.Preprocess() text_format.Merge( r""" random_brightness_prob: 1.0 random_brightness_max_delta: %.2lf """ % (max_delta), options) self._preprocess(options, "brightness_%.2lf" % (max_delta))
def test_flip(self): options = preprocess_pb2.Preprocess() text_format.Merge(r""" random_flip_left_right_prob: 0.5 """, options) self._preprocess(options, "flip_no") options.random_flip_left_right_prob = 1.0 self._preprocess(options, "flip_yes")
def test_contrast(self): for contrast in [0.4, 0.6, 0.8]: options = preprocess_pb2.Preprocess() text_format.Merge( r""" random_contrast_prob: 1.0 random_contrast_lower: %.2lf random_contrast_upper: %.2lf """ % (contrast, contrast + 0.01), options) self._preprocess(options, "contrast_%.2lf" % (contrast))
def test_saturation(self): for saturation in [0.4, 1.6]: options = preprocess_pb2.Preprocess() text_format.Merge( r""" random_saturation_prob: 1.0 random_saturation_lower: %.2lf random_saturation_upper: %.2lf """ % (saturation, saturation + 0.01), options) self._preprocess(options, "saturation_%.2lf" % (saturation))
def test_preprocess(self): for index in range(20): options = preprocess_pb2.Preprocess() text_format.Merge( r""" random_flip_left_right_prob: 0.5 random_crop_prob: 1.0 random_crop_min_scale: 0.6 random_brightness_prob: 0.8 random_brightness_max_delta: 0.2 random_contrast_prob: 0.8 random_contrast_lower: 0.7 random_contrast_upper: 1.0 random_hue_prob: 0.2 random_hue_max_delta: 0.10 random_saturation_prob: 0.8 random_saturation_lower: 0.6 random_saturation_upper: 1.4 """, options) self._preprocess(options, "preprocess_%i" % (index))