AmbiGen: Generating Ambigrams from Pre-trained Diffusion Model

Boheng Zhao, Rana Hanocka, Raymond A. YeharXiv 2023

Abstract

Ambigrams are calligraphic designs that maintain legibility under different viewing orientations, typically a 180-degree rotation. Creating these designs is a significant challenge even for skilled artists, as it requires balancing the visual features of two different characters or words simultaneously. We introduce AmbiGen, a framework that automates ambigram generation by distilling a large-scale vision-language diffusion model (DeepFloyd IF) to optimize vector-based glyph outlines. Our method significantly outperforms existing rule-based and pixel-based AI generators in both legibility and aesthetic quality.

Introduction

Designing an ambigram is a visual optimization problem. A designer must craft a shape that functions as one letter (e.g., 'A') from one perspective and potentially a different letter (e.g., 'G') when inverted. Traditional automated tools often rely on rigid font libraries or pixel-based neural networks that produce noisy, unscalable results. AmbiGen addresses these issues by shifting the focus to vector-based optimization, ensuring clean, scalable typography that respects the structural nuances of characters.

Methodology: The AmbiGen Framework

AmbiGen utilizes a two-stage optimization pipeline to bridge the gap between individual character legibility and cohesive word design.

Vector-Based Optimization

Unlike previous generative models that operate in pixel space, AmbiGen optimizes the control points of Bézier curves. By using a differentiable rasterizer (DiffVG), the system can compute gradients from image-based AI feedback and apply them directly to vector shapes. This constraint naturally leads to "font-like" outputs, eliminating the artifacts and "floaters" common in pixel-based generation.

Score Distillation with DeepFloyd IF

The core of the system is the DeepFloyd IF diffusion model. Its T5-XXL text encoder provides a superior understanding of character structures compared to CLIP-based models like Stable Diffusion. The optimization process uses "score distillation" to iteratively nudge the Bézier curves until the diffusion model recognizes the shape as the target letters from both orientations.

Two-Stage Pipeline

  1. Letter-Level Optimization: Individual glyphs are initialized and optimized to satisfy dual-view requirements. The system uses specific alignment strategies to provide diverse starting points for the design.
  2. Word-Level Optimization: To ensure the word functions as a cohesive unit, the letters are optimized together. This stage prevents issues like awkward spacing or overlapping that arise when letters are designed in isolation.
The two-stage optimization pipeline of AmbiGen, showing the transition from individual glyph initialization to word-level refinement for the word "GAVE".

Key Results and Evaluation

We evaluated AmbiGen against artist-designed fonts and existing AI baselines using the 500 most common English words.

Legibility and Accuracy

Using TrOCR (a transformer-based OCR model) for objective legibility testing, AmbiGen achieved a 24.2% word accuracy. While seemingly low, this is a substantial improvement over the best artist-designed baseline (9.2%) and nearly seven times better than previous AI methods (3.6%). Furthermore, the system reduced the average edit distance to 3.634, compared to 7.042 for the best baseline.

User Preference

In a study with 30 participants, AmbiGen's designs were preferred 76.1% of the time when compared to top-tier artist-designed fonts, highlighting the aesthetic appeal of the generated vectors.

Examples of rotational ambigrams generated by AmbiGen for the words "ASK", "BARK", and "WATER".

Conclusion

AmbiGen represents a significant step forward in automated typography. By combining vector constraints with the powerful text-understanding capabilities of DeepFloyd IF, the framework produces ambigrams that are both legible and artistically sophisticated. Future work will focus on reducing optimization time and automating the generation of unequal-length ambigrams (e.g., "Stir" ↔ "Sup").

Summary updated

BibTeX
@misc{zhao2023ambigen,
  author = {Boheng Zhao and Rana Hanocka and Raymond A. Yeh},
  title = {{AmbiGen: Generating Ambigrams from Pre-trained Diffusion Model}},
  year = {2023},
  eprint = {2312.02967},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.02967},
}
Figure