|
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): |
|
repo_url = "https://huggingface.co/datasets/faridlab/deepaction_v1" |
|
|
|
dl_manager = datasets.DownloadManager( |
|
download_config=datasets.DownloadConfig(use_auth_token=True) |
|
) |
|
data_dir = dl_manager.download_and_extract(repo_url) |
|
|
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={"data_dir": data_dir}, |
|
), |
|
] |
|
|
|
def _generate_examples(self, data_dir): |
|
for label in os.listdir(data_dir): |
|
label_path = os.path.join(data_dir, label) |
|
if os.path.isdir(label_path): |
|
for subfolder in os.listdir(label_path): |
|
subfolder_path = os.path.join(label_path, 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, |
|
} |