abumafrim commited on
Commit
e2cae6b
·
1 Parent(s): e8a389b

First commit

Browse files
Files changed (3) hide show
  1. HausaVG.py +114 -0
  2. README.md +142 -0
  3. dataset_infos.json +86 -0
HausaVG.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Hausa Visual Genome: A Dataset for Multi-Modal English to Hausa Machine Translation."""
16
+
17
+
18
+ import json
19
+ import os
20
+ from PIL import Image
21
+ import datasets
22
+
23
+ _CITATION = """\
24
+ @inproceedings{abdulmumin-etal-2022-hausa,
25
+ title = "{H}ausa Visual Genome: A Dataset for Multi-Modal {E}nglish to {H}ausa Machine Translation",
26
+ author = "Abdulmumin, Idris and Dash, Satya Ranjan and Dawud, Musa Abdullahi and Parida, Shantipriya and Muhammad, Shamsuddeen and Ahmad, Ibrahim Sa{'}id and Panda, Subhadarshi and Bojar, Ond{\v{r}}ej and Galadanci, Bashir Shehu and Bello, Bello Shehu",
27
+ booktitle = "Proceedings of the Thirteenth Language Resources and Evaluation Conference",
28
+ month = jun,
29
+ year = "2022",
30
+ address = "Marseille, France",
31
+ publisher = "European Language Resources Association",
32
+ url = "https://aclanthology.org/2022.lrec-1.694",
33
+ pages = "6471--6479"
34
+ }
35
+ """
36
+
37
+
38
+ _DESCRIPTION = """\
39
+ Multi-modal Machine Translation (MMT) enables the use of visual information to enhance the quality of translations, especially where the full context is not available to enable the unambiguous translation in standard machine translation. Despite the increasing popularity of such technique, it lacks sufficient and qualitative datasets to maximize the full extent of its potential. Hausa, a Chadic language, is a member of the Afro-Asiatic language family. It is estimated that about 100 to 150 million people speak the language, with more than 80 million indigenous speakers. This is more than any of the other Chadic languages. Despite the large number of speakers, the Hausa language is considered as a low resource language in natural language processing (NLP). This is due to the absence of enough resources to implement most of the tasks in NLP. While some datasets exist, they are either scarce, machine-generated or in the religious domain. Therefore, there is the need to create training and evaluation data for implementing machine learning tasks and bridging the research gap in the language. This work presents the Hausa Visual Genome (HaVG), a dataset that contains the description of an image or a section within the image in Hausa and its equivalent in English. The dataset was prepared by automatically translating the English description of the images in the Hindi Visual Genome (HVG). The synthetic Hausa data was then carefully postedited, taking into cognizance the respective images. The data is made of 32,923 images and their descriptions that are divided into training, development, test, and challenge test set. The Hausa Visual Genome is the first dataset of its kind and can be used for Hausa-English machine translation, multi-modal research, image description, among various other natural language processing and generation tasks.
40
+ """
41
+
42
+ _HOMEPAGE = "http://hdl.handle.net/11234/1-4749"
43
+
44
+ _LICENSE = "https://creativecommons.org/licenses/by-nc-sa/4.0/"
45
+
46
+ _URL = "https://lindat.mff.cuni.cz/repository/xmlui/bitstream/handle/11234/1-4749/hausa-visual-genome-10.zip"
47
+
48
+ _BASE_DIR = 'hausa-visual-genome-10'
49
+
50
+ class HausaVGClass(datasets.GeneratorBasedBuilder):
51
+ """HausaVG dataset"""
52
+
53
+ VERSION = datasets.Version("1.0.0")
54
+
55
+
56
+ def _info(self):
57
+ features = datasets.Features(
58
+ {
59
+ "image": datasets.Image(),
60
+ "X": datasets.Value("int16"),
61
+ "Y": datasets.Value("int16"),
62
+ "Width": datasets.Value("int16"),
63
+ "Height": datasets.Value("int16"),
64
+ "en_text": datasets.Value("string"),
65
+ "ha_text": datasets.Value("string")
66
+ }
67
+ )
68
+ return datasets.DatasetInfo(
69
+ description=_DESCRIPTION,
70
+ features=features,
71
+ homepage=_HOMEPAGE,
72
+ license=_LICENSE,
73
+ citation=_CITATION,
74
+ )
75
+
76
+ def _split_generators(self, dl_manager):
77
+ data_dir = dl_manager.download_and_extract(_URL)
78
+ return [
79
+ datasets.SplitGenerator(
80
+ name=datasets.Split.TRAIN,
81
+ gen_kwargs={
82
+ "data_f": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-train.txt"),
83
+ "data_dir": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-train.images")
84
+ },
85
+ ),
86
+ datasets.SplitGenerator(
87
+ name=datasets.Split.VALIDATION,
88
+ gen_kwargs={
89
+ "data_f": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-dev.txt"),
90
+ "data_dir": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-dev.images")
91
+ },
92
+ ),
93
+ datasets.SplitGenerator(
94
+ name=datasets.Split.TEST,
95
+ gen_kwargs={
96
+ "data_f": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-test.txt"),
97
+ "data_dir": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-test.images")
98
+ },
99
+ ),
100
+ datasets.SplitGenerator(
101
+ name='challenge_test',
102
+ gen_kwargs={
103
+ "data_f": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-challenge-test-set.txt"),
104
+ "data_dir": os.path.join(data_dir, _BASE_DIR, "hausa-visual-genome-challenge-test-set.images")
105
+ },
106
+ ),
107
+ ]
108
+
109
+ def _generate_examples(self, data_f, data_dir):
110
+ with open(data_f, encoding="utf-8") as f:
111
+ data = f.read().splitlines()
112
+ for row, item in enumerate(data):
113
+ filepath, X, Y, Width, Height, en_text, ha_text = item.split("\t")
114
+ yield row, {"image": os.path.join(data_dir, filepath + '.jpg'), "X": X, "Y": Y, "Width": Width, "Height": Height, "en_text": en_text, "ha_text": ha_text}
README.md CHANGED
@@ -1,3 +1,145 @@
1
  ---
2
  license: cc-by-sa-4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-sa-4.0
3
+ task_categories:
4
+ - translation
5
+ - image-to-text
6
+ - text-to-image
7
+ language:
8
+ - ha
9
+ pretty_name: HaVG
10
+ size_categories:
11
+ - 10K<n<100K
12
+ dataset_info:
13
+ features:
14
+ - name: image
15
+ dtype: image
16
+ - name: X
17
+ dtype: int16
18
+ - name: Y
19
+ dtype: int16
20
+ - name: Width
21
+ dtype: int16
22
+ - name: Height
23
+ dtype: int16
24
+ - name: en_text
25
+ dtype: string
26
+ - name: ha_text
27
+ dtype: string
28
+ splits:
29
+ - name: train
30
+ num_bytes: 7540844
31
+ num_examples: 28930
32
+ - name: validation
33
+ num_bytes: 258165
34
+ num_examples: 998
35
+ - name: test
36
+ num_bytes: 413850
37
+ num_examples: 1595
38
+ - name: challenge_test
39
+ num_bytes: 403770
40
+ num_examples: 1400
41
+ download_size: 4644869592
42
+ dataset_size: 8616629
43
  ---
44
+ # HaVG: Hausa Visual Genome
45
+
46
+ ## Dataset Description
47
+
48
+ - **Homepage:**
49
+ - **Repository:**
50
+ - **Paper:**
51
+ - **Leaderboard:**
52
+ - **Point of Contact:**
53
+
54
+ ### Dataset Summary
55
+
56
+ The Hausa Visual Genome (HaVG) dataset contains the description of an image or a section within the image in Hausa and its equivalent in English. The dataset was prepared by automatically translating the English description of the images in the Hindi Visual Genome (HVG). The synthetic Hausa data was then carefully post-edited, taking into cognizance the respective images. The data is made of 32,923 images and their descriptions that are divided into training, development, test, and challenge test set. The Hausa Visual Genome is the first dataset of its kind and can be used for Hausa-English machine translation, multi-modal research, image description, among various other natural language processing and generation tasks.
57
+
58
+ ### Supported Tasks
59
+
60
+ - Translation
61
+ - Image-to-Text
62
+ - Text-to-Image
63
+
64
+ ### Languages
65
+
66
+ - Hausa
67
+ - English
68
+
69
+ ## Dataset Structure
70
+
71
+ ### Data Fields
72
+
73
+ All the text files have seven columns as follows:
74
+
75
+ - Column1 - image_id
76
+ - Column2 - X
77
+ - Column3 - Y
78
+ - Column4 - Width
79
+ - Column5 - Height
80
+ - Column6 - English Text
81
+ - Column7 - Hausa Text
82
+
83
+ ### Data Splits
84
+
85
+ | Dataset | Segments | English Words | Hausa Words |
86
+ | -------- | ----- | ----- | ----- |
87
+ | Train | 28,930 | 143,106 | 140,981 |
88
+ | Dev | 998 | 4922 | 4857 |
89
+ | Test | 1595 | 7853 | 7736 |
90
+ | Challenge Test | 1400 | 8186 | 8752 |
91
+ | Total | 32,923 | 164067 | 162326 |
92
+
93
+ The word counts are approximate, prior to tokenization.
94
+
95
+ ## Dataset Creation
96
+
97
+ ### Source Data
98
+
99
+ The source data was obtained from the Hindi Visual Genome dataset, a subset of the Visual Genome data.
100
+
101
+ ### Annotation process
102
+
103
+ The translations were obtained using a web application that was developed specifically for this task.
104
+
105
+ ### Who are the annotators?
106
+
107
+ The dataset was created by professional translators at HausaNLP and Bayero University Kano.
108
+
109
+ ### Personal and Sensitive Information
110
+
111
+ The dataset do not contain any personal or sensitive information.
112
+
113
+ ## Considerations for Using the Data
114
+
115
+ ### Social Impact of Dataset
116
+
117
+ HaVG will enable the creation of more qualitative models for natural language applications in Hausa language.
118
+
119
+ ## Additional Information
120
+
121
+ ### Licensing Information
122
+
123
+ This dataset is shared under the Creative Commons [BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/4.0/) license.
124
+
125
+ ### Citation Information
126
+
127
+ If you use this dataset in your work, please cite us.
128
+
129
+ ```
130
+ @inproceedings{abdulmumin-etal-2022-hausa,
131
+ title = "{H}ausa Visual Genome: A Dataset for Multi-Modal {E}nglish to {H}ausa Machine Translation",
132
+ author = "Abdulmumin, Idris and Dash, Satya Ranjan and Dawud, Musa Abdullahi and Parida, Shantipriya and Muhammad, Shamsuddeen and Ahmad, Ibrahim Sa{'}id and Panda, Subhadarshi and Bojar, Ond{\v{r}}ej and Galadanci, Bashir Shehu and Bello, Bello Shehu",
133
+ booktitle = "Proceedings of the Thirteenth Language Resources and Evaluation Conference",
134
+ month = jun,
135
+ year = "2022",
136
+ address = "Marseille, France",
137
+ publisher = "European Language Resources Association",
138
+ url = "https://aclanthology.org/2022.lrec-1.694",
139
+ pages = "6471--6479"
140
+ }
141
+ ```
142
+
143
+ ### Contributions
144
+
145
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "default": {
3
+ "description": "Hausa Visual Genome (HaVG) is a dataset that contains the description of an image or a section within the image in Hausa and its equivalent in English. The dataset was prepared by automatically translating the English description of the images in the Hindi Visual Genome (HVG). The synthetic Hausa data was then carefully postedited, taking into cognizance the respective images. The data is made of 32,923 images and their descriptions that are divided into training, development, test, and challenge test set. The Hausa Visual Genome is the first dataset of its kind and can be used for Hausa-English machine translation, multi-modal research, image description, among various other natural language processing and generation tasks.\n",
4
+ "citation": "@inproceedings{abdulmumin-etal-2022-hausa,\ntitle={{H}ausa Visual Genome: A Dataset for Multi-Modal {E}nglish to {H}ausa Machine Translation},\nauthor={Abdulmumin, Idris and Dash, Satya Ranjan and Dawud, Musa Abdullahi and Parida, Shantipriya and Muhammad, Shamsuddeen and Ahmad, Ibrahim Sa{'}id and Panda, Subhadarshi and Bojar, Ondřej and Galadanci, Bashir Shehu and Bello, Bello Shehu},\nbooktitle={Proceedings of the Thirteenth Language Resources and Evaluation Conference},\nyear={2022},\naddress={Marseille, France},\npublisher={European Language Resources Association},\nurl={https://aclanthology.org/2022.lrec-1.694},\npages={6471--6479}}\n}\n",
5
+ "homepage": "http://hdl.handle.net/11234/1-4749",
6
+ "license": "https://creativecommons.org/licenses/by-nc-sa/4.0/",
7
+ "features": {
8
+ "image": {
9
+ "decode": true,
10
+ "id": null,
11
+ "_type": "Image"
12
+ },
13
+ "X": {
14
+ "dtype": "int32",
15
+ "id": null,
16
+ "_type": "Value"
17
+ },
18
+ "Y": {
19
+ "dtype": "int32",
20
+ "id": null,
21
+ "_type": "Value"
22
+ },
23
+ "Width": {
24
+ "dtype": "int32",
25
+ "id": null,
26
+ "_type": "Value"
27
+ },
28
+ "Height": {
29
+ "dtype": "int32",
30
+ "id": null,
31
+ "_type": "Value"
32
+ },
33
+ "en_text": {
34
+ "dtype": "string",
35
+ "id": null,
36
+ "_type": "Value"
37
+ },
38
+ "ha_text": {
39
+ "dtype": "string",
40
+ "id": null,
41
+ "_type": "Value"
42
+ }
43
+ },
44
+ "post_processed": null,
45
+ "supervised_keys": null,
46
+ "task_templates": null,
47
+ "builder_name": "HausaVG",
48
+ "config_name": "default",
49
+ "version": {
50
+ "version_str": "1.0.0",
51
+ "description": null,
52
+ "major": 1,
53
+ "minor": 1,
54
+ "patch": 0
55
+ },
56
+ "splits": {
57
+ "train": {
58
+ "name": "train",
59
+ "num_bytes": 7540844,
60
+ "num_examples": 28930,
61
+ "dataset_name": "HausaVG"
62
+ },
63
+ "validation": {
64
+ "name": "validation",
65
+ "num_bytes": 258165,
66
+ "num_examples": 998,
67
+ "dataset_name": "HausaVG"
68
+ },
69
+ "test": {
70
+ "name": "test",
71
+ "num_bytes": 413850,
72
+ "num_examples": 1595,
73
+ "dataset_name": "HausaVG"
74
+ },
75
+ "challenge_test": {
76
+ "name": "challenge_test",
77
+ "num_bytes": 403770,
78
+ "num_examples": 1400,
79
+ "dataset_name": "HausaVG"
80
+ }
81
+ },
82
+ "download_size": 4644869592,
83
+ "post_processing_size": null,
84
+ "dataset_size": 8616629
85
+ }
86
+ }