omoured's picture
Update README.md
ea2063e verified
---
license: cc-by-4.0
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: image_name
dtype: string
- name: image
dtype: image
- name: width
dtype: int32
- name: height
dtype: int32
- name: instances
sequence:
- name: category_id
dtype: int32
- name: mask
sequence:
sequence: float32
splits:
- name: train
num_bytes: 8566253.0
num_examples: 200
- name: val
num_bytes: 4532786.0
num_examples: 100
- name: test
num_bytes: 3809329.0
num_examples: 100
download_size: 16498520
dataset_size: 16908368.0
---
<h1 align="center">Line Graphics Digitization: A Step Towards Full Automation</h1>
<p align="center">
<em>Omar Moured, Jiaming Zhang, Alina Roitberg, Thorsten Schwarz, Rainer Stiefelhagen</em>
</p>
<p align="center">
<a href="https://link.springer.com/chapter/10.1007/978-3-031-41734-4_27">
<img src="https://img.shields.io/badge/Paper-Springer-blue?logo=book" alt="Paper">
</a><a href="https://huggingface.co/datasets/omoured/line-graphics-dataset/tree/main">
<img src="https://img.shields.io/badge/Dataset-HuggingFace-orange?logo=huggingface" alt="Dataset">
</a>
</p>
![Example visualization](./lgsample.png)
## Dataset Summary
The dataset includes instance segmentation masks for **400 real line chart images, manually labeled into 11 categories** by professionals.
These images were collected from 5 different professions to enhance diversity. In our paper, we studied two levels of segmentation: **coarse-level**,
where we segmented (spines, axis-labels, legend, lines, titles), and **fine-level**, where we further segmented each category into x and y subclasses
(except for legend and lines), and individually segmented each line.
<!-- ## Category ID Reference
```python
class_id_mapping = {
"Label": 0,
"Legend": 1,
"Line": 2,
"Spine": 3,
"Title": 4,
"ptitle": 5,
"xlabel": 6,
"xspine": 7,
"xtitle": 8,
"ylabel": 9,
"yspine": 10,
"ytitle": 11
}
``` -->
## Dataset structure (train, validation, test)
- **image** - contains the PIL image of the chart
- **image_name** - image name with PNG extension
- **width** - original image width
- **height** - original image height
- **instances** - contains **N** number of COCO format instances. Check the sample visulization code below.
## Sample Usage
[optional] install `pycocotools` to rendeder masks with below code.
```python
from datasets import load_dataset
from pycocotools import mask
import matplotlib.pyplot as plt
import random
# Load dataset
ds = load_dataset("omoured/line-graphics-dataset")
# Class ID to name
id_to_name = {
0: "Label", 1: "Legend", 2: "Line", 3: "Spine",
4: "Title", 5: "ptitle", 6: "xlabel", 7: "xspine",
8: "xtitle", 9: "ylabel", 10: "yspine", 11: "ytitle"
}
# Random image + instance
sample = random.choice(ds["val"])
img = sample["image"]
i = random.randint(0, len(sample["instances"]["mask"]) - 1)
# Get mask + class info
poly = sample["instances"]["mask"][i]
cat_id = sample["instances"]["category_id"][i]
cat_name = id_to_name.get(cat_id, "Unknown")
# Decode and plot
rle = mask.frPyObjects(poly, sample["height"], sample["width"])
bin_mask = mask.decode(rle)
plt.imshow(img)
plt.imshow(bin_mask, alpha=0.5, cmap="jet")
plt.title(f"imgname: {sample['image_name']}, inst: {cat_name}")
plt.axis("off")
plt.show()
```
## Copyrights
This dataset is published under the CC-BY 4.0 license, which allows for unrestricted usage, but it should be cited when used.
## Citation
```bibtex
@inproceedings{moured2023line,
title={Line Graphics Digitization: A Step Towards Full Automation},
author={Moured, Omar and Zhang, Jiaming and Roitberg, Alina and Schwarz, Thorsten and Stiefelhagen, Rainer},
booktitle={International Conference on Document Analysis and Recognition},
pages={438--453},
year={2023},
organization={Springer}
}
```
## Contact
If you have any questions or need further assistance with this dataset, please feel free to contact us:
- **Omar Moured**, omar.moured@kit.edu