hand-gesture-recognition-dataset / hand-gesture-recognition-dataset.py
Vadzim Kashko
fix
f1e3448
raw history blame
No virus
3.58 kB
# import datasets
# import pandas as pd
# _CITATION = """\
# @InProceedings{huggingface:dataset,
# title = {hand-gesture-recognition-dataset},
# author = {TrainingDataPro},
# year = {2023}
# }
# """
# _DESCRIPTION = """\
# The dataset consists of videos showcasing individuals demonstrating 5 different
# hand gestures (*"one", "four", "small", "fist", and "me"*). Each video captures
# a person prominently displaying a single hand gesture, allowing for accurate
# identification and differentiation of the gestures.
# The dataset offers a diverse range of individuals performing the gestures,
# enabling the exploration of variations in hand shapes, sizes, and movements
# across different individuals.
# The videos in the dataset are recorded in reasonable lighting conditions and
# with adequate resolution, to ensure that the hand gestures can be easily
# observed and studied.
# """
# _NAME = 'hand-gesture-recognition-dataset'
# _HOMEPAGE = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}"
# _LICENSE = "cc-by-nc-nd-4.0"
# _DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/data/"
# class HandGestureRecognitionDataset(datasets.GeneratorBasedBuilder):
# def _info(self):
# return datasets.DatasetInfo(description=_DESCRIPTION,
# features=datasets.Features({
# 'set_id': datasets.Value('int32'),
# 'fist': datasets.Value('string'),
# 'four': datasets.Value('string'),
# 'me': datasets.Value('string'),
# 'one': datasets.Value('string'),
# 'small': datasets.Value('string')
# }),
# supervised_keys=None,
# homepage=_HOMEPAGE,
# citation=_CITATION,
# license=_LICENSE)
# def _split_generators(self, dl_manager):
# files = dl_manager.download_and_extract(f"{_DATA}files.zip")
# annotations = dl_manager.download(f"{_DATA}{_NAME}.csv")
# files = dl_manager.iter_files(files)
# return [
# datasets.SplitGenerator(name=datasets.Split.TRAIN,
# gen_kwargs={
# "files": files,
# 'annotations': annotations
# }),
# ]
# def _generate_examples(self, files, annotations):
# annotations_df = pd.read_csv(annotations, sep=';')
# files = sorted(files)
# files = [files[i:i + 5] for i in range(0, len(files), 5)]
# for idx, files_set in enumerate(files):
# set_id = int(files_set[0].split('/')[2])
# data = {'set_id': set_id}
# for file in files_set:
# file_name = file.split('/')[3]
# if 'fist' in file_name.lower():
# data['fist'] = file
# elif 'four' in file_name.lower():
# data['four'] = file
# elif 'me' in file_name.lower():
# data['me'] = file
# elif 'one' in file_name.lower():
# data['one'] = file
# elif 'small' in file_name.lower():
# data['small'] = file
# yield idx, data