Diff-Font: Diffusion Model for Robust One-Shot Font Generation

Haibin He, Xinyuan Chen, Chaoyue Wang, Juhua Liu, Bo Du, Dacheng Tao, Yu QiaoIJCV 2022

TL;DR

This paper introduces Diff-Font, a novel approach to one-shot font generation that leverages diffusion models instead of traditional GANs. By treating font generation as a conditional generation task and incorporating fine-grained stroke/component information, Diff-Font achieves more stable training and superior generation quality, especially for complex scripts like Chinese and Korean.

What Problem Does This Paper Address?

Creating high-quality font libraries, especially for languages with thousands of complex characters like Chinese and Korean, is a labor-intensive and challenging task. Existing "few-shot" or "one-shot" font generation methods, primarily based on Generative Adversarial Networks (GANs), struggle with several issues:

  • Unstable Training: GANs are notoriously difficult to train, often suffering from convergence problems, especially with large datasets.
  • Limited Fidelity: They can have trouble accurately replicating subtle font style variations or preserving intricate local details.
  • Imprecise Generation of Complex Characters: GANs often fail to maintain the structural integrity of characters with complex shapes and numerous strokes.

These limitations hinder the creation of diverse and high-fidelity font styles, particularly for glyph-rich languages.

Methods

Diff-Font tackles these challenges by adopting a diffusion model-based approach, moving away from GANs. The core ideas are:

  • Conditional Generation: Instead of a direct image-to-image translation, Diff-Font frames font generation as a conditional generation task. This means the model generates a character image based on specific conditions.
  • Multi-Attribute Conditioning: The generation process is guided by multiple attributes:
  • Content: Character content is represented by predefined embedding tokens, similar to word embeddings in NLP, allowing for better distinction between characters.
  • Style: Font style is extracted from a single reference image using a pre-trained style encoder.
  • Fine-grained Conditions (Strokes/Components): For complex scripts like Chinese and Korean, additional fine-grained information is incorporated. For Chinese, this involves stroke information, and for Korean, component information. Crucially, they use a count encoding for these strokes/components, which captures the number of occurrences, offering a richer representation than simple binary encoding.
  • Diffusion Model Backbone: The core generation is handled by a diffusion model (specifically, a UNet architecture). This model learns to reverse a diffusion process, gradually denoising a random noise input into a coherent character image, guided by the multi-attribute conditions.
  • Attribute-wise Guidance: A two-stage training strategy is employed. After initial multi-attribute conditional training, a fine-tuning stage randomly discards certain attribute conditions (content or stroke/component) with a probability. This helps the model become more sensitive to each attribute and improves overall generation quality.

Datasets

The paper utilizes existing datasets and also introduces new ones:

  • Chinese Font Datasets: They collected 410 fonts, each with 6,625 Chinese characters. They created both a small dataset (400 fonts for training, 10 for testing) and a large dataset (400 fonts for training, 10 for testing, with more complex characters in the test set).
  • Korean Font Dataset: A dataset of 201 Korean fonts (195 for training, 6 for testing) with 2,350 characters was compiled.
  • Latin and Greek Datasets: Used for demonstrating generalization to simpler scripts.

The paper also mentions creating a "stroke-wise dataset for Chinese font generation and a component-wise dataset for Korean font generation."

Key Insights and Ideas

  • Diffusion Models for Font Generation: This is presented as the first work to apply diffusion models to font generation, offering a promising alternative to GANs. The inherent stability of diffusion models is a significant advantage.
  • Conditional Generation is Key: Framing font generation as a conditional task, rather than just style transfer, allows for better disentanglement of content and style, leading to more robust results.
  • Count Encoding for Strokes/Components: Using a count-based representation for strokes and components is a novel and effective way to capture structural details, outperforming simpler binary encoding and significantly improving the generation of complex characters.
  • Attribute-wise Guidance Improves Sensitivity: The fine-tuning strategy that randomly drops attributes forces the model to learn more robust representations for each condition, leading to better overall performance.

Key Results

  • State-of-the-Art Performance: Diff-Font achieves state-of-the-art results on both qualitative and quantitative metrics across various scripts (Chinese, Korean, Latin, Greek).
  • Quantitative Improvements: On the small Chinese dataset, Diff-Font achieved an FID of 27.30, outperforming previous methods like DG-Font (43.44). On the large dataset, it achieved an FID of 16.20, significantly better than DG-Font (28.63). Similar improvements were seen for Korean script generation.
  • Qualitative Superiority: Figures demonstrate Diff-Font's ability to generate high-fidelity fonts with accurate styles and well-preserved character structures, especially in challenging scenarios where GAN-based methods fail.
  • Human Evaluation: A user study showed that Diff-Font was preferred by a significant margin, with 48.75% of participants choosing its output, compared to 24.53% for DG-Font and much lower for FUNIT and MX-Font.

Limitations and Future Work

  • Inference Efficiency: Like most diffusion models, Diff-Font suffers from low inference efficiency due to the iterative denoising process.
  • Generation Failures: While significantly reduced, generation failures can still occur for characters with extreme intricate structures or uncommon styles that were infrequently encountered during training.
  • Future Work: The paper suggests that further exploration into improving inference speed and addressing rare/complex character generation remains an area for future research. The proposed framework's language-agnostic nature also opens doors for application to a wider range of scripts.

Summary updated

BibTeX
@article{he2022diff,
  author = {Haibin He and Xinyuan Chen and Chaoyue Wang and Juhua Liu and Bo Du and Dacheng Tao and Yu Qiao},
  title = {{Diff-Font: Diffusion Model for Robust One-Shot Font Generation}},
  journal = {Int. J. Comput. Vis.},
  year = {2022},
  url = {https://openreview.net/forum?id=SXBmyoT3ta},
}
Figure