All Projects → VITA-Group → Shapematchinggan

VITA-Group / Shapematchinggan

[ICCV 2019, Oral] Controllable Artistic Text Style Transfer via Shape-Matching GAN

Projects that are alternatives of or similar to Shapematchinggan

Aulas
Aulas da Escola de Inteligência Artificial de São Paulo
Stars: ✭ 166 (-47.3%)
Mutual labels:  jupyter-notebook, gans
Book deeplearning in pytorch source
Stars: ✭ 236 (-25.08%)
Mutual labels:  jupyter-notebook, gans
Dst
Deformable Style Transfer (ECCV 2020)
Stars: ✭ 167 (-46.98%)
Mutual labels:  jupyter-notebook, style-transfer
Generative adversarial networks 101
Keras implementations of Generative Adversarial Networks. GANs, DCGAN, CGAN, CCGAN, WGAN and LSGAN models with MNIST and CIFAR-10 datasets.
Stars: ✭ 138 (-56.19%)
Mutual labels:  jupyter-notebook, gans
HistoGAN
Reference code for the paper HistoGAN: Controlling Colors of GAN-Generated and Real Images via Color Histograms (CVPR 2021).
Stars: ✭ 158 (-49.84%)
Mutual labels:  style-transfer, gans
Starnet
StarNet
Stars: ✭ 141 (-55.24%)
Mutual labels:  jupyter-notebook, gans
Style transfer
CNN image style transfer 🎨.
Stars: ✭ 210 (-33.33%)
Mutual labels:  jupyter-notebook, style-transfer
Image Outpainting
🏖 Keras Implementation of Painting outside the box
Stars: ✭ 1,106 (+251.11%)
Mutual labels:  jupyter-notebook, gans
Zhihu
This repo contains the source code in my personal column (https://zhuanlan.zhihu.com/zhaoyeyu), implemented using Python 3.6. Including Natural Language Processing and Computer Vision projects, such as text generation, machine translation, deep convolution GAN and other actual combat code.
Stars: ✭ 3,307 (+949.84%)
Mutual labels:  jupyter-notebook, style-transfer
CoMoGAN
CoMoGAN: continuous model-guided image-to-image translation. CVPR 2021 oral.
Stars: ✭ 139 (-55.87%)
Mutual labels:  style-transfer, gans
Deep Learning With Python
Example projects I completed to understand Deep Learning techniques with Tensorflow. Please note that I do no longer maintain this repository.
Stars: ✭ 134 (-57.46%)
Mutual labels:  jupyter-notebook, style-transfer
Generative models tutorial with demo
Generative Models Tutorial with Demo: Bayesian Classifier Sampling, Variational Auto Encoder (VAE), Generative Adversial Networks (GANs), Popular GANs Architectures, Auto-Regressive Models, Important Generative Model Papers, Courses, etc..
Stars: ✭ 276 (-12.38%)
Mutual labels:  jupyter-notebook, gans
Neural Painters Pytorch
PyTorch library for "Neural Painters: A learned differentiable constraint for generating brushstroke paintings"
Stars: ✭ 118 (-62.54%)
Mutual labels:  jupyter-notebook, style-transfer
Cartoonify
Deploy and scale serverless machine learning app - in 4 steps.
Stars: ✭ 157 (-50.16%)
Mutual labels:  jupyter-notebook, style-transfer
Neural Painters X
Neural Paiters
Stars: ✭ 61 (-80.63%)
Mutual labels:  jupyter-notebook, style-transfer
Deep Math Machine Learning.ai
A blog which talks about machine learning, deep learning algorithms and the Math. and Machine learning algorithms written from scratch.
Stars: ✭ 173 (-45.08%)
Mutual labels:  jupyter-notebook, gans
Style Transfer
Style Transfer - Alia Bhatt (Google Colab)
Stars: ✭ 26 (-91.75%)
Mutual labels:  jupyter-notebook, style-transfer
Asrgen
Attacking Speaker Recognition with Deep Generative Models
Stars: ✭ 31 (-90.16%)
Mutual labels:  jupyter-notebook, gans
sRender
Facial Sketch Render, ICASSP 2021
Stars: ✭ 20 (-93.65%)
Mutual labels:  style-transfer, gans
Hands On Deep Learning Algorithms With Python
Master Deep Learning Algorithms with Extensive Math by Implementing them using TensorFlow
Stars: ✭ 272 (-13.65%)
Mutual labels:  jupyter-notebook, gans

ShapeMatchingGAN

source adjustable stylistic degree of glyph stylized text application
liquid artistic text rendering smoke artistic text rendering

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]

It is provided for educational/research purpose only. Please consider citing our paper if you find the software useful for your work.

Usage:

Prerequisites

  • Python 2.7
  • Pytorch 1.1.0
  • matplotlib
  • scipy
  • Pillow

Install

  • Clone this repo:
git clone https://github.com/TAMU-VITA/ShapeMatchingGAN.git
cd ShapeMatchingGAN/src

Testing Example

  • Download pre-trained models from [Google Drive] or [Baidu Cloud](code:rjpi) to ../save/
  • Artisic text style transfer using fire style with scale 0.0
    • Results can be found in ../output/
python test.py \
--scale 0.0
--structure_model ../save/fire-GS-iccv.ckpt \
--texture_model ../save/fire-GT-iccv.ckpt \
--gpu
  • Artisic text style transfer with specified parameters
    • setting scale to -1 means testing with multiple scales in [0,1] with step of scale_step
    • specify the input text name, output image path and name with text_name, result_dir and name, respectively
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
  • For black and white text images, use option --text_type 1
    • utils.text_image_preprocessing will transform BW images into distance-based images
    • distance-based images make the network better deal with the saturated regions

Training Examples

Training Sketch Module G_B

  • Download text dataset from [Google Drive] or [Baidu Cloud](code:rjpi) to ../data/

  • Train G_B with default parameters

    • Adding augmented images to the training set can make G_B more robust
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/

  • Use --help to view more training options
python trainSketchModule.py --help

Training Structure Transfer G_S

  • Train G_S with default parameters
    • step1: G_S is first trained with a fixed l = 1 to learn the greatest deformation
    • step2: we then use l ∈ {0, 1} to learn two extremes
    • step3: G_S is tuned on l ∈ {i/K}, i=0,...,K where K = 3 (i.e. --scale_num 4)
    • for structure with directional patterns, training without --Sanglejitter will be a good option
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/

  • To preserve the glyph legibility (Eq. (7) in the paper), use option --glyph_preserve
    • need to specify the text dataset --text_path ../data/rawtext/yaheiB/train and --text_datasize 708
    • need to load pre-trained G_B model --load_GB_name ../save/GB-iccv.ckpt
    • in most cases, --glyph_preserve is not necessary, since one can alternatively use a smaller l
  • Use --help to view more training options
python trainStructureTransfer.py --help

Training Texture Transfer G_T

  • Train G_T with default parameters
    • for complicated style or style with directional patterns, training without --Tanglejitter will be a good option
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/

  • To train with style loss, use option --style_loss
    • need to specify the text dataset --text_path ../data/rawtext/yaheiB/train and --text_datasize 708
    • need to load pre-trained G_S model --load_GS_name ../save/fire-GS.ckpt
    • adding --style_loss can slightly improve the texture details
  • Use --help to view more training options
python trainTextureTransfer.py --help

More

Three training examples are in the IPythonNotebook ShapeMatchingGAN.ipynb

Have fun :-)

Try with your own style images

  • Style image preparation
    • Applicable style types: To make the stylized text easy to recognize, it is desirable to have a certain distinction between the text and the background. If the texture has no distinct shape, the generated stylized text will be mixed with the background. Therefore, textures with distinct shapes as the reference style are recommended.
    • Prepare (X,Y): Use Image Matting Algorithm or the Quick Selection Tool in Photoshop to obtain the black and white structure map X (i.e. foreground mask) of the style image Y.
    • Prepare distance-based structure map: Use utils.text_image_preprocessing to transform black and white X into distance-based X.
    • Concatenate distance-based X with Y as the format of images in ../data/style/ and copy the result to ../data/style/.

Contact

Shuai Yang

[email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].