def process_single_image(img, scale, crop, mean):
"""
Processing an image for zero-mean/std-dev fix etc
"""
new_shape = tf.pack([scale, scale])
img = tf.image.resize_images(img, new_shape[0], new_shape[1])
offset = (new_shape - crop) / 2
img = tf.slice(img, begin=tf.pack([offset[0], offset[1], 0]), size=tf.pack([crop, crop, -1]))
return tf.to_float(img) - mean
评论列表
文章目录