doclaynet-6class / README.md
kbang2021's picture
Update README.md
0e31de5 verified
---
license: cdla-permissive-2.0
task_categories:
- object-detection
- document-layout-analysis
tags:
- document-ai
- layout-analysis
- object-detection
- doclaynet
- filtered
size_categories:
- 10K<n<100K
---
# DocLayNet 6-Class Filtered Dataset
## Dataset Description
This is a filtered version of the [DocLayNet dataset](https://huggingface.co/datasets/docling-project/DocLayNet) containing only 6 most relevant layout element classes for document layout analysis tasks.
### Original Dataset
DocLayNet is a human-annotated document layout segmentation dataset containing 80,863 pages from diverse sources with 11 distinct layout categories.
**Citation:**
```
@article{doclaynet2022,
title = {DocLayNet: A Large Human-Annotated Dataset for Document-Layout Analysis},
author = {Pfitzmann, Birgit and Auer, Christoph and Dolfi, Michele and Nassar, Ahmed S and Staar, Peter W J},
year = {2022},
doi = {10.1145/3534678.3539043},
}
```
### Filtering Methodology
**Classes Retained (6):**
1. **Text** - Body text paragraphs
2. **List-item** - List elements (bulleted, numbered)
3. **Section-header** - Section and subsection titles
4. **Picture** - Images, figures, diagrams
5. **Table** - Tabular data structures
6. **Caption** - Image and table captions
**Classes Removed (5):**
- Footnote
- Formula
- Page-footer
- Page-header
- Title
**Rationale:** Focus on the most common and semantically important layout elements for general document understanding tasks. The 6 retained classes represent 85.1% of all annotations in the original dataset.
## Dataset Statistics
### Split Distribution
| Split | Images | Annotations | Classes |
|-------|--------|-------------|---------|
| Train | 68,673 | 800,614 | 6 |
| Validation | 6,446 | 85,057 | 6 |
| Test | 4,952 | 56,483 | 6 |
| **Total** | **80,071** | **942,154** | **6** |
### Class Distribution (Training Set)
Based on 800,614 annotations:
| Class ID | Class Name | Count | Percentage |
|----------|------------|-------|------------|
| 0 | Caption | 19,218 | 2.4% |
| 1 | List-item | 161,818 | 20.2% |
| 2 | Picture | 39,667 | 5.0% |
| 3 | Section-header | 118,590 | 14.8% |
| 4 | Table | 30,070 | 3.8% |
| 5 | Text | 431,251 | 53.9% |
### Retention from Original Dataset
- **Images retained:** 99.0%
- **Annotations retained:** 85.1%
## Dataset Structure
### Format
Annotations are provided in **COCO JSON format**:
```
DocLayNet_6class/
├── coco/
│ ├── train.json # Training annotations
│ ├── val.json # Validation annotations
│ └── test.json # Test annotations
└── README.md # This file
```
Images are **NOT included** - use the original DocLayNet image files from:
- HuggingFace: `docling-project/DocLayNet`
- Official source: https://github.com/DS4SD/DocLayNet
### Loading the Dataset
#### Using HuggingFace Datasets
```python
from datasets import load_dataset
# Load the filtered annotations
dataset = load_dataset("kbang2021/doclaynet-6class")
# Access splits
train_data = dataset["train"]
val_data = dataset["validation"]
test_data = dataset["test"]
```
#### Manual Loading
```python
import json
from pathlib import Path
# Load COCO annotations
with open("coco/train.json") as f:
train_coco = json.load(f)
# Categories
categories = train_coco["categories"] # 6 classes with IDs 0-5
# Images
images = train_coco["images"] # Image metadata
# Annotations
annotations = train_coco["annotations"] # Bounding boxes
```
### Annotation Format
Each annotation follows the COCO format:
```json
{
"id": 12345,
"image_id": 123,
"category_id": 5, // 0-5 (remapped from original 11 classes)
"bbox": [x_min, y_min, width, height], // In pixels
"area": 12345.67,
"iscrowd": 0
}
```
### Category Mapping
Original DocLayNet → 6-Class Filtered:
| Original ID | Original Name | Filtered ID | Filtered Name | Status |
|-------------|---------------|-------------|---------------|--------|
| 0 | Caption | 0 | Caption | ✅ Kept |
| 1 | Footnote | - | - | ❌ Removed |
| 2 | Formula | - | - | ❌ Removed |
| 3 | List-item | 1 | List-item | ✅ Kept |
| 4 | Page-footer | - | - | ❌ Removed |
| 5 | Page-header | - | - | ❌ Removed |
| 6 | Picture | 2 | Picture | ✅ Kept |
| 7 | Section-header | 3 | Section-header | ✅ Kept |
| 8 | Table | 4 | Table | ✅ Kept |
| 9 | Text | 5 | Text | ✅ Kept |
| 10 | Title | - | - | ❌ Removed |
## Use Cases
This filtered dataset is ideal for:
- **Document layout analysis** with focus on content structure
- **Information extraction** from documents (text, tables, figures)
- **Object detection** model training for document AI
- **Multi-scale document understanding** tasks
- **Transfer learning** from general object detection to document analysis
## Limitations
1. **Images not included**: You must obtain images from the original DocLayNet dataset
2. **Class imbalance**: Text class dominates (53.9% of annotations)
3. **Domain specific**: Focused on document layout, may not generalize to other domains
4. **Annotation quality**: Inherits any annotation errors from original DocLayNet
## Ethical Considerations
- Dataset maintains the original DocLayNet license (CDLA-Permissive-2.0)
- No personal or sensitive information in annotations
- Source documents from diverse domains (financial, scientific, patents, manuals)
- Should not be used to discriminate based on document type or origin
## Citation
If you use this filtered dataset, please cite both:
1. **Original DocLayNet paper:**
```bibtex
@article{doclaynet2022,
title = {DocLayNet: A Large Human-Annotated Dataset for Document-Layout Analysis},
author = {Pfitzmann, Birgit and Auer, Christoph and Dolfi, Michele and Nassar, Ahmed S and Staar, Peter W J},
year = {2022},
doi = {10.1145/3534678.3539043},
}
```
2. **This filtered version:**
```bibtex
@misc{doclaynet6class2024,
title = {DocLayNet 6-Class: Filtered Document Layout Analysis Dataset},
author = {[Keng Boon, Ang]},
year = {2026},
howpublished = {\url{https://huggingface.co/datasets/kbang2021/doclaynet-6class}},
note = {Filtered subset of DocLayNet containing 6 primary layout element classes}
}
```
## License
This filtered dataset maintains the original license:
**CDLA-Permissive-2.0** (Community Data License Agreement – Permissive – Version 2.0)
See: https://cdla.dev/permissive-2-0/
## Acknowledgments
- Original DocLayNet dataset: IBM Research
- Built using the layout-for-tools evaluation framework
## Contact
For questions or issues with this filtered dataset, please open an issue on the repository.
For questions about the original DocLayNet dataset, see: https://github.com/DS4SD/DocLayNet