PyTorch implementation of style transfer (landscape cartoonization) models
- Pytorch
- torchvision
- numpy
- PIL
- OpenCV
- tqdm
- click
- Download dataset
- Place data
e.g.
.
└── data
├── summer2winter_yosemite
| ├── trainA
| ├── trainB
| ├── testA
| └── testB
└── cartoon_dataset
├── photo
| ├── 0.jpg
| └── ...
├── cartoon
| ├── 0_1.jpg
| └── ...
├── cartoon_smoothed
| ├── 0_1.jpg
| └── ...
└── val
├── 1.jpg
└── ...
- Train
-
CycleGAN:
python train_cyclegan.py
-
CartoonGAN:
python train_cartoongan.py
-
AnimeGAN:
python train_animegan.py
-
arguments
- dataset_type (only for CycleGAN): folder name to use for dataset (e.g. summer2winter_yosemite)
- load_model:
True
/False
- cuda_visible:
CUDA_VISIBLE_DEVICES
(e.g. 1)
- Test
-
CycleGAN:
python test_cyclegan.py
-
CartoonGAN:
python test_cartoongan.py
-
AnimeGAN:
python test_cartoongan.py --model_name=animegan
-
arguments
- dataset_type (only for CycleGAN)
- model_type (only for CycleGAN):
x2y
/y2x
- image_path: folder path to convert the images
- cuda_visible
- model_name (only for CartoonGAN):
cartoongan
/animegan
- is_crop (only for CartoonGAN):
True
/False
. crop and resize image to (256, 256)
- We trained the models with Shinkai style
Photo | CartoonGAN | AnimeGAN |
- AnimeGAN kept the original texture and color than CartoonGAN.
- CartoonGAN made good use of the unique black edge of cartoons.
- CartoonGAN and AnimeGAN were close to the texture of TVD/Movie, respectively.
- AnimeGAN did not reduce the Discriminator adversial loss from certain point.
- In CartoonGAN, the color expressions changed as the epoch increases, and was unified for all generated images.
- The performance was better when using generated cartoon data by cropping the high-resolution images than resizing them.