TALI / README.md
Antreas's picture
Update README.md
753b140
---
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: val
path: data/val-*
- split: test
path: data/test-*
dataset_info:
features:
- name: image
dtype: image
- name: image_url
dtype: string
- name: item_idx
dtype: int64
- name: wit_features
struct:
- name: attribution_passes_lang_id
sequence: bool
- name: caption_alt_text_description
sequence: string
- name: caption_reference_description
sequence: string
- name: caption_title_and_reference_description
sequence: string
- name: context_page_description
sequence: string
- name: context_section_description
sequence: string
- name: hierarchical_section_title
sequence: string
- name: is_main_image
sequence: bool
- name: language
sequence: string
- name: page_changed_recently
sequence: bool
- name: page_title
sequence: string
- name: page_url
sequence: string
- name: section_title
sequence: string
- name: wit_idx
dtype: int64
- name: youtube_title_text
dtype: string
- name: youtube_description_text
dtype: string
- name: youtube_video_content
dtype: binary
- name: youtube_video_starting_time
dtype: string
- name: youtube_subtitle_text
dtype: string
- name: youtube_video_size
dtype: int64
- name: youtube_video_file_path
dtype: string
splits:
- name: train
num_bytes: 1902638101655.625
num_examples: 1052915
- name: val
num_bytes: 104485442867.25
num_examples: 57958
- name: test
num_bytes: 111107332347.375
num_examples: 61389
download_size: 2058391040534
dataset_size: 2118230876870.25
license: cc-by-4.0
task_categories:
- zero-shot-classification
tags:
- video
- audio
- text
- image
- tetramodal
- multimodal
- youtube
- wikipedia
pretty_name: TALI
size_categories:
- 1M<n<10M
---
# Dataset Card for "TALI"
## Table of Contents
1. Dataset Description
1. Abstract
2. Brief Description
2. Dataset Information
1. Modalities
2. Dataset Variants
3. Dataset Statistics
4. Data Fields
5. Data Splits
3. Dataset Creation
4. Dataset Use
5. Additional Information
## Dataset Description
### Abstract
TALI is a large-scale, tetramodal dataset designed to facilitate a shift from unimodal and duomodal to tetramodal research in deep learning. It aligns text, video, images, and audio, providing a rich resource for innovative self-supervised learning tasks and multimodal research. TALI enables exploration of how different modalities and data/model scaling affect downstream performance, with the aim of inspiring diverse research ideas and enhancing understanding of model capabilities and robustness in deep learning.
### Brief Description
TALI (Temporally and semantically Aligned Audio, Language and Images) is a dataset that uses the Wikipedia Image Text (WIT) captions and article titles to search Youtube for videos that match the captions. It then downloads the video, audio, and subtitles from these videos. The result is a rich multimodal dataset that has multiple caption types related to both the WiT Images, and the Youtube videos. This enables learning to take place between either temporally or semantically aligned text, images, audio and video.
## Dataset Information
### Modalities
The TALI dataset consists of the following modalities:
1. Image:
1. Wikipedia caption image
2. Randomly sampled image from youtube video
2. Text
1. Wikipedia Caption Text
2. Wikipedia Title Text
3. Wikipedia Main Body Text
4. YouTube Subtitle Text
5. YouTube Description Text
6. YouTube Title Text
3. Audio
1. YouTube Content Audio
4. Video
1. YouTube Content Video
## Usage:
To get started with TALI, you can load the dataset via Hugging Face's `datasets` library through our helper functions. The reason we don't use `datasets` directly is because we found huggingface_hub downloads much faster and reliable. For a full set of possible configurations look at [examples.py](examples.py). Here's a basic usage example:
First install the tali package:
### Installation
For the default install use:
```bash
pip install git+https://github.com/AntreasAntoniou/TALI
```
For the dev install use:
```bash
pip install git+https://github.com/AntreasAntoniou/TALI[dev]
```
Then use the dataset using:
### Examples
Import relevant helper functions
```python
import pathlib
from enum import Enum
import torch
from tqdm.auto import tqdm
from tali.data import (
SubModalityTypes,
TALIBaseTransform,
TALIBaseTransformConfig,
VideoFramesFormat,
default_transforms,
load_dataset_via_hub,
)
```
#### TALI with default transforms (CLIP and Whisper) and no streaming
```python
def tali_with_transforms_no_streaming(
dataset_storage_path: pathlib.Path | str,
):
if isinstance(dataset_storage_path, str):
dataset_storage_path = pathlib.Path(dataset_storage_path)
dataset = load_dataset_via_hub(
dataset_storage_path, dataset_name="Antreas/TALI"
)["train"]
(
image_transforms,
text_transforms,
audio_transforms,
video_transforms,
) = default_transforms()
preprocessing_transform = TALIBaseTransform(
cache_dir=dataset_storage_path / "cache",
text_tokenizer=text_transforms,
image_tokenizer=image_transforms,
audio_tokenizer=audio_transforms,
video_tokenizer=video_transforms,
config=TALIBaseTransformConfig(
root_filepath=dataset_storage_path,
modality_list=[
SubModalityTypes.youtube_content_video,
SubModalityTypes.youtube_content_audio,
SubModalityTypes.youtube_random_video_frame,
SubModalityTypes.youtube_subtitle_text,
SubModalityTypes.youtube_description_text,
SubModalityTypes.youtube_title_text,
SubModalityTypes.wikipedia_caption_image,
SubModalityTypes.wikipedia_caption_text,
SubModalityTypes.wikipedia_main_body_text,
SubModalityTypes.wikipedia_title_text,
],
video_frames_format=VideoFramesFormat.PIL,
),
)
for sample in tqdm(dataset):
sample = preprocessing_transform(sample)
print(list(sample.keys()))
for key, value in sample.items():
if hasattr(value, "shape"):
print(key, value.shape)
elif isinstance(value, torch.Tensor):
print(key, value.shape)
elif hasattr(value, "__len__"):
print(key, len(value))
print(key, type(value))
break
```
#### TALI with no transforms and no streaming, returning text as text, images as PIL images, videos as a list of PIL images, and audio as a sequence of floats
```python
def tali_without_transforms_no_streaming(
dataset_storage_path: pathlib.Path | str,
):
if isinstance(dataset_storage_path, str):
dataset_storage_path = pathlib.Path(dataset_storage_path)
dataset = load_dataset_via_hub(
dataset_storage_path, dataset_name="Antreas/TALI"
)["train"]
preprocessing_transform = TALIBaseTransform(
cache_dir=dataset_storage_path / "cache",
text_tokenizer=None,
image_tokenizer=None,
audio_tokenizer=None,
video_tokenizer=None,
config=TALIBaseTransformConfig(
root_filepath=dataset_storage_path,
modality_list=[
SubModalityTypes.youtube_content_video,
SubModalityTypes.youtube_content_audio,
SubModalityTypes.youtube_random_video_frame,
SubModalityTypes.youtube_subtitle_text,
SubModalityTypes.youtube_description_text,
SubModalityTypes.youtube_title_text,
SubModalityTypes.wikipedia_caption_image,
SubModalityTypes.wikipedia_caption_text,
SubModalityTypes.wikipedia_main_body_text,
SubModalityTypes.wikipedia_title_text,
],
video_frames_format=VideoFramesFormat.PIL,
),
)
for sample in tqdm(dataset):
sample = preprocessing_transform(sample)
print(list(sample.keys()))
for key, value in sample.items():
if hasattr(value, "shape"):
print(key, value.shape)
elif isinstance(value, torch.Tensor):
print(key, value.shape)
elif hasattr(value, "__len__"):
print(key, len(value))
print(key, type(value))
break
```
#### TALI with default transforms and streaming
```python
def tali_with_transforms_streaming(
dataset_storage_path: pathlib.Path | str,
):
if isinstance(dataset_storage_path, str):
dataset_storage_path = pathlib.Path(dataset_storage_path)
dataset = load_dataset_via_hub(
dataset_storage_path, dataset_name="Antreas/TALI", streaming=True
)["train"]
(
image_transforms,
text_transforms,
audio_transforms,
video_transforms,
) = default_transforms()
preprocessing_transform = TALIBaseTransform(
cache_dir=dataset_storage_path / "cache",
text_tokenizer=text_transforms,
image_tokenizer=image_transforms,
audio_tokenizer=audio_transforms,
video_tokenizer=video_transforms,
config=TALIBaseTransformConfig(
root_filepath=dataset_storage_path,
modality_list=[
SubModalityTypes.youtube_content_video,
SubModalityTypes.youtube_content_audio,
SubModalityTypes.youtube_random_video_frame,
SubModalityTypes.youtube_subtitle_text,
SubModalityTypes.youtube_description_text,
SubModalityTypes.youtube_title_text,
SubModalityTypes.wikipedia_caption_image,
SubModalityTypes.wikipedia_caption_text,
SubModalityTypes.wikipedia_main_body_text,
SubModalityTypes.wikipedia_title_text,
],
video_frames_format=VideoFramesFormat.PIL,
),
)
for sample in tqdm(dataset):
sample = preprocessing_transform(sample)
print(list(sample.keys()))
for key, value in sample.items():
if hasattr(value, "shape"):
print(key, value.shape)
elif isinstance(value, torch.Tensor):
print(key, value.shape)
elif hasattr(value, "__len__"):
print(key, len(value))
print(key, type(value))
break
```
#### TALI with no transforms and streaming, returning text as text, images as PIL images, videos as a list of PIL images, and audio as a sequence of floats
```python
def tali_without_transforms_streaming(
dataset_storage_path: pathlib.Path | str,
):
if isinstance(dataset_storage_path, str):
dataset_storage_path = pathlib.Path(dataset_storage_path)
dataset = load_dataset_via_hub(
dataset_storage_path, dataset_name="Antreas/TALI", streaming=True
)["train"]
preprocessing_transform = TALIBaseTransform(
cache_dir=dataset_storage_path / "cache",
text_tokenizer=None,
image_tokenizer=None,
audio_tokenizer=None,
video_tokenizer=None,
config=TALIBaseTransformConfig(
root_filepath=dataset_storage_path,
modality_list=[
SubModalityTypes.youtube_content_video,
SubModalityTypes.youtube_content_audio,
SubModalityTypes.youtube_random_video_frame,
SubModalityTypes.youtube_subtitle_text,
SubModalityTypes.youtube_description_text,
SubModalityTypes.youtube_title_text,
SubModalityTypes.wikipedia_caption_image,
SubModalityTypes.wikipedia_caption_text,
SubModalityTypes.wikipedia_main_body_text,
SubModalityTypes.wikipedia_title_text,
],
video_frames_format=VideoFramesFormat.PIL,
),
)
for sample in tqdm(dataset):
sample = preprocessing_transform(sample)
print(list(sample.keys()))
for key, value in sample.items():
if hasattr(value, "shape"):
print(key, value.shape)
elif isinstance(value, torch.Tensor):
print(key, value.shape)
elif hasattr(value, "__len__"):
print(key, len(value))
print(key, type(value))
break
```
### Dataset Statistics
TBA
## Dataset Creation
The TALI dataset was created by starting from the WiT dataset and using either the context_page_description or page_title as a source-query to search YouTube for video that were creative commons opted-in, and, not age restricted. The top 100 result titles were returned and compared with the source-query using the CLIP text embeddings of the largest CLIP model available. The top-1 title’s video based on the CLIP ranking was chosen and downloaded. The video was broken into 30-second segments and the top-10 segments for eachvideo were chosen based on the distance between the CLIP image embedding of the first image of each segment and the video’s title text. The image, audio, and subtitle frames were extracted from these segments. At sampling time, one of these 10 segments is randomly selected, and a 10-second segment is chosen out of the 30-second clip. The result is 200 video frames (spread throughout the 10-second segment), and 160000 audio frames (10 seconds).
## Dataset Use
TALI is designed for use in a wide range of multimodal research tasks, including but not limited to:
- Multimodal understanding and reasoning
- Self-supervised learning
- Multimodal alignment and translation
- Multimodal summarization
- Multimodal question answering
## Dataset Curators: Antreas Antoniou
Citation Information: TBA
Contributions: Thanks to all contributors including data curators, annotators, and software developers.
[More Information needed](https://github.com/huggingface/datasets/blob/main/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)