Upload movingthings.py
Browse files- movingthings.py +46 -0
movingthings.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import datasets
|
| 2 |
+
from datasets.tasks import ImageClassification
|
| 3 |
+
|
| 4 |
+
_HOMEPAGE = "https://github.com/Rivoks"
|
| 5 |
+
_CITATION = """\
|
| 6 |
+
@ONLINE {movingthings,
|
| 7 |
+
author="Rivoks",
|
| 8 |
+
title="Moving things dataset",
|
| 9 |
+
month="August",
|
| 10 |
+
year="2023",
|
| 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 |
+
features = datasets.Features(
|
| 27 |
+
{
|
| 28 |
+
"text": datasets.Value("string"),
|
| 29 |
+
"image": datasets.Image(),
|
| 30 |
+
"labels": datasets.ClassLabel(names=_NAMES),
|
| 31 |
+
}
|
| 32 |
+
)
|
| 33 |
+
return datasets.DatasetInfo(
|
| 34 |
+
description=_DESCRIPTION,
|
| 35 |
+
features=features,
|
| 36 |
+
supervised_keys=("image", "labels"),
|
| 37 |
+
homepage=_HOMEPAGE,
|
| 38 |
+
citation=_CITATION,
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
def _split_generators(self, dl_manager):
|
| 42 |
+
# Define your data split logic here
|
| 43 |
+
pass
|
| 44 |
+
|
| 45 |
+
# Task template outside of _info()
|
| 46 |
+
MovingThingsTaskTemplate = ImageClassification(image_column="image", label_column="labels")
|