GamePhysics_Grand_Theft_Auto_V / GamePhysics_Grand_Theft_Auto_V.py
taesiri's picture
Renaming the generator
bd3505b
"""mini-GamePhysics test Dataset """
from __future__ import absolute_import, division, print_function
import csv
import json
import os
import datasets
from datasets import Dataset
# TODO: Add BibTeX citation
# Find for instance the citation on arxiv or on the dataset repo/website
_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}
}
"""
# TODO: Add description of the dataset here
# You can copy an official description
_DESCRIPTION = """\
A test dataset for GamePhysics
"""
# TODO: Add a link to an official homepage for the dataset here
_HOMEPAGE = "https://asgaardlab.github.io/CLIPxGamePhysics/"
# TODO: Add the licence for the dataset here if you can find it
_LICENSE = ""
# TODO: Add link to the official dataset URLs here
# The HuggingFace dataset library don't host the datasets but only point to the original files
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
_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"}