Datasets:
|
Download README.md from SujieHu/PolyText-Bench: direct link, hf CLI and curl.
- Browser
- Download file 6.7 kB
-
https://huggingface.co/datasets/SujieHu/PolyText-Bench/resolve/main/README.md
- Command line
-
hf download hf://datasets/SujieHu/PolyText-Bench/README.md
-
curl -L -o README.md https://huggingface.co/datasets/SujieHu/PolyText-Bench/resolve/main/README.md
6.7 kB
| 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} | |
| } | |
| ``` | |