davanstrien HF staff commited on
Commit
732a8b6
1 Parent(s): 06e7bf3

clean loading script

Browse files
Files changed (2) hide show
  1. dataset_infos.json +1 -1
  2. yalt_ai_tabular_dataset.py +4 -13
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"default": {"description": "TODO", "citation": " @dataset{clerice_thibault_2022_6827706,\n author = {Cl\u00e9rice, Thibault},\n title = {YALTAi: Tabular Dataset},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6827706},\n url = {https://doi.org/10.5281/zenodo.6827706}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6827706", "license": "Creative Commons Attribution 4.0 International", "features": {"image": {"decode": true, "id": null, "_type": "Image"}, "objects": {"feature": {"label": {"num_classes": 4, "names": ["Header", "Col", "Marginal", "text"], "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": "yalt_ai_tabular_dataset", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 60704, "num_examples": 196, "dataset_name": "yalt_ai_tabular_dataset"}, "validation": {"name": "validation", "num_bytes": 7537, "num_examples": 22, "dataset_name": "yalt_ai_tabular_dataset"}, "test": {"name": "test", "num_bytes": 47159, "num_examples": 135, "dataset_name": "yalt_ai_tabular_dataset"}}, "download_checksums": {"https://zenodo.org/record/6827706/files/yaltai-table.zip?download=1": {"num_bytes": 376190064, "checksum": "5b312faf097939302fb98ab0a8b35c007962d88978ea9dc28d2f560b89dc0657"}}, "download_size": 376190064, "post_processing_size": null, "dataset_size": 115400, "size_in_bytes": 376305464}, "YOLO": {"description": "TODO", "citation": " @dataset{clerice_thibault_2022_6827706,\n author = {Cl\u00e9rice, Thibault},\n title = {YALTAi: Tabular Dataset},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6827706},\n url = {https://doi.org/10.5281/zenodo.6827706}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6827706", "license": "Creative Commons Attribution 4.0 International", "features": {"image": {"decode": true, "id": null, "_type": "Image"}, "objects": {"feature": {"label": {"num_classes": 4, "names": ["Header", "Col", "Marginal", "text"], "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": "yalt_ai_tabular_dataset", "config_name": "YOLO", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 60704, "num_examples": 196, "dataset_name": "yalt_ai_tabular_dataset"}, "validation": {"name": "validation", "num_bytes": 7537, "num_examples": 22, "dataset_name": "yalt_ai_tabular_dataset"}, "test": {"name": "test", "num_bytes": 47159, "num_examples": 135, "dataset_name": "yalt_ai_tabular_dataset"}}, "download_checksums": {"https://zenodo.org/record/6827706/files/yaltai-table.zip?download=1": {"num_bytes": 376190064, "checksum": "5b312faf097939302fb98ab0a8b35c007962d88978ea9dc28d2f560b89dc0657"}}, "download_size": 376190064, "post_processing_size": null, "dataset_size": 115400, "size_in_bytes": 376305464}, "COCO": {"description": "TODO", "citation": " @dataset{clerice_thibault_2022_6827706,\n author = {Cl\u00e9rice, Thibault},\n title = {YALTAi: Tabular Dataset},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6827706},\n url = {https://doi.org/10.5281/zenodo.6827706}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6827706", "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": 4, "names": ["Header", "Col", "Marginal", "text"], "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": "yalt_ai_tabular_dataset", "config_name": "COCO", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 87171, "num_examples": 196, "dataset_name": "yalt_ai_tabular_dataset"}, "validation": {"name": "validation", "num_bytes": 11225, "num_examples": 22, "dataset_name": "yalt_ai_tabular_dataset"}, "test": {"name": "test", "num_bytes": 71491, "num_examples": 135, "dataset_name": "yalt_ai_tabular_dataset"}}, "download_checksums": {"https://zenodo.org/record/6827706/files/yaltai-table.zip?download=1": {"num_bytes": 376190064, "checksum": "5b312faf097939302fb98ab0a8b35c007962d88978ea9dc28d2f560b89dc0657"}}, "download_size": 376190064, "post_processing_size": null, "dataset_size": 169887, "size_in_bytes": 376359951}}
 
1
+ {"default": {"description": "TODO", "citation": " @dataset{clerice_thibault_2022_6827706,\n author = {Cl\u00e9rice, Thibault},\n title = {YALTAi: Tabular Dataset},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6827706},\n url = {https://doi.org/10.5281/zenodo.6827706}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6827706", "license": "Creative Commons Attribution 4.0 International", "features": {"image": {"decode": true, "id": null, "_type": "Image"}, "objects": {"feature": {"label": {"num_classes": 4, "names": ["Header", "Col", "Marginal", "text"], "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": "yalt_ai_tabular_dataset", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 60704, "num_examples": 196, "dataset_name": "yalt_ai_tabular_dataset"}, "validation": {"name": "validation", "num_bytes": 7537, "num_examples": 22, "dataset_name": "yalt_ai_tabular_dataset"}, "test": {"name": "test", "num_bytes": 47159, "num_examples": 135, "dataset_name": "yalt_ai_tabular_dataset"}}, "download_checksums": {"https://zenodo.org/record/6827706/files/yaltai-table.zip?download=1": {"num_bytes": 376190064, "checksum": "5b312faf097939302fb98ab0a8b35c007962d88978ea9dc28d2f560b89dc0657"}}, "download_size": 376190064, "post_processing_size": null, "dataset_size": 115400, "size_in_bytes": 376305464}, "YOLO": {"description": "Yalt AI Tabular Dataset", "citation": " @dataset{clerice_thibault_2022_6827706,\n author = {Cl\u00e9rice, Thibault},\n title = {YALTAi: Tabular Dataset},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6827706},\n url = {https://doi.org/10.5281/zenodo.6827706}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6827706", "license": "Creative Commons Attribution 4.0 International", "features": {"image": {"decode": true, "id": null, "_type": "Image"}, "objects": {"feature": {"label": {"num_classes": 4, "names": ["Header", "Col", "Marginal", "text"], "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": "yalt_ai_tabular_dataset", "config_name": "YOLO", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 60704, "num_examples": 196, "dataset_name": "yalt_ai_tabular_dataset"}, "validation": {"name": "validation", "num_bytes": 7537, "num_examples": 22, "dataset_name": "yalt_ai_tabular_dataset"}, "test": {"name": "test", "num_bytes": 47159, "num_examples": 135, "dataset_name": "yalt_ai_tabular_dataset"}}, "download_checksums": {"https://zenodo.org/record/6827706/files/yaltai-table.zip?download=1": {"num_bytes": 376190064, "checksum": "5b312faf097939302fb98ab0a8b35c007962d88978ea9dc28d2f560b89dc0657"}}, "download_size": 376190064, "post_processing_size": null, "dataset_size": 115400, "size_in_bytes": 376305464}, "COCO": {"description": "Yalt AI Tabular Dataset", "citation": " @dataset{clerice_thibault_2022_6827706,\n author = {Cl\u00e9rice, Thibault},\n title = {YALTAi: Tabular Dataset},\n month = jul,\n year = 2022,\n publisher = {Zenodo},\n version = {1.0.0},\n doi = {10.5281/zenodo.6827706},\n url = {https://doi.org/10.5281/zenodo.6827706}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6827706", "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": 4, "names": ["Header", "Col", "Marginal", "text"], "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": "yalt_ai_tabular_dataset", "config_name": "COCO", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 87171, "num_examples": 196, "dataset_name": "yalt_ai_tabular_dataset"}, "validation": {"name": "validation", "num_bytes": 11225, "num_examples": 22, "dataset_name": "yalt_ai_tabular_dataset"}, "test": {"name": "test", "num_bytes": 71491, "num_examples": 135, "dataset_name": "yalt_ai_tabular_dataset"}}, "download_checksums": {"https://zenodo.org/record/6827706/files/yaltai-table.zip?download=1": {"num_bytes": 376190064, "checksum": "5b312faf097939302fb98ab0a8b35c007962d88978ea9dc28d2f560b89dc0657"}}, "download_size": 376190064, "post_processing_size": null, "dataset_size": 169887, "size_in_bytes": 376359951}}
yalt_ai_tabular_dataset.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
  #
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
  # you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
16
 
17
  import os
18
  from glob import glob
19
- from re import L
20
 
21
  import datasets
22
  from PIL import Image
@@ -34,7 +33,7 @@ _CITATION = """\
34
  }
35
  """
36
 
37
- _DESCRIPTION = """TODO"""
38
 
39
  _HOMEPAGE = "https://doi.org/10.5281/zenodo.6827706"
40
 
@@ -71,7 +70,6 @@ class YaltAiTabularDataset(datasets.GeneratorBasedBuilder):
71
  "image": datasets.Image(),
72
  "width": datasets.Value("int32"),
73
  "height": datasets.Value("int32"),
74
- # "url": datasets.Value("string"),
75
  }
76
  )
77
  object_dict = {
@@ -87,7 +85,6 @@ class YaltAiTabularDataset(datasets.GeneratorBasedBuilder):
87
  if self.config.name == "YOLO":
88
  features = datasets.Features(
89
  {
90
- # "image_id": datasets.Value("int32"),
91
  "image": datasets.Image(),
92
  "objects": datasets.Sequence(
93
  {
@@ -168,16 +165,13 @@ class YaltAiTabularDataset(datasets.GeneratorBasedBuilder):
168
  ):
169
  image_id = idx
170
  annotations = []
171
- image = Image.open(image_path) # .convert("RGB")
172
  w, h = image.size
173
  with open(label_path, "r") as f:
174
  lines = f.readlines()
175
  for line in lines:
176
  line = line.strip().split()
177
- # logger.warn(line)
178
- category_id = line[
179
- 0
180
- ] # int(line[0]) + 1 # you start with annotation id with '1'
181
  x_center = float(line[1])
182
  y_center = float(line[2])
183
  width = float(line[3])
@@ -201,12 +195,9 @@ class YaltAiTabularDataset(datasets.GeneratorBasedBuilder):
201
  image_id,
202
  category_id,
203
  image_id,
204
- # segmentation=opt.box2seg,
205
  )
206
  annotations.append(annotation)
207
- # annotation_id += 1
208
 
209
- # image_id += 1 # if you finished annotation work, updates the image id.
210
  example = {
211
  "image_id": image_id,
212
  "image": image,
 
1
+ # Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
2
  #
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
  # you may not use this file except in compliance with the License.
 
16
 
17
  import os
18
  from glob import glob
 
19
 
20
  import datasets
21
  from PIL import Image
 
33
  }
34
  """
35
 
36
+ _DESCRIPTION = """Yalt AI Tabular Dataset"""
37
 
38
  _HOMEPAGE = "https://doi.org/10.5281/zenodo.6827706"
39
 
 
70
  "image": datasets.Image(),
71
  "width": datasets.Value("int32"),
72
  "height": datasets.Value("int32"),
 
73
  }
74
  )
75
  object_dict = {
 
85
  if self.config.name == "YOLO":
86
  features = datasets.Features(
87
  {
 
88
  "image": datasets.Image(),
89
  "objects": datasets.Sequence(
90
  {
 
165
  ):
166
  image_id = idx
167
  annotations = []
168
+ image = Image.open(image_path) # Possibly conver to RGB?
169
  w, h = image.size
170
  with open(label_path, "r") as f:
171
  lines = f.readlines()
172
  for line in lines:
173
  line = line.strip().split()
174
+ category_id = line[0]
 
 
 
175
  x_center = float(line[1])
176
  y_center = float(line[2])
177
  width = float(line[3])
 
195
  image_id,
196
  category_id,
197
  image_id,
 
198
  )
199
  annotations.append(annotation)
 
200
 
 
201
  example = {
202
  "image_id": image_id,
203
  "image": image,