File size: 3,539 Bytes
e6c4023
 
da18d64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e6c4023
76d7feb
aa4f8b6
76d7feb
15a8143
76d7feb
aa4f8b6
 
 
15a8143
 
 
 
aa4f8b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15a8143
 
aa4f8b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
license: cc-by-4.0
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: validation
    path: data/validation-*
  - split: test
    path: data/test-*
dataset_info:
  features:
  - name: image
    dtype: image
  - name: image_name
    dtype: string
  - name: width
    dtype: int64
  - name: height
    dtype: int64
  - name: instances
    list:
    - name: category_id
      dtype: int64
    - name: mask
      sequence:
        sequence: float64
  splits:
  - name: train
    num_bytes: 8927542.0
    num_examples: 200
  - name: validation
    num_bytes: 4722935.0
    num_examples: 100
  - name: test
    num_bytes: 3984722.0
    num_examples: 100
  download_size: 16709320
  dataset_size: 17635199.0
---

# Line Graphics (LG) dataset

This is the official page for the LG dataset, as featured in our paper [Line Graphics Digitization: A Step Towards Full Automation](https://link.springer.com/chapter/10.1007/978-3-031-41734-4_27).

By [Omar Moured](https://www.linkedin.com/in/omar-moured/) et al.

## 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 labeled instances, each instance dictionary has {category_id, annotations}. **The annotations are in COCO format**.

## Sample Usage

```python
from datasets import load_dataset

# Load the dataset
dataset = load_dataset("omoured/line-graphics-dataset")

# Access the training split
train_dataset = dataset["train"]

# Print sample data
print(dataset["train"][0])
```

You can render the masks using `pycocotools` library as follows:
```python
from pycocotools import mask

polygon_coords = dataset['train'][0]['instances'][1]['mask']
image_width = dataset['validation'][0]['width']
image_height = dataset['validation'][0]['height']

mask_binary = mask.frPyObjects(polygon_coords, image_height, image_width) 

segmentation_mask = mask.decode(mask_binary)
```

## 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