遇见数据集

harryrobert/latex-ocr-aug

收藏
Hugging Face2026-04-15 更新2026-04-26 收录
官方服务:

资源简介:

--- license: mit task_categories: - image-to-text language: - en tags: - latex - ocr - math - formula-recognition - augmentation size_categories: - 1M<n<10M --- # latex-ocr-aug A large-scale LaTeX OCR dataset with multiple augmentation variants, designed for training image-to-LaTeX models. Contains over **1.38M** training samples across five augmentation levels, plus validation and test splits. ## Dataset Summary | Split | Subset | Samples | Shards | |------------|--------------|-----------|--------| | train | raw | 1,389,527 | 28 | | train | light | 1,389,527 | 28 | | train | heavy | 1,389,527 | 28 | | train | light_text | 1,389,527 | 56 | | train | heavy_text | 1,389,527 | 56 | | validation | — | 77,195 | 2 | | test | — | 77,195 | 2 | ## Dataset Structure ``` latex-ocr-aug/ ├── train/ │ ├── raw/ # No augmentation — original rendered formula images │ ├── light/ # Light augmentation (mild noise, slight blur, small rotation) │ ├── heavy/ # Heavy augmentation (strong distortion, shadow, perspective) │ ├── light_text/ # Light augmentation + surrounding text context │ └── heavy_text/ # Heavy augmentation + surrounding text context ├── validation/ # Held-out validation split └── test/ # Held-out test split ``` Each parquet file contains the following columns: | Column | Type | Description | |-----------|--------|------------------------------------------| | `image` | bytes | PNG image of the rendered LaTeX formula | | `latex` | string | Ground-truth LaTeX source string | ## Augmentation Levels - **raw**: Clean renders with no augmentation. Use for baseline evaluation. - **light**: Mild augmentations — slight blur, small brightness/contrast jitter, minimal rotation. Suitable for general training. - **heavy**: Strong augmentations — heavy distortion, shadows, perspective warp, ink simulation. Designed for robustness. - **light_text / heavy_text**: Same as light/heavy but the formula image is embedded inside a larger document-like context with surrounding text, simulating real-world document scanning. ## Usage ### Load a specific subset ```python from datasets import load_dataset # Load raw train split ds = load_dataset("harryrobert/latex-ocr-aug", data_dir="train/raw", split="train") # Load heavy augmentation ds = load_dataset("harryrobert/latex-ocr-aug", data_dir="train/heavy", split="train") # Load validation ds = load_dataset("harryrobert/latex-ocr-aug", data_dir="validation", split="train") ``` ### Iterate samples ```python for sample in ds: image = sample["image"] # PIL image or bytes latex = sample["latex"] # LaTeX string ``` ## Intended Use This dataset is intended for training and evaluating sequence-to-sequence models that convert formula images to LaTeX, such as: - Encoder-decoder transformers (e.g., TrOCR, Donut, custom ViT + decoder) - Autoregressive decoder models fine-tuned on formula recognition The multiple augmentation variants allow training with curriculum learning (start on `raw` or `light`, gradually introduce `heavy`) or multi-task sampling across subsets. ## License MIT

许可证:MIT协议 任务类别: - 图像转文本(image-to-text) 语言: - 英语(en) 标签: - LaTeX(latex) - OCR(ocr) - 数学(math) - 公式识别(formula-recognition) - 数据增强(augmentation) 样本量区间: - 100万<样本量<1000万 # LaTeX-OCR增强数据集 本数据集为大规模LaTeX OCR数据集,包含多种数据增强变体,专为训练图像转LaTeX模型设计。数据集涵盖5种增强级别下的超138万条训练样本,同时包含验证集与测试集划分。 ## 数据集概览 | 划分方式 | 子集名称 | 样本数量 | 分片数 | |---------------|------------------------|------------|--------| | 训练集 | 原始(raw) | 1,389,527 | 28 | | 训练集 | 轻度增强(light) | 1,389,527 | 28 | | 训练集 | 重度增强(heavy) | 1,389,527 | 28 | | 训练集 | 轻度增强+文本上下文(light_text) | 1,389,527 | 56 | | 训练集 | 重度增强+文本上下文(heavy_text) | 1,389,527 | 56 | | 验证集 | — | 77,195 | 2 | | 测试集 | — | 77,195 | 2 | ## 数据集结构 latex-ocr-aug/ ├── train/ │ ├── raw/ # 无数据增强——原始渲染的公式图像 │ ├── light/ # 轻度数据增强(轻微噪声、轻度模糊、小角度旋转) │ ├── heavy/ # 重度数据增强(强畸变、阴影、透视变换) │ ├── light_text/ # 轻度数据增强 + 周边文本上下文 │ └── heavy_text/ # 重度数据增强 + 周边文本上下文 ├── validation/ # 预留验证集划分 └── test/ # 预留测试集划分 每个Parquet文件包含以下列: | 列名 | 数据类型 | 描述 | |---------|----------------|-------------------------------------------| | `image` | 字节流(bytes)| 渲染后的LaTeX公式的PNG图像 | | `latex` | 字符串(string)| 真实标签LaTeX源码字符串 | ## 数据增强级别 - **原始(raw)**:无任何增强的纯净渲染结果,可用于基准评估。 - **轻度增强(light)**:轻度增强操作——轻微模糊、亮度/对比度小幅抖动、极小角度旋转,适用于通用模型训练。 - **重度增强(heavy)**:重度增强操作——强畸变、阴影、透视扭曲、笔迹模拟,旨在提升模型鲁棒性。 - **轻度增强+文本上下文(light_text) / 重度增强+文本上下文(heavy_text)**:与轻度/重度增强规则一致,但将公式图像嵌入至带有周边文本的类文档场景中,模拟真实文档扫描场景。 ## 使用方法 ### 加载特定子集 python from datasets import load_dataset # 加载原始训练子集 ds = load_dataset("harryrobert/latex-ocr-aug", data_dir="train/raw", split="train") # 加载重度增强训练子集 ds = load_dataset("harryrobert/latex-ocr-aug", data_dir="train/heavy", split="train") # 加载验证集 ds = load_dataset("harryrobert/latex-ocr-aug", data_dir="validation", split="train") ### 遍历样本 python for sample in ds: image = sample["image"] # PIL图像或字节流 latex = sample["latex"] # LaTeX源码字符串 ## 预期用途 本数据集旨在训练和评估将公式图像转换为LaTeX的序列到序列模型,例如: - 编码器-解码器Transformer模型(如TrOCR、Donut、自定义ViT+解码器架构) - 针对公式识别任务微调的自回归解码器模型 多种数据增强变体支持采用课程学习策略进行训练(先使用`raw`或`light`子集训练,逐步引入`heavy`子集),或跨子集进行多任务采样训练。 ## 许可证 MIT协议

提供机构:
harryrobert
二维码
社区交流群
二维码
科研交流群
商业服务