ocr_data
收藏资源简介:
该数据集是合成阿拉伯语文档图像数据集,包含布局标注,主要用于光学字符识别(OCR)训练任务。数据以WebDataset格式存储,采用.tar分片文件,每个分片最多包含9990个样本,大小约为1.2GB。数据集分为原始子集(data/)和增强子集(data_aug/),其中原始子集使用PNG图像和JSON标注,增强子集使用JPEG/PNG图像和JSON标注。每个样本包含一张图片和对应的JSON标注,标注字段包括:图像尺寸(dimensions)、文本块(blocks)列表(含类型、文本、坐标、阅读顺序)、图像区域(images)列表以及元数据(meta,如模板、字体、语言、脚本、方向等)。增强子集的元数据中会记录具体的增强名称和参数。该数据集支持通过HuggingFace Datasets库加载,可指定单个分片、分片范围,或同时加载原始和增强所有数据。
This dataset is a synthetic Arabic document image dataset with layout annotations, primarily used for Optical Character Recognition (OCR) training tasks. The data is stored in WebDataset format using .tar shards, each containing up to 9990 samples with a size of approximately 1.2GB. The dataset is divided into a raw subset (data/) and an augmented subset (data_aug/), where the raw subset uses PNG images and JSON annotations, and the augmented subset uses JPEG/PNG images and JSON annotations. Each sample includes an image and corresponding JSON annotation, with fields including: image dimensions, a list of text blocks (with type, text, coordinates, reading order), a list of image regions, and metadata (e.g., template, font, language, script, orientation, etc.). The augmented subsets metadata records specific augmentation names and parameters. The dataset supports loading via the HuggingFace Datasets library, allowing specification of single shards, shard ranges, or loading all raw and augmented data together.
数据集概述:OCR-Data-new/ocr_data
该数据集是一个合成阿拉伯语文档图像数据集,专门用于 OCR(光学字符识别)训练,并附带布局标注信息。
基本属性
| 属性 | 值 |
|---|---|
| 任务类别 | 图像到文本(image-to-text) |
| 语言 | 阿拉伯语(ar) |
| 标签 | OCR、阿拉伯语、合成数据、WebDataset |
| 数据格式 | WebDataset .tar 分片文件 |
数据布局
数据集主目录下包含两个子目录:
data/:原始数据分片,文件格式为 PNG(图像)+ JSON(标注),文件名格式为<contributor>_<NNN>.tardata_aug/:增强变体数据分片,文件格式为 JPEG/PNG(图像)+ JSON(标注),文件名格式为<contributor>_<NNN>_aug<K>.tar
文件组织规则:共享同一个基名的文件属于同一样本,其中图像作为 image 列,标注作为 json 列。每个分片最多包含 9990 个样本,大小约为 1.2 GB。data/ 和 data_aug/ 目录彼此分离,便于仅使用干净的原始图像进行训练。
加载方式
该数据集采用 WebDataset 格式,可通过 Hugging Face 的 datasets 库进行流式加载,支持三种模式:
- 加载单个分片:通过
data_files参数指定具体分片路径 - 加载连续范围的分片:使用大括号语法,如
{001..010}加载指定范围的多个分片 - 加载全量数据:同时指定
data/*.tar和data_aug/*.tar,将原始数据与增强数据合并
此外,如需恢复为松散文件,可使用生成器仓库中的 unpack_shard.py 脚本。
标注格式(Annotation Schema)
每个样本的 JSON 标注包含以下字段:
dimensions:页面尺寸信息(宽度和高度)blocks:文本块数组,每个文本块包含:type:块类型text:文本内容top_left_x/top_left_y:左上角坐标bottom_right_x/bottom_right_y:右下角坐标reading_index:阅读顺序索引
images:图像区域数组,包含位置坐标信息(如top_left_x)meta:元信息,包括:template:使用的模板hybrid:混合标记(通常为 null)page_font:页面字体language:语言(固定为ar)script:文字系统(固定为arabic)direction:书写方向(固定为rtl,即从右到左)augmentation:增强信息(原始数据为null;增强数据为对象格式,包含name和params字段)




