Home

Awesome

APDrawingGAN

We provide PyTorch implementations for our CVPR 2019 paper "APDrawingGAN: Generating Artistic Portrait Drawings from Face Photos with Hierarchical GANs".

This project generates artistic portrait drawings from face photos using a GAN-based model. You may find useful information in preprocessing steps and training/testing tips.

[Paper] [Demo]

[Jittor implementation]

Our Proposed Framework

<img src = 'imgs/architecture.png'>

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>

Citation

If you use this code 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}
}

Prerequisites

Getting Started

Installation

pip install -r requirements.txt

Quick Start (Apply a Pre-trained Model)

python test.py --dataroot dataset/data/test_single --name formal_author --model test --dataset_mode single --norm batch --use_local --which_epoch 300

The test results will be saved to a html file here: ./results/formal_author/test_300/index.html.

python test.py --dataroot {path_to_aligned_photos} --name formal_author --model test --dataset_mode single --norm batch --use_local --which_epoch 300

Train

python train.py --dataroot dataset/data --name formal --continue_train --use_local --discriminator_local --niter 300 --niter_decay 0 --save_epoch_freq 25
python train.py --dataroot dataset/data --name formal_noinit --use_local --discriminator_local --niter 300 --niter_decay 0 --save_epoch_freq 25

Test

python test.py --dataroot dataset/data --name formal --use_local --which_epoch 250

The test results will be saved to a html file here: ./results/formal/test_250/index.html.

python test.py --dataroot dataset/data/test_single --name formal --model test --dataset_mode single --norm batch --use_local --which_epoch 250

You can find these scripts at scripts directory.

Preprocessing Steps

Preprocessing steps for your own data (either for testing or training).

Training/Test Tips

Best practice for training and testing your models.

You can contact email ranyi@sjtu.edu.cn for any questions.

Acknowledgments

Our code is inspired by pytorch-CycleGAN-and-pix2pix.