Upload movingthings.py
Browse files- movingthings.py +8 -22
movingthings.py
CHANGED
|
@@ -17,6 +17,7 @@ _DESCRIPTION = (
|
|
| 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 |
class MovingThings(datasets.GeneratorBasedBuilder):
|
| 21 |
|
| 22 |
VERSION = datasets.Version("1.0.0") # Update the version as needed
|
|
@@ -35,26 +36,11 @@ class MovingThings(datasets.GeneratorBasedBuilder):
|
|
| 35 |
supervised_keys=("image", "labels"),
|
| 36 |
homepage=_HOMEPAGE,
|
| 37 |
citation=_CITATION,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
)
|
| 39 |
-
|
| 40 |
-
def _split_generators(self, dl_manager):
|
| 41 |
-
return {
|
| 42 |
-
"train": self._generate_examples(),
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
def _generate_examples(self):
|
| 46 |
-
# Implement your example generation logic here
|
| 47 |
-
# Return a list of dictionaries containing the features for each example
|
| 48 |
-
# You can simulate example data generation here
|
| 49 |
-
examples = [{"file_name": "soccer-ball-0.png", "text": "there is a man that is standing in the dark with a cell phone", "labels":"roll"},
|
| 50 |
-
{"file_name": "sled-1.png", "text": "there is a red chair that is sitting on the sidewalk", "labels":"roll"},
|
| 51 |
-
{"file_name": "steamroller-2.png", "text": "there is a large yellow pipe laying on the ground next to a yellow pole", "labels":"roll"},
|
| 52 |
-
{"file_name": "hamster-wheel-3.png", "text": "there is a large circular sculpture made of colored plastic", "labels":"roll"},
|
| 53 |
-
{"file_name": "skateboard-4.png", "text": "there is a skateboard that is laying on the ground", "labels":"roll"}]
|
| 54 |
-
return examples
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
# Task template outside of _info()
|
| 58 |
-
MovingThingsTaskTemplate = ImageClassification(image_column="image", label_column="labels")
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 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
|
|
|
|
| 36 |
supervised_keys=("image", "labels"),
|
| 37 |
homepage=_HOMEPAGE,
|
| 38 |
citation=_CITATION,
|
| 39 |
+
task_templates=[
|
| 40 |
+
ImageClassification(
|
| 41 |
+
image_column="image",
|
| 42 |
+
label_column="labels",
|
| 43 |
+
label_classes=_NAMES
|
| 44 |
+
)
|
| 45 |
+
],
|
| 46 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|