Datasets:
Formats:
parquet
Sub-tasks:
image-captioning
Size:
100K - 1M
ArXiv:
Tags:
text-image-retrieval
License:
mariosasko
commited on
Commit
•
8fe29d7
1
Parent(s):
12a3ee3
Add card and scripts
Browse files- README.md +363 -0
- scripts/corrected_examples.py +0 -0
- scripts/wit.py +141 -0
README.md
ADDED
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- machine-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- af
|
8 |
+
- an
|
9 |
+
- ar
|
10 |
+
- arz
|
11 |
+
- ast
|
12 |
+
- az
|
13 |
+
- azb
|
14 |
+
- ba
|
15 |
+
- bar
|
16 |
+
- be
|
17 |
+
- be-tarask
|
18 |
+
- bg
|
19 |
+
- bn
|
20 |
+
- br
|
21 |
+
- bs
|
22 |
+
- ca
|
23 |
+
- ce
|
24 |
+
- ceb
|
25 |
+
- ckb
|
26 |
+
- cs
|
27 |
+
- cv
|
28 |
+
- cy
|
29 |
+
- da
|
30 |
+
- de
|
31 |
+
- el
|
32 |
+
- en
|
33 |
+
- eo
|
34 |
+
- es
|
35 |
+
- et
|
36 |
+
- eu
|
37 |
+
- fa
|
38 |
+
- fi
|
39 |
+
- fil
|
40 |
+
- fr
|
41 |
+
- fy
|
42 |
+
- ga
|
43 |
+
- gl
|
44 |
+
- hi
|
45 |
+
- hr
|
46 |
+
- hsb
|
47 |
+
- ht
|
48 |
+
- hu
|
49 |
+
- hy
|
50 |
+
- ia
|
51 |
+
- id
|
52 |
+
- io
|
53 |
+
- is
|
54 |
+
- it
|
55 |
+
- iw
|
56 |
+
- ja
|
57 |
+
- jv
|
58 |
+
- ka
|
59 |
+
- kk
|
60 |
+
- kn
|
61 |
+
- ko
|
62 |
+
- la
|
63 |
+
- lah
|
64 |
+
- lb
|
65 |
+
- lmo
|
66 |
+
- lt
|
67 |
+
- lv
|
68 |
+
- mg
|
69 |
+
- mk
|
70 |
+
- ml
|
71 |
+
- mn
|
72 |
+
- mr
|
73 |
+
- ms
|
74 |
+
- my
|
75 |
+
- nan
|
76 |
+
- nds
|
77 |
+
- ne
|
78 |
+
- nl
|
79 |
+
- nn
|
80 |
+
- 'no'
|
81 |
+
- nv
|
82 |
+
- oc
|
83 |
+
- pa
|
84 |
+
- pl
|
85 |
+
- pt
|
86 |
+
- qu
|
87 |
+
- ro
|
88 |
+
- ru
|
89 |
+
- sco
|
90 |
+
- si
|
91 |
+
- sk
|
92 |
+
- sl
|
93 |
+
- sq
|
94 |
+
- sr
|
95 |
+
- sr-Latn
|
96 |
+
- sv
|
97 |
+
- sw
|
98 |
+
- ta
|
99 |
+
- te
|
100 |
+
- tg
|
101 |
+
- th
|
102 |
+
- tr
|
103 |
+
- tt
|
104 |
+
- uk
|
105 |
+
- ur
|
106 |
+
- uz
|
107 |
+
- vec
|
108 |
+
- vi
|
109 |
+
- vo
|
110 |
+
- war
|
111 |
+
- xmf
|
112 |
+
- yue
|
113 |
+
- zh
|
114 |
+
- zh-TW
|
115 |
+
licenses:
|
116 |
+
- cc-by-sa-4.0
|
117 |
+
multilinguality:
|
118 |
+
- multilingual
|
119 |
+
paperswithcode_id: wit
|
120 |
+
pretty_name: Wikipedia-based Image Text
|
121 |
+
size_categories:
|
122 |
+
- 1M<n<10M
|
123 |
+
source_datasets:
|
124 |
+
- original
|
125 |
+
- extended|wikipedia
|
126 |
+
task_categories:
|
127 |
+
- text-retrieval
|
128 |
+
- image-to-text
|
129 |
+
task_ids:
|
130 |
+
- text-retrieval-other-text-image-retrieval
|
131 |
+
- image-captioning
|
132 |
+
---
|
133 |
+
|
134 |
+
# Dataset Card for WIT
|
135 |
+
|
136 |
+
## Table of Contents
|
137 |
+
- [Table of Contents](#table-of-contents)
|
138 |
+
- [Dataset Description](#dataset-description)
|
139 |
+
- [Dataset Summary](#dataset-summary)
|
140 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
141 |
+
- [Languages](#languages)
|
142 |
+
- [Dataset Structure](#dataset-structure)
|
143 |
+
- [Data Instances](#data-instances)
|
144 |
+
- [Data Fields](#data-fields)
|
145 |
+
- [Data Splits](#data-splits)
|
146 |
+
- [Dataset Creation](#dataset-creation)
|
147 |
+
- [Curation Rationale](#curation-rationale)
|
148 |
+
- [Source Data](#source-data)
|
149 |
+
- [Annotations](#annotations)
|
150 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
151 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
152 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
153 |
+
- [Discussion of Biases](#discussion-of-biases)
|
154 |
+
- [Other Known Limitations](#other-known-limitations)
|
155 |
+
- [Additional Information](#additional-information)
|
156 |
+
- [Dataset Curators](#dataset-curators)
|
157 |
+
- [Licensing Information](#licensing-information)
|
158 |
+
- [Citation Information](#citation-information)
|
159 |
+
- [Contributions](#contributions)
|
160 |
+
|
161 |
+
## Dataset Description
|
162 |
+
|
163 |
+
- **Homepage:** [WIT homepage](https://github.com/google-research-datasets/wit)
|
164 |
+
- **Paper:** [WIT: Wikipedia-based Image Text Dataset for Multimodal Multilingual Machine Learning
|
165 |
+
](https://arxiv.org/abs/2103.01913)
|
166 |
+
- **Leaderboard:** [WIT leaderboard](https://paperswithcode.com/sota/text-image-retrieval-on-wit) and [WIT Kaggle competition](https://www.kaggle.com/competitions/wikipedia-image-caption/leaderboard)
|
167 |
+
- **Point of Contact:** [Miriam Redi](mailto:miriam@wikimedia.org)
|
168 |
+
|
169 |
+
### Dataset Summary
|
170 |
+
|
171 |
+
Wikimedia's version of the Wikipedia-based Image Text (WIT) Dataset, a large multimodal multilingual dataset.
|
172 |
+
|
173 |
+
From the [official blog post](https://techblog.wikimedia.org/2021/09/09/the-wikipedia-image-caption-matching-challenge-and-a-huge-release-of-image-data-for-research/):
|
174 |
+
|
175 |
+
> The core training data is taken from the Wikipedia Image-Text (WIT) Dataset, a large curated set of more than 37 million image-text associations extracted from Wikipedia articles in 108 languages that was recently released by Google Research.
|
176 |
+
>
|
177 |
+
> The WIT dataset offers extremely valuable data about the pieces of text associated with Wikipedia images. However, due to licensing and data volume issues, the Google dataset only provides the image name and corresponding URL for download and not the raw image files.
|
178 |
+
>
|
179 |
+
> Getting easy access to the image files is crucial for participants to successfully develop competitive models. Therefore, today, the Wikimedia Research team is releasing its first large image dataset. It contains more than six million image files from Wikipedia articles in 100+ languages, which correspond to almost [1] all captioned images in the WIT dataset. Image files are provided at a 300-px resolution, a size that is suitable for most of the learning frameworks used to classify and analyze images.
|
180 |
+
|
181 |
+
> [1] We are publishing all images having a non-null “reference description” in the WIT dataset. For privacy reasons, we are not publishing images where a person is the primary subject, i.e., where a person’s face covers more than 10% of the image surface. To identify faces and their bounding boxes, we use the RetinaFace detector. In addition, to avoid the inclusion of inappropriate images or images that violate copyright constraints, we have removed all images that are candidate for deletion on Commons from the dataset.
|
182 |
+
|
183 |
+
**Note**: Compared to [Google's version](https://huggingface.co/datasets/google/wit), which has contents of one Wikipedia page per data sample, this version groups contents of all Wikipedia pages available in different languages for the image in one single data sample to avoid duplication of image bytes.
|
184 |
+
|
185 |
+
### Supported Tasks and Leaderboards
|
186 |
+
|
187 |
+
- `image-captioning`: This dataset can be used to train a model for image captioning where the goal is to predict a caption given the image.
|
188 |
+
|
189 |
+
- `text-retrieval`: The goal in this task is to build a model that retrieves the text (`caption_title_and_reference_description`) closest to an image. The leaderboard for this task can be found [here](https://paperswithcode.com/sota/text-image-retrieval-on-wit). This task also has a competition on [Kaggle](https://www.kaggle.com/c/wikipedia-image-caption).
|
190 |
+
|
191 |
+
In these tasks, any combination of the `caption_reference_description`, `caption_attribution_description` and `caption_alt_text_description` fields can be used as the input text/caption.
|
192 |
+
|
193 |
+
### Languages
|
194 |
+
|
195 |
+
The dataset contains examples from all Wikipedia languages.
|
196 |
+
|
197 |
+
## Dataset Structure
|
198 |
+
|
199 |
+
### Data Instances
|
200 |
+
|
201 |
+
Each instance is an image, its representation in bytes, a pre-computed embedding, and the set of captions attached to the image in Wikipedia.
|
202 |
+
|
203 |
+
```
|
204 |
+
{
|
205 |
+
'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=300x225 at 0x7F88F3876358>,
|
206 |
+
'image_url': 'https://upload.wikimedia.org/wikipedia/commons/8/8b/Scolopendra_gigantea.jpg',
|
207 |
+
'embedding': [1.4784087, 2.8710432, 0.0, 0.51603067, ..., 10.266883, 0.51142216, 0.0, 2.3464653],
|
208 |
+
'metadata_url': 'http://commons.wikimedia.org/wiki/File:Scolopendra_gigantea.jpg',
|
209 |
+
'original_height': 3000,
|
210 |
+
'original_width': 4000,
|
211 |
+
'mime_type': 'image/jpeg',
|
212 |
+
'caption_attribution_description': 'English: Puerto Rican Giant Centipede, Scolopendra gigantea; Vieques, Puerto Rico Slovenčina: Stonožka obrovská, Scolopendra gigantea; Vieques, Portoriko',
|
213 |
+
'wit_features': {
|
214 |
+
'language': ['ro', 'vi', 'sk', ..., 'nl', 'th', 'lv'],
|
215 |
+
'page_url': ['https://ro.wikipedia.org/wiki/Scolopendra_gigantea', 'https://vi.wikipedia.org/wiki/Scolopendra_gigantea', 'https://sk.wikipedia.org/wiki/Scolopendra_gigantea', ..., 'https://nl.wikipedia.org/wiki/Scolopendra_gigantea', 'https://th.wikipedia.org/wiki/%E0%B8%95%E0%B8%B0%E0%B8%82%E0%B8%B2%E0%B8%9A%E0%B8%A2%E0%B8%B1%E0%B8%81%E0%B8%A9%E0%B9%8C%E0%B8%82%E0%B8%B2%E0%B9%80%E0%B8%AB%E0%B8%A5%E0%B8%B7%E0%B8%AD%E0%B8%87%E0%B9%80%E0%B8%9B%E0%B8%A3%E0%B8%B9', 'https://lv.wikipedia.org/wiki/Skolopendru_dzimta'],
|
216 |
+
'attribution_passes_lang_id': [True, True, True, ..., True, True, True],
|
217 |
+
'caption_alt_text_description': [None, None, None, ..., 'Scolopendra gigantea', None, 'Milzu skolopendra (Scolopendra gigantea)'],
|
218 |
+
'caption_reference_description': [None, None, None, ..., None, None, 'Milzu skolopendra (Scolopendra gigantea)'],
|
219 |
+
'caption_title_and_reference_description': [None, 'Scolopendra gigantea [SEP] ', None, ..., 'Scolopendra gigantea [SEP] ', None, 'Skolopendru dzimta [SEP] Milzu skolopendra (Scolopendra gigantea)'],
|
220 |
+
'context_page_description': ['Scolopendra gigantea este un miriapod din clasa Chilopoda, fiind cel mai mare reprezentant al genului Scolopendra. Adultul poate atinge o lungime de 26 cm, uneori depășind 30 cm. Această specie habitează în regiunile de nord și de vest a Americii de Sud, pe insulele Trinidad, insulele Virgine, Jamaica Hispaniola ș.a. Localnicii denumesc scolopendra chilopodul gigant galben și chilopodul gigant amazonian.', 'Scolopendra gigantea là đại diện lớn nhất của chi Scolopendra nói riêng và cả lớp rết nói chung, thường đạt độ dài 26 cm và có thể vượt quá 30 cm. Sinh sống ở khu vực phía bắc và tây của Nam Mỹ và các đảo Trinidad, Puerto Rico, Saint Thomas, U.S. Virgin Islands, Jamaica, và Hispaniola.', 'Scolopendra gigantea, starší slovenský nazov: štípavica veľká, je živočích z rodu Scolopendra, s veľkosťou do 30 cm.', ..., 'Scolopendra gigantea is een tijgerduizendpoot uit Zuid-Amerika. De soort jaagt onder andere op grote geleedpotigen, amfibieën, reptielen en kleine zoogdieren. Het is voor zover bekend de grootste niet uitgestorven duizendpoot ter wereld.', 'ตะขาบยักษ์ขาเหลืองเปรู หรือ ตะขาบยักษ์อเมซอน เป็นตะขาบชนิดที่มีขนาดใหญ่ที่สุดในสกุล Scolopendra โดยปกติเมื่อโตเต็มที่จะยาว 26 เซนติเมตร แต่บางครั้งก็สามารถโตได้ถึง 30 เซนติเมตร ตะขาบชนิดนี้อาศัยอยู่ทางแถบเหนือและตะวันตกของทวีปอเมริกาใต้ และตามเกาะแก่งของประเทศตรินิแดดและจาไมกา เป็นสัตว์กินเนื้อ โดยกินจิ้งจก, กบ, นก, หนู และแม้แต่ค้างคาวเป็นอาหาร และขึ้นชื่อในเรื่องความดุร้าย', 'Skolpendru dzimta pieder pie simtkāju kārtas. Ap 400 dzimtas sugas sastopamas visā pasaulē, īpaši subtropu un tropu apgabalos. Mitinās augsnē, nobirušās lapās, plaisās, spraugās.'],
|
221 |
+
'context_section_description': [None, 'Scolopendra gigantea (còn được gọi là Rết chân vàng khổng lồ Peru và Rết khổng lồ Amazon) là đại diện lớn nhất của chi Scolopendra nói riêng và cả lớp rết nói chung, thường đạt độ dài 26\xa0cm (10\xa0in) và có thể vượt quá 30\xa0cm (12\xa0in). Sinh sống ở khu vực phía bắc và tây của Nam Mỹ và các đảo Trinidad, Puerto Rico, Saint Thomas, U.S. Virgin Islands, Jamaica, và Hispaniola.', None, ..., 'Scolopendra gigantea is een tijgerduizendpoot uit Zuid-Amerika. De soort jaagt onder andere op grote geleedpotigen, amfibieën, reptielen en kleine zoogdieren. Het is voor zover bekend de grootste niet uitgestorven duizendpoot ter wereld.', None, 'Skolpendru dzimta (Scolopendridae) pieder pie simtkāju kārtas. Ap 400 dzimtas sugas sastopamas visā pasaulē, īpaši subtropu un tropu apgabalos. Mitinās augsnē, nobirušās lapās, plaisās, spraugās.'],
|
222 |
+
'hierarchical_section_title': ['Scolopendra gigantea', 'Scolopendra gigantea', 'Scolopendra gigantea', ..., 'Scolopendra gigantea', 'ตะขาบยักษ์ขาเหลืองเปรู', 'Skolopendru dzimta'],
|
223 |
+
'is_main_image': [True, True, True, ..., True, True, True],
|
224 |
+
'page_title': ['Scolopendra gigantea', 'Scolopendra gigantea', 'Scolopendra gigantea', ..., 'Scolopendra gigantea', 'ตะขาบยักษ์ขาเหลืองเปรู', 'Skolopendru dzimta'],
|
225 |
+
'section_title': [None, None, None, ..., None, None, None]
|
226 |
+
}
|
227 |
+
}
|
228 |
+
```
|
229 |
+
|
230 |
+
**Note**: The data is stored in Parquet for better performance. The dataset, which was later converted to Parquet, was generated from the original files using [this script](./scripts/wit.py). Additionally, 120 examples from the original files have incorrectly formatted one or more of the following fields: `original_height`, `original_width`, `mime_type` and `caption_attribution_description`. The fixed versions of these examples that were used in the generation script can be found in [this script](./scripts/corrected_examples.py)
|
231 |
+
|
232 |
+
### Data Fields
|
233 |
+
|
234 |
+
- `image`: A `PIL.Image.Image` object containing the image resized to a width of 300-px while preserving its aspect ratio. Note that when accessing the image column: `dataset[0]["image"]` the image file is automatically decoded. Decoding of a large number of image files might take a significant amount of time. Thus it is important to first query the sample index before the `"image"` column, *i.e.* `dataset[0]["image"]` should **always** be preferred over `dataset["image"][0]`.
|
235 |
+
- `image_url`: URL to wikipedia image
|
236 |
+
- `embedding`: Precomputed image embedding. Each image is described with a 2048-dimensional signature extracted from the second-to-last layer of a [ResNet-50](https://arxiv.org/abs/1512.03385) neural network trained with [Imagenet](https://www.image-net.org/) data. These embeddings contain rich information about the image content and layout, in a compact form
|
237 |
+
- `metadata_url`: URL to wikimedia page containing the image and the metadata
|
238 |
+
- `original_height`: Original image height before resizing
|
239 |
+
- `original_width`: Original image width before resizing
|
240 |
+
- `mime_type`: Mime type associated to the image
|
241 |
+
- `caption_attribution_description`: This is the text found on the Wikimedia page of the image. This text is common to all occurrences of that image across all Wikipedias.
|
242 |
+
- `wit_features`: Sequence of captions for the image with language, page URL, information about the page, caption text, etc.
|
243 |
+
- `language`: Language code depicting wikipedia language of the page
|
244 |
+
- `page_url`: URL to wikipedia page
|
245 |
+
- `attribution_passes_lang_id`: Compared `language` field with the attribution language (written in the prefix of the attribution description.
|
246 |
+
- `caption_alt_text_description`: This is the “alt” text associated with the image. While not visible in general, it is commonly used for accessibility / screen readers
|
247 |
+
- `caption_reference_description`: This is the caption that is visible on the wikipedia page directly below the image.
|
248 |
+
- `caption_title_and_reference_description`: Concatenation of `page_title` and `caption_reference_description`.
|
249 |
+
- `context_page_description`: Corresponds to the short description of the page. It provides a concise explanation of the scope of the page.
|
250 |
+
- `context_section_description`: Text within the image's section
|
251 |
+
- `hierarchical_section_title`: Hierarchical section's title
|
252 |
+
- `is_main_image`: Flag determining if the image is the first image of the page. Usually displayed on the top-right part of the page when using web browsers.
|
253 |
+
- `page_changed_recently`: [More Information Needed]
|
254 |
+
- `page_title`: Wikipedia page's title
|
255 |
+
- `section_title`: Section's title
|
256 |
+
|
257 |
+
<p align='center'>
|
258 |
+
<img width='75%' src='https://production-media.paperswithcode.com/datasets/Screenshot_2021-03-04_at_14.26.02.png' alt="Half Dome" /> </br>
|
259 |
+
<b>Figure: WIT annotation example. </b>
|
260 |
+
</p>
|
261 |
+
|
262 |
+
Details on the field content can be found directly in the [paper, figure 5 and table 12.](https://arxiv.org/abs/2103.01913)
|
263 |
+
|
264 |
+
### Data Splits
|
265 |
+
|
266 |
+
All data is held in `train` split, with a total of 6477255 examples.
|
267 |
+
|
268 |
+
## Dataset Creation
|
269 |
+
|
270 |
+
### Curation Rationale
|
271 |
+
|
272 |
+
From the [official blog post](https://techblog.wikimedia.org/2021/09/09/the-wikipedia-image-caption-matching-challenge-and-a-huge-release-of-image-data-for-research/):
|
273 |
+
|
274 |
+
> The WIT dataset offers extremely valuable data about the pieces of text associated with Wikipedia images.
|
275 |
+
|
276 |
+
> Getting easy access to the image files is crucial for participants to successfully develop competitive models.
|
277 |
+
|
278 |
+
> With this large release of visual data, we aim to help the competition participants—as well as researchers and practitioners who are interested in working with Wikipedia images—find and download the large number of image files associated with the challenge, in a compact form.
|
279 |
+
|
280 |
+
### Source Data
|
281 |
+
|
282 |
+
#### Initial Data Collection and Normalization
|
283 |
+
|
284 |
+
From the [paper, section 3.1](https://arxiv.org/abs/2103.01913):
|
285 |
+
|
286 |
+
> We started with all Wikipedia content pages (i.e., ignoring other
|
287 |
+
pages that have discussions, comments and such). These number about ~124M pages across 279 languages.
|
288 |
+
|
289 |
+
#### Who are the source language producers?
|
290 |
+
|
291 |
+
Text was extracted from Wikipedia.
|
292 |
+
|
293 |
+
### Annotations
|
294 |
+
|
295 |
+
#### Annotation process
|
296 |
+
|
297 |
+
WIT was constructed using an automatic process. However it was human-validated.
|
298 |
+
|
299 |
+
From the [paper, section 3.7](https://arxiv.org/abs/2103.01913):
|
300 |
+
|
301 |
+
> To further verify the quality of the WIT dataset we performed a
|
302 |
+
study using (crowd-sourced) human annotators. As seen in Fig. 3,
|
303 |
+
we asked raters to answer 3 questions. Given an image and the page
|
304 |
+
title, raters first evaluate the quality of the attribution description
|
305 |
+
and reference description in the first two questions (order randomized). The third question understands the contextual quality of these
|
306 |
+
text descriptions given the page description and caption. Each response is on a 3-point scale: "Yes" if the text perfectly describes
|
307 |
+
the image, "Maybe" if it is sufficiently explanatory and "No" if it is
|
308 |
+
irrelevant or the image is inappropriate.
|
309 |
+
|
310 |
+
#### Who are the annotators?
|
311 |
+
|
312 |
+
[More Information Needed]
|
313 |
+
|
314 |
+
### Personal and Sensitive Information
|
315 |
+
|
316 |
+
From the [official blog post](https://techblog.wikimedia.org/2021/09/09/the-wikipedia-image-caption-matching-challenge-and-a-huge-release-of-image-data-for-research/#FN1):
|
317 |
+
|
318 |
+
> For privacy reasons, we are not publishing images where a person is the primary subject, i.e., where a person’s face covers more than 10% of the image surface. To identify faces and their bounding boxes, we use the [RetinaFace](https://arxiv.org/abs/1905.00641) detector. In addition, to avoid the inclusion of inappropriate images or images that violate copyright constraints, we have removed all images that are [candidate for deletion](https://commons.wikimedia.org/wiki/Commons:Deletion_requests) on Commons from the dataset.
|
319 |
+
|
320 |
+
## Considerations for Using the Data
|
321 |
+
|
322 |
+
### Social Impact of Dataset
|
323 |
+
|
324 |
+
[More Information Needed]
|
325 |
+
|
326 |
+
### Discussion of Biases
|
327 |
+
|
328 |
+
From the [paper, section 3.4](https://arxiv.org/abs/2103.01913):
|
329 |
+
|
330 |
+
> Lastly we found that certain image-text pairs occurred very
|
331 |
+
frequently. These were often generic images that did not have
|
332 |
+
much to do with the main article page. Common examples
|
333 |
+
included flags, logos, maps, insignia and such. To prevent
|
334 |
+
biasing the data, we heavily under-sampled all such images
|
335 |
+
|
336 |
+
### Other Known Limitations
|
337 |
+
|
338 |
+
[More Information Needed]
|
339 |
+
|
340 |
+
## Additional Information
|
341 |
+
|
342 |
+
### Dataset Curators
|
343 |
+
|
344 |
+
Miriam Redi, Fabian Kaelin and Tiziano Piccardi.
|
345 |
+
|
346 |
+
### Licensing Information
|
347 |
+
|
348 |
+
[CC BY-SA 4.0 international license](https://creativecommons.org/licenses/by-sa/4.0/)
|
349 |
+
|
350 |
+
### Citation Information
|
351 |
+
|
352 |
+
```bibtex
|
353 |
+
@article{srinivasan2021wit,
|
354 |
+
title={WIT: Wikipedia-based Image Text Dataset for Multimodal Multilingual Machine Learning},
|
355 |
+
author={Srinivasan, Krishna and Raman, Karthik and Chen, Jiecao and Bendersky, Michael and Najork, Marc},
|
356 |
+
journal={arXiv preprint arXiv:2103.01913},
|
357 |
+
year={2021}
|
358 |
+
}
|
359 |
+
```
|
360 |
+
|
361 |
+
### Contributions
|
362 |
+
|
363 |
+
Thanks to [@nateraw](https://github.com/nateraw), [yjernite](https://github.com/yjernite) and [mariosasko](https://github.com/mariosasko) for adding this dataset.
|
scripts/corrected_examples.py
ADDED
The diff for this file is too large to render.
See raw diff
|
|
scripts/wit.py
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 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 |
+
""""WIT (Wikipedia-based Image Text Dataset) dataset (Wikimedia version)."""
|
16 |
+
|
17 |
+
import base64
|
18 |
+
import gzip
|
19 |
+
import json
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
|
23 |
+
from .corrected_examples import CORRECTED_EXAMPLES
|
24 |
+
|
25 |
+
|
26 |
+
_CITATION = """\
|
27 |
+
@article{srinivasan2021wit,
|
28 |
+
title={WIT: Wikipedia-based Image Text Dataset for Multimodal Multilingual Machine Learning},
|
29 |
+
author={Srinivasan, Krishna and Raman, Karthik and Chen, Jiecao and Bendersky, Michael and Najork, Marc},
|
30 |
+
journal={arXiv preprint arXiv:2103.01913},
|
31 |
+
year={2021}
|
32 |
+
}
|
33 |
+
"""
|
34 |
+
|
35 |
+
_DESCRIPTION = """\
|
36 |
+
Wikipedia-based Image Text (WIT) Dataset is a large multimodal multilingual dataset.
|
37 |
+
It contains more than six million images from Wikipedia articles in 100+ languages, which correspond to almost all captioned images in Google's version of the WIT dataset.
|
38 |
+
Images are provided at a 300-px resolution, a size that is suitable for most of the learning frameworks used to classify and analyze images.
|
39 |
+
This version of the WIT dataset was released by Wikimedia Research team.
|
40 |
+
"""
|
41 |
+
|
42 |
+
_LICENSE = "CC BY-SA 4.0 international license"
|
43 |
+
|
44 |
+
_HOMEPAGE = "https://techblog.wikimedia.org/2021/09/09/the-wikipedia-image-caption-matching-challenge-and-a-huge-release-of-image-data-for-research/"
|
45 |
+
|
46 |
+
_BASE_URL = "https://storage.googleapis.com/huggingface-nlp/datasets/wit/"
|
47 |
+
|
48 |
+
_URLS = [_BASE_URL + f"part-{'%05d' % i}-48a6f07e-bb86-4735-aac7-883349f41a28-c000.json.gz" for i in range(400)]
|
49 |
+
|
50 |
+
|
51 |
+
class Wit(datasets.GeneratorBasedBuilder):
|
52 |
+
"""Builder for WIT dataset (Wikimedia version)."""
|
53 |
+
|
54 |
+
DEFAULT_WRITER_BATCH_SIZE = 1000
|
55 |
+
|
56 |
+
def _info(self):
|
57 |
+
return datasets.DatasetInfo(
|
58 |
+
description=_DESCRIPTION,
|
59 |
+
features=datasets.Features(
|
60 |
+
{
|
61 |
+
"image": datasets.Image(),
|
62 |
+
"image_url": datasets.Value("string"),
|
63 |
+
"embedding": datasets.Sequence(datasets.Value("float64"), length=2048),
|
64 |
+
"metadata_url": datasets.Value("string"),
|
65 |
+
"original_height": datasets.Value("int32"),
|
66 |
+
"original_width": datasets.Value("int32"),
|
67 |
+
"mime_type": datasets.Value("string"),
|
68 |
+
"caption_attribution_description": datasets.Value("string"),
|
69 |
+
"wit_features": datasets.Sequence(
|
70 |
+
{
|
71 |
+
"language": datasets.Value("string"),
|
72 |
+
"page_url": datasets.Value("string"),
|
73 |
+
"attribution_passes_lang_id": datasets.Value("bool"),
|
74 |
+
"caption_alt_text_description": datasets.Value("string"),
|
75 |
+
"caption_reference_description": datasets.Value("string"),
|
76 |
+
"caption_title_and_reference_description": datasets.Value("string"),
|
77 |
+
"context_page_description": datasets.Value("string"),
|
78 |
+
"context_section_description": datasets.Value("string"),
|
79 |
+
"hierarchical_section_title": datasets.Value("string"),
|
80 |
+
"is_main_image": datasets.Value("bool"),
|
81 |
+
"page_changed_recently": datasets.Value("bool"),
|
82 |
+
"page_title": datasets.Value("string"),
|
83 |
+
"section_title": datasets.Value("string"),
|
84 |
+
}
|
85 |
+
),
|
86 |
+
}
|
87 |
+
),
|
88 |
+
homepage=_HOMEPAGE,
|
89 |
+
license=_LICENSE,
|
90 |
+
citation=_CITATION,
|
91 |
+
)
|
92 |
+
|
93 |
+
def _split_generators(self, dl_manager):
|
94 |
+
"""Returns SplitGenerators."""
|
95 |
+
downloaded_files = dl_manager.download(_URLS)
|
96 |
+
return [
|
97 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"data_files": downloaded_files}),
|
98 |
+
]
|
99 |
+
|
100 |
+
def _generate_examples(self, data_files):
|
101 |
+
"""Yields examples."""
|
102 |
+
wit_feature_names = self.info.features["wit_features"].feature.keys()
|
103 |
+
idx = 0
|
104 |
+
for data_file_idx, data_file in enumerate(data_files):
|
105 |
+
with gzip.open(open(data_file, "rb"), mode="rt", encoding="utf-8") as f:
|
106 |
+
for row_idx, row in enumerate(f):
|
107 |
+
example = json.loads(row)
|
108 |
+
ex_wit_features_non_empty = []
|
109 |
+
for feature in example["wit_features"]:
|
110 |
+
# If a feature is missing from feature dict, add it as None
|
111 |
+
for wit_feature_name in wit_feature_names:
|
112 |
+
if wit_feature_name not in feature:
|
113 |
+
feature[wit_feature_name] = None
|
114 |
+
# Here we take redundant values from wit_features and add them to example to avoid unnecessary duplication
|
115 |
+
extra_wit_feature_keys = [k for k in feature.keys() if k not in wit_feature_names]
|
116 |
+
for extra_wit_feature_key in extra_wit_feature_keys:
|
117 |
+
extra_wit_feature_value = feature.pop(extra_wit_feature_key)
|
118 |
+
if isinstance(extra_wit_feature_value, list):
|
119 |
+
extra_wit_feature_value = extra_wit_feature_value[0]
|
120 |
+
example[extra_wit_feature_key] = extra_wit_feature_value
|
121 |
+
# Remove empty wit features
|
122 |
+
if any(v is not None for v in feature.values()):
|
123 |
+
ex_wit_features_non_empty.append(feature)
|
124 |
+
example["wit_features"] = ex_wit_features_non_empty
|
125 |
+
# Check example now for missing keys, adding None to avoid failures
|
126 |
+
missing_keys = [k for k in self.info.features.keys() if k not in example]
|
127 |
+
for missing_key in missing_keys:
|
128 |
+
example[missing_key] = None
|
129 |
+
# Decode base64 encoded image bytes
|
130 |
+
b64_image_bytes = example.pop("b64_bytes")
|
131 |
+
example["image"] = (
|
132 |
+
{"path": None, "bytes": base64.b64decode(b64_image_bytes)}
|
133 |
+
if b64_image_bytes is not None
|
134 |
+
else None
|
135 |
+
)
|
136 |
+
corrections = CORRECTED_EXAMPLES.get((data_file_idx, row_idx))
|
137 |
+
if corrections is not None:
|
138 |
+
assert example["metadata_url"] == corrections["metadata_url"]
|
139 |
+
example.update(corrections)
|
140 |
+
yield idx, example
|
141 |
+
idx += 1
|