Datasets:
File size: 6,696 Bytes
3256b8f 3127b61 3256b8f 3127b61 | 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | ---
license: apache-2.0
task_categories:
- text-to-image
language:
- en
- zh
pretty_name: PolyText-Bench
size_categories:
- n<1K
tags:
- text-to-image
- visual-text-rendering
- benchmark
- multimodal
- textdart
- scanner
dataset_info:
features:
- name: pair_id
dtype: string
- name: task_type
dtype: string
- name: language
dtype: string
- name: scene_category
dtype: string
- name: prompt
dtype: string
- name: target_list
list: string
- name: target
dtype: string
splits:
- name: critical_en
num_examples: 150
- name: optional_en
num_examples: 150
- name: critical_zh
num_examples: 150
- name: optional_zh
num_examples: 150
configs:
- config_name: default
data_files:
- split: critical_en
path: critical_en.jsonl
- split: optional_en
path: optional_en.jsonl
- split: critical_zh
path: critical_zh.jsonl
- split: optional_zh
path: optional_zh.jsonl
---
# PolyText-Bench
> [**Project Page**](https://sujiehu.github.io/textdart-scanner/)
PolyText-Bench is a bilingual benchmark for evaluating text accuracy and glyph fidelity
in text-to-image generation. It is introduced in
[Blame Errant Words, Not the Canvas: Defect-Aware Spatial Credit Assignment for Visual Text Generation](https://arxiv.org/abs/2610.20794).
This repository contains both the **600 benchmark prompts** and the scripts required for
image generation, TextDART deployment, resumable scoring, and metric aggregation.
## Benchmark Design
PolyText-Bench contains paired critical and optional prompts in English and Chinese:
- **Critical prompts** specify one or more required text targets. They measure Critical
Semantic accuracy (**CS**) and Critical Glyph quality (**CG**).
- **Optional prompts** describe the same scenes without prescribing text. They measure
Optional Glyph quality (**OG**) over text that the generator introduces voluntarily.
| Split | Language | Task | Prompts |
|---|---|---|---:|
| `critical_en` | English | Required target text | 150 |
| `optional_en` | English | No required target text | 150 |
| `critical_zh` | Chinese | Required target text | 150 |
| `optional_zh` | Chinese | No required target text | 150 |
Critical and optional prompts with the same `pair_id` describe matched scenes. The
provided evaluation protocol generates four images per prompt by default using
deterministic paired seeds.
## Repository Contents
```text
PolyText-Bench/
├── critical_en.jsonl
├── optional_en.jsonl
├── critical_zh.jsonl
├── optional_zh.jsonl
├── generate.py
├── deploy_textdart.sh
├── evaluate.py
├── summarize.py
├── requirements.txt
└── LICENSE
```
## Load the Prompts
```python
from datasets import load_dataset
dataset = load_dataset("SujieHu/PolyText-Bench", "default")
critical_en = dataset["critical_en"]
optional_en = dataset["optional_en"]
critical_zh = dataset["critical_zh"]
optional_zh = dataset["optional_zh"]
```
Each record contains:
- `pair_id`: shared identifier for a critical/optional scene pair
- `task_type`: `critical` or `optional`
- `language`: `en` or `zh`
- `scene_category`: visual scene category
- `prompt`: text-to-image generation prompt
- `target_list`: required rendered strings; empty for optional prompts
- `target`: space-joined convenience representation of `target_list`
## Installation
Create the TextDART environment using the official source repository:
```bash
conda create -n TextDART python=3.11 -y
conda activate TextDART
git clone https://github.com/WeChatCV/TextDART-SCANNER.git
cd TextDART-SCANNER/TextDART/train
bash install_all.sh
cd ../..
```
Then clone this Dataset repository and install its scoring dependency:
```bash
git clone https://huggingface.co/datasets/SujieHu/PolyText-Bench
cd PolyText-Bench
pip install -r requirements.txt
```
The evaluation code uses the official
[WeChatCV/TextDART-SCANNER](https://github.com/WeChatCV/TextDART-SCANNER)
implementation for TextDART parsing and target matching.
## Download and Serve TextDART
Passing the Hugging Face repository ID downloads the model
automatically:
```bash
bash deploy_textdart.sh SujieHu/TextDART-8B-Qwen3VL 1925 0
```
To download the checkpoint first and serve it from disk instead:
```bash
hf download SujieHu/TextDART-8B-Qwen3VL \
--local-dir TextDART-8B-Qwen3VL
bash deploy_textdart.sh ./TextDART-8B-Qwen3VL 1925 0
```
## Generate Images
Generate English images with Qwen-Image:
```bash
torchrun --nproc_per_node=8 generate.py \
--model-family qwen \
--mode EN \
--model_name qwen_image \
--model_path Qwen/Qwen-Image-2512 \
--gallery_output_dir outputs
```
For FLUX.1-dev, set `--model-family flux` and provide its model path. Add
`--ckpt_path /path/to/adapter` to evaluate a PEFT LoRA checkpoint. Generation defaults
to 1024 × 1024, 50 steps, and four repeats per prompt.
Generated files are written to `outputs/<model_name>_<LANG>/` as
`<pair_id>_<task_type>_<repeat>.png`. You may also evaluate externally generated images
if they follow this naming and resolution contract.
## Evaluate
With the TextDART server running:
```bash
python evaluate.py \
--mode EN \
--image-dir outputs/qwen_image_EN \
--output-dir scores/qwen_image_EN \
--server-urls http://127.0.0.1:1925
```
The evaluator validates every expected image, scores it with TextDART, writes each
successful result durably, and resumes from `eval_results.jsonl` after interruption.
Validate score completeness and write `summary.json` plus `scores.md`:
```bash
python summarize.py \
--mode EN \
--scores-dir scores/qwen_image_EN
```
## Metrics
- **CS (Critical Semantic accuracy):** mean semantic score over required text targets;
unmatched targets receive zero.
- **CG (Critical Glyph quality):** mean glyph-quality score over required text targets;
unmatched targets receive zero.
- **OG (Optional Glyph quality):** mean glyph quality over text regions detected in
optional-prompt images; images without detected text are reported as undefined and
excluded from the OG average.
All reported scores are normalized to `[0, 1]`; higher is better.
## Citation
If you find PolyText-Bench useful, please cite:
```bibtex
@article{hu2026textdartscanner,
title={Blame Errant Words, Not the Canvas: Defect-Aware Spatial Credit Assignment for Visual Text Generation},
author={Hu, Sujie and Zhang, Huaisong and Yang, Pujing and Wang, Qian and Li, Xiaomin and Leng, Xinhang and Li, Chen and Lyu, Jing and Li, Xiu and Pan, Ling},
journal={arXiv preprint arXiv:2610.20794},
year={2026}
}
```
|