We provide PyTorch implementation for our CYB paper "Towards Realistic Face Photo-Sketch Synthesis via Composition-Aided GANs"
left: sketch synthesis; right: photo synthesis
(a)Input Image, (b)cGAN, (c)CA-GAN, (d)SCA-GAN
If you find this useful for your research, please use the following.
@article{gao2017ca-gan,
title = {Towards Realistic Face Photo-Sketch Synthesis via Composition-Aided GANs},
author = {Jun Yu, Xingxin Xu, Fei Gao, Shengjie Shi, Meng Wang, Dacheng Tao, and Qingming Huang},
booktitle = {arXiv:1712.00899},
year = {2019},
}
- Linux or similar environment
- Python 2.7
- NVIDIA GPU + CUDA CuDNN
- Clone this repo:
git clone https://github.com/jehovahxu/ca-gan cd ca-gan
- Install PyTorch 0.4+ and torchvision from http://pytorch.org and other dependencies (e.g., visdom and dominate). You can install all the dependencies by
pip install -r requirments.txt
-
Download a dataset(CUFS split train and test with this files)
-
Download the VGG-Face model which based on the VGG-Very-Deep-16 CNN architecture. Here we convert torch weight to pyTorch to fit our frame, you can download our converted model directly.
-
Get face parsing
- here we use Face Labling to get face parsing
- Check out the branch to get the our newly used
-
Train a model
python main.py --model_vgg {model path}
-
Test the model
python test.py --dataroot {data path} --fold {epoch number}
- The option
fold
is used for load./checkpoint/netG_epoch_'+fold+'.weight
and you can edit it intest.py
- The option
-
You can download a pre-trained model which trained on the CUSF and can transform photo to sketch :
-
The pre-trained model need to be save at
./checkpoint
and named it asnetG_epoch_'+fold+'.weight
-
Then you can test the model
- Our final result can be downloaded:
Best practice for training and testing your models.
Feel free to ask any questions.Xingxin Xu, jehovahxu@gmail.com
Our code is inspired by pytorch-CycleGAN-and-pix2pix