File size: 6,862 Bytes
8d0d861
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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<n<10K
task_categories:
  - image-to-text
  - text-generation
---

# AncientDoc_Plus — VLM SFT Data for Vertical-Layout Ancient Chinese OCR

**中文说明见下半部分 | Chinese documentation follows the English section below.**

---

## English

Message-level SFT (supervised fine-tuning) data for training **vision-language
models** to transcribe vertical-layout ancient Chinese books — built on top of
the [AncientDoc](https://huggingface.co/datasets/ByteDance/AncientDoc) benchmark
(ByteDance, upstream license **CC0-1.0**).

This repository contains **annotations only** — no images. Each sample is one
page: a fixed system-style user instruction with an `<image>` 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": "<image>\n<transcription instructions>" },
      { "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, `<SKIP>` 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/<category>/<book>/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/<category>/<book>/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/<category>/<book>/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": "<image>\n<转写规则说明>" },
      { "role": "assistant", "content": "整页转写文本,列间以 \\n 分隔" }
    ],
    "images": ["AncientDoc/<书名>page_NN.png"]
  }
]
```

- `images`:每条恰好一张页面图(共 2,198 张,全部 `.png`)。
- `user` 指令:全数据集**唯一一条固定指令**,约定 OCR 契约——普通正文从右到左、每列自上而下;保留原标点、标题与双列夹注(`[...]`);忽略版心/页眉页脚/页码/印章等;模糊不可辨识字输出 `□`,无字页输出 `<SKIP>`。
- `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 见上方英文部分)。