diff --git a/README.md b/README.md index 42007e780ea7f62d1832cdd32b8fa6cb8d193c02..909dff0cc5323e1209ce9dcc745c6ccee426f946 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,7 @@ PaddleGAN 是一个基于飞桨的生成对抗网络开发工具包. ### 图片变换
- -
-
- +
### 妆容迁移 diff --git a/README_en.md b/README_en.md index ba36a0c1b75167e7f6c2b176ff0694a36d6f8485..1f27baa8f41ff2608002306216e3b69899bbb359 100644 --- a/README_en.md +++ b/README_en.md @@ -10,10 +10,7 @@ PaddleGAN is an development kit of Generative Adversarial Network based on Paddl ### Image Translation
- -
-
- +
diff --git a/docs/en_US/tutorials/pix2pix_cyclegan.md b/docs/en_US/tutorials/pix2pix_cyclegan.md index f87a96f4a08887d57e74bd17b46c36b9e6c002cd..818ea8d5e7ce148e51d46583a04356450bb7c0da 100644 --- a/docs/en_US/tutorials/pix2pix_cyclegan.md +++ b/docs/en_US/tutorials/pix2pix_cyclegan.md @@ -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 diff --git a/docs/en_US/tutorials/psgan.md b/docs/en_US/tutorials/psgan.md index 2fd5d894962ece0a84a9325ff36451e3e9dc4a74..4b1f723780bf49e71656aefa99c2b88afef07b1a 100644 --- a/docs/en_US/tutorials/psgan.md +++ b/docs/en_US/tutorials/psgan.md @@ -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) diff --git a/docs/imgs/horse2zebra.gif b/docs/imgs/horse2zebra.gif new file mode 100644 index 0000000000000000000000000000000000000000..93dc63be84c7502dc0d2bd76570858f9e8a7b278 Binary files /dev/null and b/docs/imgs/horse2zebra.gif differ diff --git a/docs/zh_CN/tutorials/pix2pix_cyclegan.md b/docs/zh_CN/tutorials/pix2pix_cyclegan.md index 7cbf7441fadd308754c2372766463caa519b660d..5a211306f6be023e202a42f04949a258d7a27b65 100644 --- a/docs/zh_CN/tutorials/pix2pix_cyclegan.md +++ b/docs/zh_CN/tutorials/pix2pix_cyclegan.md @@ -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) # 参考: diff --git a/docs/zh_CN/tutorials/psgan.md b/docs/zh_CN/tutorials/psgan.md index b4b4510223999d4b4e01db7e21bfb87460b8ade4..6b039606df2e4e9aa57035614236d2c55cc22b1b 100644 --- a/docs/zh_CN/tutorials/psgan.md +++ b/docs/zh_CN/tutorials/psgan.md @@ -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. 妆容迁移结果展示 diff --git a/ppgan/apps/psgan_predictor.py b/ppgan/apps/psgan_predictor.py index 029beb9053023dcbc824ee7dae86a259556a9f95..29fa0e8190a3b03d0ac66490912099d47a6c043b 100644 --- a/ppgan/apps/psgan_predictor.py +++ b/ppgan/apps/psgan_predictor.py @@ -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: diff --git a/ppgan/engine/trainer.py b/ppgan/engine/trainer.py index 0e91a8fdf8fc2bf1f8b6a0a1d65fc74d210e2d0b..145480480cb9ffff91ad59970ae0454e1a48c281 100644 --- a/ppgan/engine/trainer.py +++ b/ppgan/engine/trainer.py @@ -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)