/cartoon-gan-sample

Primary LanguageJupyter NotebookMIT LicenseMIT

Cartoon-GAN

Original_0

Paper: https://arxiv.org/abs/2005.07702

Description

This project takes on the problem of transferring the style of cartoon images to real-life photographic images by implementing previous work done by CartoonGAN. We trained a Generative Adversial Network(GAN) on over 60 000 images from works by Hayao Miyazaki at Studio Ghibli.

To the people asking for the dataset, im sorry but as the material is copyright protected i cannot share the dataset.

Dependencies

  1. Install Anaconda from https://www.anaconda.com/

  2. Install pytorch at: https://pytorch.org/get-started/locally/

  3. Install dependencies:

    python -m pip install tqdm pillow numpy matplotlib opencv-python
    
  4. For predicting videos you will also need ffmpeg

Weights

Weights for the presented models can be found here

Training

All training code can be found in experiment.ipynb

Predict

Predict by running predict.py.

Example:

python predict.py -i C:/folder/input_image.png -o ./output_folder/output_image.png

Predictions can be made on images, videos or a folder of images/videos.

Demonstration

Image # Original CartoonGAN GANILLA Our implementation
1 Original_1 CartoonGAN_1 GANILLA_1 Ours_1
2 Original_2 CartoonGAN_2 GANILLA_2 Ours_2
3 Original_3 CartoonGAN_3 GANILLA_3 Ours_3
4 Original_4 CartoonGAN_4 GANILLA_4 Ours_4
5 Original_5 CartoonGAN_5 GANILLA_5 Ours_5
6 Original_6 CartoonGAN_6 GANILLA_6 Ours_6
7 Original_7 CartoonGAN_7 GANILLA_7 Ours_7
8 Original_8 CartoonGAN_8 GANILLA_8 Ours_8
9 Original_9 CartoonGAN_9 GANILLA_9 Ours_9
10 Original_10 CartoonGAN_10 GANILLA_10 Ours_10
11 Original_11 CartoonGAN_11 GANILLA_11 Ours_11
12 Original_12 CartoonGAN_12 GANILLA_12 Ours_12
13 Original_13 CartoonGAN_13 GANILLA_13 Ours_13
14 Original_14 CartoonGAN_14 GANILLA_14 Ours_14
15 Original_15 CartoonGAN_15 GANILLA_15 Ours_15
16 Original_16 CartoonGAN_16 GANILLA_16 Ours_16
17 Original_17 CartoonGAN_17 GANILLA_17 Ours_17
18 Original_18 CartoonGAN_18 GANILLA_18 Ours_18
19 Original_19 CartoonGAN_19 GANILLA_19 Ours_19
20 Original_20 CartoonGAN_20 GANILLA_20 Ours_20

Citation

@misc{andersson2020generative,
      title={Generative Adversarial Networks for photo to Hayao Miyazaki style cartoons}, 
      author={Filip Andersson and Simon Arvidsson},
      year={2020},
      eprint={2005.07702},
      archivePrefix={arXiv},
      primaryClass={cs.GR}
}