Skip to content

CSA-GAN: Cyclic synthesized attention guided generative adversarial network for face synthesis

License

Notifications You must be signed in to change notification settings

GANGREEK/CSA-GAN

Repository files navigation

Python 3.6 Packagist

Installation

This code requires PyTorch 0.4.1+ and python 3.6.9+. Please install dependencies by

pip install -r requirements.txt (for pip users)

or

./scripts/conda_deps.sh (for Conda users)

To reproduce the results reported in the paper, you would need an NVIDIA 1080Ti or above GPUs.

Dataset Preparation

Download the datasets using the following script. Please cite their paper if you use the data.

bash ./datasets/download_cyclegan_dataset.sh dataset_name

CSA-GAN Training/Testing

  • Download a dataset using the previous script (e.g., horse2zebra).
  • To view training results and loss plots, run python -m visdom.server and click the URL http://localhost:8097.
  • Train a model:
python  train.py --dataroot ./datasets/AR --name  AR220  --model  attention_gan  --dataset_mode aligned --norm instance --load_size 286 --crop_size  256  --batch_size 1 --gpu_ids 0  


- How to continue train? Append `--continue_train --epoch_count xxx` on the command line.
- Test the model:
- The test results will be saved to a html file here: `./results/{dataset_name}/latest_test/index.html`.

## Generating Images Using Pretrained Model
- You need download a pretrained model (e.g., horse2zebra) with the following script:
- The pretrained model is saved at `./checkpoints/{name}_pretrained/latest_net_G.pth`. 
- Then generate the result using

python test.py --dataroot ./datasets/horse2zebra --name horse2zebra_pretrained --model attention_gan --dataset_mode unaligned --norm instance --phase test --no_dropout --load_size 256 --crop_size 256 --batch_size 1 --gpu_ids 0 --num_test 5000 --epoch latest --saveDisk

The results will be saved at `./results/`. Use `--results_dir {directory_path_to_save_result}` to specify the results directory. Note that if you want to save the intermediate results and have enough disk space, remove `--saveDisk` on the command line.

- For your own experiments, you might want to specify --netG, --norm, --no_dropout to match the generator architecture of the trained model.

## Evaluation Code

  Install Steps: `conda create -n python36 pyhton=3.6 anaconda` and `pip install --ignore-installed --upgrade tensorflow==1.13.1`


Citation : Yadav, N.K., Singh, S.K. & Dubey, S.R. CSA-GAN: Cyclic synthesized attention guided generative adversarial network for face synthesis. Appl Intell 52, 12704–12723 (2022). https://doi.org/10.1007/s10489-021-03064-0

About

CSA-GAN: Cyclic synthesized attention guided generative adversarial network for face synthesis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages