VictorSanh HF staff commited on
Commit
ce6310c
1 Parent(s): 031f9b0

vatex dataset

Browse files
Files changed (2) hide show
  1. dataset_infos.json +1 -0
  2. vatex.py +159 -0
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"v1.1": {"description": "VATEX is a large-scale multilingual video description dataset, which contains over 41,250 videos and 825,000 captions\nin both English and Chinese. VATEX is characterized by the following major unique properties.\nFirst, it contains both English and Chinese descriptions at scale, which can support many multilingual studies\nthat are constrained by monolingual datasets. Secondly, VATEX has a high number of clip-sentence pairs\nwith each video clip annotated with multiple unique sentences, and every caption is unique in\nthe whole corpus. Third, VATEX contains more comprehensive yet representative video content,\ncovering 600 human activities in total. Furthermore, both the English and Chinese corpora in\nVATEX are lexically richer and thus allow more natural and diverse caption generation.\n", "citation": "\n@InProceedings{Wang_2019_ICCV,\nauthor = {Wang, Xin and Wu, Jiawei and Chen, Junkun and Li, Lei and Wang, Yuan-Fang and Wang, William Yang},\ntitle = {VaTeX: A Large-Scale, High-Quality Multilingual Dataset for Video-and-Language Research},\nbooktitle = {The IEEE International Conference on Computer Vision (ICCV)},\nmonth = {October},\nyear = {2019}\n}\n", "homepage": "https://eric-xw.github.io/vatex-website/index.html", "license": "CC BY 4.0", "features": {"videoID": {"dtype": "string", "id": null, "_type": "Value"}, "start": {"dtype": "int32", "id": null, "_type": "Value"}, "end": {"dtype": "int32", "id": null, "_type": "Value"}, "enCap": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "chCap": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "vatex", "config_name": "v1.1", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 39036990, "num_examples": 25991, "dataset_name": "vatex"}, "validation": {"name": "validation", "num_bytes": 4493766, "num_examples": 3000, "dataset_name": "vatex"}, "public_test": {"name": "public_test", "num_bytes": 4802675, "num_examples": 6000, "dataset_name": "vatex"}, "private_test": {"name": "private_test", "num_bytes": 196216, "num_examples": 6278, "dataset_name": "vatex"}}, "download_checksums": {"https://eric-xw.github.io/vatex-website/data/vatex_training_v1.0.json": {"num_bytes": 57319458, "checksum": "9a3b5f08e354d9543ef4f1ab004f9db9bc4e5da49d9692f0c8c6aa3bef9751c4"}, "https://eric-xw.github.io/vatex-website/data/vatex_validation_v1.0.json": {"num_bytes": 6598992, "checksum": "838212d8eead2e22c8838cf58530b94868f1a4905b8322b639212122c8033708"}, "https://eric-xw.github.io/vatex-website/data/vatex_public_test_english_v1.1.json": {"num_bytes": 4933553, "checksum": "0252a923ab08491db62c333e5e5439c1e1272e23a2b97bac8babf766d8b7e905"}, "https://eric-xw.github.io/vatex-website/data/vatex_private_test_without_annotations.json": {"num_bytes": 263676, "checksum": "79c6917d30ac77cf50fae60465da93e9c029b6e8c7d3baee20a1910adb75ddef"}, "https://eric-xw.github.io/vatex-website/data/vatex_public_test_without_annotations.json": {"num_bytes": 252000, "checksum": "889bfdb47238dda4403f3954bd04d38640b2ee4c7e7f596332fa896102837768"}}, "download_size": 69367679, "post_processing_size": null, "dataset_size": 48529647, "size_in_bytes": 117897326}, "v1.0": {"description": "VATEX is a large-scale multilingual video description dataset, which contains over 41,250 videos and 825,000 captions\nin both English and Chinese. VATEX is characterized by the following major unique properties.\nFirst, it contains both English and Chinese descriptions at scale, which can support many multilingual studies\nthat are constrained by monolingual datasets. Secondly, VATEX has a high number of clip-sentence pairs\nwith each video clip annotated with multiple unique sentences, and every caption is unique in\nthe whole corpus. Third, VATEX contains more comprehensive yet representative video content,\ncovering 600 human activities in total. Furthermore, both the English and Chinese corpora in\nVATEX are lexically richer and thus allow more natural and diverse caption generation.\n", "citation": "\n@InProceedings{Wang_2019_ICCV,\nauthor = {Wang, Xin and Wu, Jiawei and Chen, Junkun and Li, Lei and Wang, Yuan-Fang and Wang, William Yang},\ntitle = {VaTeX: A Large-Scale, High-Quality Multilingual Dataset for Video-and-Language Research},\nbooktitle = {The IEEE International Conference on Computer Vision (ICCV)},\nmonth = {October},\nyear = {2019}\n}\n", "homepage": "https://eric-xw.github.io/vatex-website/index.html", "license": "CC BY 4.0", "features": {"videoID": {"dtype": "string", "id": null, "_type": "Value"}, "start": {"dtype": "int32", "id": null, "_type": "Value"}, "end": {"dtype": "int32", "id": null, "_type": "Value"}, "enCap": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "chCap": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "vatex", "config_name": "v1.0", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 39036990, "num_examples": 25991, "dataset_name": "vatex"}, "validation": {"name": "validation", "num_bytes": 4493766, "num_examples": 3000, "dataset_name": "vatex"}, "public_test": {"name": "public_test", "num_bytes": 187528, "num_examples": 6000, "dataset_name": "vatex"}}, "download_checksums": {"https://eric-xw.github.io/vatex-website/data/vatex_training_v1.0.json": {"num_bytes": 57319458, "checksum": "9a3b5f08e354d9543ef4f1ab004f9db9bc4e5da49d9692f0c8c6aa3bef9751c4"}, "https://eric-xw.github.io/vatex-website/data/vatex_validation_v1.0.json": {"num_bytes": 6598992, "checksum": "838212d8eead2e22c8838cf58530b94868f1a4905b8322b639212122c8033708"}, "https://eric-xw.github.io/vatex-website/data/vatex_public_test_english_v1.1.json": {"num_bytes": 4933553, "checksum": "0252a923ab08491db62c333e5e5439c1e1272e23a2b97bac8babf766d8b7e905"}, "https://eric-xw.github.io/vatex-website/data/vatex_private_test_without_annotations.json": {"num_bytes": 263676, "checksum": "79c6917d30ac77cf50fae60465da93e9c029b6e8c7d3baee20a1910adb75ddef"}, "https://eric-xw.github.io/vatex-website/data/vatex_public_test_without_annotations.json": {"num_bytes": 252000, "checksum": "889bfdb47238dda4403f3954bd04d38640b2ee4c7e7f596332fa896102837768"}}, "download_size": 69367679, "post_processing_size": null, "dataset_size": 43718284, "size_in_bytes": 113085963}}
vatex.py ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # Lint as: python3
17
+ """VATEX is a large-Scale (826K captions for 41.3K video clips), multilingual (English and Chinese) dataset for video-and-language research.
18
+ The dataset covers 600 fine-grained human activities."""
19
+
20
+ import os
21
+ import json
22
+ import datasets
23
+
24
+
25
+ _CITATION = """
26
+ @InProceedings{Wang_2019_ICCV,
27
+ author = {Wang, Xin and Wu, Jiawei and Chen, Junkun and Li, Lei and Wang, Yuan-Fang and Wang, William Yang},
28
+ title = {VaTeX: A Large-Scale, High-Quality Multilingual Dataset for Video-and-Language Research},
29
+ booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
30
+ month = {October},
31
+ year = {2019}
32
+ }
33
+ """
34
+
35
+ _DESCRIPTION = """\
36
+ VATEX is a large-scale multilingual video description dataset, which contains over 41,250 videos and 825,000 captions
37
+ in both English and Chinese. VATEX is characterized by the following major unique properties.
38
+ First, it contains both English and Chinese descriptions at scale, which can support many multilingual studies
39
+ that are constrained by monolingual datasets. Secondly, VATEX has a high number of clip-sentence pairs
40
+ with each video clip annotated with multiple unique sentences, and every caption is unique in
41
+ the whole corpus. Third, VATEX contains more comprehensive yet representative video content,
42
+ covering 600 human activities in total. Furthermore, both the English and Chinese corpora in
43
+ VATEX are lexically richer and thus allow more natural and diverse caption generation.
44
+ """
45
+
46
+ _HOMEPAGE = "https://eric-xw.github.io/vatex-website/index.html"
47
+
48
+ _LICENSE = "CC BY 4.0"
49
+
50
+ _URL_BASE = "https://eric-xw.github.io/vatex-website/data/"
51
+
52
+ _VARIANTS = [
53
+ "v1.1",
54
+ "v1.0",
55
+ ]
56
+
57
+ class Vatex(datasets.GeneratorBasedBuilder):
58
+ """Vatex"""
59
+
60
+ BUILDER_CONFIGS = [datasets.BuilderConfig(name) for name in _VARIANTS]
61
+ DEFAULT_CONFIG_NAME = "v1.1"
62
+
63
+ def _info(self):
64
+ return datasets.DatasetInfo(
65
+ description=_DESCRIPTION,
66
+ features=datasets.Features(
67
+ {
68
+ "videoID": datasets.Value("string"),
69
+ "start": datasets.Value("int32"),
70
+ "end": datasets.Value("int32"),
71
+ "enCap": datasets.features.Sequence(datasets.Value("string")),
72
+ "chCap": datasets.features.Sequence(datasets.Value("string")),
73
+ }
74
+ ),
75
+ supervised_keys=None,
76
+ homepage=_HOMEPAGE,
77
+ citation=_CITATION,
78
+ license=_LICENSE
79
+ )
80
+
81
+ def _split_generators(self, dl_manager):
82
+ urls = {
83
+ "v1.1": {
84
+ "train": os.path.join(_URL_BASE, "vatex_training_v1.0.json"),
85
+ "validation": os.path.join(_URL_BASE, "vatex_validation_v1.0.json"),
86
+ "public_test": os.path.join(_URL_BASE, "vatex_public_test_english_v1.1.json"),
87
+ "private_test": os.path.join(_URL_BASE, "vatex_private_test_without_annotations.json"),
88
+ },
89
+ "v1.0": {
90
+ "train": os.path.join(_URL_BASE, "vatex_training_v1.0.json"),
91
+ "validation": os.path.join(_URL_BASE, "vatex_validation_v1.0.json"),
92
+ "public_test": os.path.join(_URL_BASE, "vatex_public_test_without_annotations.json"),
93
+ },
94
+ }
95
+ # Download data for all splits once for all since they are tiny csv files
96
+ files_path = dl_manager.download_and_extract(urls)
97
+
98
+ splits = [
99
+ datasets.SplitGenerator(
100
+ name=datasets.Split.TRAIN,
101
+ gen_kwargs={
102
+ "filepath": files_path[self.config.name]["train"],
103
+ "split": "train",
104
+ },
105
+ ),
106
+ datasets.SplitGenerator(
107
+ name=datasets.Split.VALIDATION,
108
+ gen_kwargs={
109
+ "filepath": files_path[self.config.name]["validation"],
110
+ "split": "validation",
111
+ },
112
+ ),
113
+ datasets.SplitGenerator(
114
+ name=datasets.Split("public_test"),
115
+ gen_kwargs={
116
+ "filepath": files_path[self.config.name]["public_test"],
117
+ "split": "public_test",
118
+ },
119
+ )
120
+ ]
121
+
122
+ if self.config.name == "v1.1":
123
+ splits.append(
124
+ datasets.SplitGenerator(
125
+ name=datasets.Split("private_test"),
126
+ gen_kwargs={
127
+ "filepath": files_path[self.config.name]["private_test"],
128
+ "split": "private_test",
129
+ },
130
+ )
131
+ )
132
+ return splits
133
+
134
+ def _generate_examples(self, filepath, split):
135
+ """This function returns the examples."""
136
+ with open(filepath, encoding="utf-8") as json_file:
137
+ annotations = json.load(json_file)
138
+ for idx, instance in enumerate(annotations):
139
+ videoID = instance["videoID"]
140
+ splitted = videoID.split("_")
141
+ start, end = int(splitted[-2]), int(splitted[-1])
142
+ videoID = "_".join(splitted[:-2])
143
+
144
+ if split in ["train", "validation"]:
145
+ enCap = instance["enCap"]
146
+ chCap = instance["chCap"]
147
+ elif split == "public_test" and self.config.name == "v1.1":
148
+ enCap = instance["enCap"]
149
+ chCap = []
150
+ else:
151
+ enCap, chCap = [], []
152
+
153
+ yield idx, {
154
+ "videoID": videoID,
155
+ "start": start,
156
+ "end": end,
157
+ "enCap": enCap,
158
+ "chCap": chCap,
159
+ }