Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
d2250403450 bfe893e38a | 2 years ago | |
---|---|---|
ascend310_infer | 2 years ago | |
gan | 2 years ago | |
scripts | 2 years ago | |
src | 2 years ago | |
README.md | 2 years ago | |
eval.py | 2 years ago | |
export.py | 2 years ago | |
postprocess.py | 2 years ago | |
preprocess.py | 2 years ago | |
requirements.txt | 2 years ago | |
train.py | 2 years ago |
GAN网络是2014年提出的,是一种深度学习模型,是近年来复杂分布上无监督学习最具前景的方法之一。模型通过框架中两个模块:生成模型(Generative Model)和判别模型(Discriminative Model)的互相博弈学习产生相当好的输出。
论文:Goodfellow I, Pouget-Abadie J, Mirza M, et al. Generative adversarial nets[J]. Advances in neural information processing systems, 2014, 27.
一个生成器和一个判别器。
使用的数据集:MNIST
└─data
└─MNIST_Data
└─t10k-images.idx3-ubyte
└─t10k-labels.idx1-ubyte
└─train-images.idx3-ubyte
└─train-labels.idx1-ubyte
通过官方网站安装MindSpore后,您可以按照如下步骤进行训练和评估:
Ascend处理器环境运行
# 添加数据集路径,以训练MNIST为例
train_data_path: data/MNIST_Data/
test_data_path: data/MNIST_Data/
# 单卡训练
bash ./scripts/run_standalone_train.sh [DEVICE_ID]
# Ascend多卡训练
bash ./scripts/run_distributed_train.sh [RANK_TABLE] [RANK_SIZE] [DEVICE_START]
示例:
# 单卡训练
bash ./scripts/run_standalone_train.sh 0
# Ascend多卡训练(8P)
bash ./scripts/run_distributed_train.sh ./rank_table_8pcs.json 8 0
# 评估
bash ./scripts/run_eval.sh [DEVICE_ID]
示例:
# 评估
bash ./scripts/run_eval.sh 0
生成.mindir文件
python export.py
执行310推理脚本
bash run_infer_310.sh [MINDIR_PATH] [DATASET_PATH] [DEVICE_ID]
示例:
bash run_infer_310.sh /home/gan3/output.mindir /home/gan3/data/MNIST_Data/ 0
├──gan
├── README_CN.md # README
├── requirements.txt # required modules
├── scripts # shell script
├─run_standalone_train.sh # training in standalone mode
├─run_distributed_train.sh # training in parallel mode
├─export.sh # export checkpoints into mindir model
├─run_eval.sh # evaluation
└─run_infer_310.sh # 310 inference
├── src
├─loss.py # loss function
├─gan.py # define the construction of gan
├─param_parse.py # parameter parser
└─dataset.py # dataset create
├── ascend310_infer # 310 inference
├─ main.cc # 310 inference
├─ CMakeLists.txt # compile
└─ build.sh # script of main.cc
├── train.py # train model
├── export.py # export checkpoints into mindir model
├── preprocess.py # fixed noise
├── postprocess.py # eval the result of 310 infer
└── eval.py # test model
Ascend处理器环境运行
python train.py > train.log 2>&1 &
上述python命令将在后台运行,您可以通过train.log文件查看结果。
训练结束后,您可在默认脚本文件夹下找到检查点文件。采用以下方式达到损失值:
模型检查点保存在当前目录下。
上述python命令将在后台运行,您可以通过train.log文件查看结果。
在Ascend环境运行时评估MNIST数据集
python eval.py > eval.log 2>&1 &
参数 | Ascend |
---|---|
模型名称 | GAN |
资源 | Ascend 910;CPU 2.60GHz,192核;内存 755G;系统 Euler2.8 |
上传日期 | 2021-09-28 |
MindSpore版本 | 1.3.0 |
数据集 | MNIST |
训练参数 | epoch=200, batch_size = 64, lr=0.001 |
优化器 | Adam |
损失函数 | 自定义损失函数 |
检查点 | 8914KB, .ckpt文件 |
脚本 | gan脚本 |
请浏览官网主页。
Generative adversarial network includes generator and discriminator. The generative model G captures the data distribution, and a discriminative model D estimates the probability that a sample came from the training data rather than G.
Python Shell C++ Text other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》