Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -138,4 +138,62 @@ tags:
|
|
138 |
- code
|
139 |
size_categories:
|
140 |
- 100K<n<1M
|
141 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
- code
|
139 |
size_categories:
|
140 |
- 100K<n<1M
|
141 |
+
---
|
142 |
+
|
143 |
+
# LaTeX OCR 的数据仓库
|
144 |
+
|
145 |
+
本数据仓库是专为 [LaTeX_OCR](https://github.com/LinXueyuanStdio/LaTeX_OCR) 及 [LaTeX_OCR_PRO](https://github.com/LinXueyuanStdio/LaTeX_OCR) 制作的数据,来源于 `https://zenodo.org/record/56198#.V2p0KTXT6eA` 以及 `https://www.isical.ac.in/~crohme/` 以及我们自己构建。
|
146 |
+
|
147 |
+
> 原始数据仓库在github [LinXueyuanStdio/Data-for-LaTeX_OCR](https://github.com/LinXueyuanStdio/Data-for-LaTeX_OCR).
|
148 |
+
|
149 |
+
## 数据集
|
150 |
+
|
151 |
+
本仓库有 5 个数据集
|
152 |
+
|
153 |
+
1. `small` 是小数据集,测试用
|
154 |
+
2. `full` 是印刷体约 100k 的完整数据集。实际上略小于 100k,因为用 LaTeX 的抽象语法树剔除了很多不能渲染的 LaTeX。
|
155 |
+
3. `synthetic_handwrite` 是手写体 100k 的完整数据集,基于`full`的公式,使用手写字体合成而来。样本数实际上略小于 100k,理由同上。
|
156 |
+
4. `human_handwrite` 是手写体较小数据集,更符合人类在电子屏上的手写体。主要来源于 `CROHME`。我们用 LaTeX 的抽象语法树校验过了。
|
157 |
+
5. `human_handwrite_print` 来自 `human_handwrite` 的印刷体数据集,公式部分和`human_handwrite`相同,图片部分由公式用 LaTeX 渲染而来。
|
158 |
+
|
159 |
+
## 使用
|
160 |
+
|
161 |
+
加载训练集
|
162 |
+
|
163 |
+
- name 可选 small, full, synthetic_handwrite, human_handwrite, human_handwrite_print
|
164 |
+
- split 可选 train, validation, test
|
165 |
+
|
166 |
+
```python
|
167 |
+
>>> from datasets import load_dataset
|
168 |
+
>>> train_dataset = load_dataset("linxy/LaTeX_OCR", name="small", split="train")
|
169 |
+
>>> train_dataset[2]["text"]
|
170 |
+
\rho _ { L } ( q ) = \sum _ { m = 1 } ^ { L } \ P _ { L } ( m ) \ { \frac { 1 } { q ^ { m - 1 } } } .
|
171 |
+
>>> train_dataset[2]
|
172 |
+
{'image': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=200x50 at 0x15A5D6CE210>,
|
173 |
+
'text': '\\rho _ { L } ( q ) = \\sum _ { m = 1 } ^ { L } \\ P _ { L } ( m ) \\ { \\frac { 1 } { q ^ { m - 1 } } } .'}
|
174 |
+
>>> len(train_dataset)
|
175 |
+
50
|
176 |
+
```
|
177 |
+
|
178 |
+
加载所有
|
179 |
+
```python
|
180 |
+
>>> from datasets import load_dataset
|
181 |
+
>>> dataset = load_dataset("linxy/LaTeX_OCR", name="small")
|
182 |
+
>>> dataset
|
183 |
+
DatasetDict({
|
184 |
+
train: Dataset({
|
185 |
+
features: ['image', 'text'],
|
186 |
+
num_rows: 50
|
187 |
+
})
|
188 |
+
validation: Dataset({
|
189 |
+
features: ['image', 'text'],
|
190 |
+
num_rows: 30
|
191 |
+
})
|
192 |
+
test: Dataset({
|
193 |
+
features: ['image', 'text'],
|
194 |
+
num_rows: 30
|
195 |
+
})
|
196 |
+
})
|
197 |
+
```
|
198 |
+
|
199 |
+
|