This repository provides GAN with various attention modules. All attention modules are applied to 32x32 feature map in both generator and discriminator(SA-GAN paper demonstrated when attention module apply to 32x32 feature map have the best fid result). Used wgan-hinge loss, spectral normalization and Adam optimizer for train, for discriminator and generator have different learning rate(4e-4 for discriminator, 1e-4 for generator) to satisfy TTUR(Two Time-scale Update Rule). Because we only use one class dataset(CelebA), replaced Conditional Batch Normalization with Batch Normalization.
Attention Module | Num of Head |
---|---|
Self Attention (SA) | 1 |
Criss Cross Attention (CCA) | 2 |
Your Local Attention (YLA) | 8 |
Attention Module | FID |
---|---|
Self Attention (SA) | 32.516 |
Criss Cross Attention (CCA) | 30.016 |
Your Local Attention (YLA) | 32.691 |
- numpy>=1.20.3
- tqdm>=4.61.0
- pillow>=7.1.2
- torch>=1.7.1
- torchvision>=0.8.2
python train.py
python train.py --batch_size 64 --dataset CelebA --version CCA
python generate.py --load 100
python generate.py --version CCA --load 100