← all repositories
kaonashi-tyc/zi2zi

Forging brushstrokes with conditional GANs

It trains a conditional GAN to redraw thousands of CJK characters as images in a new typographic style, so you don't have to.

zi2zi
Not currently ranked — collecting fresh signals.
star history

What it does

This project is a style-transfer rig for East Asian characters. Feed it a source font and a target style, and a conditional GAN redraws the glyphs—Chinese, Korean, Japanese, or traditional—as images in the new visual style. It is essentially a pix2pix pipeline augmented with category embeddings and extra losses borrowed from AC-GAN and Domain Transfer Networks.

The interesting bit

The real tweak is label shuffling. Once the discriminator collapses and d_loss flatlines near zero, the model stops improving. The fix: inside each minibatch, shuffle the style labels for half the targets. Those shuffled pairs have no ground-truth image for the L1 loss, but they still feed the other losses, forcing the generator to generalize beyond memorized examples. The README claims this improves detail and reduces the number of characters needed for training.

Key highlights

  • Built on pix2pix, but adds AC-GAN category loss and DTN constant loss to handle multiple styles.
  • Supports interpolation between fonts and can output GIF animations of style transitions.
  • Pretrained generator available (27 fonts), whose encoder can be reused to accelerate training.
  • Handles CN, CN_T, JP, and KR character sets out of the box.
  • Can generate brush, cursive, and Mingchao (Songti) styles from the same architecture.

Caveats

  • The code targets Python 2.7 and TensorFlow >= 1.0.1, so expect a vintage dependency stack.
  • The README recommends enabling label shuffling manually once d_loss flatlines; it does not mention an automatic trigger.
  • Only the generator is saved in the pretrained checkpoint, so you will need the full model setup to resume discriminator training.

Verdict

Worth a look if you are researching generative typefaces or need a baseline for CJK style transfer. Skip it if you want a modern, batteries-included font tool; this is a research artifact pinned to Python 2.7 and TensorFlow 1.x.

Frequently asked

What is kaonashi-tyc/zi2zi?
It trains a conditional GAN to redraw thousands of CJK characters as images in a new typographic style, so you don't have to.
Is zi2zi open source?
Yes — kaonashi-tyc/zi2zi is open source, released under the Apache-2.0 license.
What language is zi2zi written in?
kaonashi-tyc/zi2zi is primarily written in Python.
How popular is zi2zi?
kaonashi-tyc/zi2zi has 2.7k stars on GitHub.
Where can I find zi2zi?
kaonashi-tyc/zi2zi is on GitHub at https://github.com/kaonashi-tyc/zi2zi.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.