Home

Awesome

ShapeMatchingGAN

<table border="0" width='100%'> <tr align="center"> <td width="14.5%"><img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/teaser-a.jpg" width="100%" ></td> <td width="32%"><img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/teaser-b.png" width="99%" ></td> <td width="33%"><img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/teaser-c.gif" width="99%" ></td> <td width="18.6%"><img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/teaser-d.gif" width="99%" ></td> </tr> <tr align="center"> <td>source</td><td>adjustable stylistic degree of glyph</td><td>stylized text</td><td>application</td> </tr> </table> <table border="0" width='100%'> <tr align="center"> <td width="50%"><img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/teaser-e.gif" alt="" width="99%" ></td> <td width="50%"><img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/teaser-f.gif" alt="" width="99%" ></td> </tr> <tr align="center"> <td>liquid artistic text rendering</td><td>smoke artistic text rendering</td> </tr> </table>

This is a pytorch implementation of the paper.

Shuai Yang, Zhangyang Wang, Zhaowen Wang, Ning Xu, Jiaying Liu and Zongming Guo. Controllable Artistic Text Style Transfer via Shape-Matching GAN, accepted by International Conference on Computer Vision (ICCV), 2019.

[Project] | [Paper] | More about artistic text style transfer [Link]

Please consider citing our paper if you find the software useful for your work.

Usage:

Prerequisites

Install

git clone https://github.com/TAMU-VITA/ShapeMatchingGAN.git
cd ShapeMatchingGAN/src

Testing Example

<img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/test.jpg" width="60%" height="60%">
python test.py \
--scale 0.0
--structure_model ../save/fire-GS-iccv.ckpt \
--texture_model ../save/fire-GT-iccv.ckpt \
--gpu
python test.py \
--text_name ../data/rawtext/yaheiB/val/0801.png \
--scale -1 --scale_step 0.2 \
--structure_model ../save/fire-GS-iccv.ckpt \
--texture_model ../save/fire-GT-iccv.ckpt \
--result_dir ../output --name fire-0801 \
--gpu

or just modifying and running

sh ../script/launch_test.sh

Training Examples

Training Sketch Module G_B

python trainSketchModule.py \
--text_path ../data/rawtext/yaheiB/train --text_datasize 708 \
--augment_text_path ../data/rawtext/augment --augment_text_datasize 5 \
--batchsize 16 --Btraining_num 12800 \
--save_GB_name ../save/GB.ckpt \
--gpu

or just modifying and running

sh ../script/launch_SketchModule.sh

Saved model can be found at ../save/

python trainSketchModule.py --help

Training Structure Transfer G_S

python trainStructureTransfer.py \
--style_name ../data/style/fire.png \
--batchsize 16 --Straining_num 2560 \
--step1_epochs 30 --step2_epochs 40 --step3_epochs 80 \
--scale_num 4 \
--Sanglejitter \
--save_path ../save --save_name fire \
--gpu

or just modifying and running

sh ../script/launch_ShapeMGAN_structure.sh

Saved model can be found at ../save/

python trainStructureTransfer.py --help

Training Texture Transfer G_T

python trainTextureTransfer.py \
--style_name ../data/style/fire.png \
--batchsize 4 --Ttraining_num 800 \
--texture_step1_epochs 40 \
--Tanglejitter \
--save_path ../save --save_name fire \
--gpu

or just modifying and running

sh ../script/launch_ShapeMGAN_texture.sh

Saved model can be found at ../save/

python trainTextureTransfer.py --help

More

Three training examples are in the IPythonNotebook ShapeMatchingGAN.ipynb

Have fun :-)

Try with your own style images

<img src="https://github.com/williamyang1991/ShapeMatchingGAN/blob/master/imgs/failure.jpg" width="90%" height="90%">

Contact

Shuai Yang

williamyang@pku.edu.cn