vichetkao's picture
Update README.md
b36b05e verified
---
dataset_info:
features:
- name: image_name
dtype: string
- name: image
dtype: Image
- name: yolo_obb
dtype: string
- name: labelme
dtype: string
splits:
- name: train
num_bytes: 562178036
num_examples: 8000
- name: validation
num_bytes: 140633367
num_examples: 2000
download_size: 702811403
dataset_size: 702811403
configs:
- config_name: default
data_files:
- split: train
path: data/train.parquet
- split: validation
path: data/val.parquet
license: cc-by-4.0
task_categories:
- object-detection
- image-classification
language:
- km
size_categories:
- 10K<n<100K
---
# Table Dataset - Image & LabelMe & OBB Annotation (Train/Val Split)
## Dataset Overview
Comprehensive table detection dataset with ground truth LabelMe polygon annotations and OBB (Oriented Bounding Box) data, split into training and validation sets.
- **Total examples:** 10,000 image-annotation pairs
- Train: 8,000 (80.0%)
- Validation: 2,000 (20.0%)
- **Total size:** 670.25 MB
- **Language:** km
- **Document types:** Table/Chart documents
- **Ground truth:** LabelMe polygon annotations
## Dataset Statistics
### Split Information
| Split | Examples | Size (MB) |
|-----------|----------|-----------|
| Train | 8,000 | 536.13 |
| Validation| 2,000 | 134.12 |
| **Total** | **10,000** | **670.25** |
### Train/Val Ratio
- **Train:** 80.0%
- **Validation:** 20.0%
- **Random Seed:** 42 (for reproducibility)
## Features
| Feature | Type | Description |
| ------------- | ------------- | --------------------------------------------- |
| `image_name` | string | Document image filename (without extension) |
| `image` | image (bytes) | PNG image binary data |
| `labelme` | string | LabelMe JSON annotations (polygons) |
| `yolo_obb` | string | OBB (Oriented Bounding Box) annotations |
## Data Format
### Image (bytes)
PNG binary data - convert to PIL Image for processing:
```python
from PIL import Image
from io import BytesIO
image_bytes = row['image']
image = Image.open(BytesIO(image_bytes))
```
### LabelMe JSON (strings)
Annotations are stored as JSON strings. Parse with `json.loads()`:
```python
import json
labelme_dict = json.loads(row['labelme'])
# Structure: {
# "version": "5.5.0",
# "imagePath": "filename.png",
# "imageHeight": <height>,
# "imageWidth": <width>,
# "shapes": [
# {
# "label": "table_element",
# "points": [[x1, y1], [x2, y2], ...],
# "shape_type": "polygon",
# ...
# }
# ]
# }
```
### OBB JSON (strings)
OBB annotations are stored as JSON strings:
```python
import json
# Parse OBB content
obb_data = json.loads(row['yolo_obb'])
# Each item: {"class_id": <int>, "polygon": [x1, y1, x2, y2, ..., x8, y8]}
for obj in obb_data:
class_id = obj['class_id']
polygon = obj['polygon'] # 8 coordinates for oriented bounding box
```
## Usage Examples
### Load Dataset
```python
import pandas as pd
import json
from PIL import Image
from io import BytesIO
# Load train split
df_train = pd.read_parquet('train.parquet')
# Load validation split
df_val = pd.read_parquet('val.parquet')
print(f"Train samples: {len(df_train)}")
print(f"Validation samples: {len(df_val)}")
```
### Access Single Row
```python
row = df_train.iloc[0]
# Get image name
image_name = row['image_name'] # str
# Get image
image_bytes = row['image'] # bytes
image = Image.open(BytesIO(image_bytes))
print(f"Image: {image.size} (width x height)")
# Get LabelMe annotations
labelme_data = json.loads(row['labelme'])
print(f"Shapes: {len(labelme_data['shapes'])}")
for shape in labelme_data['shapes']:
points = shape['points']
label = shape.get('label', 'unknown')
print(f" - {label}: {len(points)} points")
# Get OBB annotations
obb_data = json.loads(row['yolo_obb'])
print(f"OBB objects: {len(obb_data)}")
for obj in obb_data:
print(f" - Class {obj['class_id']}: {obj['polygon']}")
```
### Iterate Through Dataset
```python
import json
from PIL import Image
from io import BytesIO
# Train split
for idx, row in df_train.iterrows():
image_name = row['image_name']
image = Image.open(BytesIO(row['image']))
# Get annotations
labelme_data = json.loads(row['labelme'])
obb_data = json.loads(row['yolo_obb'])
num_shapes = len(labelme_data['shapes'])
num_obb = len(obb_data)
print(f"{image_name}: {num_shapes} LabelMe shapes, {num_obb} OBB objects")
```
### Export Annotations as Files
```python
import json
import os
from PIL import Image
from io import BytesIO
output_dir = 'exported_data'
os.makedirs(output_dir, exist_ok=True)
# Export train set
for idx, row in df_train.iterrows():
image_name = row['image_name']
# Save image
image = Image.open(BytesIO(row['image']))
image.save(f'{output_dir}/train_{image_name}.png')
# Save labelme annotation
labelme = json.loads(row['labelme'])
with open(f'{output_dir}/train_{image_name}_labelme.json', 'w') as f:
json.dump(labelme, f, indent=2, ensure_ascii=False)
# Save OBB annotation
obb = json.loads(row['yolo_obb'])
with open(f'{output_dir}/train_{image_name}_obb.json', 'w') as f:
json.dump(obb, f, indent=2, ensure_ascii=False)
# Export validation set
for idx, row in df_val.iterrows():
image_name = row['image_name']
# Save image
image = Image.open(BytesIO(row['image']))
image.save(f'{output_dir}/val_{image_name}.png')
# Save labelme annotation
labelme = json.loads(row['labelme'])
with open(f'{output_dir}/val_{image_name}_labelme.json', 'w') as f:
json.dump(labelme, f, indent=2, ensure_ascii=False)
# Save OBB annotation
obb = json.loads(row['yolo_obb'])
with open(f'{output_dir}/val_{image_name}_obb.json', 'w') as f:
json.dump(obb, f, indent=2, ensure_ascii=False)
```
### Loading with Hugging Face Datasets
```python
from datasets import load_dataset
# Load both train and validation splits
dataset = load_dataset('parquet',
data_files={
'train': 'train.parquet',
'validation': 'val.parquet'
})
# Access splits
train_split = dataset['train']
val_split = dataset['validation']
# Iterate
for example in train_split:
print(example.keys())
```
### Training Loop Example
```python
from datasets import load_dataset
import json
from PIL import Image
from io import BytesIO
dataset = load_dataset('parquet',
data_files={
'train': 'train.parquet',
'validation': 'val.parquet'
})
# Training
for epoch in range(num_epochs):
for batch in dataset['train'].batch(batch_size=32):
images = [Image.open(BytesIO(img)) for img in batch['image']]
labelme_labels = [json.loads(lm) for lm in batch['labelme']]
obb_labels = [json.loads(obb) for obb in batch['yolo_obb']]
# Train model...
# Validation
for batch in dataset['validation'].batch(batch_size=32):
images = [Image.open(BytesIO(img)) for img in batch['image']]
labelme_labels = [json.loads(lm) for lm in batch['labelme']]
obb_labels = [json.loads(obb) for obb in batch['yolo_obb']]
# Evaluate model...
```
## File Summary
| File | Type | Size (MB) | Samples |
|------|------|-----------|---------|
| train.parquet | Parquet | 536.13 | 8,000 |
| val.parquet | Parquet | 134.12 | 2,000 |
## Citation
```bibtex
@dataset{table_dataset_obb_2026,
title={Table Dataset - Image & LabelMe & OBB Annotations (Train/Val Split)},
author={Dataset Creator},
year={2026},
note={Table detection dataset with LabelMe and OBB annotations, split into train/val}
}
```
## License
cc-by-4.0
## Contact & Support
For questions or issues with the dataset, please refer to the dataset repository.
---
**Last Updated:** 2026-05-21
**Dataset Version:** 1.0
**Total Examples:** 10,000
**Total Size:** 670.25 MB
**Train/Val Split:** 80.0/20.0%
**Annotations:** LabelMe + OBB