--- license: cc-by-4.0 language: - lzh - zh - en pretty_name: AncientDoc_Plus - VLM SFT data for vertical-layout ancient Chinese OCR tags: - ocr - ancient-chinese - classical-chinese - historical-documents - vision-language-model - sft - vertical-text size_categories: - 1K` placeholder, and the expected full-page transcription as the assistant response. ## Data format Single JSON file `1016v2_AncientDoc.json`, a JSON array of 2,198 entries: ```json [ { "messages": [ { "role": "user", "content": "\n" }, { "role": "assistant", "content": "full-page transcription, columns separated by \\n" } ], "images": ["AncientDoc/<书名>page_NN.png"] } ] ``` - `images` — exactly one page image per entry (2,198 total, all `.png`). - `user` content — one fixed instruction (identical across all 2,198 entries) describing the OCR contract: read columns **right-to-left, top-to-bottom**; keep original punctuation, titles and interlinear notes (`[...]`); skip page furniture (版心/页眉/页码/印章 etc.); output `□` for illegible characters, `` for empty pages. - `assistant` content — the ground-truth transcription, 31–792 characters (median 301), unique per page (no duplicates). ## Getting the images The `images` paths in the JSON are **relative flat names** (`AncientDoc/<书名>page_NN.png`); the actual page images live in the upstream CC0 repository under a **two-level category layout** (`imgs///page_NN.png`). A mapping file **`source_path_map.json`** is provided (see Files below) that resolves every flat name to its exact upstream path: `{"<书名>page_NN.png": "imgs///page_NN.png"}`. All 2,198 mappings were verified 1:1 against the upstream repository tree (14 categories, e.g. 诗文评类/艺术类/别集类/兵家类/儒家类 …). Download the upstream images and rewrite the `images` field accordingly: ```python import json m = json.load(open("source_path_map.json", encoding="utf-8")) # e.g. "楚辭新註page_17.png" -> "imgs/楚辞类/楚辭新註/page_17.png" ``` ```bash pip install -U huggingface_hub python -c "from huggingface_hub import snapshot_download; snapshot_download('ByteDance/AncientDoc', repo_type='dataset', local_dir='AncientDoc')" ``` ## Files | File | Description | |---|---| | `1016v2_AncientDoc.json` | SFT message data, 2,198 entries | | `source_path_map.json` | flat filename → upstream `imgs///page_NN.png` (2,198 verified mappings) | | `LICENSE` | CC-BY-4.0 (this annotation set) | | `NOTICE.md` | upstream attribution and usage notes | | `README.md` | this card | ## Why "Plus" The upstream AncientDoc benchmark ships images plus `label.csv`, but is not packaged for VLM fine-tuning. We contribute: (a) full-page transcription annotations in a ready-to-use `messages`/`images` SFT layout with a fixed OCR instruction prompt; (b) a verified path map so the annotations can be joined back to upstream images regardless of local directory layout. ## Licensing - **Upstream images & benchmark**: [ByteDance/AncientDoc](https://huggingface.co/datasets/ByteDance/AncientDoc), **CC0-1.0**. - **These annotations (SFT data + path map)**: **CC-BY-4.0** — our own original transcriptions of public-domain ancient texts; the CC0 upstream imposes no additional restriction. Attribution: link to this repository. ## Citation ```bibtex @misc{ancientdoc2024, title={AncientDoc: A Benchmark for Chinese Ancient Document Understanding}, author={{ByteDance}}, howpublished={\url{https://huggingface.co/datasets/ByteDance/AncientDoc}}, note={CC0} } ``` Please also cite this repository when you use the annotations. --- ## 中文说明 基于 [AncientDoc](https://huggingface.co/datasets/ByteDance/AncientDoc) 基准(字节跳动,上游许可 **CC0-1.0**)构建的**视觉语言模型(VLM)SFT 微调数据**,用于训练竖排古籍整页 OCR。本仓库**仅含标注,不含图片**。 ### 数据格式 单文件 `1016v2_AncientDoc.json`,JSON 数组,共 2,198 条: ```json [ { "messages": [ { "role": "user", "content": "\n<转写规则说明>" }, { "role": "assistant", "content": "整页转写文本,列间以 \\n 分隔" } ], "images": ["AncientDoc/<书名>page_NN.png"] } ] ``` - `images`:每条恰好一张页面图(共 2,198 张,全部 `.png`)。 - `user` 指令:全数据集**唯一一条固定指令**,约定 OCR 契约——普通正文从右到左、每列自上而下;保留原标点、标题与双列夹注(`[...]`);忽略版心/页眉页脚/页码/印章等;模糊不可辨识字输出 `□`,无字页输出 ``。 - `assistant`:整页转写真值,31–792 字(中位数 301),逐页唯一,无重复。 ### 获取图片 JSON 中的 `images` 是**相对扁平名**(`AncientDoc/<书名>page_NN.png`),而上游 CC0 仓库的实际目录为 `imgs/<类别>/<书名>/page_NN.png`。为此提供 **`source_path_map.json`**(2,198 条映射,已逐一与上游目录树核对): `{"<书名>page_NN.png": "imgs/<类别>/<书名>/page_NN.png"}`。下载上游图片后按 映射改写 `images` 字段即可对齐。 ### 文件 | 文件 | 说明 | |---|---| | `1016v2_AncientDoc.json` | SFT 消息数据,2,198 条 | | `source_path_map.json` | 扁平文件名 → 上游路径(2,198 条已核验映射) | | `LICENSE` | 本标注集适用 CC-BY-4.0 | | `NOTICE.md` | 上游署名与使用说明 | | `README.md` | 本说明 | ### 为什么叫 "Plus" 上游 AncientDoc 基准只有图片 + `label.csv`,并非 VLM 微调格式。我们补充:(a) 现成的 `messages`/`images` SFT 布局与固定 OCR 指令的整页转写标注;(b) 经核验的路径映射,使标注可与任意本地目录布局下的上游图片对齐。 ### 许可 - 上游图片与基准:CC0-1.0。 - 本标注集(SFT 数据 + 路径映射):**CC-BY-4.0**——公有领域古籍文本的我方原创转写;使用请署名并链接本仓库。 ### 引用 请同时引用上游基准与本仓库(BibTeX 见上方英文部分)。