Awesome
APDrawingGAN Jittor Implementation
We provide Jittor implementations for our CVPR 2019 oral paper "APDrawingGAN: Generating Artistic Portrait Drawings from Face Photos with Hierarchical GANs". [Paper]
This project generates artistic portrait drawings from face photos using a GAN-based model.
Prerequisites
- Linux or macOS
- Python 3
- CPU or NVIDIA GPU + CUDA CuDNN
Sample Results
Up: input, Down: output
<p> <img src='imgs/samples/img_1701.png' width="19%"/> <img src='imgs/samples/img_1696.png' width="19%"/> <img src='imgs/samples/img_1682.png' width="19%"/> <img src='imgs/samples/img_1794.png' width="19%"/> <img src='imgs/samples/img_1673.png' width="19%"/> </p> <p> <img src='imgs/samples/img_1701_fake_B.png' width="19%"/> <img src='imgs/samples/img_1696_fake_B.png' width="19%"/> <img src='imgs/samples/img_1682_fake_B.png' width="19%"/> <img src='imgs/samples/img_1794_fake_B.png' width="19%"/> <img src='imgs/samples/img_1673_fake_B.png' width="19%"/> </p>Installation
- To install the dependencies, run
pip install -r requirements.txt
Apply pretrained model
-
- Download pre-trained models from BaiduYun(extract code: 9qhp) and rename the folder to
checkpoints
.
- Download pre-trained models from BaiduYun(extract code: 9qhp) and rename the folder to
-
- Test for example photos: generate artistic portrait drawings for example photos in the folder
./samples/A/example
using models incheckpoints/formal_author
- Test for example photos: generate artistic portrait drawings for example photos in the folder
python test.py
Results are saved in ./results/portrait_drawing/formal_author_300/example
-
- To test on your own photos: First run preprocess here). Then specify the folder that contains test photos using option
--input_folder
, specify the folder of landmarks using--lm_folder
and the folder of masks using--mask_folder
, and run thetest.py
again.
- To test on your own photos: First run preprocess here). Then specify the folder that contains test photos using option
Train
-
- Download the APDrawing dataset from GoogleDrive and put the folder to
data/apdrawing
.
- Download the APDrawing dataset from GoogleDrive and put the folder to
-
- Train our model (300 epochs)
python apdrawing_gan.py
Models are saved in folder checkpoints/apdrawing
-
- Test the trained model
python test.py --which_epoch 300 --model_name apdrawing
Results are saved in ./results/portrait_drawing/apdrawing_300/example
Citation
If you use this code or APDrawing dataset for your research, please cite our paper.
@inproceedings{YiLLR19,
title = {{APDrawingGAN}: Generating Artistic Portrait Drawings from Face Photos with Hierarchical GANs},
author = {Yi, Ran and Liu, Yong-Jin and Lai, Yu-Kun and Rosin, Paul L},
booktitle = {{IEEE} Conference on Computer Vision and Pattern Recognition (CVPR '19)},
pages = {10743--10752},
year = {2019}
}