MehdiH7 commited on
Commit
6dd7ee8
·
verified ·
1 Parent(s): 3e17e76

Update data/hockey_pose.py

Browse files
Files changed (1) hide show
  1. data/hockey_pose.py +12 -12
data/hockey_pose.py CHANGED
@@ -1,25 +1,24 @@
1
  import json
2
  import os
3
-
4
  import datasets
5
  from datasets import Features, Image, Value, Sequence
6
 
7
-
8
  class HockeyPoseConfig(datasets.BuilderConfig):
9
  """BuilderConfig for HockeyPose dataset."""
10
-
11
  def __init__(self, **kwargs):
12
- """BuilderConfig for HockeyPose.
13
- Args:
14
- **kwargs: keyword arguments forwarded to super.
15
- """
16
  super(HockeyPoseConfig, self).__init__(**kwargs)
17
 
18
-
19
  class HockeyPose(datasets.GeneratorBasedBuilder):
20
  """HockeyPose dataset: Hockey player images with pose keypoints."""
21
 
22
  VERSION = datasets.Version("1.0.0")
 
 
 
 
 
 
 
23
 
24
  def _info(self):
25
  return datasets.DatasetInfo(
@@ -30,13 +29,14 @@ class HockeyPose(datasets.GeneratorBasedBuilder):
30
  'annotations': Sequence({
31
  'class_id': Value('int64'),
32
  'bbox': Sequence(Value('float32'), length=4),
33
- 'keypoints': Sequence(
34
  Sequence(Value('float32'), length=3),
35
- length=56
36
  ),
37
  })
38
  }),
39
  supervised_keys=None,
 
40
  )
41
 
42
  def _split_generators(self, dl_manager):
@@ -52,8 +52,8 @@ class HockeyPose(datasets.GeneratorBasedBuilder):
52
 
53
  def _generate_examples(self, split):
54
  """Yields examples."""
55
- frames_dir = "frames"
56
- annotations_dir = "annotations"
57
 
58
  # Get all image files
59
  image_files = [f for f in os.listdir(frames_dir)
 
1
  import json
2
  import os
 
3
  import datasets
4
  from datasets import Features, Image, Value, Sequence
5
 
 
6
  class HockeyPoseConfig(datasets.BuilderConfig):
7
  """BuilderConfig for HockeyPose dataset."""
 
8
  def __init__(self, **kwargs):
 
 
 
 
9
  super(HockeyPoseConfig, self).__init__(**kwargs)
10
 
 
11
  class HockeyPose(datasets.GeneratorBasedBuilder):
12
  """HockeyPose dataset: Hockey player images with pose keypoints."""
13
 
14
  VERSION = datasets.Version("1.0.0")
15
+ BUILDER_CONFIGS = [
16
+ HockeyPoseConfig(
17
+ name="hockey_pose",
18
+ version=VERSION,
19
+ description="Hockey pose dataset with keypoints",
20
+ ),
21
+ ]
22
 
23
  def _info(self):
24
  return datasets.DatasetInfo(
 
29
  'annotations': Sequence({
30
  'class_id': Value('int64'),
31
  'bbox': Sequence(Value('float32'), length=4),
32
+ 'keypoints': Sequence(
33
  Sequence(Value('float32'), length=3),
34
+ length=56
35
  ),
36
  })
37
  }),
38
  supervised_keys=None,
39
+ homepage="https://huggingface.co/datasets/SimulaMet-HOST/HockeyRink",
40
  )
41
 
42
  def _split_generators(self, dl_manager):
 
52
 
53
  def _generate_examples(self, split):
54
  """Yields examples."""
55
+ frames_dir = os.path.join(os.path.dirname(__file__), "..", "frames")
56
+ annotations_dir = os.path.join(os.path.dirname(__file__), "..", "annotations")
57
 
58
  # Get all image files
59
  image_files = [f for f in os.listdir(frames_dir)