CartoonGAN-Test-Pytorch-Torch
Pytorch and Torch testing code of CartoonGAN [Chen et al., CVPR18]. With the released pretrained models by the authors, I made these simple scripts for a quick test.
Getting started
Linux
NVIDIA GPU
Pytorch 0.3
Torch
git clone https://github.com/Yijunmaverick/CartoonGAN-Test-Pytorch-Torch
cd CartoonGAN-Test-Pytorch-Torch
Pytorch
The original pretrained models are Torch nngraph models, which cannot be loaded in Pytorch through load_lua. So I manually copy the weights (bias) layer by layer and convert them to .pth models.
Download the converted models:
sh pretrained_model/download_pth.sh
For testing:
python test.py --input_dir YourImgDir --style Hosoda --gpu 0
Torch
Working with the original models in Torch is also fine. I just convert the weights (bias) in their models from CudaTensor to FloatTensor so that cudnn is not required for loading models.
Download the converted models:
sh pretrained_model/download_t7.sh
For testing:
th test.lua -input_dir YourImgDir -style Hosoda -gpu 0
Examples (Left: input, Right: output)
Note
The training code should be similar to the popular GAN-based image-translation frameworks and thus is not included here.
Acknowledgement
Many thanks to the authors for this cool work.
Part of the codes are borrowed from DCGAN, TextureNet, AdaIN and CycleGAN.
本文介绍了使用Pytorch和Torch对CartoonGAN进行测试的代码。在Linux和NVIDIA GPU环境下,需安装Pytorch 0.3和Torch。文中给出了克隆代码库、下载转换模型及测试的具体步骤,还提到训练代码与流行的基于GAN的图像翻译框架类似,未包含在内。

被折叠的 条评论
为什么被折叠?



