def _train_preprocess(reshaped_image, args):
# Image processing for training the network. Note the many random
# distortions applied to the image.
# Randomly crop a [height, width] section of the image.
reshaped_image = tf.random_crop(reshaped_image, [args.crop_size[0], args.crop_size[1], args.num_channels])
# Randomly flip the image horizontally.
reshaped_image = tf.image.random_flip_left_right(reshaped_image)
# Because these operations are not commutative, consider randomizing
# the order their operation.
reshaped_image = tf.image.random_brightness(reshaped_image,
max_delta=63)
# Randomly changing contrast of the image
reshaped_image = tf.image.random_contrast(reshaped_image,
lower=0.2, upper=1.8)
# Subtract off the mean and divide by the variance of the pixels.
reshaped_image = tf.image.per_image_standardization(reshaped_image)
# Set the shapes of tensors.
reshaped_image.set_shape([args.crop_size[0], args.crop_size[1], args.num_channels])
#read_input.label.set_shape([1])
return reshaped_image
data_loader.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录