Skip to content

Commit 4a538cc

Browse files
YixinKristyLielinJiang
authored andcommitted
Update get-started docs (#324)
* revise video restore docs * delete photos * Update README.md * Update install.md * �update readme * Update README.md * Update get_started.md * Update get_started.md
1 parent 600a799 commit 4a538cc

File tree

2 files changed

+80
-20
lines changed

2 files changed

+80
-20
lines changed

docs/zh_CN/get_started.md

Lines changed: 77 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,61 @@
1+
# 快速开始
12

2-
## 快速开始使用PaddleGAN
3+
PaddleGAN是飞桨生成对抗网络(GAN)开发套件,提供多种经典前沿网络的高性能复现,应用覆盖图像生成、风格迁移、动作驱动、影像超分及上色等多种领域。
34

4-
注意:
5-
* 开始使用PaddleGAN前请确保已经阅读过[安装文档](./install.md),并根据[数据准备文档](./data_prepare.md)准备好数据集。
6-
* 以下教程以CycleGAN模型在Cityscapes数据集上的训练预测作为示例。
5+
本章节将以CycleGAN模型在Cityscapes数据集上的训练预测作为示例,教大家如何快速上手使用PaddleGAN。
76

7+
**注意,PaddleGAN中所有的模型配置文件均可在 [./PaddleGAN/configs](https://github.com/PaddlePaddle/PaddleGAN/tree/develop/configs) 中找到。**
88

9-
### 训练
9+
## 目录
10+
- [安装](#安装)
11+
- [数据准备](#数据准备)
12+
- [训练](#训练)
13+
- [单卡训练](#1-单卡训练)
14+
- [参数](#参数)
15+
- [可视化训练](#可视化训练)
16+
- [恢复训练](#恢复训练)
17+
- [多卡训练](#2-多卡训练)
18+
- [预测](#预测)
19+
20+
## 安装
21+
22+
关于安装配置运行环境,请参考[安装文档](./install.md)完成Paddle及PaddleGAN的安装。
23+
24+
在本演示案例中,假设用户将PaddleGAN的代码克隆并放置在 ’/home/paddle‘ 目录中。用户执行的命令操作均在 ’/home/paddle/PaddleGAN‘ 目录下完成。
25+
26+
27+
## 数据准备
28+
29+
按照[数据准备文档](./data_prepare.md)准备Cityscapes数据集。
30+
31+
- 使用脚本下载Cityscapes数据集到 ~/.cache/ppgan 并软连接到 PaddleGAN/data/ 下:
32+
33+
```
34+
python data/download_cyclegan_data.py --name cityscapes
35+
```
36+
37+
## 训练
38+
39+
### 1. 单卡训练
1040

11-
#### 单卡训练
1241
```
1342
python -u tools/main.py --config-file configs/cyclegan_cityscapes.yaml
1443
```
44+
1545
#### 参数
46+
- `--config-file (str)`: 配置文件的路径。此处用的是CycleGAN在Cityscapes数据集上训练的配置文件。
47+
- 输出的日志,权重,可视化结果会默认保存在`./output_dir`中,可以通过配置文件中的`output_dir`参数修改:
48+
49+
```
50+
output_dir: output_dir
51+
```
52+
<div align='center'>
53+
<img src='https://user-images.githubusercontent.com/48054808/119620857-0b2ee200-be38-11eb-83c3-9c5c4c4cbedf.png' width=60%>
54+
</div>
1655

17-
- `--config-file (str)`: 配置文件的路径。
1856

19-
输出的日志,权重,可视化结果会默认保存在```./output_dir```中,可以通过配置文件中的```output_dir```参数修改:
20-
```
21-
output_dir: output_dir
22-
```
57+
- 保存的文件夹会根据模型名字和时间戳自动生成一个新目录,目录示例如下:
2358

24-
保存的文件夹会根据模型名字和时间戳自动生成一个新目录,目录示例如下:
2559
```
2660
output_dir
2761
└── CycleGANModel-2020-10-29-09-21
@@ -44,32 +78,55 @@ output_dir
4478
├── epoch002_real_B.png
4579
├── epoch002_rec_A.png
4680
└── epoch002_rec_B.png
81+
4782
```
48-
同时可以通过在配置文件中添加参数```enable_visualdl: true```使用[飞桨VisualDL](https://github.com/PaddlePaddle/VisualDL)对训练过程产生的指标或生成的图像进行记录,并运行相应命令对训练过程进行实时监控:
83+
84+
#### 可视化训练
85+
86+
[飞桨VisualDL](https://github.com/PaddlePaddle/VisualDL)是针对深度学习模型开发所打造的可视化分析工具,提供关键指标的实时趋势可视化、样本训练中间过程可视化、网络结构可视化等等,更能直观展示超参与模型效果间关系,辅助实现高效调参。
87+
88+
以下操作请确保您已完成[VisualDL](https://github.com/PaddlePaddle/VisualDL)的安装,安装指南请见[VisualDL安装文档](https://github.com/PaddlePaddle/VisualDL/blob/develop/README_CN.md#%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F)
89+
90+
**通过在配置文件 cyclegan_cityscapes.yaml 中添加参数`enable_visualdl: true`使用 [飞桨VisualDL](https://github.com/PaddlePaddle/VisualDL)对训练过程产生的指标或生成的图像进行记录,并运行相应命令对训练过程进行实时监控:**
91+
92+
<div align='center'>
93+
<img src='https://user-images.githubusercontent.com/48054808/119621184-68c32e80-be38-11eb-9830-95429db787cf.png' width=60%>
94+
</div>
95+
96+
如果想要自定义[飞桨VisualDL](https://github.com/PaddlePaddle/VisualDL)可视化内容,可以到 [./PaddleGAN/ppgan/engine/trainer.py](https://github.com/PaddlePaddle/PaddleGAN/blob/develop/ppgan/engine/trainer.py) 中进行修改。
97+
98+
本地启动命令:
99+
49100
```
50101
visualdl --logdir output_dir/CycleGANModel-2020-10-29-09-21/
51102
```
103+
更多启动方式及可视化功能使用指南请见[VisualDL使用指南](https://github.com/PaddlePaddle/VisualDL/blob/develop/docs/components/README_CN.md)
52104

53105
#### 恢复训练
54106

55-
训练过程中默认会保存上一个epoch的checkpoint,方便恢复训练
107+
在训练过程中默认会**保存上一个epoch的checkpoint在`output_dir`中,方便恢复训练。**
108+
109+
本次示例中,cyclegan的训练默认**每五个epoch会保存checkpoint**,如需更改,可以到**config文件中的`interval`**进行修改。
110+
111+
<div align='center'>
112+
<img src='https://user-images.githubusercontent.com/48054808/120147997-2758c780-c21a-11eb-9cf1-4288dbc01d22.png' width=60%>
113+
</div>
114+
56115
```
57116
python -u tools/main.py --config-file configs/cyclegan_cityscapes.yaml --resume your_checkpoint_path
58117
```
59-
#### 参数
118+
- `--resume (str)`: 用来恢复训练的checkpoint路径(保存于上面配置文件中设置的output所在路径)。
60119

61-
- `--resume (str)`: 用来恢复训练的checkpoint路径。
120+
### 2. 多卡训练
62121

63-
#### 多卡训练:
64122
```
65123
CUDA_VISIBLE_DEVICES=0,1 python -m paddle.distributed.launch tools/main.py --config-file configs/cyclegan_cityscapes.yaml
66124
```
67125

68-
### 预测
126+
## 预测
127+
69128
```
70129
python tools/main.py --config-file configs/cyclegan_cityscapes.yaml --evaluate-only --load your_weight_path
71130
```
72-
73-
#### 参数
74131
- `--evaluate-only`: 是否仅进行预测。
75132
- `--load (str)`: 训练好的权重路径。

docs/zh_CN/install.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
本文档包含了如何安装PaddleGAN以及相关依赖,更多产品简介请参考[README](https://github.com/PaddlePaddle/PaddleGAN/blob/develop/README_cn.md)
33

44
## 环境依赖
5+
56
- PaddlePaddle >= 2.1.0
67
- Python >= 3.6
78
- CUDA >= 10.1
89

10+
911
## 安装PaddlePaddle
1012

1113
```
14+
1215
# CUDA10.1
1316
python -m pip install paddlepaddle-gpu==2.1.0.post101 -f https://mirror.baidu.com/pypi/simple
1417

0 commit comments

Comments
 (0)