Datasets:

Modalities:
Video
Languages:
Chinese
Libraries:
Datasets
License:
AIMClab commited on
Commit
bda7b0b
·
1 Parent(s): bc57c7d

Delete ChinaOpen.py

Browse files
Files changed (1) hide show
  1. ChinaOpen.py +0 -139
ChinaOpen.py DELETED
@@ -1,139 +0,0 @@
1
-
2
- import json
3
-
4
- import datasets
5
- from datasets.tasks import QuestionAnsweringExtractive
6
-
7
-
8
- logger = datasets.logging.get_logger(__name__)
9
-
10
- _CITATION = """\
11
- @inproceedings{10.1145/3581783.3612156,
12
- author = {Chen, Aozhu and Wang, Ziyuan and Dong, Chengbo and Tian, Kaibin and Zhao, Ruixiang and Liang, Xun and Kang, Zhanhui and Li, Xirong},
13
- title = {ChinaOpen: A Dataset for Open-World Multimodal Learning},
14
- year = {2023},
15
- isbn = {9798400701085},
16
- publisher = {Association for Computing Machinery},
17
- address = {New York, NY, USA},
18
- url = {https://doi.org/10.1145/3581783.3612156},
19
- doi = {10.1145/3581783.3612156},
20
- booktitle = {Proceedings of the 31st ACM International Conference on Multimedia},
21
- pages = {6432–6440},
22
- numpages = {9},
23
- keywords = {chinese video dataset, multi-task evaluation, multimodal learning},
24
- location = {Ottawa ON, Canada},
25
- series = {MM '23}
26
- }
27
- """
28
-
29
-
30
-
31
- _DESCRIPTION = """\
32
- ChinaOpen is a dataset sourced from Bilibili, a popular Chinese video-sharing website, \
33
- for open-world multimodal learning. While the state-of-the-art multimodal learning \
34
- networks have shown impressive performance in automated video annotation and \
35
- cross-modal video retrieval, their training and evaluation are primarily conducted on \
36
- YouTube videos with English text. Their effectiveness on Chinese data remains to be \
37
- verified. For a multi-faceted evaluation, we build ChinaOpen-1k, a manually labeled \
38
- test set of 1k videos. Each test video is accompanied with a manually checked user \
39
- title and a manually written caption. Besides, each video is manually tagged to describe \
40
- objects / actions / scenes shown in the visual content. The original user tags are also \
41
- manually checked. Moreover, with all the Chinese text translated into English, \
42
- ChinaOpen-1k is also suited for evaluating models trained on English data. \
43
-
44
- """
45
-
46
-
47
-
48
- #_URL = "./ChinaOpen-1k.zip"
49
- _URLS = {
50
- "train": "https://huggingface.co/datasets/AIMClab/ChinaOpen/resolve/main/ChinaOpen-1k.zip"
51
- }
52
-
53
-
54
-
55
- class ChinaOpenConfig(datasets.BuilderConfig):
56
- """BuilderConfig for SQUAD."""
57
-
58
- def __init__(self, **kwargs):
59
- """BuilderConfig for SQUAD.
60
- Args:
61
- **kwargs: keyword arguments forwarded to super.
62
- """
63
- super(ChinaOpenConfig, self).__init__(**kwargs)
64
-
65
-
66
- class ChinaOpen(datasets.GeneratorBasedBuilder):
67
- """SQUAD: The Stanford Question Answering Dataset. Version 1.1."""
68
-
69
- BUILDER_CONFIGS = [
70
- ChinaOpenConfig(
71
- name="plain_text",
72
- version=datasets.Version("1.0.0", ""),
73
- description="Plain text",
74
- ),
75
- ]
76
-
77
- def _info(self):
78
- return datasets.DatasetInfo(
79
- description=_DESCRIPTION,
80
- features=datasets.Features(
81
- {
82
- "id": datasets.Value("string"),
83
- "title": datasets.Value("string"),
84
- "context": datasets.Value("string"),
85
- "question": datasets.Value("string"),
86
- "answers": datasets.features.Sequence(
87
- {
88
- "text": datasets.Value("string"),
89
- "answer_start": datasets.Value("int32"),
90
- }
91
- ),
92
- }
93
- ),
94
- # No default supervised_keys (as we have to pass both question
95
- # and context as input).
96
- supervised_keys=None,
97
- citation=_CITATION,
98
- task_templates=[
99
- QuestionAnsweringExtractive(
100
- question_column="question", context_column="context", answers_column="answers"
101
- )
102
- ],
103
- )
104
-
105
- def _split_generators(self, dl_manager):
106
- downloaded_files = dl_manager.download_and_extract(_URLS)
107
-
108
- return [
109
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
110
- #datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
111
- ]
112
- '''
113
- def _generate_examples(self, filepath):
114
- """This function returns the examples in the raw (text) form."""
115
- logger.info("generating examples from = %s", filepath)
116
- key = 0
117
- with open(filepath, encoding="utf-8") as f:
118
- squad = json.load(f)
119
- for article in squad["data"]:
120
- title = article.get("title", "")
121
- for paragraph in article["paragraphs"]:
122
- context = paragraph["context"] # do not strip leading blank spaces GH-2585
123
- for qa in paragraph["qas"]:
124
- answer_starts = [answer["answer_start"] for answer in qa["answers"]]
125
- answers = [answer["text"] for answer in qa["answers"]]
126
- # Features currently used are "context", "question", and "answers".
127
- # Others are extracted here for the ease of future expansions.
128
- yield key, {
129
- "title": title,
130
- "context": context,
131
- "question": qa["question"],
132
- "id": qa["id"],
133
- "answers": {
134
- "answer_start": answer_starts,
135
- "text": answers,
136
- },
137
- }
138
- key += 1
139
- '''