您好,欢迎来到钮旅网。
搜索
您的当前位置:首页pytorch中tensor转成图片保存

pytorch中tensor转成图片保存

来源:钮旅网
image_tensor为带有devices:cuda的三维tensor

image_numpy = image_tensor[0].cpu().float().numpy()  # convert it into a numpy array
image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0  # post-processing: tranpose and scaling
image_pil = Image.fromarray(image_numpy)
image_pil.save(image_path)

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- niushuan.com 版权所有 赣ICP备2024042780号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务