当前位置:网站首页>plt.savefig()的用法以及保存路径
plt.savefig()的用法以及保存路径
2022-06-28 12:55:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
图像有时候比数据更能满足人们的视觉需求
pytorch下保存图像有很多种方法,但是这些基本上都是基于图像处理的,将图像的像素指定一定的维度 ,具体可见以下博客:
Pytorch中保存图片的方式_造未来-CSDN博客_pytorch保存图片
主要是写一些函数来保存图片;
另外,pytorch中有很多可以直接保存图片的语句
如
save_image(fake_images, './img/fake_images-{}.png'.format(epoch + 1))
此语句同样需要转化像素。
那么如果
我只需要打开一个视窗,观察训练过程中图像的变化,我对图像像素保存没有什么需求,只是保存一个视窗,那么我需要的保存图像的函数仅仅是一个
plt.savefig
plt.savefig的用法以及保存的路径,及训练过程中不会被覆盖掉,可以上代码供大家参考
if epoch % 10== 0:
plt.title('ber:{:.3f},a: {:.3f},b:{:.3f},snr: {:.3f}'.format(
error_rate, a, b,M
))
plt.plot(r3) # 绘制波形
# save_image(r3, './img/fake_images-{}.png'.format(epoch + 1))
# print(type(r3))
# plt.draw()
plt.draw()
plt.savefig('./img/pic-{}.png'.format(epoch + 1))
plt.pause(1)
plt.close(fig1)
大功告成,可以看看保存后的图片
已经都整整齐齐的在我的保存路径下了。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/150676.html原文链接:https://javaforall.cn
边栏推荐
- STM32F1与STM32CubeIDE编程实例-矩阵键盘驱动
- [today in history] June 28: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born
- Jerry's wif interferes with Bluetooth [chapter]
- centos6.5 php+mysql mysql库找不到
- VS2012 VC新建一个空白窗口应用
- Après avoir échoué à l'examen d'entrée à l'Université de technologie de Harbin, vous devez rester à l'Université en tant que « chercheur » après avoir obtenu votre diplôme.
- ASP.NET CORE Study03
- I²C、SMBus、PMBus关系
- ASP.NET CORE Study09
- manjaro easyconnecy报错:libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
猜你喜欢
ASP.NET CORE Study09
pytorch模型
ASP.NET CORE Study01
[today in history] June 28: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born
弹性盒子自动换行小Demo
From jsonpath and XPath to spl
命名空间和作用域
Online JSON to plaintext tool
Deep understanding of Bayes theorem
《数字经济全景白皮书》消费金融数字化篇 重磅发布
随机推荐
1015.摘花生
Go language learning notes - Gorm usage - database configuration, table addition | web framework gin (VII)
Namespace and scope
Mysq 8.0 launched histogram, which greatly improved the performance!
求职简历的书写技巧
newest! Introduction and practical tutorial of point cloud processing based on open3d
ASP.NET CORE Study07
百度APP 基于Pipeline as Code的持续集成实践
易观分析《2022年中国银行业隐私计算平台供应商实力矩阵分析》研究报告正式启动
同花顺上怎么进行开户啊, 安全吗
[MySQL from introduction to mastery] [advanced part] (III) creation of MySQL users_ Modification_ Delete and password settings
Matplotlib_Study01
JS duration and asynchronous function promise
腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”
[today in history] June 28: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born
简历模板百度网盘自取
Après avoir échoué à l'examen d'entrée à l'Université de technologie de Harbin, vous devez rester à l'Université en tant que « chercheur » après avoir obtenu votre diplôme.
Jerry's wif interferes with Bluetooth [chapter]
Jerry's wif interferes with Bluetooth [chapter]
数字孪生能源系统,打造低碳时代“透视”眼