Vadzim Kashko commited on
Commit
3bc13bd
1 Parent(s): dcff9fc
.hand-gesture-recognition-dataset DELETED
@@ -1,83 +0,0 @@
1
- # import datasets
2
- # import pandas as pd
3
-
4
- # _CITATION = """\
5
- # @InProceedings{huggingface:dataset,
6
- # title = {hand-gesture-recognition-dataset},
7
- # author = {TrainingDataPro},
8
- # year = {2023}
9
- # }
10
- # """
11
-
12
- # _DESCRIPTION = """\
13
- # The dataset consists of videos showcasing individuals demonstrating 5 different
14
- # hand gestures (*"one", "four", "small", "fist", and "me"*). Each video captures
15
- # a person prominently displaying a single hand gesture, allowing for accurate
16
- # identification and differentiation of the gestures.
17
- # The dataset offers a diverse range of individuals performing the gestures,
18
- # enabling the exploration of variations in hand shapes, sizes, and movements
19
- # across different individuals.
20
- # The videos in the dataset are recorded in reasonable lighting conditions and
21
- # with adequate resolution, to ensure that the hand gestures can be easily
22
- # observed and studied.
23
- # """
24
- # _NAME = 'hand-gesture-recognition-dataset'
25
-
26
- # _HOMEPAGE = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}"
27
-
28
- # _LICENSE = "cc-by-nc-nd-4.0"
29
-
30
- # _DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/data/"
31
-
32
-
33
- # class HandGestureRecognitionDataset(datasets.GeneratorBasedBuilder):
34
-
35
- # def _info(self):
36
- # return datasets.DatasetInfo(description=_DESCRIPTION,
37
- # features=datasets.Features({
38
- # 'set_id': datasets.Value('int32'),
39
- # 'fist': datasets.Value('string'),
40
- # 'four': datasets.Value('string'),
41
- # 'me': datasets.Value('string'),
42
- # 'one': datasets.Value('string'),
43
- # 'small': datasets.Value('string')
44
- # }),
45
- # supervised_keys=None,
46
- # homepage=_HOMEPAGE,
47
- # citation=_CITATION,
48
- # license=_LICENSE)
49
-
50
- # def _split_generators(self, dl_manager):
51
- # files = dl_manager.download_and_extract(f"{_DATA}files.zip")
52
- # annotations = dl_manager.download(f"{_DATA}{_NAME}.csv")
53
- # files = dl_manager.iter_files(files)
54
- # return [
55
- # datasets.SplitGenerator(name=datasets.Split.TRAIN,
56
- # gen_kwargs={
57
- # "files": files,
58
- # 'annotations': annotations
59
- # }),
60
- # ]
61
-
62
- # def _generate_examples(self, files, annotations):
63
- # annotations_df = pd.read_csv(annotations, sep=';')
64
-
65
- # files = sorted(files)
66
- # files = [files[i:i + 5] for i in range(0, len(files), 5)]
67
- # for idx, files_set in enumerate(files):
68
- # set_id = int(files_set[0].split('/')[2])
69
- # data = {'set_id': set_id}
70
-
71
- # for file in files_set:
72
- # file_name = file.split('/')[3]
73
- # if 'fist' in file_name.lower():
74
- # data['fist'] = file
75
- # elif 'four' in file_name.lower():
76
- # data['four'] = file
77
- # elif 'me' in file_name.lower():
78
- # data['me'] = file
79
- # elif 'one' in file_name.lower():
80
- # data['one'] = file
81
- # elif 'small' in file_name.lower():
82
- # data['small'] = file
83
- # yield idx, data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
hand-gesture-recognition-dataset.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+ import pandas as pd
3
+
4
+ _CITATION = """\
5
+ @InProceedings{huggingface:dataset,
6
+ title = {hand-gesture-recognition-dataset},
7
+ author = {TrainingDataPro},
8
+ year = {2023}
9
+ }
10
+ """
11
+
12
+ _DESCRIPTION = """\
13
+ The dataset consists of videos showcasing individuals demonstrating 5 different
14
+ hand gestures (*"one", "four", "small", "fist", and "me"*). Each video captures
15
+ a person prominently displaying a single hand gesture, allowing for accurate
16
+ identification and differentiation of the gestures.
17
+ The dataset offers a diverse range of individuals performing the gestures,
18
+ enabling the exploration of variations in hand shapes, sizes, and movements
19
+ across different individuals.
20
+ The videos in the dataset are recorded in reasonable lighting conditions and
21
+ with adequate resolution, to ensure that the hand gestures can be easily
22
+ observed and studied.
23
+ """
24
+ _NAME = 'hand-gesture-recognition-dataset'
25
+
26
+ _HOMEPAGE = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}"
27
+
28
+ _LICENSE = "cc-by-nc-nd-4.0"
29
+
30
+ _DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/data/"
31
+
32
+
33
+ class HandGestureRecognitionDataset(datasets.GeneratorBasedBuilder):
34
+
35
+ def _info(self):
36
+ return datasets.DatasetInfo(description=_DESCRIPTION,
37
+ features=datasets.Features({
38
+ 'set_id': datasets.Value('int32'),
39
+ 'fist': datasets.Value('string'),
40
+ 'four': datasets.Value('string'),
41
+ 'me': datasets.Value('string'),
42
+ 'one': datasets.Value('string'),
43
+ 'small': datasets.Value('string')
44
+ }),
45
+ supervised_keys=None,
46
+ homepage=_HOMEPAGE,
47
+ citation=_CITATION,
48
+ license=_LICENSE)
49
+
50
+ def _split_generators(self, dl_manager):
51
+ files = dl_manager.download_and_extract(f"{_DATA}files.zip")
52
+ annotations = dl_manager.download(f"{_DATA}{_NAME}.csv")
53
+ files = dl_manager.iter_files(files)
54
+ return [
55
+ datasets.SplitGenerator(name=datasets.Split.TRAIN,
56
+ gen_kwargs={
57
+ "files": files,
58
+ 'annotations': annotations
59
+ }),
60
+ ]
61
+
62
+ def _generate_examples(self, files, annotations):
63
+ annotations_df = pd.read_csv(annotations, sep=',')
64
+
65
+ # files = sorted(files)
66
+ # files = [files[i:i + 5] for i in range(0, len(files), 5)]
67
+ for idx, file_path in enumerate(files):
68
+ set_id = int(file_path.split('/')[-2])
69
+ file_name = file_path.split('/')[-1]
70
+
71
+ print(set_id, file_name)
72
+ if 'fist' in file_name:
73
+ data = {
74
+ 'set_id':
75
+ set_id,
76
+ 'fist':
77
+ annotations_df.loc[annotations_df['set_id'] == set_id]
78
+ ['fist'].values[0],
79
+ 'four':
80
+ annotations_df.loc[annotations_df['set_id'] == set_id]
81
+ ['four'].values[0],
82
+ 'me':
83
+ annotations_df.loc[annotations_df['set_id'] == set_id]
84
+ ['me'].values[0],
85
+ 'one':
86
+ annotations_df.loc[annotations_df['set_id'] == set_id]
87
+ ['one'].values[0],
88
+ 'small':
89
+ annotations_df.loc[annotations_df['set_id'] == set_id]
90
+ ['small'].values[0]
91
+ }
92
+
93
+ yield idx, data