tf_utils.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:thesis_scripts 作者: PhilippKopp 项目源码 文件源码
def subtract_mean_multi(image_tensors, mean_image_path, channels=NUM_CHANNELS, image_size=512):

    mean_image = tf.convert_to_tensor(mean_image_path, dtype=tf.string)
    mean_file_contents = tf.read_file(mean_image)
    mean_uint8 = tf.image.decode_png(mean_file_contents, channels=channels)
    mean_uint8.set_shape([image_size, image_size, channels])


    images_mean_free = []
    for image_tensor in image_tensors:
        image_tensor.set_shape([image_size, image_size, channels])
        image = tf.cast(image_tensor, tf.float32)

        #subtract mean image
        image_mean_free = tf.subtract(image, tf.cast(mean_uint8, tf.float32))
        images_mean_free.append(image_mean_free)

    return images_mean_free
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号