internvid-1M / README.md
Letian2003's picture
Add README.md
e68da82 verified
|
Raw
History Blame Contribute Delete
7.85 kB
---
license: cc-by-nc-sa-4.0
task_categories:
- video-text-to-text
- text-to-video
language:
- en
tags:
- video
- video-captioning
- internvid
- tfrecord
- tfds
pretty_name: InternVid-1M (FLT, recaptioned)
size_categories:
- 1M<n<10M
---
# InternVid-1M (FLT, recaptioned)
A uniform random **1,000,000-clip** subset of [InternVid-10M-FLT](https://github.com/OpenGVLab/InternVideo/tree/main/Data/InternVid),
packaged as TFDS-compatible TFRecord shards with **raw MP4 bytes embedded in every
example** and an additional long **`recap_caption`** field alongside InternVid's
original short `caption`.
- **Clips:** 1,000,000 (parent: 10,647,325)
- **Shards:** 206 TFRecord files, ~2 GiB each
- **Size:** 412 GiB
- **Video:** H.264/AVC in MP4, short side 256 px, audio track present (unused by most pipelines)
## Why this subset exists
The full 10.6M-clip parent is 4.29 TiB, which is awkward for ablations and for
anyone who wants a representative slice rather than the whole corpus. This is a
statistically uniform 9.39% sample, so aggregate statistics match the parent
closely enough to substitute for it in most experiments.
## Sampling method (and why it is uniform)
206 of the parent's 2198 **whole shards** were selected uniformly at random
(`random.Random(20260725)`), with the final shard chosen so the clip count lands
on exactly 1,000,000. Shard payloads are **byte-identical** copies of the parent
shards — nothing was re-encoded, so MP4 bytes and all field values are bit-exact.
Whole-shard selection is only equivalent to per-clip sampling if shards are
interchangeable, which was verified on the parent before sampling:
| Test | Result |
|---|---|
| Permutation test, between-shard variance of per-shard mean log(duration) | **p = 0.91** (observed 0.076 vs i.i.d. null median 0.114) |
| Per-shard `InternVId-FLT_*` source-directory composition | chi² max 15.8, df 10 (crit. 18.3) — passes |
| Per-shard mean `umt_score` spread | 0.011 vs 0.012 predicted under i.i.d. |
| Per-shard mean `aesthetic_score` spread | 0.289 vs 0.269 predicted under i.i.d. |
| Source-video clustering | 343/343 probed clips had distinct `youtube_id`, zero adjacent repeats |
The 206 selected shards are spread evenly across the parent's shard index
(10 equal bins: 20/19/19/26/11/20/21/23/27/20). Read-back of 357 clips from 24
shards of this subset reproduces the parent distribution (duration median 3.92 s
vs 3.70 s; identical fps mix; all 11 source subdirectories present).
The exact source→destination shard mapping is in
[`data/1.0.0/shard_provenance.json`](data/1.0.0/shard_provenance.json).
## Fields (15 per example)
| Field | Type | Description |
|---|---|---|
| `video_bytes` | bytes | Raw MP4 file bytes (H.264, short side 256) |
| `video_size` | int64 | MP4 size in bytes |
| `mime_type` | string | `video/mp4` |
| `relative_path` | string | e.g. `InternVId-FLT_4/<yid>_<start>_<end>.mp4` |
| `youtube_id` | string | Source YouTube video id |
| `index` | int64 | Row id **in the parent dataset** (non-contiguous here) |
| `caption` | string | InternVid's original short caption |
| `recap_caption` | string | Long re-captioned description (median ~347 bytes) |
| `start_sec` / `end_sec` | float32 | Clip span within the source video |
| `start_timestamp` / `end_timestamp` | string | Same span as `HH:MM:SS.mmm` |
| `duration_sec` | float32 | Clip duration (matches the real video to ~0.0002 s median) |
| `aesthetic_score` | float32 | Aesthetic predictor score |
| `umt_score` | float32 | UMT video-text similarity (the "FLT" filter score) |
> **Note:** `index` refers to the parent's row numbering, so it is *not*
> contiguous in this subset (observed range 179,080 – 10,634,432). Don't use it
> as a row counter.
## Measured clip statistics
Measured by parsing MP4 atoms directly (`mvhd`/`mdhd`/`stts`). All sampled clips
were perfectly CFR (a single `stts` entry), so these frame rates are exact.
**Duration** — heavily right-skewed, most clips are short:
```
min 0.50s p10 1.13s p25 1.90s median 3.70s p75 9.74s p90 19.08s max 110.2s mean 8.31s
```
**Frame rate:**
| fps | share |
|---|---|
| 30.00 | 30% |
| 29.97 | 30% |
| 25.00 | 28% |
| 24.00 / 23.98 | 8% |
| other (23.78, 24.98, 29.94, 10.00) | 4% |
**Frame count:** median 103, p25 49, p75 250, max 3304.
⚠️ Because the median clip is only ~3.7 s, pipelines that sample a fixed number
of frames at a low target fps will frequently come up short — e.g. sampling at
1 fps yields a median of just 3–4 frames. Budget for padding and masking, and
check your effective frame counts rather than assuming your requested count.
## Usage
### TFDS (native format)
```python
import tensorflow_datasets as tfds
builder = tfds.builder_from_directory("data/1.0.0") # after snapshot_download
ds = builder.as_dataset(split="train")
for ex in tfds.as_numpy(ds.take(1)):
mp4_bytes = ex["video_bytes"] # feed to decord / PyAV / ffmpeg
print(len(mp4_bytes), ex["recap_caption"].decode())
```
Download first (412 GiB — fetch a subset of shards if you don't need it all):
```bash
hf download Letian2003/internvid-1M --repo-type dataset --local-dir ./internvid-1M
```
Grab just a few shards:
```bash
hf download Letian2003/internvid-1M --repo-type dataset --local-dir ./internvid-1M \
--include "data/1.0.0/dataset_info.json" "data/1.0.0/features.json" \
"data/1.0.0/internvid_10m_flt_packed-train.tfrecord-0000[0-3]-of-00206"
```
Note that `dataset_info.json` declares all 206 shards, so TFDS expects them all
to be present; for a partial download, read the shards directly with
`tf.data.TFRecordDataset` instead.
### Raw TFRecord (no TFDS)
```python
import tensorflow as tf
FEATURES = {
"video_bytes": tf.io.FixedLenFeature([], tf.string),
"recap_caption": tf.io.FixedLenFeature([], tf.string),
"caption": tf.io.FixedLenFeature([], tf.string),
"duration_sec": tf.io.FixedLenFeature([], tf.float32),
"umt_score": tf.io.FixedLenFeature([], tf.float32),
}
ds = tf.data.TFRecordDataset(tf.io.gfile.glob("data/1.0.0/*.tfrecord-*"))
ds = ds.map(lambda r: tf.io.parse_single_example(r, FEATURES))
```
## Dataset structure
```
data/1.0.0/
├── dataset_info.json # TFDS metadata: 206 shards, 1,000,000 examples
├── features.json # TFDS feature spec (byte-identical to parent)
├── shard_provenance.json # src -> dst shard mapping for reproducibility
├── README.txt # provenance notes
├── LICENSE
└── internvid_10m_flt_packed-train.tfrecord-{00000..00205}-of-00206
```
The dataset viewer is not available for this repo: the clips are stored as raw
MP4 bytes inside TFRecord containers rather than Parquet/WebDataset.
## Limitations
- **Not deduplicated by source video.** Clips are independent samples, so two
clips from the same YouTube video can both appear. Group by `youtube_id` if you
need source-disjoint train/test splits.
- **English captions only.**
- Inherits any bias and noise present in InternVid-10M-FLT; `recap_caption` is
model-generated and not human-verified.
- No train/validation split is defined — the whole subset is `train`.
## License
`cc-by-nc-sa-4.0`, inherited from InternVid. Non-commercial use only. The
underlying videos remain the property of their original YouTube uploaders.
## Citation
Please cite the original InternVid paper:
```bibtex
@article{wang2023internvid,
title={InternVid: A Large-scale Video-Text Dataset for Multimodal Understanding and Generation},
author={Wang, Yi and He, Yinan and Li, Yizhuo and Li, Kunchang and Yu, Jiashuo and Ma, Xin and Chen, Xinyuan and Wang, Yaohui and Luo, Ping and Liu, Ziwei and Wang, Yali and Wang, Limin and Qiao, Yu},
journal={arXiv preprint arXiv:2307.06942},
year={2023}
}
```