Skip to content
lorezvnPublic

About

Generative Adversarial Network to generate new Pokémons.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

PokéGAN

Project developed for the AILab: Computer Vision and NLP course

  • Lorenzo Zanda
  • Davide Vittucci
  • Paolo Marchetti
  • Gabriele Sepe

Real vs Fake

Overview

The goal of this project is to build a DCGAN capable of generating new Pokémon images that mimic the style, silhouettes, and color palette of the original 819 Pokémon. We chose a DCGAN over more advanced architectures (e.g. StyleGAN) because it strikes a good balance between implementation simplicity and computational cost.

A DCGAN pits two convolutional networks against each other:

  • Generator (G) — turns a random latent vector into a 64×64×3 RGB image via transposed convolutions.
  • Discriminator (D) — classifies images as real (from the dataset) or fake (from the Generator) via strided convolutions.

The two are trained jointly in a minimax game: G tries to fool D, D tries not to be fooled, and over time G learns to produce increasingly convincing Pokémon-like images.

PokéGAN architecture

Dataset

  • Source: Pokémon Images Dataset — all 819 Pokémon existing at the time of the project.
  • Preprocessing: resize to 64×64, center crop, normalization to [-1, 1] (to match the Generator's Tanh output).
  • Augmentation: horizontal flip (src/augment.py), which safely doubles the dataset size. Other augmentations (vertical flip, brightness jitter) were tried but discarded — they corrupted the background of generated images.

Model Architecture

Generator

Takes a latent noise vector and upsamples it through transposed convolutions: latent → 4×4×512 → ... → 32×32×64 → 64×64×3 Each intermediate layer uses BatchNorm + ReLU; the output layer uses only Tanh.

Generator architecture

Discriminator

Downsamples a 64×64×3 image to a single real/fake score: 64×64×3 → 32×32 → 16×16 → 8×8 → 4×4 → scalar Uses spectral normalization + LeakyReLU + Dropout at every layer, BatchNorm on the intermediate layers (skipped on the input and output layers to preserve raw low-level and final decision information respectively), and a Sigmoid on the final scalar output.

Discriminator architecture

Spectral normalization, dropout, and label smoothing were introduced to counter discriminator overfitting, which otherwise caused unstable, spiky training dynamics.

Project Structure

repo/
├── src/
│   ├── augment.py           # Dataset augmentation (horizontal flip, etc.)
│   ├── config.py            # Hyperparameters & paths (LATENT_SIZE, BATCH_SIZE, LR, ...)
│   ├── dataset.py           # Dataloader construction
│   ├── generate.py          # Generate new Pokémon from a trained checkpoint
│   ├── init_folders.py      # Creates models/ and results/ output folders
│   ├── models.py            # Generator, Discriminator, weight initialization
│   ├── train.py             # Train / resume-train the DCGAN
│   └── utils.py             # Device selection, plotting, GIF/sample saving, seeding
├── notebooks/             # Exploratory / experiment notebooks
├── paper_eng.pdf          # Full project report
├── presentation.pptx      # Project presentation slides
└── main.py                # Entry point

How to run

  1. Install depencies:

    pip install -r requirements.txt
  2. Get pretrained weights

    Pretrained model checkpoints (after 10,000 epochs) can be downloaded from the GitHub Releases page:

    • 10000-generator.pth
    • 10000-discriminator.pth

    Place the downloaded .pth files inside the models/ directory before running generation.

  3. Run main.py

     python main.py

Results

After 10,000 epochs of training the model reliably produces silhouettes and color palettes faithful to the original art style, even if fine details remain blurry.

Evolution

Evolution of a generated sample over training

Known Issues

  • Limited dataset. Only 819 base images (1,638 after horizontal-flip augmentation) is a small dataset for a GAN. Other augmentations (vertical flip, brightness) hurt output quality by altering generated backgrounds.
  • Discriminator overfitting. The Discriminator tends to memorize training details rather than generalize, hurting overall GAN balance. Mitigated with spectral normalization, dropout, and label smoothing, but not fully eliminated.

Future Work

  • Use a larger, more diverse dataset (e.g. fan-made Pokémon art, other creature datasets).
  • Explore more advanced GAN architectures (e.g. StyleGAN).
  • Train for longer / with better-tuned schedules.

References

  1. DCGAN PyTorch Tutorial
  2. Pokémon Images Dataset (Kaggle)
  3. Goodfellow et al., Generative Adversarial Networks, Communications of the ACM, 2020.
  4. Karras et al., Progressive Growing of GANs for Improved Quality, Stability, and Variation, arXiv:1710.10196, 2017.
  5. Radford, Metz & Chintala, Unsupervised Representation Learning with Deep Convolutional GANs, arXiv:1511.06434, 2015.
  6. Sebastian Raschka — Introduction to GANs (YouTube playlist)

Pokémon® is a registered trademark of Nintendo/Game Freak/Creatures Inc. This project is an academic, non-commercial exercise in generative modeling and is not affiliated with or endorsed by the Pokémon Company.

About

Generative Adversarial Network to generate new Pokémons.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages