yifanai / video2anime

Turn your videos (and selfies) into anime with generative adversarial network (GAN)
Other
26 stars 14 forks source link

video2anime

Turn your videos (and selfies) into anime!

Introduction

This repository uses a generative adversarial network to transform real-life videos and images into anime. It is based on the paper [1] and the official implementation [2], which contain a lot more stuff. I suppose most people are more interested in trying out the anime generation demo, so I made the following adaptations:

Example Results

Photos / Selfies

dany jon cersei

Videos

webcam webcam2

Guy vs. Girl Video Results

Note: training data was biased, containing only images of women, which might explain why things could get weird for guys close-up :laughing:

Try It Yourself

  1. Install the following requirements. I have tested with these exact versions, although earlier versions might also work.
    • Ubuntu 18.04
    • Python 3.6
    • OpenCV 4.1 Python binding
    • TensorFlow 1.14 (GPU or CPU only)
    • CUDA 10.0 (for GPU support)
    • CUDNN 7.6.1 (for GPU support)
  2. Clone this repository.
  3. Download the pretrained checkpoint files, and put them in the directory: video2anime/checkpoints/
Checkpoint Description Link Size
UGATIT_100_epoch_generator_only Minified, generator only checkpoint based on 100-epoch checkpoint from [2] Google Drive 1 GB
  1. Run the following scripts. For best results, input images and videos should be square, and contain a big face in the center.
Script Description Run (with help for options)
record.py Record your video to anime live with a webcam* python record.py --help
selfie.py Turn your selfie into an anime character python selfie.py --help

*Note: powerful computer with NVIDIA GPU may be required

References

This project is based on the paper [1] and official TensorFlow implementation by the authors [2].

[1] Junho Kim, Minjae Kim, Hyeonwoo Kang, et al. “U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation”. In: arXiv preprint arXiv:1907.10830 (2019).

[2] https://github.com/taki0112/UGATIT