tanthinhdt commited on
Commit
d0a86b3
·
1 Parent(s): 48d87c6

update: builder

Browse files
Files changed (1) hide show
  1. how2sign-clips.py +32 -11
how2sign-clips.py CHANGED
@@ -15,7 +15,7 @@ _DESCRIPTION = """
15
  _HOMEPAGE = "https://how2sign.github.io/index.html"
16
  _REPO_URL = "https://huggingface.co/datasets/VieSignLang/how2sign-clips/resolve/main"
17
  _URLS = {
18
- "meta": f"{_REPO_URL}/metadata/" + "sharded_{split}.parquet",
19
  "video": f"{_REPO_URL}/videos/" + "{type}/{split}/*/*.zip",
20
  }
21
 
@@ -46,12 +46,22 @@ class How2SignClips(datasets.GeneratorBasedBuilder):
46
 
47
  def _info(self) -> datasets.DatasetInfo:
48
  features = datasets.Features({
49
- "id": datasets.Value("string"),
50
- "type": datasets.Value("string"),
51
- "view": datasets.Value("string"),
52
- "text": datasets.Value("string"),
 
 
 
53
  "video": datasets.Value("large_binary"),
54
  })
 
 
 
 
 
 
 
55
 
56
  return datasets.DatasetInfo(
57
  description=_DESCRIPTION,
@@ -127,16 +137,27 @@ class How2SignClips(datasets.GeneratorBasedBuilder):
127
  video_path = os.path.join(
128
  video_dir,
129
  f"shard_{shard_idx:03d}_{num_shards:03d}",
130
- sample["id"] + ".mp4",
 
131
  )
132
  if os.path.exists(video_path):
133
  yield i, {
134
- "id": sample["id"],
135
- "type": sample["type"],
136
- "view": sample["view"],
137
- "text": sample["text"],
138
- "video": self.__get_binary_data(video_path),
 
 
 
139
  }
 
 
 
 
 
 
 
140
 
141
  def __get_binary_data(self, path):
142
  with open(path, "rb") as f:
 
15
  _HOMEPAGE = "https://how2sign.github.io/index.html"
16
  _REPO_URL = "https://huggingface.co/datasets/VieSignLang/how2sign-clips/resolve/main"
17
  _URLS = {
18
+ "meta": f"{_REPO_URL}/metadata/" + "sharded_how2sign_realigned_{split}.parquet",
19
  "video": f"{_REPO_URL}/videos/" + "{type}/{split}/*/*.zip",
20
  }
21
 
 
46
 
47
  def _info(self) -> datasets.DatasetInfo:
48
  features = datasets.Features({
49
+ "VIDEO_ID": datasets.Value("string"),
50
+ "VIDEO_NAME": datasets.Value("string"),
51
+ "SENTENCE_ID": datasets.Value("string"),
52
+ "SENTENCE_NAME": datasets.Value("string"),
53
+ "START_REALIGNED": datasets.Value("float64"),
54
+ "END_REALIGNED": datasets.Value("float64"),
55
+ "SENTENCE": datasets.Value("string"),
56
  "video": datasets.Value("large_binary"),
57
  })
58
+ # features = datasets.Features({
59
+ # "id": datasets.Value("string"),
60
+ # "type": datasets.Value("string"),
61
+ # "view": datasets.Value("string"),
62
+ # "text": datasets.Value("string"),
63
+ # "video": datasets.Value("large_binary"),
64
+ # })
65
 
66
  return datasets.DatasetInfo(
67
  description=_DESCRIPTION,
 
137
  video_path = os.path.join(
138
  video_dir,
139
  f"shard_{shard_idx:03d}_{num_shards:03d}",
140
+ sample["SENTENCE_NAME"] + ".mp4",
141
+ # sample["id"] + ".mp4",
142
  )
143
  if os.path.exists(video_path):
144
  yield i, {
145
+ "VIDEO_ID": sample["VIDEO_ID"],
146
+ "VIDEO_NAME": sample["VIDEO_NAME"],
147
+ "SENTENCE_ID": sample["SENTENCE_ID"],
148
+ "SENTENCE_NAME": sample["SENTENCE_NAME"],
149
+ "START_REALIGNED": sample["START_REALIGNED"],
150
+ "END_REALIGNED": sample["END_REALIGNED"],
151
+ "SENTENCE": sample["SENTENCE"],
152
+ "VIDEO": self.__get_binary_data(video_path),
153
  }
154
+ # yield i, {
155
+ # "id": sample["id"],
156
+ # "type": sample["type"],
157
+ # "view": sample["view"],
158
+ # "text": sample["text"],
159
+ # "video": self.__get_binary_data(video_path),
160
+ # }
161
 
162
  def __get_binary_data(self, path):
163
  with open(path, "rb") as f: