sgan icon indicating copy to clipboard operation
sgan copied to clipboard

A wrapper for stylegan2 with ada. You can train a model with just six lines of code.

SGAN

Easy impelementation of stylegans2. You can literally train a stylegan2 in less than 10 lines of code.

Notebooks

Name Notebook
Training
Visualization

Tranining

In just a few lines you can use style tranfer or train a stylegan from scratch.


from datasets import Dataset
from sgan import SGAN

dataset = Dataset('/path/to/dataset')
dataset.prepare('path/to/records')

model = SGAN()
model.train(data_path = 'path/to/records', out_dir = 'path/to/out')

Visualization

A set of functions for vis, interpolation and animation. Mostly tested in colab notebooks.

Load Model

from sgan import SGAN
model = SGAN(pkl_path = '/path/to/pkl')

Generate random

sgan.generate_randomly()

Generate grid

model.generate_grid()

Generate animation

model.generate_animation(size = 2, steps = 20)

Sample Models

Mosaics

alt text

Calligraphy

alt text

Flowers

alt text

Medusas

alt text

Cats

alt text

Jellfish

alt text

Celebs

alt text

References

  • Gan-surgery: https://github.com/aydao/stylegan2-surgery
  • WikiArt model: https://github.com/pbaylies/stylegan2
  • Starter-Notebook: https://github.com/Hephyrius/Stylegan2-Ada-Google-Colab-Starter-Notebook/