未验证 提交 896939b2 编写于 作者: L LielinJiang 提交者: GitHub

Update image translation demo (#68)

* update demo
上级 e54169d5
......@@ -10,10 +10,7 @@ PaddleGAN 是一个基于飞桨的生成对抗网络开发工具包.
### 图片变换
<div align='center'>
<img src='./docs/imgs/A2B.png'>
</div>
<div align='center'>
<img src='./docs/imgs/B2A.png'>
<img src='./docs/imgs/horse2zebra.gif'>
</div>
### 妆容迁移
......
......@@ -10,10 +10,7 @@ PaddleGAN is an development kit of Generative Adversarial Network based on Paddl
### Image Translation
<div align='center'>
<img src='./docs/imgs/A2B.png'>
</div>
<div align='center'>
<img src='./docs/imgs/B2A.png'>
<img src='./docs/imgs/horse2zebra.gif'>
</div>
......
......@@ -37,9 +37,12 @@
## 1.3 Results
![](../imgs/horse2zebra.png)
![](../../imgs/horse2zebra.png)
[model download](TODO)
## 1.4 模型下载
| 模型 | 数据集 | 下载地址 |
|---|---|---|
| Pix2Pix_cityscapes | cityscapes | [Pix2Pix_cityscapes](https://paddlegan.bj.bcebos.com/models/Pix2Pix_cityscapes.pdparams)
......@@ -49,7 +52,7 @@
CycleGAN uses unpaired pictures for image translation, input two different images with different styles, and automatically perform style transfer. CycleGAN consists of two generators and two discriminators, generator A is inputting images of style A and outputting images of style B, generator B is inputting images of style B and outputting images of style A. The biggest difference between CycleGAN and pix2pix is that CycleGAN can realize image translation without establishing a one-to-one mapping between the source domain and the target domain.
![](../imgs/cyclegan.png)
![](../../imgs/cyclegan.png)
## 2.2 How to use
......@@ -87,9 +90,13 @@
## 2.3 Results
![](../imgs/A2B.png)
![](../../imgs/A2B.png)
[model download](TODO)
## 2.4 模型下载
| 模型 | 数据集 | 下载地址 |
|---|---|---|
| CycleGAN_cityscapes | cityscapes | [CycleGAN_cityscapes](https://paddlegan.bj.bcebos.com/models/CycleGAN_cityscapes.pdparams) |
| CycleGAN_horse2zebra | horse2zebra | [CycleGAN_horse2zebra](https://paddlegan.bj.bcebos.com/models/CycleGAN_horse2zebra.pdparams)
# References
......
......@@ -10,7 +10,7 @@ This paper is to address the makeup transfer task, which aims to transfer the ma
## 2. How to use
### 2.1 Test
Pretrained model can be downloaded under following link: [psgan_weight](https://paddlegan.bj.bcebos.com/models/psgan_weight.pkl)
Pretrained model can be downloaded under following link: [psgan_weight](https://paddlegan.bj.bcebos.com/models/psgan_weight.pdparams)
Running the following command to complete the makeup transfer task. It will geneate the transfered image in the current path when the program running sucessfully.
......@@ -79,7 +79,7 @@ Notation: In train phase, the `isTrain` value in makeup.yaml file is `True`, but
Model|Dataset|BatchSize|Inference speed|Download
---|:--:|:--:|:--:|:--:
PSGAN|MT-Dataset| 1 | 1.9s/image (GPU:P40) | [model](https://paddlegan.bj.bcebos.com/models/psgan_weight.pkl)
PSGAN|MT-Dataset| 1 | 1.9s/image (GPU:P40) | [model](https://paddlegan.bj.bcebos.com/models/psgan_weight.pdparams)
## 3. Result
![](../../imgs/makeup_shifter.png)
......
因为 它太大了无法显示 image diff 。你可以改为 查看blob
......@@ -40,7 +40,10 @@
![](../../imgs/horse2zebra.png)
[模型下载](TODO)
## 1.4 模型下载
| 模型 | 数据集 | 下载地址 |
|---|---|---|
| Pix2Pix_cityscapes | cityscapes | [Pix2Pix_cityscapes](https://paddlegan.bj.bcebos.com/models/Pix2Pix_cityscapes.pdparams)
# 2 CycleGAN
......@@ -88,7 +91,11 @@
![](../../imgs/A2B.png)
[模型下载](TODO)
## 2.4 模型下载
| 模型 | 数据集 | 下载地址 |
|---|---|---|
| CycleGAN_cityscapes | cityscapes | [CycleGAN_cityscapes](https://paddlegan.bj.bcebos.com/models/CycleGAN_cityscapes.pdparams) |
| CycleGAN_horse2zebra | horse2zebra | [CycleGAN_horse2zebra](https://paddlegan.bj.bcebos.com/models/CycleGAN_horse2zebra.pdparams)
# 参考:
......
......@@ -10,7 +10,7 @@
## 2. 使用方法
### 2.1 测试
预训练模型可以从如下地址下载: [psgan_weight](https://paddlegan.bj.bcebos.com/models/psgan_weight.pkl)
预训练模型可以从如下地址下载: [psgan_weight](https://paddlegan.bj.bcebos.com/models/psgan_weight.pdparams)
运行如下命令,就可以完成妆容迁移,程序运行成功后,会在当前文件夹生成妆容迁移后的图片文件。本项目中提供了原始图片和参考供展示使用,具体命令如下所示:
......@@ -75,7 +75,7 @@ data
### 2.3 模型
Model|Dataset|BatchSize|Inference speed|Download
---|:--:|:--:|:--:|:--:
PSGAN|MT-Dataset| 1 | 1.9s(GPU:P40) | [model](https://paddlegan.bj.bcebos.com/models/psgan_weight.pkl)
PSGAN|MT-Dataset| 1 | 1.9s(GPU:P40) | [model](https://paddlegan.bj.bcebos.com/models/psgan_weight.pdparams)
## 3. 妆容迁移结果展示
......
......@@ -53,7 +53,7 @@ def mask2image(mask: np.array, format="HWC"):
return canvas
PS_WEIGHT_URL = "https://paddlegan.bj.bcebos.com/models/psgan_weight.pkl"
PS_WEIGHT_URL = "https://paddlegan.bj.bcebos.com/models/psgan_weight.pdparams"
class PreProcess:
......
......@@ -256,7 +256,7 @@ class Trainer:
assert name in ['checkpoint', 'weight']
state_dicts = {}
save_filename = 'epoch_%s_%s.pkl' % (epoch, name)
save_filename = 'epoch_%s_%s.pdparams' % (epoch, name)
save_path = os.path.join(self.output_dir, save_filename)
for net_name, net in self.model.nets.items():
state_dicts[net_name] = net.state_dict()
......@@ -275,7 +275,8 @@ class Trainer:
if keep > 0:
try:
checkpoint_name_to_be_removed = os.path.join(
self.output_dir, 'epoch_%s_%s.pkl' % (epoch - keep, name))
self.output_dir,
'epoch_%s_%s.pdparams' % (epoch - keep, name))
if os.path.exists(checkpoint_name_to_be_removed):
os.remove(checkpoint_name_to_be_removed)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册