Simple Tensorflow implementation of "Toward Spatially Unbiased Generative Models" (ICCV 2021)

taki0112, updated πŸ•₯ 2022-01-21 07:51:52

Spatial unbiased GANs — Simple TensorFlow Implementation [Paper]

: Toward Spatially Unbiased Generative Models (ICCV 2021)

Abstract Recent image generation models show remarkable generation performance. However, they mirror strong location preference in datasets, which we call spatial bias. Therefore, generators render poor samples at unseen locations and scales. We argue that the generators rely on their implicit positional encoding to render spatial content. From our observations, the generator’s implicit positional encoding is translation-variant, making the generator spatially biased. To address this issue, we propose injecting explicit positional encoding at each scale of the generator. By learning the spatially unbiased generator, we facilitate the robust use of generators in multiple tasks, such as GAN inversion, multi-scale generation, generation of arbitrary sizes and aspect ratios. Furthermore, we show that our method can also be applied to denoising diffusion probabilistic models.


  • Tensorflow >= 2.x


β”œβ”€β”€ dataset Β Β  └── YOUR_DATASET_NAME β”œβ”€β”€ 000001.jpg β”œβ”€β”€ 000002.png └── ...



python --dataset FFHQ --phase train --img_size 256 --batch_size 4 --n_total_image 6400 ```

Generate Video


python ```


  • FID: 3.81 (6.4M images(200k iterations), 8GPU, each 4 batch size)
  • FID reported in the paper: 6.75



Style mixing

  • It's worse than stylegan2.

Truncation trick



Junho Kim

Junho Kim

Research Scientist

GitHub Repository