当前位置:网站首页>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/
边栏推荐
- After Oracle creates a table partition, the partition is not given during the query, but the value specified for the partition field will be automatically queried according to the partition?
- 【机器学习】Mean Shift原理及代码
- 办公软件常用快捷键大全
- 环境搭建-MongoDB
- 快速学会配置yum的本地源和网络源,并学会yum的使用
- FIR filter design
- 使用 Dired 快速移动文件
- [express receives get, post, and route request parameters]
- [ctfshow-web]反序列化
- API analysis of Taobao / tmall shipping address list and express delivery fees
猜你喜欢
![[C language classic topic exercise 2]](/img/66/8dbfefe585aa35f5791f04b376b75c.png)
[C language classic topic exercise 2]
2.1.2 同步始终失败

我们被一个 kong 的性能 bug 折腾了一个通宵

Eureka Registry - from entry to application

Stop using xshell and try this more modern terminal connection tool

How emqx 5.0 under the new architecture of mria+rlog realizes 100million mqtt connections

Comparison between agile development and Devops

Execution process of select statement in MySQL

ASEMI整流桥KBPC3510,KBPC3510封装,KBPC3510应用

FIR filter design
随机推荐
[visdrone data set] yolov7 training visdrone data set and results
Crazy God redis notes 02
[development tutorial 7] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - capacitive touch
如何快速使用 ELisp 进行插件编写
重磅公布!ICML2022奖项:15篇杰出论文,复旦、厦大、上交大研究入选
Quickly learn to configure local and network sources of yum, and learn to use yum
6-19漏洞利用-nsf获取目标密码文件
图扑 3D 可视化国风设计 | 科技与文化碰撞炫酷”火花“
Redis persistence - detailed analysis of RDB source code | nanny level analysis! The most complete network
Recurrence of historical loopholes in ThinkPHP
Data preprocessing of machine learning
现在网上开户安全么?股票开户要找谁?
[basic course of flight control development 1] crazy shell · open source formation UAV GPIO (LED flight information light and signal light control)
【机器学习】Mean Shift原理及代码
SCCM tips - improve the download speed of drivers and shorten the deployment time of the system when deploying the system
My meeting of OA project (meeting seating & submission for approval)
Linear regression from zero sum using mxnet
使用 Dired 快速移动文件
Establishment of Eureka registration center Eureka server
【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用,虚拟磁盘文件丢失的数据恢复案例