davanstrien HF staff commited on
Commit
9f7c3e3
1 Parent(s): db6b423

update scripts

Browse files
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"YOLO": {"description": "YALTAi: Segmonto Manuscript and Early Printed Book Dataset", "citation": "@dataset{clerice_thibault_2022_6814770,\n author = {Cl\u00e9rice, Thibault},\n title = {{YALTAi: Segmonto Manuscript and Early Printed Book\n Dataset}},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6814770},\n url = {https://doi.org/10.5281/zenodo.6814770}\n", "homepage": "https://doi.org/10.5281/zenodo.6814770", "license": "Creative Commons Attribution 4.0 International", "features": {"image": {"decode": true, "id": null, "_type": "Image"}, "objects": {"feature": {"label": {"num_classes": 14, "names": ["DamageZone", "DigitizationArtefactZone", "DropCapitalZone", "GraphicZone", "MainZone", "MarginTextZone", "MusicZone", "NumberingZone", "QuireMarksZone", "RunningTitleZone", "SealZone", "StampZone", "TableZone", "TitlePageZone"], "id": null, "_type": "ClassLabel"}, "bbox": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": 4, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "yalta_ai_segmonto_manuscript_dataset", "config_name": "YOLO", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 279776, "num_examples": 854, "dataset_name": "yalta_ai_segmonto_manuscript_dataset"}, "validation": {"name": "validation", "num_bytes": 47196, "num_examples": 154, "dataset_name": "yalta_ai_segmonto_manuscript_dataset"}, "test": {"name": "test", "num_bytes": 45982, "num_examples": 139, "dataset_name": "yalta_ai_segmonto_manuscript_dataset"}}, "download_checksums": {"https://zenodo.org/record/6814770/files/yaltai-segmonto-dataset.zip?download=1": {"num_bytes": 2826543829, "checksum": "78d15c92f563d0a96b72302bb4889d2a34e48b4ec15a0cbe9414458dbb22ac29"}}, "download_size": 2826543829, "post_processing_size": null, "dataset_size": 372954, "size_in_bytes": 2826916783}, "COCO": {"description": "YALTAi: Segmonto Manuscript and Early Printed Book Dataset", "citation": "@dataset{clerice_thibault_2022_6814770,\n author = {Cl\u00e9rice, Thibault},\n title = {{YALTAi: Segmonto Manuscript and Early Printed Book\n Dataset}},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6814770},\n url = {https://doi.org/10.5281/zenodo.6814770}\n", "homepage": "https://doi.org/10.5281/zenodo.6814770", "license": "Creative Commons Attribution 4.0 International", "features": {"image_id": {"dtype": "int64", "id": null, "_type": "Value"}, "image": {"decode": true, "id": null, "_type": "Image"}, "width": {"dtype": "int32", "id": null, "_type": "Value"}, "height": {"dtype": "int32", "id": null, "_type": "Value"}, "objects": [{"category_id": {"num_classes": 14, "names": ["DamageZone", "DigitizationArtefactZone", "DropCapitalZone", "GraphicZone", "MainZone", "MarginTextZone", "MusicZone", "NumberingZone", "QuireMarksZone", "RunningTitleZone", "SealZone", "StampZone", "TableZone", "TitlePageZone"], "id": null, "_type": "ClassLabel"}, "image_id": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int64", "id": null, "_type": "Value"}, "area": {"dtype": "int64", "id": null, "_type": "Value"}, "bbox": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": 4, "id": null, "_type": "Sequence"}, "segmentation": [[{"dtype": "float32", "id": null, "_type": "Value"}]], "iscrowd": {"dtype": "bool", "id": null, "_type": "Value"}}]}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "yalta_ai_segmonto_manuscript_dataset", "config_name": "COCO", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 413822, "num_examples": 854, "dataset_name": "yalta_ai_segmonto_manuscript_dataset"}, "validation": {"name": "validation", "num_bytes": 68148, "num_examples": 154, "dataset_name": "yalta_ai_segmonto_manuscript_dataset"}, "test": {"name": "test", "num_bytes": 66949, "num_examples": 139, "dataset_name": "yalta_ai_segmonto_manuscript_dataset"}}, "download_checksums": {"https://zenodo.org/record/6814770/files/yaltai-segmonto-dataset.zip?download=1": {"num_bytes": 2826543829, "checksum": "78d15c92f563d0a96b72302bb4889d2a34e48b4ec15a0cbe9414458dbb22ac29"}}, "download_size": 2826543829, "post_processing_size": null, "dataset_size": 548919, "size_in_bytes": 2827092748}}
yalta_ai_segmonto_manuscript_dataset.py CHANGED
@@ -21,29 +21,43 @@ import datasets
21
  from PIL import Image
22
 
23
  _CITATION = """\
24
- @dataset{clerice_thibault_2022_6827706,
25
  author = {Clérice, Thibault},
26
- title = {YALTAi: Tabular Dataset},
 
27
  month = jul,
28
  year = 2022,
29
  publisher = {Zenodo},
30
  version = {1.0.0},
31
- doi = {10.5281/zenodo.6827706},
32
- url = {https://doi.org/10.5281/zenodo.6827706}
33
- }
34
  """
35
 
36
- _DESCRIPTION = """Yalt AI Tabular Dataset"""
37
 
38
- _HOMEPAGE = "https://doi.org/10.5281/zenodo.6827706"
39
 
40
  _LICENSE = "Creative Commons Attribution 4.0 International"
41
 
42
  _URL = "https://zenodo.org/record/6814770/files/yaltai-segmonto-dataset.zip?download=1"
43
 
44
- _CATEGORIES = ['DamageZone', 'DigitizationArtefactZone', 'DropCapitalZone', 'GraphicZone', 'MainZone',
45
- 'MarginTextZone', 'MusicZone', 'NumberingZone', 'QuireMarksZone', 'RunningTitleZone', 'SealZone',
46
- 'StampZone', 'TableZone', 'TitlePageZone']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  class YaltAiTabularDatasetConfig(datasets.BuilderConfig):
49
  """BuilderConfig for YaltAiTabularDataset."""
@@ -112,17 +126,23 @@ class YaltAiTabularDataset(datasets.GeneratorBasedBuilder):
112
  datasets.SplitGenerator(
113
  name=datasets.Split.TRAIN,
114
  gen_kwargs={
115
- "data_dir": os.path.join(data_dir, "yaltai-segmonto-dataset", "train")
 
 
116
  },
117
  ),
118
  datasets.SplitGenerator(
119
  name=datasets.Split.VALIDATION,
120
- gen_kwargs={"data_dir": os.path.join(data_dir, "yaltai-segmonto-dataset", "val")},
 
 
121
  ),
122
  datasets.SplitGenerator(
123
  name=datasets.Split.TEST,
124
  gen_kwargs={
125
- "data_dir": os.path.join(data_dir, "yaltai-segmonto-dataset", "test")
 
 
126
  },
127
  ),
128
  ]
@@ -211,8 +231,8 @@ class YaltAiTabularDataset(datasets.GeneratorBasedBuilder):
211
  for idx, (image_path, label_path) in enumerate(
212
  zip(image_paths, label_paths)
213
  ):
214
- im = Image.open(image_path)
215
- width, height = im.size
216
  image_id = idx
217
  annotations = []
218
  with open(label_path, "r") as f:
21
  from PIL import Image
22
 
23
  _CITATION = """\
24
+ @dataset{clerice_thibault_2022_6814770,
25
  author = {Clérice, Thibault},
26
+ title = {{YALTAi: Segmonto Manuscript and Early Printed Book
27
+ Dataset}},
28
  month = jul,
29
  year = 2022,
30
  publisher = {Zenodo},
31
  version = {1.0.0},
32
+ doi = {10.5281/zenodo.6814770},
33
+ url = {https://doi.org/10.5281/zenodo.6814770}
 
34
  """
35
 
36
+ _DESCRIPTION = """YALTAi: Segmonto Manuscript and Early Printed Book Dataset"""
37
 
38
+ _HOMEPAGE = "https://doi.org/10.5281/zenodo.6814770"
39
 
40
  _LICENSE = "Creative Commons Attribution 4.0 International"
41
 
42
  _URL = "https://zenodo.org/record/6814770/files/yaltai-segmonto-dataset.zip?download=1"
43
 
44
+ _CATEGORIES = [
45
+ "DamageZone",
46
+ "DigitizationArtefactZone",
47
+ "DropCapitalZone",
48
+ "GraphicZone",
49
+ "MainZone",
50
+ "MarginTextZone",
51
+ "MusicZone",
52
+ "NumberingZone",
53
+ "QuireMarksZone",
54
+ "RunningTitleZone",
55
+ "SealZone",
56
+ "StampZone",
57
+ "TableZone",
58
+ "TitlePageZone",
59
+ ]
60
+
61
 
62
  class YaltAiTabularDatasetConfig(datasets.BuilderConfig):
63
  """BuilderConfig for YaltAiTabularDataset."""
126
  datasets.SplitGenerator(
127
  name=datasets.Split.TRAIN,
128
  gen_kwargs={
129
+ "data_dir": os.path.join(
130
+ data_dir, "yaltai-segmonto-dataset", "train"
131
+ )
132
  },
133
  ),
134
  datasets.SplitGenerator(
135
  name=datasets.Split.VALIDATION,
136
+ gen_kwargs={
137
+ "data_dir": os.path.join(data_dir, "yaltai-segmonto-dataset", "val")
138
+ },
139
  ),
140
  datasets.SplitGenerator(
141
  name=datasets.Split.TEST,
142
  gen_kwargs={
143
+ "data_dir": os.path.join(
144
+ data_dir, "yaltai-segmonto-dataset", "test"
145
+ )
146
  },
147
  ),
148
  ]
231
  for idx, (image_path, label_path) in enumerate(
232
  zip(image_paths, label_paths)
233
  ):
234
+ image = Image.open(image_path)
235
+ width, height = image.size
236
  image_id = idx
237
  annotations = []
238
  with open(label_path, "r") as f: