File size: 2,165 Bytes
882c47a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
pipeline_tag: text-to-image
library_name: diffusers
---

# GlyphPrinter: Region-Grouped Direct Preference Optimization for Glyph-Accurate Visual Text Rendering

[Paper](https://huggingface.co/papers/2603.15616) | [Project Page](https://henghuiding.com/GlyphPrinter/) | [GitHub](https://github.com/FudanCVL/GlyphPrinter)

**GlyphPrinter** is a preference-based text rendering framework designed to eliminate the reliance on explicit reward models for visual text generation. It addresses common failure cases in existing text-to-image models, such as stroke distortions and incorrect glyphs, especially when rendering complex Chinese characters, multilingual text, or out-of-domain symbols.

## Key Features

- **R-GDPO (Region-Grouped Direct Preference Optimization):** A region-based objective that optimizes inter- and intra-sample preferences over annotated regions, substantially enhancing glyph accuracy.
- **GlyphCorrector Dataset:** A specialized dataset with region-level glyph preference annotations.
- **Regional Reward Guidance (RRG):** An inference strategy that samples from an optimal distribution with controllable glyph accuracy.

## Usage

To use this model, please follow the installation instructions in the [official GitHub repository](https://github.com/FudanCVL/GlyphPrinter).

### CLI Inference

You can run inference using the provided `inference.py` script:

```bash
# list available saved conditions
python3 inference.py --list-conditions

# run inference using a prompt
python3 inference.py \
  --prompt "The colorful graffiti font <sks1> printed on the street wall" \
  --save-mask

# run inference using a specific condition file
python3 inference.py \
  --condition condition_1.npz \
  --output-dir outputs_inference
```

### Gradio Demo

Alternatively, you can run the interactive Gradio app:
```bash
python app.py
```

## Citation
```bibtex
@inproceedings{GlyphPrinter,
        title={{GlyphPrinter}: Region-Grouped Direct Preference Optimization for Glyph-Accurate Visual Text Rendering},
        author={Shuai, Xincheng and Li, Ziye and Ding, Henghui and Tao, Dacheng},
        booktitle={CVPR},
        year={2026}
      }
```