|
import os |
|
import datasets |
|
|
|
_CITATION = """\ |
|
@inproceedings{tbd, |
|
title={tbd}, |
|
author={tbd}, |
|
year={2024}, |
|
url={https://huggingface.co/datasets/faridlab/deepaction_v1} |
|
} |
|
""" |
|
|
|
_DESCRIPTION = """\ |
|
TBD |
|
""" |
|
|
|
_HOMEPAGE = "https://huggingface.co/datasets/faridlab/deepaction_v1" |
|
|
|
_LICENSE = "TBD" |
|
|
|
class DeepActionV1(datasets.GeneratorBasedBuilder): |
|
VERSION = datasets.Version("1.0.0") |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=datasets.Features({ |
|
"video": datasets.Video(), |
|
"label": datasets.ClassLabel(names=["VideoPoet", "BDAnimateDiffLightning", "CogVideoX5B", "Pexels", "RunwayML", "StableDiffusion", "Veo"]), |
|
}), |
|
supervised_keys=("video", "label"), |
|
homepage=_HOMEPAGE, |
|
license=_LICENSE, |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
url = "https://huggingface.co/datasets/faridlab/deepaction_v1/resolve/main/data.zip" |
|
data_dir = dl_manager.download_and_extract(url) |
|
|
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={"data_dir": data_dir}, |
|
), |
|
] |
|
|
|
def _generate_examples(self, data_dir): |
|
label_names = os.listdir(data_dir) |
|
for label in label_names: |
|
label_dir = os.path.join(data_dir, label) |
|
if os.path.isdir(label_dir): |
|
for subfolder in os.listdir(label_dir): |
|
subfolder_path = os.path.join(label_dir, subfolder) |
|
if os.path.isdir(subfolder_path): |
|
for video_file in os.listdir(subfolder_path): |
|
if video_file.endswith(".mp4"): |
|
video_path = os.path.join(subfolder_path, video_file) |
|
yield video_path, { |
|
"video": video_path, |
|
"label": label, |
|
} |