utils.py 文件源码

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

项目:FastNeuralStyle 作者: bengxy 项目源码 文件源码
def X2img(X, image_name, mod='rgb'):
    if mod=='bgr':
        (b,g,r) = torch.chunk(X, 3)
        X = torch.cat((r,g,b))
    img = X.clone().cpu().clamp(0,255).numpy()
    img = img.transpose(1,2,0).astype('uint8')
    img = Image.fromarray(img)
    img.save(image_name)

# load image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号