|
"""mini-GamePhysics test Dataset """ |
|
|
|
from __future__ import absolute_import, division, print_function |
|
|
|
import csv |
|
import json |
|
import os |
|
|
|
import datasets |
|
from datasets import Dataset |
|
|
|
|
|
|
|
|
|
_CITATION = """\ |
|
@article{taesiri2022clip, |
|
title={CLIP meets GamePhysics: Towards bug identification in gameplay videos using zero-shot transfer learning}, |
|
author={Taesiri, Mohammad Reza and Macklon, Finlay and Bezemer, Cor-Paul}, |
|
journal={arXiv preprint arXiv:2203.11096}, |
|
year={2022} |
|
} |
|
""" |
|
|
|
|
|
|
|
|
|
_DESCRIPTION = """\ |
|
A test dataset for GamePhysics |
|
""" |
|
|
|
|
|
_HOMEPAGE = "https://asgaardlab.github.io/CLIPxGamePhysics/" |
|
|
|
|
|
_LICENSE = "" |
|
|
|
|
|
|
|
|
|
|
|
_URLS = { |
|
"Grand_Theft_Auto_V": "https://huggingface.co/datasets/taesiri/GamePhysics_Grand_Theft_Auto_V/resolve/main/gta-v.tar.gz" |
|
} |
|
|
|
_NAMES = ["Grand_Theft_Auto_V"] |
|
|
|
|
|
class GamePhysics_Grand_Theft_Auto_VConfig(datasets.BuilderConfig): |
|
"""BuilderConfig for GamePhysics.""" |
|
|
|
def __init__(self, **kwargs): |
|
"""BuilderConfig for GamePhysics_Grand_Theft_Auto_V. |
|
Args: |
|
**kwargs: keyword arguments forwarded to super. |
|
""" |
|
super(GamePhysics_Grand_Theft_Auto_VConfig, self).__init__( |
|
version=datasets.Version("0.0.1", ""), **kwargs |
|
) |
|
|
|
|
|
class GamePhysics_Grand_Theft_Auto_V(datasets.GeneratorBasedBuilder): |
|
"""Test dataset for GamePhysics""" |
|
|
|
BUILDER_CONFIGS = [ |
|
GamePhysics_Grand_Theft_Auto_VConfig( |
|
name="GamePhysics_Grand_Theft_Auto_V", |
|
description="GamePhysics - Grand Theft Auto V", |
|
) |
|
] |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=datasets.Features( |
|
{ |
|
"video_file_path": datasets.Value("string"), |
|
"labels": datasets.features.ClassLabel(names=_NAMES), |
|
} |
|
), |
|
supervised_keys=None, |
|
homepage=_HOMEPAGE, |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
data_files = dl_manager.download_and_extract(_URLS) |
|
return [ |
|
datasets.SplitGenerator( |
|
name="Grand_Theft_Auto_V", |
|
gen_kwargs={ |
|
"files": dl_manager.iter_files([data_files["Grand_Theft_Auto_V"]]), |
|
}, |
|
), |
|
] |
|
|
|
def _generate_examples(self, files): |
|
for i, path in enumerate(files): |
|
file_name = os.path.basename(path) |
|
if file_name.endswith(".mp4"): |
|
yield i, {"video_file_path": path, "labels": "Grand_Theft_Auto_V"} |
|
|