def distort_op(self, image_tensor):
""" copied from tensorflow cifar10 tutorial"""
# Randomly crop a [height, width] section of the image.
distorted_image = tf.random_crop(image_tensor, [self.shape[0],self.shape[1], self.channels])
# Randomly flip the image horizontally.
distorted_image = tf.image.random_flip_left_right(distorted_image)
# Because these operations are not commutative, consider randomizing
# the order their operation.
# distorted_image = tf.image.random_brightness(distorted_image,
# max_delta=63)
# distorted_image = tf.image.random_contrast(distorted_image,
# lower=0.2, upper=1.8)
return distorted_image
评论列表
文章目录