utils.py 文件源码

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

项目:fast-neural-style 作者: coder-james 项目源码 文件源码
def get_image(filepath, height, width, preprocess_fn, queue=None):
    png = filepath.lower().endswith('png')
    if queue is None:
      img_bytes = tf.read_file(filepath)
    else:
      reader = tf.WholeFileReader()
      _, img_bytes = reader.read(queue)

    image = tf.image.decode_png(img_bytes, channels=3) if png else tf.image.decode_jpeg(img_bytes, channels=3)
    return preprocess_fn(image, height, width)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号