Skip to content

Python scripts to pre-train, fine-tune and use JoJoGAN with improved GAN inversion.

Notifications You must be signed in to change notification settings

007prateekd/jojo-gan-restyle

Repository files navigation

jojo-gan-restyle

This repository aims to perform one-shot image stylization getting the facial stylistic details right. Given a reference style image, paired real data is approximated using GAN inversion and a pretrained StyleGAN is fine-tuned using that approximate paired data. The StyleGAN is then encouraged to generalize so that the learned style can be applied to all other images.

Improvements

Added support for restyle GAN inverter which performs better than the already existing e4e. This also improves the overall performance of JoJoGAN. Also created well-documented and modular Python scripts to easily pre-train and fine-tune JoJoGAN.

Usage

  1. Put the target image into test_input

  2. Download the required data and models using
    python3 download_data.py

    1. To use a pretrained JoJoGAN model, run
      python3 pretrained_style.py
      To use other pretrained styles, change the value of style here from the set of options mentioned in the comment above it

    2. To fine-tune a StyleGAN2 model for a custom style, run
      python3 finetune_style.py
      The styles need to be present in the style_images and mentioned here as a list. Note that the style must have a face in it for dlib to detect. If it fails to detect, then manually crop the style image and put into the style_images_aligned

Acknowledgements

This code borrows from JoJoGAN and ReStyle.

About

Python scripts to pre-train, fine-tune and use JoJoGAN with improved GAN inversion.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published