我想做一些随机增强,只在火车时间。
我已将增强合并为图表的一部分——我认为这是一种错误,因为同一个图表也用于测试——而且我不希望测试图像被增强。
x = tf.placeholder(tf.float32, shape=[None, _IMAGE_SIZE * _IMAGE_SIZE * _IMAGE_CHANNELS], name='Input')
y = tf.placeholder(tf.float32, shape=[None, _NUM_CLASSES], name='Output')
#reshape the input so we can apply conv2d########
x_image = tf.reshape(x, [-1,32,32,3])
x_image = tf.map_fn(lambda frame: tf.random_crop(frame, [_IMAGE_SIZE, _IMAGE_SIZE, _IMAGE_CHANNELS]), x_image)
x_image = tf.map_fn(lambda frame: tf.image.random_flip_left_right(frame), x_image)
x_image = tf.map_fn(lambda frame: tf.image.random_brightness(frame, max_delta=63), x_image)
x_image = tf.map_fn(lambda frame: tf.image.random_contrast(frame, lower=0.2, upper=1.8), x_image)
x_image = tf.map_fn(lambda frame: tf.image.per_image_standardization(frame), x_image)
我希望仅在测试时应用上述增强 - 怎么做?