UIT_HWDB / README.md
blue7012's picture
Add files using upload-large-folder tool
3f6ff77 verified
|
Raw
History Blame Contribute Delete
3.05 kB
---
license: cc-by-4.0
task_categories:
- image-to-text
- optical-character-recognition
language:
- vi
size_categories:
- 1K<n<10K
configs:
- config_name: default
data_files:
- split: train
path: "data/train-*-of-*.parquet"
- split: test
path: "data/test-*-of-*.parquet"
---
# UIT_HWDB - Vietnamese Handwritten Text Dataset
## Dataset Description
UIT_HWDB is a comprehensive dataset for Vietnamese handwritten text recognition.
This version combines both line-level and paragraph-level handwriting samples.
Each sample contains:
- A handwritten text image (line or paragraph)
- Ground truth transcription in Vietnamese
- Writer identification
- Unique image identifier
## Dataset Structure
### Data Instances
Each instance contains:
- `image`: A PIL Image of the handwritten text
- `text`: The ground truth transcription in Vietnamese
- `writer_id`: Unique identifier for the writer
- `image_id`: Unique identifier for the image
### Data Splits
| Split | Samples | Writers | Shards |
|-------|---------|---------|--------|
| train | 8,141 | 249 | 8 |
| test | 232 | 6 | 1 |
| **Total** | **8,373** | **255** | **9** |
## Usage
### Basic Loading
```python
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("YOUR_USERNAME/UIT_HWDB")
# Access samples
for sample in dataset['train']:
image = sample['image'] # PIL Image
text = sample['text'] # Vietnamese text
writer_id = sample['writer_id']
image_id = sample['image_id']
```
### Parallel Loading (Recommended for Large Datasets)
```python
# Use multiple workers for faster loading
dataset = load_dataset("YOUR_USERNAME/UIT_HWDB", num_proc=8)
```
### Streaming (For Limited Memory)
```python
# Stream data without downloading entire dataset
dataset = load_dataset("YOUR_USERNAME/UIT_HWDB", streaming=True)
for sample in dataset['train']:
# Process one sample at a time
pass
```
### Use in Training
```python
from torch.utils.data import DataLoader
# Convert to PyTorch format
dataset = dataset.with_format("torch")
# Create DataLoader
train_loader = DataLoader(
dataset['train'],
batch_size=32,
shuffle=True,
num_workers=4
)
for batch in train_loader:
images = batch['image']
texts = batch['text']
# Your training code here...
```
## Dataset Creation
This dataset was converted to Parquet format following HuggingFace best practices:
- ✅ Sharded into ~450MB chunks for optimal performance
- ✅ Memory-efficient streaming conversion process
- ✅ Proper image encoding using HuggingFace Image feature
- ✅ Compatible with HuggingFace Dataset Viewer
- ✅ Supports parallel loading and streaming
## Citation
If you use this dataset, please cite the original UIT_HWDB paper:
```bibtex
@inproceedings{uitHWDB,
title={Vietnamese Handwriting Database (UIT-HWDB)},
author={Your Authors Here},
booktitle={Conference Name},
year={Year},
organization={Organization}
}
```
## License
This dataset is released under CC-BY-4.0 license.