def preprocess_example(self, example, mode, unused_hparams): example["inputs"].set_shape([_CIFAR10_IMAGE_SIZE, _CIFAR10_IMAGE_SIZE, 3]) example["inputs"] = tf.to_int64(example["inputs"]) if mode == tf_estimator.ModeKeys.TRAIN: example["inputs"] = image_utils.random_shift( example["inputs"], wsr=0.1, hsr=0.1) return example
def preprocess_example(self, example, mode, unused_hparams): example["inputs"].set_shape([_CIFAR10_IMAGE_SIZE, _CIFAR10_IMAGE_SIZE, 3]) example["inputs"] = tf.to_int64(example["inputs"]) if mode == tf.estimator.ModeKeys.TRAIN: example["inputs"] = image_utils.random_shift( example["inputs"], wsr=0.1, hsr=0.1) return example
def testRandomShift(self): image = tf.random_normal([256, 256, 3]) image_shift = image_utils.random_shift(image, wsr=0.1, hsr=0.1) self.assertEqual(image_shift.shape, [256, 256, 3])
def testRandomShift(self): image = tf.random_normal([256, 256, 3]) image_shift = image_utils.random_shift(image, wsr=0.1, hsr=0.1) self.assertEqual(image_shift.shape, [256, 256, 3])