Filtered WIT, an Image-Text Dataset.
A reliable Dataset to run Image-Text models.
You can find WIT, Wikipedia Image Text Dataset, here Data was taken from dalle-mini/wit
Author
Data Structure
The data is stored as tars, containing 10,000 samples per tar.
The parquets contain the metadata of each tar, which was crated using this script
Each tar contains a .jpg
, .txt
, and .json
.
The image is stored in .jpg
, the caption in .txt.
and the metadata in .json
The preferred method to read the data is WebDataset
Here's an example:
import webdataset as wds
dataset = wds.WebDataset('data/00000.tar').to_tuple('txt', 'jpg', 'json')
for text, image, meta in dataset:
print(
text[:50],
image[:50],
meta[:50]
)
Filteration
Each sample has 8 possible captions which were compared to the image using CLIP ViT-B32
The text was encoded using multilingual CLIP text encoder
Each possible caption was compared to the encoded image using Cosine Similarity
and kept if the sim was greater than 0.26
Then the new caption was the filtered captions concatenated, and samples with no filtered caption were dropped.
The script used is filter_wit.py