Pytorch implementation for (PRCV 2022) LAGAN: Landmark Aided Text to Face Sketch Generation.
TextCUFSF dataset has been included in data/sketches/
. If not availvale, please give me your emali in Issues
.
or link: https://pan.baidu.com/s/1vhJKsrGdffg2kS2oWo5EHg?pwd=9xyf password: 9xyf; or link: https://pan.bnu.edu.cn/l/n1Hd8o
All code was developed and tested on Ubuntu 16.04 with Python 3.7 (Anaconda) and PyTorch 1.1.
DAMSM model includes text encoder and image encoder
- Pre-train DAMSM model for TextCUFSF dataset:
python pretrain_DAMSM.py --cfg cfg/DAMSM/sketches_18_4.yml --gpu 0
- Train LAGAN model for TextCUFSF dataset:
python main.py --cfg cfg/train_sketch_18_4.yml --gpu 1
*.yml
files include configuration for training and testing.
- Test LAGAN model for bird dataset:
python main.py --cfg cfg/eval_sketch_18_4.yml --gpu 2
Examples generated by LAGAN
- code/main.py: the entry point for training and testing.
- code/trainer_mutual_self.py: creates the main networks, harnesses and reports the progress of training.
- code/model.py: defines the architecture of LAGAN.
- code/attention.py: defines the spatial and channel-wise attentions.
- code/VGGFeatureLoss.py: defines the architecture of the VGG-16.
- code/datasets.py: defines the class for loading images and captions.
- code/pretrain_DAMSM.py: creates the text and image encoders, harnesses and reports the progress of training.
- code/miscc/losses.py: defines and computes the losses.
- code/miscc/config.py: creates the option list.
- code/miscc/utils.py: additional functions.
If you find this work helpful, please consider citing:
@inproceedings{chao2022lagan,
title={LAGAN: Landmark Aided Text to Face Sketch Generation},
author={Chao, Wentao and Chang, Liang and Xi, Fangfang and Duan, Fuqing},
booktitle={Chinese Conference on Pattern Recognition and Computer Vision (PRCV)},
pages={137--151},
year={2022},
organization={Springer}
}
This code borrows heavily from ControlGAN repository. Thanks a lot.