Datasets:
|
Download README.zh-CN.md from ATH-MaaS/TextRefinementBench: direct link, hf CLI and curl.
- Browser
- Download file 3.4 kB
-
https://huggingface.co/datasets/ATH-MaaS/TextRefinementBench/resolve/main/README.zh-CN.md
- Command line
-
hf download hf://datasets/ATH-MaaS/TextRefinementBench/README.zh-CN.md
-
curl -L -o README.zh-CN.md https://huggingface.co/datasets/ATH-MaaS/TextRefinementBench/resolve/main/README.zh-CN.md
3.4 kB
metadata
language:
- zh
license: apache-2.0
task_categories:
- image-to-image
pretty_name: TextRefinementBench
size_categories:
- 1K<n<10K
configs:
- config_name: images
data_files:
- split: test
path: data/images/test-*.parquet
- config_name: annotations
data_files:
- split: test
path: data/annotations/test-*.parquet
TextRefinementBench 是用于字形条件局部文字修复(glyph-conditioned local text refinement)的评测基准。每个样本是一张原始分辨率图片,配上一组需要重绘的文字区域:每个目标包含目标文字、该区域的多边形,以及原图像素坐标下的轴对齐编辑框。模型拿到图片和目标后,需要在原位置重绘这些区域,因此这个基准既衡量目标文字是否被正确、完整地生成,也衡量编辑区域之外的画面是否被完整保留。
test split 包含 960 张图片和 2,357 个目标区域。
数据集配置
images
test split 共 960 行:
image_id:图片标识,同时也是标注行中引用的样本名。image:内嵌的 RGB PNG 图片,与源文件逐字节一致。image_path:规范的相对路径,images/<image_id>.png。width、height:图片尺寸。
annotations
test split 共 2,357 行,每个目标区域一行:
sample_id:目标级别的唯一标识,<image_id>-<item_index>。image_id:指向images配置的外键。image_path:规范的相对图片路径。item_index:该目标在所属图片内的序号,按标注顺序排列。text:该区域应包含的文字。box:原图像素坐标下的四个多边形角点[x, y]。rect:原图像素坐标下的轴对齐裁剪框[x0, y0, x1, y1]。annotation_status:该图片目标的标注来源,取值为existing_human_annotation(167 张)或reviewed_miner_proposals(793 张)。
两个配置通过 image_id 关联。
加载
from datasets import load_dataset
images = load_dataset(
"parquet",
data_files={"test": "data/images/test-00000-of-00001.parquet"},
split="test",
)
annotations = load_dataset(
"parquet",
data_files={"test": "data/annotations/test-00000-of-00001.parquet"},
split="test",
)
按 image_id 分组标注行,即可还原每张图片按顺序排列的目标列表。
运行修复模型
每条标注行对应一次编辑请求。使用 PixText 推理接口时,单张图片的目标可直接转成编辑列表:
from pixtext import PixTextPipeline, TextEdit
pipeline = PixTextPipeline.from_pretrained("models/PixText-MeanFlow")
edits = [TextEdit(bbox=tuple(row["rect"]), text=row["text"]) for row in image_rows]
result = pipeline.edit("images/sample_000001.png", edits=edits, seed=42)
编辑框使用原图像素坐标,采用左闭右开的区间;目标按标注顺序处理。评测要求实际编辑范围之外的像素保持完全一致,因此区域外的像素保留情况也是评测的一部分。
许可
本基准的图片与标注以 Apache License 2.0 发布,见 LICENSE。