当前位置:网站首页>GAN (Generative Adversarial Network,GAN)生成式对抗网络
GAN (Generative Adversarial Network,GAN)生成式对抗网络
2022-07-26 16:46:00 【irrationality】

处理可忽略的报错
import warnings
warnings.filterwarnings("ignore")
克隆仓库
git clone https://gitee.com/mindspore/models.git
cp -r ~/CANN/models/research/cv/wgan ./wgan/
cp -r ~/CANN/models/research/cv/gan ./gan/
最后没仔细看,要求的是mnist即可
那我们就搞一个mnist的脚本
注意scipy.misc已经没有imsave了
def save_img(img, fname):
pil_img = deprocess_image(np.copy(img))
scipy.misc.imsave(fname, pil_img)
改成
def save_img(img, fname):
pil_img = deprocess_image(np.copy(img))
imageio.imwrite(fname, pil_img)

本地训练较慢,那我们只训练3轮
在云脑上,我们同步训练一个:
pip install tensorflow-gpu==1.13.1
测试GPU
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
--------
import tensorflow as tf
tf.debugging.set_log_device_placement(True)
--------
# Place tensors on the CPU
with tf.device('/GPU:0'):
a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
--------
c = tf.matmul(a, b)
print(c)
--------
import tensorflow as tf
print (tf.__version__)
if tf.test.gpu_device_name():
print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
else:
print("Please install GPU version of TF")
wgan恢复为gan
wgan定义的:
# gradient penalty
gp = gradient_penalty(D, xr, xf.detach())
# aggregate all
loss_D = lossr + lossf + 0.2 * gp
改为
# aggregate all
loss_D = lossr + lossf

如果想不输出解压过程
unzip xx.zip > /dev/null 2>&1


pytorch也可以实现类似的功能。
读取tfevents
读取的步骤:①先转到events.out.tfevents所在的文件目录下
命令:cd dir(所在文件夹目录)
②tensorboard --logdir dir(文件所在文件夹)
③firefox浏览器打开第二部生成的网址,例如http://ubuntu122:6006/
边栏推荐
- Relationship between standardization, normalization and regularization
- 注意 公安部发出旅游客运交通安全预警
- Interface comparator
- Pay attention to the traffic safety warning of tourism passenger transport issued by the Ministry of public security
- SQL注入(思维导图)
- the loss outweighs the gain! Doctors cheated 2.1 million yuan and masters cheated 30000 yuan of talent subsidies, all of which were sentenced!
- [development tutorial 8] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - triaxial meter pace
- The user experience center of Analysys Qianfan bank was established to help upgrade the user experience of the banking industry
- Execution process of select statement in MySQL
- 使用 replace-regexp 在行首添加序号
猜你喜欢

Comparison between agile development and Devops
![[machine learning] principle and code of mean shift](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[machine learning] principle and code of mean shift

The principle of reliable transmission in TCP protocol

我们被一个 kong 的性能 bug 折腾了一个通宵
![37. [categories of overloaded operators]](/img/67/b821270079589c53b9c38b0ca033ac.png)
37. [categories of overloaded operators]

About the adjustment of the game background, reading this article is enough

The user experience center of Analysys Qianfan bank was established to help upgrade the user experience of the banking industry

【OpenCV 例程 300篇】240. OpenCV 中的 Shi-Tomas 角点检测
![[flight control development basic tutorial 3] crazy shell · open source formation UAV - serial port (basic transceiver)](/img/25/160b827d74f7902ec0d6be4683b1e5.png)
[flight control development basic tutorial 3] crazy shell · open source formation UAV - serial port (basic transceiver)

Thoroughly uncover how epoll realizes IO multiplexing
随机推荐
简述CUDA镜像构建
Is it safe for Guosen Securities to open an account? How can I find the account manager
Pyqt5 rapid development and practice 3.2 introduction to layout management and 3.3 practical application of QT Designer
Everything is available Cassandra: the fairy database behind Huawei tag
Pytest(思维导图)
In depth exploration of ribbon load balancing
注意 公安部发出旅游客运交通安全预警
2 - configuration and use of routes
A collection of commonly used shortcut keys for office software
Methods of path related comments (I)
ASEMI整流桥KBPC2510,KBPC2510参数,KBPC2510规格书
现在网上开户安全么?股票开户要找谁?
Good afternoon, everyone. Please ask a question: how to start a job submitted in SQL from the savepoint? Problem Description: using SQL in Cl
03|实现 useReducer 和 useState
Redis persistence - detailed analysis of RDB source code | nanny level analysis! The most complete network
如何快速使用 ELisp 进行插件编写
Stop supporting Huawei! Signing 640billion 5g orders in Germany and 270billion 5g orders in the Middle East is pure nonsense!
API for sellers -- description of the return value of adding baby API to Taobao / tmall sellers' stores
the loss outweighs the gain! Doctors cheated 2.1 million yuan and masters cheated 30000 yuan of talent subsidies, all of which were sentenced!
我们被一个 kong 的性能 bug 折腾了一个通宵