1. 程式人生 > >Tensorflow 中資料增強

Tensorflow 中資料增強

影象

# Randomly crop a [height, width] section of the image.
distorted_image = tf.random_crop(reshaped_image, [height, width, 3])
# Randomly flip the image horizontally.  隨機翻轉圖片,50%的圖片被左右翻轉
distorted_image = tf.image.random_flip_left_right(distorted_image)
# Because these operations are not commutative, consider randomizing
# the order their operation. # change brightness and contrast ,both changed in the same picture 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)