Skip to content

hangjoo/cartoonGAN_pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CartoonGAN with pytorch

Abstract

CartoonGAN(in CVPR2018) implementation code with pytorch.

Environment

1. Modules

- python : 3.6.10
- pytorch : 1.6.0
- torchvision : 0.7.0

2. GPU

- k80 (Microsoft Azure VM server)
- Your GPU card must have at least 11GB of VRAM.

3. OS

- Ubuntu 18.04-LTS

4. Directory Structure

  .
  ├── Data  
  │   └── train
  │       ├── cartoon
  │       │   └── 1
  │       ├── edge_smoothing
  │       │   └── 0
  │       └── real
  │           └── 0
  ├── Saved_model
  ├── src
  └── Train
      ├── Pretraining
      └── Training

"./Data/train/cartoon/1":

The directory to save cartoon image set to train models.

"./Data/train/edge_smoothing/0":

The directory to save edge smoothed cartoon image set to train models. You don't have to do anything to this directory.

"./Data/train/real/0":

The directory to save real image set to train models.

"./Saved_model":

After the training process is over, the generated weight files are saved in this directory.

"./src":

Only used for other tasks.

"./Train/Pretraining":

The intermediate results and weight files created during the pre-training process are saved.

"./Train/Training":

The intermediate validation results and weight files(every 5 epoch) created during the main-training process are saved.

How to train models

  1. If you want to train models, put the cartoon image set in "Data/cartoon/1/" directory. and put the real image set in "Data/real/0" directory.
  2. Open the Train.py and edit the parameters at line 20-41.
  3. Excute command python Train.py

Our train results

We used cartoon image set from Tom and Jerry animation to train models. And Flickr 30k dataset was used for real image set. Each label contains about 20,000 images.

Initialization phase (section [3.3] in paper)

Original Epoch 1 Epoch 5 Epoch 10
Original_1 Epoch_1_1 Epoch_4_1 Epoch_9_1
Original_2 Epoch_1_2 Epoch_4_2 Epoch_9_2
Original_3 Epoch_1_3 Epoch_4_3 Epoch_9_3
Original_4 Epoch_1_4 Epoch_4_4 Epoch_9_4

Training Results

Original Converted
Original_1 converted_1
Original_2 converted_2
Original_3 converted_3
Original_4 converted_4