Rivoks commited on
Commit
7d9446e
·
1 Parent(s): 343fa4f

Upload movingthings.py

Browse files
Files changed (1) hide show
  1. movingthings.py +11 -56
movingthings.py CHANGED
@@ -1,12 +1,7 @@
1
- import os
2
  import datasets
3
  from datasets.tasks import ImageClassification
4
 
5
- """MovingThings: The moving things dataset."""
6
-
7
-
8
  _HOMEPAGE = "https://github.com/Rivoks"
9
-
10
  _CITATION = """\
11
  @ONLINE {movingthings,
12
  author="Rivoks",
@@ -16,25 +11,16 @@ _CITATION = """\
16
  url="https://github.com/Rivoks"
17
  }
18
  """
19
-
20
- _DESCRIPTION = """\
21
- MovingThings is a dataset of images of moving things programmaticaly generated with Stable Diffusion (v1.5).
22
- It consists of 5 self movement class: roll, flow, zigzag, walk and linear.
23
- Data was annoted by the script that generates the images with the prompt passed to Stable Diffusion.
24
- """
25
-
26
-
27
- _URLS = {
28
- "train": "https://huggingface.co/datasets/Rivoks/movingthings/resolve/main/data/train.parquet",
29
- "validation": "https://huggingface.co/datasets/Rivoks/movingthings/resolve/main/data/validation.parquet",
30
- "test": "https://huggingface.co/datasets/Rivoks/movingthings/resolve/main/data/test.parquet",
31
- }
32
-
33
  _NAMES = ["roll", "flow", "zigzag", "walk", "linear"]
34
 
 
35
 
36
- class Beans(datasets.GeneratorBasedBuilder):
37
- """Beans plant leaf images dataset."""
38
 
39
  def _info(self):
40
  return datasets.DatasetInfo(
@@ -43,44 +29,13 @@ class Beans(datasets.GeneratorBasedBuilder):
43
  {
44
  "text": datasets.Value("string"),
45
  "image": datasets.Image(),
46
- "labels": datasets.features.ClassLabel(names=_NAMES),
47
  }
48
  ),
49
  supervised_keys=("image", "labels"),
50
  homepage=_HOMEPAGE,
51
  citation=_CITATION,
52
- task_templates=[ImageClassification(image_column="image", label_column="labels")],
 
 
53
  )
54
-
55
- def _split_generators(self, dl_manager):
56
- data_files = dl_manager.download_and_extract(_URLS)
57
- return [
58
- datasets.SplitGenerator(
59
- name=datasets.Split.TRAIN,
60
- gen_kwargs={
61
- "files": dl_manager.iter_files([data_files["train"]]),
62
- },
63
- ),
64
- datasets.SplitGenerator(
65
- name=datasets.Split.VALIDATION,
66
- gen_kwargs={
67
- "files": dl_manager.iter_files([data_files["validation"]]),
68
- },
69
- ),
70
- datasets.SplitGenerator(
71
- name=datasets.Split.TEST,
72
- gen_kwargs={
73
- "files": dl_manager.iter_files([data_files["test"]]),
74
- },
75
- ),
76
- ]
77
-
78
- def _generate_examples(self, files):
79
- for i, path in enumerate(files):
80
- file_name = os.path.basename(path)
81
- if file_name.endswith(".jpg"):
82
- yield i, {
83
- "text": path,
84
- "image": path,
85
- "labels": os.path.basename(os.path.dirname(path)).lower(),
86
- }
 
 
1
  import datasets
2
  from datasets.tasks import ImageClassification
3
 
 
 
 
4
  _HOMEPAGE = "https://github.com/Rivoks"
 
5
  _CITATION = """\
6
  @ONLINE {movingthings,
7
  author="Rivoks",
 
11
  url="https://github.com/Rivoks"
12
  }
13
  """
14
+ _DESCRIPTION = (
15
+ "MovingThings is a dataset of images of moving things programmaticaly generated "
16
+ "with Stable Diffusion (v1.5). It consists of 5 self movement classes: roll, flow, zigzag, walk, and linear. "
17
+ "Data was annotated by the script that generates the images with the prompt passed to Stable Diffusion."
18
+ )
 
 
 
 
 
 
 
 
 
19
  _NAMES = ["roll", "flow", "zigzag", "walk", "linear"]
20
 
21
+ class MovingThings(datasets.GeneratorBasedBuilder):
22
 
23
+ VERSION = datasets.Version("1.0.0") # Update the version as needed
 
24
 
25
  def _info(self):
26
  return datasets.DatasetInfo(
 
29
  {
30
  "text": datasets.Value("string"),
31
  "image": datasets.Image(),
32
+ "labels": datasets.ClassLabel(names=_NAMES),
33
  }
34
  ),
35
  supervised_keys=("image", "labels"),
36
  homepage=_HOMEPAGE,
37
  citation=_CITATION,
38
+ task_templates=[
39
+ ImageClassification(image_column="image", label_column="labels")
40
+ ],
41
  )