遇见数据集

EvitFan/SmolTextRender

收藏
Hugging Face2026-03-27 更新2026-03-29 收录
官方服务:

资源简介:

--- license: mit configs: - config_name: default data_files: - split: train path: data/train-* - split: val path: data/val-* - split: test path: data/test-* dataset_info: features: - name: id dtype: int64 - name: image_id dtype: string - name: image dtype: image - name: text dtype: string - name: caption dtype: string - name: prompt dtype: string - name: split dtype: string - name: ocr_confidence dtype: float64 - name: ocr_backend dtype: string - name: caption_model dtype: string - name: source dtype: string - name: sharpness dtype: float64 - name: brightness dtype: float64 - name: contrast dtype: float64 - name: resolution_w dtype: int64 - name: resolution_h dtype: int64 - name: text_length dtype: int64 - name: word_count dtype: int64 - name: phrase_reconstructed dtype: bool splits: - name: train num_bytes: 58573006 num_examples: 800 - name: val num_bytes: 6821157 num_examples: 100 - name: test num_bytes: 6848431 num_examples: 100 download_size: 72132017 dataset_size: 72242594 task_categories: - image-to-text - text-to-image language: - en tags: - ocr - image-captioning - text-rendering - synthetic - blip2 - easyocr - flux size_categories: - 1K<n<10K source_datasets: - stzhao/AnyWord-3M --- # Text-in-Image OCR Dataset *Built for **Project 12 — Efficient Image Generation**, as part of the ENSTA course [CSC_5IA21](https://giannifranchi.github.io/CSC_5IA21.html)* **Team:** Adam Gassem · Asma Walha · Achraf Chaouch · Takoua Ben Aissa · Amaury Lorin **Tutors:** Arturo Mendoza Quispe · Nacim Belkhir --- ## Dataset Summary A curated text-in-image dataset designed for fine-tuning text-to-image generative models (e.g. FLUX, Stable Diffusion, ControlNet) on accurate **text rendering**. Each sample pairs a real-world image containing readable text with: - a verified OCR transcription (EasyOCR), - a visual caption (BLIP-2), - and a training prompt that embeds the OCR text verbatim. Images are sourced from [AnyWord-3M](https://huggingface.co/datasets/stzhao/AnyWord-3M) and pass a rigorous multi-step quality pipeline before inclusion. --- ## Dataset Structure | Split | Size | |-------|------| | train | 800 samples | | val | 100 samples | | test | 100 samples | ### Fields | Field | Type | Description | |-------|------|-------------| | `image` | Image | The filtered image (512 px, JPEG) | | `text` | string | Verified OCR text found in the image | | `caption` | string | General visual description generated by BLIP-2 | | `prompt` | string | Training prompt embedding the OCR text verbatim | | `ocr_confidence` | float | EasyOCR confidence score (0–100) | | `ocr_backend` | string | OCR engine used (`easyocr`) | | `caption_model` | string | Captioning model used (`blip2` or `blip`) | | `source` | string | AnyWord-3M subset of origin | | `sharpness` | float | Laplacian variance of the image | | `brightness` | float | Mean pixel brightness | | `contrast` | float | Pixel standard deviation | | `resolution_w` / `resolution_h` | int | Image dimensions in pixels | | `text_length` | int | Character count of the OCR text | | `word_count` | int | Word count of the OCR text | | `phrase_reconstructed` | bool | Whether the full phrase was expanded beyond the bounding box | ### Sample record ```json { "image": "<PIL.Image>", "text": "OPEN", "caption": "A storefront with a neon sign above the door.", "prompt": "A storefront with a neon sign above the door, with the text \"OPEN\" clearly visible", "ocr_confidence": 87.5, "source": "AnyWord-3M/laion", "sharpness": 142.3, "resolution_w": 512, "resolution_h": 384 } ``` --- ## Usage ```python from datasets import load_dataset ds = load_dataset("your-org/your-dataset-name") # Access a training sample sample = ds["train"][0] print(sample["prompt"]) sample["image"].show() ``` For fine-tuning with the prompt field: ```python for sample in ds["train"]: image = sample["image"] # PIL image prompt = sample["prompt"] # text-conditioned training caption text = sample["text"] # ground-truth OCR string ``` --- ## Creation Pipeline Images are drawn from AnyWord-3M (streamed) and pass through the following stages: ``` AnyWord-3M stream │ ▼ 1. Annotation filtering → valid, short, English text regions only │ ▼ 2. Image quality gate → resolution ≥ 256 px, sharpness ≥ 80, brightness 30–230, contrast ≥ 20 │ ▼ 3. EasyOCR verify → confirm annotated text is readable (conf ≥ 0.40) │ ▼ 4. EasyOCR reconstruct → expand to the full visible phrase │ ▼ 5. BLIP-2 caption → general visual description │ ▼ 6. Prompt construction → natural sentence with OCR text in quotes │ ▼ 7. Split & save → 80 % train / 10 % val / 10 % test ``` --- ## Source Subsets | Subset | Description | |--------|-------------| | `laion` | Web-crawled natural images | | `OCR_COCO_Text` | COCO scene text | | `OCR_mlt2019` | Multi-language (English filtered) | | `OCR_Art` | Artistic / designed text | --- ## Citation & Project This dataset was produced as part of the **Efficient Image Generation** project at ENSTA Paris. Full methodology, training experiments, and inference benchmarks are documented in the [project report](https://drive.google.com/file/d/1ay4-cBOSt4LbLhwgQ0gBykda1Bu0HUXY/view?usp=drive_link). --- ## License Released under the **MIT License** — free to use, modify, and distribute without restriction. Note that the AnyWord-3M source dataset and BLIP-2 model are subject to their own respective licenses on HuggingFace.

许可证:MIT许可证 配置项: - 配置名称:default 数据文件: - 划分集:训练集(train),路径:data/train-* - 划分集:验证集(val),路径:data/val-* - 划分集:测试集(test),路径:data/test-* 数据集信息: 特征字段: - 名称:id,数据类型:64位整数 - 名称:image_id,数据类型:字符串 - 名称:image,数据类型:图像 - 名称:text,数据类型:字符串 - 名称:caption,数据类型:字符串 - 名称:prompt,数据类型:字符串 - 名称:split,数据类型:字符串 - 名称:ocr_confidence,数据类型:64位浮点数 - 名称:ocr_backend,数据类型:字符串 - 名称:caption_model,数据类型:字符串 - 名称:source,数据类型:字符串 - 名称:sharpness,数据类型:64位浮点数 - 名称:brightness,数据类型:64位浮点数 - 名称:contrast,数据类型:64位浮点数 - 名称:resolution_w,数据类型:64位整数 - 名称:resolution_h,数据类型:64位整数 - 名称:text_length,数据类型:64位整数 - 名称:word_count,数据类型:64位整数 - 名称:phrase_reconstructed,数据类型:布尔值 划分集统计: - 名称:训练集(train),字节数:58573006,样本数:800 - 名称:验证集(val),字节数:6821157,样本数:100 - 名称:测试集(test),字节数:6848431,样本数:100 下载大小:72132017,数据集总大小:72242594 任务类别: - 图像到文本(image-to-text) - 文本到图像(text-to-image) 语言: - 英语(en) 标签: - 光学字符识别(OCR) - 图像字幕生成(image-captioning) - 文本渲染(text-rendering) - 合成数据集(synthetic) - blip2 - easyocr - flux 样本规模类别: - 1K<n<10K 源数据集: - stzhao/AnyWord-3M # 文本图像OCR数据集 *为**项目12——高效图像生成**构建,作为ENSTA课程[CSC_5IA21](https://giannifranchi.github.io/CSC_5IA21.html)的一部分* **团队**:Adam Gassem · Asma Walha · Achraf Chaouch · Takoua Ben Aissa · Amaury Lorin **导师**:Arturo Mendoza Quispe · Nacim Belkhir ## 数据集概述 一款经精心甄选的文本图像数据集,专为针对精准文本渲染任务微调文本到图像生成模型(如FLUX、稳定扩散(Stable Diffusion)、ControlNet)而设计。每个样本均将包含可读文本的真实世界图像与以下内容配对: - 经验证的光学字符识别(OCR)转录结果(采用EasyOCR引擎), - 由BLIP-2生成的视觉字幕, - 以及逐字嵌入OCR文本的训练提示词。 图像源自[AnyWord-3M](https://huggingface.co/datasets/stzhao/AnyWord-3M),且在纳入本数据集前需通过严格的多阶段质量校验流程。 ## 数据集结构 | 划分集 | 规模 | |-------|------| | 训练集 | 800个样本 | | 验证集 | 100个样本 | | 测试集 | 100个样本 | ### 字段说明 | 字段 | 数据类型 | 描述 | |-------|------|-------------| | `image` | 图像 | 经过滤的图像(分辨率512像素,JPEG格式) | | `text` | 字符串 | 图像中提取的经验证的OCR文本 | | `caption` | 字符串 | 由BLIP-2生成的通用视觉描述 | | `prompt` | 字符串 | 逐字嵌入OCR文本的训练提示词 | | `ocr_confidence` | 浮点数 | EasyOCR的置信度得分(0–100) | | `ocr_backend` | 字符串 | 所用的OCR引擎(`easyocr`) | | `caption_model` | 字符串 | 所用的字幕生成模型(`blip2`或`blip`) | | `source` | 字符串 | 来源的AnyWord-3M子集 | | `sharpness` | 浮点数 | 图像的拉普拉斯方差 | | `brightness` | 浮点数 | 图像的平均像素亮度 | | `contrast` | 浮点数 | 像素的标准差 | | `resolution_w` / `resolution_h` | 整数 | 图像的像素尺寸(宽/高) | | `text_length` | 整数 | OCR文本的字符数 | | `word_count` | 整数 | OCR文本的单词数 | | `phrase_reconstructed` | 布尔值 | 是否将完整短语扩展至边界框之外 | ### 样本示例 json { "image": "<PIL.Image>", "text": "OPEN", "caption": "门店门上方带有霓虹招牌的店面。", "prompt": "门店门上方带有霓虹招牌的店面,清晰可见文本“OPEN”", "ocr_confidence": 87.5, "source": "AnyWord-3M/laion", "sharpness": 142.3, "resolution_w": 512, "resolution_h": 384 } ## 使用方法 python from datasets import load_dataset ds = load_dataset("your-org/your-dataset-name") # 访问训练集样本 sample = ds["train"][0] print(sample["prompt"]) sample["image"].show() 若需使用提示词字段进行微调: python for sample in ds["train"]: image = sample["image"] # PIL图像 prompt = sample["prompt"] # 带文本条件的训练字幕 text = sample["text"] # 真实OCR字符串 ## 构建流程 图像源自AnyWord-3M(流式加载),并经过以下处理阶段: AnyWord-3M 流式数据源 │ ▼ 1. 标注过滤 → 仅保留有效的短文本英文区域 │ ▼ 2. 图像质量校验 → 分辨率≥256像素、清晰度≥80、亮度范围30–230、对比度≥20 │ ▼ 3. EasyOCR验证 → 确认标注文本可读(置信度≥0.40) │ ▼ 4. EasyOCR重构 → 扩展至完整可见短语 │ ▼ 5. BLIP-2生成字幕 → 通用视觉描述 │ ▼ 6. 提示词构建 → 包含引号内OCR文本的自然语句 │ ▼ 7. 划分与存储 → 80%训练集 / 10%验证集 / 10%测试集 ## 源数据集子集 | 子集 | 描述 | |--------|-------------| | `laion` | 网络爬取的自然图像 | | `OCR_COCO_Text` | COCO场景文本数据集 | | `OCR_mlt2019` | 多语言数据集(已过滤英文) | | `OCR_Art` | 艺术/设计类文本 | ## 引用与项目 本数据集作为巴黎ENSTA高等理工学院**高效图像生成**项目的成果产出。完整的方法论、训练实验与推理基准测试已在[项目报告](https://drive.google.com/file/d/1ay4-cBOSt4LbLhwgQ0gBykda1Bu0HUXY/view?usp=drive_link)中记录。 ## 许可证 本数据集采用**MIT许可证**发布——可免费使用、修改与分发,无任何限制。请注意,AnyWord-3M源数据集与BLIP-2模型需遵循其在HuggingFace平台上的各自许可证条款。

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