Document construction metadata downloads
Browse files- README.md +26 -5
- construction/create_data.py +178 -48
README.md
CHANGED
|
@@ -56,6 +56,16 @@ videos. Exact attrition is reproducible as the set difference between
|
|
| 56 |
IDs) and `construction/surviving-public-media-video-ids.txt`
|
| 57 |
(2,110 IDs).
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
`media-manifest.jsonl` records the exact frozen ID, packaged filename, original
|
| 60 |
and acquisition URLs, byte count, and SHA-256 checksum for every video. The
|
| 61 |
manifest's own SHA-256 is `9ef60f6584b0ca6b2cfe9be6ba982d10b06cb37fc1d8ee52718a5f0349efa8fb`. Construction fails if any
|
|
@@ -116,19 +126,30 @@ captures are used only where listed explicitly in the source-override manifest.
|
|
| 116 |
No applicable dataset-wide redistribution license for the original videos was
|
| 117 |
identified; the archived project page also contains no explicit third-party
|
| 118 |
redistribution prohibition. Copyright remains with the respective video rights
|
| 119 |
-
holders.
|
| 120 |
-
|
| 121 |
-
|
|
|
|
| 122 |
|
| 123 |
The EVVE project page states separately that its software is BSD-licensed and
|
| 124 |
-
its released descriptors are free.
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
## Sources
|
| 128 |
|
| 129 |
- [Archived EVVE project page](https://web.archive.org/web/20241102150758id_/http://pascal.inrialpes.fr/data2/evve/index.html)
|
| 130 |
- [Original paper](https://openaccess.thecvf.com/content_cvpr_2013/html/Revaud_Event_Retrieval_in_2013_CVPR_paper.html)
|
| 131 |
- [Pinned S2VS annotations](https://github.com/gkordo/s2vs/tree/03eb0c9a9a7455d132c4210b797fa6ef563b52ea)
|
|
|
|
| 132 |
- [S2VS EVVE feature artifact](https://mever.iti.gr/s2vs/features/evve.hdf5)
|
| 133 |
|
| 134 |
## Citation
|
|
|
|
| 56 |
IDs) and `construction/surviving-public-media-video-ids.txt`
|
| 57 |
(2,110 IDs).
|
| 58 |
|
| 59 |
+
Those two manifests and `construction/media-source-overrides.json` are frozen in
|
| 60 |
+
the immutable Hugging Face revision
|
| 61 |
+
[`88f505f0a77f0ee0a14f2d7e098aaea08507bbe5`](https://huggingface.co/datasets/Cerru02/EVVE/tree/88f505f0a77f0ee0a14f2d7e098aaea08507bbe5/construction).
|
| 62 |
+
They are not copied into the MTEB source tree. The construction script downloads
|
| 63 |
+
them from that revision and verifies these SHA-256 checksums before use:
|
| 64 |
+
|
| 65 |
+
- `s2vs-2023-video-ids.txt`: `d7a84d997fcc23c6bb10db1902203b5c0d6ad65c65c4f8257b4295c690fb1c1c`;
|
| 66 |
+
- `surviving-public-media-video-ids.txt`: `ebf63bd9f524a1ab15104657e0448ddd4a1cbfb5720795ca9569703fbffcb0e6`;
|
| 67 |
+
- `media-source-overrides.json`: `3fb004549047e942be5e193b816c4fb18efdfcf9c166cb949016d5b1fd184d6d`.
|
| 68 |
+
|
| 69 |
`media-manifest.jsonl` records the exact frozen ID, packaged filename, original
|
| 70 |
and acquisition URLs, byte count, and SHA-256 checksum for every video. The
|
| 71 |
manifest's own SHA-256 is `9ef60f6584b0ca6b2cfe9be6ba982d10b06cb37fc1d8ee52718a5f0349efa8fb`. Construction fails if any
|
|
|
|
| 126 |
No applicable dataset-wide redistribution license for the original videos was
|
| 127 |
identified; the archived project page also contains no explicit third-party
|
| 128 |
redistribution prohibition. Copyright remains with the respective video rights
|
| 129 |
+
holders. Hugging Face card metadata therefore records the dataset-wide license
|
| 130 |
+
as `unknown`, while MTEB's `TaskMetadata` uses its corresponding value, `not
|
| 131 |
+
specified`. This provenance statement does not claim that video copyright was
|
| 132 |
+
transferred to EVVE or to this repository, or that redistribution is authorized.
|
| 133 |
|
| 134 |
The EVVE project page states separately that its software is BSD-licensed and
|
| 135 |
+
its released descriptors are free. The pinned S2VS source repository is
|
| 136 |
+
MIT-licensed. Those source-specific terms are not presented here as a license
|
| 137 |
+
for the packaged videos, so assigning BSD or MIT to the dataset as a whole would
|
| 138 |
+
be inaccurate.
|
| 139 |
+
|
| 140 |
+
| Component | License or status reported by its source |
|
| 141 |
+
|---|---|
|
| 142 |
+
| MTEB construction code | Apache-2.0 (MTEB repository license) |
|
| 143 |
+
| Pinned S2VS source repository | MIT |
|
| 144 |
+
| EVVE software and released descriptors | BSD / described as free on the EVVE project page |
|
| 145 |
+
| Packaged third-party videos | No dataset-wide license identified (`not specified`) |
|
| 146 |
|
| 147 |
## Sources
|
| 148 |
|
| 149 |
- [Archived EVVE project page](https://web.archive.org/web/20241102150758id_/http://pascal.inrialpes.fr/data2/evve/index.html)
|
| 150 |
- [Original paper](https://openaccess.thecvf.com/content_cvpr_2013/html/Revaud_Event_Retrieval_in_2013_CVPR_paper.html)
|
| 151 |
- [Pinned S2VS annotations](https://github.com/gkordo/s2vs/tree/03eb0c9a9a7455d132c4210b797fa6ef563b52ea)
|
| 152 |
+
- [S2VS MIT license](https://github.com/gkordo/s2vs/blob/03eb0c9a9a7455d132c4210b797fa6ef563b52ea/LICENSE)
|
| 153 |
- [S2VS EVVE feature artifact](https://mever.iti.gr/s2vs/features/evve.hdf5)
|
| 154 |
|
| 155 |
## Citation
|
construction/create_data.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""Construct and package a checksum-pinned surviving-public-media EVVE set.
|
| 3 |
|
| 4 |
-
The official EVVE metadata identifies media by YouTube ID. This script
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
|
| 11 |
Examples:
|
| 12 |
uv run python scripts/data/evve/create_data.py \
|
|
@@ -19,6 +21,10 @@ Examples:
|
|
| 19 |
uv run python scripts/data/evve/create_data.py \
|
| 20 |
--work-dir /tmp/evve-mteb \
|
| 21 |
--repo-id Cerru02/EVVE --push
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
from __future__ import annotations
|
|
@@ -54,15 +60,30 @@ EVALUATOR_URL = (
|
|
| 54 |
f"https://raw.githubusercontent.com/fyang93/BURST/{EVALUATOR_REVISION}/eval_evve.py"
|
| 55 |
)
|
| 56 |
EVALUATOR_SHA256 = "49dd29a499857764972b6b8959ad18dd94d80f8b34e8c4814c05076609fd93fd"
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
S2VS_PROTOCOL_MANIFEST_SHA256 = (
|
| 59 |
"d7a84d997fcc23c6bb10db1902203b5c0d6ad65c65c4f8257b4295c690fb1c1c"
|
| 60 |
)
|
| 61 |
-
PROTOCOL_MANIFEST =
|
| 62 |
-
MEDIA_SOURCE_OVERRIDES =
|
| 63 |
PROTOCOL_MANIFEST_SHA256 = (
|
| 64 |
"ebf63bd9f524a1ab15104657e0448ddd4a1cbfb5720795ca9569703fbffcb0e6"
|
| 65 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
EXPECTED_QUERIES = 466
|
| 68 |
EXPECTED_DATABASE = 1_644
|
|
@@ -96,6 +117,13 @@ class Protocol:
|
|
| 96 |
event_stats: tuple[dict[str, int | str], ...]
|
| 97 |
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
class DownloadFailure(Exception):
|
| 100 |
"""A non-fatal media download failure collected in the audit log."""
|
| 101 |
|
|
@@ -113,6 +141,54 @@ def _sha256(data: bytes) -> str:
|
|
| 113 |
return hashlib.sha256(data).hexdigest()
|
| 114 |
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
def load_annotations(path: Path) -> dict[str, Any]:
|
| 117 |
data = path.read_bytes()
|
| 118 |
digest = _sha256(data)
|
|
@@ -152,14 +228,10 @@ def fetch_annotations(work_dir: Path) -> Path:
|
|
| 152 |
return destination
|
| 153 |
|
| 154 |
|
| 155 |
-
def load_protocol_ids(path: Path
|
| 156 |
data = path.read_bytes()
|
| 157 |
digest = _sha256(data)
|
| 158 |
-
|
| 159 |
-
PROTOCOL_MANIFEST: PROTOCOL_MANIFEST_SHA256,
|
| 160 |
-
S2VS_PROTOCOL_MANIFEST: S2VS_PROTOCOL_MANIFEST_SHA256,
|
| 161 |
-
}.get(path)
|
| 162 |
-
if expected_digest is not None and digest != expected_digest:
|
| 163 |
raise ValueError(
|
| 164 |
f"protocol manifest checksum mismatch: {digest}; expected {expected_digest}"
|
| 165 |
)
|
|
@@ -193,18 +265,24 @@ def load_download_ids(path: Path, protocol_ids: tuple[str, ...]) -> tuple[str, .
|
|
| 193 |
|
| 194 |
|
| 195 |
def load_media_source_overrides(
|
| 196 |
-
path: Path
|
|
|
|
| 197 |
) -> dict[str, dict[str, str]]:
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
if not isinstance(payload, dict):
|
| 202 |
raise ValueError("media source overrides must be a JSON object")
|
| 203 |
|
| 204 |
-
|
| 205 |
overrides: dict[str, dict[str, str]] = {}
|
| 206 |
for video_id, raw_record in payload.items():
|
| 207 |
-
if video_id not in
|
| 208 |
raise ValueError(f"invalid media source override for {video_id!r}")
|
| 209 |
record = {str(key): str(value) for key, value in raw_record.items()}
|
| 210 |
if set(record) != {"extension", "sha256", "url"}:
|
|
@@ -388,14 +466,18 @@ def protocol_summary(
|
|
| 388 |
"annotations_revision": ANNOTATIONS_REVISION,
|
| 389 |
"annotations_url": ANNOTATIONS_URL,
|
| 390 |
"annotations_sha256": ANNOTATIONS_SHA256,
|
|
|
|
|
|
|
| 391 |
"feature_artifact_url": FEATURES_URL,
|
| 392 |
"surviving_evaluator_revision": EVALUATOR_REVISION,
|
| 393 |
"surviving_evaluator_url": EVALUATOR_URL,
|
| 394 |
"surviving_evaluator_sha256": EVALUATOR_SHA256,
|
| 395 |
-
"s2vs_protocol_manifest": S2VS_PROTOCOL_MANIFEST
|
| 396 |
"s2vs_protocol_manifest_sha256": S2VS_PROTOCOL_MANIFEST_SHA256,
|
| 397 |
-
"protocol_manifest": PROTOCOL_MANIFEST
|
| 398 |
"protocol_manifest_sha256": PROTOCOL_MANIFEST_SHA256,
|
|
|
|
|
|
|
| 399 |
},
|
| 400 |
"published_original": {
|
| 401 |
"queries": PUBLISHED_ORIGINAL_QUERIES,
|
|
@@ -812,9 +894,8 @@ def write_media_manifest(
|
|
| 812 |
video_ids: tuple[str, ...],
|
| 813 |
media: dict[str, Path],
|
| 814 |
destination: Path,
|
| 815 |
-
source_overrides: dict[str, dict[str, str]]
|
| 816 |
) -> None:
|
| 817 |
-
source_overrides = source_overrides or load_media_source_overrides()
|
| 818 |
missing = sorted(set(video_ids) - set(media))
|
| 819 |
if missing:
|
| 820 |
raise ValueError(
|
|
@@ -871,9 +952,8 @@ def index_media(media_root: Path) -> dict[str, Path]:
|
|
| 871 |
def build_datasets(
|
| 872 |
protocol: Protocol,
|
| 873 |
media: dict[str, Path],
|
| 874 |
-
source_overrides: dict[str, dict[str, str]]
|
| 875 |
) -> dict[str, Any]:
|
| 876 |
-
source_overrides = source_overrides or load_media_source_overrides()
|
| 877 |
required = set(protocol.queries) | set(protocol.database)
|
| 878 |
missing = sorted(required - set(media))
|
| 879 |
if missing:
|
|
@@ -950,11 +1030,14 @@ def build_datasets(
|
|
| 950 |
|
| 951 |
|
| 952 |
def export_local_dataset(
|
| 953 |
-
protocol: Protocol,
|
|
|
|
|
|
|
|
|
|
| 954 |
) -> None:
|
| 955 |
from datasets import DatasetDict
|
| 956 |
|
| 957 |
-
datasets = build_datasets(protocol, media)
|
| 958 |
output_dir.mkdir(parents=True, exist_ok=False)
|
| 959 |
for config, dataset in datasets.items():
|
| 960 |
DatasetDict({"test": dataset}).save_to_disk(output_dir / config)
|
|
@@ -1038,6 +1121,16 @@ videos. Exact attrition is reproducible as the set difference between
|
|
| 1038 |
IDs) and `construction/surviving-public-media-video-ids.txt`
|
| 1039 |
({evaluation["queries"] + evaluation["database"]:,} IDs).
|
| 1040 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1041 |
`media-manifest.jsonl` records the exact frozen ID, packaged filename, original
|
| 1042 |
and acquisition URLs, byte count, and SHA-256 checksum for every video. The
|
| 1043 |
manifest's own SHA-256 is `{media_manifest_sha256}`. Construction fails if any
|
|
@@ -1084,19 +1177,30 @@ captures are used only where listed explicitly in the source-override manifest.
|
|
| 1084 |
No applicable dataset-wide redistribution license for the original videos was
|
| 1085 |
identified; the archived project page also contains no explicit third-party
|
| 1086 |
redistribution prohibition. Copyright remains with the respective video rights
|
| 1087 |
-
holders.
|
| 1088 |
-
|
| 1089 |
-
|
|
|
|
| 1090 |
|
| 1091 |
The EVVE project page states separately that its software is BSD-licensed and
|
| 1092 |
-
its released descriptors are free.
|
| 1093 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1094 |
|
| 1095 |
## Sources
|
| 1096 |
|
| 1097 |
- [Archived EVVE project page](https://web.archive.org/web/20241102150758id_/http://pascal.inrialpes.fr/data2/evve/index.html)
|
| 1098 |
- [Original paper](https://openaccess.thecvf.com/content_cvpr_2013/html/Revaud_Event_Retrieval_in_2013_CVPR_paper.html)
|
| 1099 |
- [Pinned S2VS annotations](https://github.com/gkordo/s2vs/tree/{ANNOTATIONS_REVISION})
|
|
|
|
| 1100 |
- [S2VS EVVE feature artifact]({FEATURES_URL})
|
| 1101 |
|
| 1102 |
## Citation
|
|
@@ -1116,6 +1220,8 @@ license for the packaged videos.
|
|
| 1116 |
def push_dataset(
|
| 1117 |
protocol: Protocol,
|
| 1118 |
media: dict[str, Path],
|
|
|
|
|
|
|
| 1119 |
*,
|
| 1120 |
repo_id: str,
|
| 1121 |
work_dir: Path,
|
|
@@ -1137,7 +1243,7 @@ def push_dataset(
|
|
| 1137 |
)
|
| 1138 |
|
| 1139 |
api.create_repo(repo_id, repo_type="dataset", private=True, exist_ok=True)
|
| 1140 |
-
for config, dataset in build_datasets(protocol, media).items():
|
| 1141 |
DatasetDict({"test": dataset}).push_to_hub(
|
| 1142 |
repo_id,
|
| 1143 |
config,
|
|
@@ -1155,16 +1261,16 @@ def push_dataset(
|
|
| 1155 |
(card_path, "README.md"),
|
| 1156 |
(Path(__file__), "construction/create_data.py"),
|
| 1157 |
(
|
| 1158 |
-
|
| 1159 |
-
f"construction/{PROTOCOL_MANIFEST
|
| 1160 |
),
|
| 1161 |
(
|
| 1162 |
-
|
| 1163 |
-
f"construction/{S2VS_PROTOCOL_MANIFEST
|
| 1164 |
),
|
| 1165 |
(
|
| 1166 |
-
|
| 1167 |
-
f"construction/{MEDIA_SOURCE_OVERRIDES
|
| 1168 |
),
|
| 1169 |
(media_manifest_path, media_manifest_path.name),
|
| 1170 |
(media_audit_path, media_audit_path.name),
|
|
@@ -1190,6 +1296,14 @@ def main() -> None:
|
|
| 1190 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 1191 |
parser.add_argument("--work-dir", type=Path, default=Path("/tmp/evve-mteb"))
|
| 1192 |
parser.add_argument("--repo-id", default="Cerru02/EVVE")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1193 |
parser.add_argument(
|
| 1194 |
"--annotations",
|
| 1195 |
type=Path,
|
|
@@ -1250,11 +1364,26 @@ def main() -> None:
|
|
| 1250 |
args = parser.parse_args()
|
| 1251 |
|
| 1252 |
args.work_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1253 |
annotation_path = args.annotations or fetch_annotations(args.work_dir)
|
| 1254 |
annotations = load_annotations(annotation_path)
|
| 1255 |
before_filter = build_protocol(
|
| 1256 |
annotations,
|
| 1257 |
-
|
| 1258 |
enforce_expected_counts=False,
|
| 1259 |
)
|
| 1260 |
before_counts = _protocol_counts(before_filter)
|
|
@@ -1269,7 +1398,7 @@ def main() -> None:
|
|
| 1269 |
"S2VS protocol counts changed: "
|
| 1270 |
f"{actual_before_counts}; expected {expected_before_counts}"
|
| 1271 |
)
|
| 1272 |
-
protocol = build_protocol(annotations,
|
| 1273 |
summary = protocol_summary(protocol, before_filter)
|
| 1274 |
summary_path = args.work_dir / "protocol-summary.json"
|
| 1275 |
summary_path.write_text(
|
|
@@ -1280,7 +1409,6 @@ def main() -> None:
|
|
| 1280 |
|
| 1281 |
media_root = (args.media_root or args.work_dir / "media").resolve()
|
| 1282 |
if args.download:
|
| 1283 |
-
protocol_ids = load_protocol_ids()
|
| 1284 |
download_ids = (
|
| 1285 |
load_download_ids(args.download_id_file, protocol_ids)
|
| 1286 |
if args.download_id_file is not None
|
|
@@ -1296,7 +1424,7 @@ def main() -> None:
|
|
| 1296 |
sleep_min=args.sleep_interval,
|
| 1297 |
sleep_max=args.max_sleep_interval,
|
| 1298 |
extra_args=tuple(args.yt_dlp_arg),
|
| 1299 |
-
source_overrides=
|
| 1300 |
limit=args.limit,
|
| 1301 |
failure_log=args.work_dir / "download-failures.jsonl",
|
| 1302 |
)
|
|
@@ -1337,10 +1465,10 @@ def main() -> None:
|
|
| 1337 |
|
| 1338 |
media_manifest_path = args.work_dir / "media-manifest.jsonl"
|
| 1339 |
write_media_manifest(
|
| 1340 |
-
|
| 1341 |
media,
|
| 1342 |
media_manifest_path,
|
| 1343 |
-
|
| 1344 |
)
|
| 1345 |
print(f"Wrote {media_manifest_path}")
|
| 1346 |
|
|
@@ -1348,6 +1476,8 @@ def main() -> None:
|
|
| 1348 |
revision = push_dataset(
|
| 1349 |
protocol,
|
| 1350 |
media,
|
|
|
|
|
|
|
| 1351 |
repo_id=args.repo_id,
|
| 1352 |
work_dir=args.work_dir,
|
| 1353 |
summary=summary,
|
|
@@ -1356,7 +1486,7 @@ def main() -> None:
|
|
| 1356 |
print(f"Pushed {args.repo_id} @ {revision}")
|
| 1357 |
elif should_package:
|
| 1358 |
output_dir = args.output_dir or args.work_dir / "mteb_export"
|
| 1359 |
-
export_local_dataset(protocol, media, output_dir)
|
| 1360 |
print(f"Wrote local MTEB datasets to {output_dir}")
|
| 1361 |
|
| 1362 |
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""Construct and package a checksum-pinned surviving-public-media EVVE set.
|
| 3 |
|
| 4 |
+
The official EVVE metadata identifies media by YouTube ID. This script fetches
|
| 5 |
+
three small, checksum-pinned construction inputs from the immutable Hugging Face
|
| 6 |
+
dataset revision below instead of storing generated manifests in MTEB. It then
|
| 7 |
+
freezes the reproducibly obtainable 2,110-video subset of the 2,410 IDs retained
|
| 8 |
+
by the public S2VS feature artifact, downloads a compact progressive
|
| 9 |
+
representation, validates every retained item, and builds the MTEB corpus /
|
| 10 |
+
queries / qrels configurations. Downloads are resumable and failures never
|
| 11 |
+
silently change the benchmark.
|
| 12 |
|
| 13 |
Examples:
|
| 14 |
uv run python scripts/data/evve/create_data.py \
|
|
|
|
| 21 |
uv run python scripts/data/evve/create_data.py \
|
| 22 |
--work-dir /tmp/evve-mteb \
|
| 23 |
--repo-id Cerru02/EVVE --push
|
| 24 |
+
|
| 25 |
+
For an offline metadata audit, first place the three files listed in
|
| 26 |
+
CONSTRUCTION_ASSET_SHA256 in one directory, then pass that directory with
|
| 27 |
+
--construction-dir. Their checksums are always verified.
|
| 28 |
"""
|
| 29 |
|
| 30 |
from __future__ import annotations
|
|
|
|
| 60 |
f"https://raw.githubusercontent.com/fyang93/BURST/{EVALUATOR_REVISION}/eval_evve.py"
|
| 61 |
)
|
| 62 |
EVALUATOR_SHA256 = "49dd29a499857764972b6b8959ad18dd94d80f8b34e8c4814c05076609fd93fd"
|
| 63 |
+
CONSTRUCTION_DATASET_REPO = "Cerru02/EVVE"
|
| 64 |
+
CONSTRUCTION_DATASET_REVISION = "88f505f0a77f0ee0a14f2d7e098aaea08507bbe5"
|
| 65 |
+
# These derived inputs preserve web state that cannot be reconstructed later:
|
| 66 |
+
# the S2VS feature-artifact IDs, the successful public-media acquisition set,
|
| 67 |
+
# and the checksum-pinned archive fallbacks. The dataset revision above is their
|
| 68 |
+
# immutable distribution source; the comments in dataset_card explain how each
|
| 69 |
+
# file was produced from the upstream EVVE/S2VS materials.
|
| 70 |
+
S2VS_PROTOCOL_MANIFEST = "s2vs-2023-video-ids.txt"
|
| 71 |
S2VS_PROTOCOL_MANIFEST_SHA256 = (
|
| 72 |
"d7a84d997fcc23c6bb10db1902203b5c0d6ad65c65c4f8257b4295c690fb1c1c"
|
| 73 |
)
|
| 74 |
+
PROTOCOL_MANIFEST = "surviving-public-media-video-ids.txt"
|
| 75 |
+
MEDIA_SOURCE_OVERRIDES = "media-source-overrides.json"
|
| 76 |
PROTOCOL_MANIFEST_SHA256 = (
|
| 77 |
"ebf63bd9f524a1ab15104657e0448ddd4a1cbfb5720795ca9569703fbffcb0e6"
|
| 78 |
)
|
| 79 |
+
MEDIA_SOURCE_OVERRIDES_SHA256 = (
|
| 80 |
+
"3fb004549047e942be5e193b816c4fb18efdfcf9c166cb949016d5b1fd184d6d"
|
| 81 |
+
)
|
| 82 |
+
CONSTRUCTION_ASSET_SHA256 = {
|
| 83 |
+
S2VS_PROTOCOL_MANIFEST: S2VS_PROTOCOL_MANIFEST_SHA256,
|
| 84 |
+
PROTOCOL_MANIFEST: PROTOCOL_MANIFEST_SHA256,
|
| 85 |
+
MEDIA_SOURCE_OVERRIDES: MEDIA_SOURCE_OVERRIDES_SHA256,
|
| 86 |
+
}
|
| 87 |
|
| 88 |
EXPECTED_QUERIES = 466
|
| 89 |
EXPECTED_DATABASE = 1_644
|
|
|
|
| 117 |
event_stats: tuple[dict[str, int | str], ...]
|
| 118 |
|
| 119 |
|
| 120 |
+
@dataclass(frozen=True)
|
| 121 |
+
class ConstructionAssets:
|
| 122 |
+
s2vs_protocol_manifest: Path
|
| 123 |
+
protocol_manifest: Path
|
| 124 |
+
media_source_overrides: Path
|
| 125 |
+
|
| 126 |
+
|
| 127 |
class DownloadFailure(Exception):
|
| 128 |
"""A non-fatal media download failure collected in the audit log."""
|
| 129 |
|
|
|
|
| 141 |
return hashlib.sha256(data).hexdigest()
|
| 142 |
|
| 143 |
|
| 144 |
+
def resolve_construction_assets(
|
| 145 |
+
work_dir: Path, construction_dir: Path | None = None
|
| 146 |
+
) -> ConstructionAssets:
|
| 147 |
+
"""Resolve and verify the three frozen inputs omitted from the MTEB tree."""
|
| 148 |
+
destination_dir = (construction_dir or work_dir / "construction").resolve()
|
| 149 |
+
if construction_dir is None:
|
| 150 |
+
destination_dir.mkdir(parents=True, exist_ok=True)
|
| 151 |
+
|
| 152 |
+
resolved: dict[str, Path] = {}
|
| 153 |
+
for filename, expected_digest in CONSTRUCTION_ASSET_SHA256.items():
|
| 154 |
+
destination = destination_dir / filename
|
| 155 |
+
if not destination.is_file():
|
| 156 |
+
if construction_dir is not None:
|
| 157 |
+
raise FileNotFoundError(
|
| 158 |
+
f"missing construction asset in --construction-dir: {destination}"
|
| 159 |
+
)
|
| 160 |
+
from huggingface_hub import hf_hub_download
|
| 161 |
+
|
| 162 |
+
downloaded = Path(
|
| 163 |
+
hf_hub_download(
|
| 164 |
+
repo_id=CONSTRUCTION_DATASET_REPO,
|
| 165 |
+
filename=f"construction/{filename}",
|
| 166 |
+
repo_type="dataset",
|
| 167 |
+
revision=CONSTRUCTION_DATASET_REVISION,
|
| 168 |
+
local_dir=work_dir,
|
| 169 |
+
)
|
| 170 |
+
).resolve()
|
| 171 |
+
if downloaded != destination:
|
| 172 |
+
raise RuntimeError(
|
| 173 |
+
f"construction asset downloaded to {downloaded}; "
|
| 174 |
+
f"expected {destination}"
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
digest = _sha256(destination.read_bytes())
|
| 178 |
+
if digest != expected_digest:
|
| 179 |
+
raise ValueError(
|
| 180 |
+
f"construction asset checksum mismatch for {destination}: "
|
| 181 |
+
f"{digest}; expected {expected_digest}"
|
| 182 |
+
)
|
| 183 |
+
resolved[filename] = destination
|
| 184 |
+
|
| 185 |
+
return ConstructionAssets(
|
| 186 |
+
s2vs_protocol_manifest=resolved[S2VS_PROTOCOL_MANIFEST],
|
| 187 |
+
protocol_manifest=resolved[PROTOCOL_MANIFEST],
|
| 188 |
+
media_source_overrides=resolved[MEDIA_SOURCE_OVERRIDES],
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
def load_annotations(path: Path) -> dict[str, Any]:
|
| 193 |
data = path.read_bytes()
|
| 194 |
digest = _sha256(data)
|
|
|
|
| 228 |
return destination
|
| 229 |
|
| 230 |
|
| 231 |
+
def load_protocol_ids(path: Path, expected_digest: str) -> tuple[str, ...]:
|
| 232 |
data = path.read_bytes()
|
| 233 |
digest = _sha256(data)
|
| 234 |
+
if digest != expected_digest:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
raise ValueError(
|
| 236 |
f"protocol manifest checksum mismatch: {digest}; expected {expected_digest}"
|
| 237 |
)
|
|
|
|
| 265 |
|
| 266 |
|
| 267 |
def load_media_source_overrides(
|
| 268 |
+
path: Path,
|
| 269 |
+
protocol_ids: tuple[str, ...],
|
| 270 |
) -> dict[str, dict[str, str]]:
|
| 271 |
+
data = path.read_bytes()
|
| 272 |
+
digest = _sha256(data)
|
| 273 |
+
if digest != MEDIA_SOURCE_OVERRIDES_SHA256:
|
| 274 |
+
raise ValueError(
|
| 275 |
+
f"media source override checksum mismatch: {digest}; "
|
| 276 |
+
f"expected {MEDIA_SOURCE_OVERRIDES_SHA256}"
|
| 277 |
+
)
|
| 278 |
+
payload = json.loads(data)
|
| 279 |
if not isinstance(payload, dict):
|
| 280 |
raise ValueError("media source overrides must be a JSON object")
|
| 281 |
|
| 282 |
+
protocol_id_set = set(protocol_ids)
|
| 283 |
overrides: dict[str, dict[str, str]] = {}
|
| 284 |
for video_id, raw_record in payload.items():
|
| 285 |
+
if video_id not in protocol_id_set or not isinstance(raw_record, dict):
|
| 286 |
raise ValueError(f"invalid media source override for {video_id!r}")
|
| 287 |
record = {str(key): str(value) for key, value in raw_record.items()}
|
| 288 |
if set(record) != {"extension", "sha256", "url"}:
|
|
|
|
| 466 |
"annotations_revision": ANNOTATIONS_REVISION,
|
| 467 |
"annotations_url": ANNOTATIONS_URL,
|
| 468 |
"annotations_sha256": ANNOTATIONS_SHA256,
|
| 469 |
+
"construction_dataset_repo": CONSTRUCTION_DATASET_REPO,
|
| 470 |
+
"construction_dataset_revision": CONSTRUCTION_DATASET_REVISION,
|
| 471 |
"feature_artifact_url": FEATURES_URL,
|
| 472 |
"surviving_evaluator_revision": EVALUATOR_REVISION,
|
| 473 |
"surviving_evaluator_url": EVALUATOR_URL,
|
| 474 |
"surviving_evaluator_sha256": EVALUATOR_SHA256,
|
| 475 |
+
"s2vs_protocol_manifest": S2VS_PROTOCOL_MANIFEST,
|
| 476 |
"s2vs_protocol_manifest_sha256": S2VS_PROTOCOL_MANIFEST_SHA256,
|
| 477 |
+
"protocol_manifest": PROTOCOL_MANIFEST,
|
| 478 |
"protocol_manifest_sha256": PROTOCOL_MANIFEST_SHA256,
|
| 479 |
+
"media_source_overrides": MEDIA_SOURCE_OVERRIDES,
|
| 480 |
+
"media_source_overrides_sha256": MEDIA_SOURCE_OVERRIDES_SHA256,
|
| 481 |
},
|
| 482 |
"published_original": {
|
| 483 |
"queries": PUBLISHED_ORIGINAL_QUERIES,
|
|
|
|
| 894 |
video_ids: tuple[str, ...],
|
| 895 |
media: dict[str, Path],
|
| 896 |
destination: Path,
|
| 897 |
+
source_overrides: dict[str, dict[str, str]],
|
| 898 |
) -> None:
|
|
|
|
| 899 |
missing = sorted(set(video_ids) - set(media))
|
| 900 |
if missing:
|
| 901 |
raise ValueError(
|
|
|
|
| 952 |
def build_datasets(
|
| 953 |
protocol: Protocol,
|
| 954 |
media: dict[str, Path],
|
| 955 |
+
source_overrides: dict[str, dict[str, str]],
|
| 956 |
) -> dict[str, Any]:
|
|
|
|
| 957 |
required = set(protocol.queries) | set(protocol.database)
|
| 958 |
missing = sorted(required - set(media))
|
| 959 |
if missing:
|
|
|
|
| 1030 |
|
| 1031 |
|
| 1032 |
def export_local_dataset(
|
| 1033 |
+
protocol: Protocol,
|
| 1034 |
+
media: dict[str, Path],
|
| 1035 |
+
source_overrides: dict[str, dict[str, str]],
|
| 1036 |
+
output_dir: Path,
|
| 1037 |
) -> None:
|
| 1038 |
from datasets import DatasetDict
|
| 1039 |
|
| 1040 |
+
datasets = build_datasets(protocol, media, source_overrides)
|
| 1041 |
output_dir.mkdir(parents=True, exist_ok=False)
|
| 1042 |
for config, dataset in datasets.items():
|
| 1043 |
DatasetDict({"test": dataset}).save_to_disk(output_dir / config)
|
|
|
|
| 1121 |
IDs) and `construction/surviving-public-media-video-ids.txt`
|
| 1122 |
({evaluation["queries"] + evaluation["database"]:,} IDs).
|
| 1123 |
|
| 1124 |
+
Those two manifests and `construction/media-source-overrides.json` are frozen in
|
| 1125 |
+
the immutable Hugging Face revision
|
| 1126 |
+
[`{CONSTRUCTION_DATASET_REVISION}`](https://huggingface.co/datasets/{CONSTRUCTION_DATASET_REPO}/tree/{CONSTRUCTION_DATASET_REVISION}/construction).
|
| 1127 |
+
They are not copied into the MTEB source tree. The construction script downloads
|
| 1128 |
+
them from that revision and verifies these SHA-256 checksums before use:
|
| 1129 |
+
|
| 1130 |
+
- `{S2VS_PROTOCOL_MANIFEST}`: `{S2VS_PROTOCOL_MANIFEST_SHA256}`;
|
| 1131 |
+
- `{PROTOCOL_MANIFEST}`: `{PROTOCOL_MANIFEST_SHA256}`;
|
| 1132 |
+
- `{MEDIA_SOURCE_OVERRIDES}`: `{MEDIA_SOURCE_OVERRIDES_SHA256}`.
|
| 1133 |
+
|
| 1134 |
`media-manifest.jsonl` records the exact frozen ID, packaged filename, original
|
| 1135 |
and acquisition URLs, byte count, and SHA-256 checksum for every video. The
|
| 1136 |
manifest's own SHA-256 is `{media_manifest_sha256}`. Construction fails if any
|
|
|
|
| 1177 |
No applicable dataset-wide redistribution license for the original videos was
|
| 1178 |
identified; the archived project page also contains no explicit third-party
|
| 1179 |
redistribution prohibition. Copyright remains with the respective video rights
|
| 1180 |
+
holders. Hugging Face card metadata therefore records the dataset-wide license
|
| 1181 |
+
as `unknown`, while MTEB's `TaskMetadata` uses its corresponding value, `not
|
| 1182 |
+
specified`. This provenance statement does not claim that video copyright was
|
| 1183 |
+
transferred to EVVE or to this repository, or that redistribution is authorized.
|
| 1184 |
|
| 1185 |
The EVVE project page states separately that its software is BSD-licensed and
|
| 1186 |
+
its released descriptors are free. The pinned S2VS source repository is
|
| 1187 |
+
MIT-licensed. Those source-specific terms are not presented here as a license
|
| 1188 |
+
for the packaged videos, so assigning BSD or MIT to the dataset as a whole would
|
| 1189 |
+
be inaccurate.
|
| 1190 |
+
|
| 1191 |
+
| Component | License or status reported by its source |
|
| 1192 |
+
|---|---|
|
| 1193 |
+
| MTEB construction code | Apache-2.0 (MTEB repository license) |
|
| 1194 |
+
| Pinned S2VS source repository | MIT |
|
| 1195 |
+
| EVVE software and released descriptors | BSD / described as free on the EVVE project page |
|
| 1196 |
+
| Packaged third-party videos | No dataset-wide license identified (`not specified`) |
|
| 1197 |
|
| 1198 |
## Sources
|
| 1199 |
|
| 1200 |
- [Archived EVVE project page](https://web.archive.org/web/20241102150758id_/http://pascal.inrialpes.fr/data2/evve/index.html)
|
| 1201 |
- [Original paper](https://openaccess.thecvf.com/content_cvpr_2013/html/Revaud_Event_Retrieval_in_2013_CVPR_paper.html)
|
| 1202 |
- [Pinned S2VS annotations](https://github.com/gkordo/s2vs/tree/{ANNOTATIONS_REVISION})
|
| 1203 |
+
- [S2VS MIT license](https://github.com/gkordo/s2vs/blob/{ANNOTATIONS_REVISION}/LICENSE)
|
| 1204 |
- [S2VS EVVE feature artifact]({FEATURES_URL})
|
| 1205 |
|
| 1206 |
## Citation
|
|
|
|
| 1220 |
def push_dataset(
|
| 1221 |
protocol: Protocol,
|
| 1222 |
media: dict[str, Path],
|
| 1223 |
+
source_overrides: dict[str, dict[str, str]],
|
| 1224 |
+
construction_assets: ConstructionAssets,
|
| 1225 |
*,
|
| 1226 |
repo_id: str,
|
| 1227 |
work_dir: Path,
|
|
|
|
| 1243 |
)
|
| 1244 |
|
| 1245 |
api.create_repo(repo_id, repo_type="dataset", private=True, exist_ok=True)
|
| 1246 |
+
for config, dataset in build_datasets(protocol, media, source_overrides).items():
|
| 1247 |
DatasetDict({"test": dataset}).push_to_hub(
|
| 1248 |
repo_id,
|
| 1249 |
config,
|
|
|
|
| 1261 |
(card_path, "README.md"),
|
| 1262 |
(Path(__file__), "construction/create_data.py"),
|
| 1263 |
(
|
| 1264 |
+
construction_assets.protocol_manifest,
|
| 1265 |
+
f"construction/{PROTOCOL_MANIFEST}",
|
| 1266 |
),
|
| 1267 |
(
|
| 1268 |
+
construction_assets.s2vs_protocol_manifest,
|
| 1269 |
+
f"construction/{S2VS_PROTOCOL_MANIFEST}",
|
| 1270 |
),
|
| 1271 |
(
|
| 1272 |
+
construction_assets.media_source_overrides,
|
| 1273 |
+
f"construction/{MEDIA_SOURCE_OVERRIDES}",
|
| 1274 |
),
|
| 1275 |
(media_manifest_path, media_manifest_path.name),
|
| 1276 |
(media_audit_path, media_audit_path.name),
|
|
|
|
| 1296 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 1297 |
parser.add_argument("--work-dir", type=Path, default=Path("/tmp/evve-mteb"))
|
| 1298 |
parser.add_argument("--repo-id", default="Cerru02/EVVE")
|
| 1299 |
+
parser.add_argument(
|
| 1300 |
+
"--construction-dir",
|
| 1301 |
+
type=Path,
|
| 1302 |
+
help=(
|
| 1303 |
+
"Read the three frozen construction inputs from this directory "
|
| 1304 |
+
"instead of downloading them from the pinned Hugging Face revision"
|
| 1305 |
+
),
|
| 1306 |
+
)
|
| 1307 |
parser.add_argument(
|
| 1308 |
"--annotations",
|
| 1309 |
type=Path,
|
|
|
|
| 1364 |
args = parser.parse_args()
|
| 1365 |
|
| 1366 |
args.work_dir.mkdir(parents=True, exist_ok=True)
|
| 1367 |
+
construction_assets = resolve_construction_assets(
|
| 1368 |
+
args.work_dir, args.construction_dir
|
| 1369 |
+
)
|
| 1370 |
+
s2vs_protocol_ids = load_protocol_ids(
|
| 1371 |
+
construction_assets.s2vs_protocol_manifest,
|
| 1372 |
+
S2VS_PROTOCOL_MANIFEST_SHA256,
|
| 1373 |
+
)
|
| 1374 |
+
protocol_ids = load_protocol_ids(
|
| 1375 |
+
construction_assets.protocol_manifest,
|
| 1376 |
+
PROTOCOL_MANIFEST_SHA256,
|
| 1377 |
+
)
|
| 1378 |
+
source_overrides = load_media_source_overrides(
|
| 1379 |
+
construction_assets.media_source_overrides,
|
| 1380 |
+
protocol_ids,
|
| 1381 |
+
)
|
| 1382 |
annotation_path = args.annotations or fetch_annotations(args.work_dir)
|
| 1383 |
annotations = load_annotations(annotation_path)
|
| 1384 |
before_filter = build_protocol(
|
| 1385 |
annotations,
|
| 1386 |
+
s2vs_protocol_ids,
|
| 1387 |
enforce_expected_counts=False,
|
| 1388 |
)
|
| 1389 |
before_counts = _protocol_counts(before_filter)
|
|
|
|
| 1398 |
"S2VS protocol counts changed: "
|
| 1399 |
f"{actual_before_counts}; expected {expected_before_counts}"
|
| 1400 |
)
|
| 1401 |
+
protocol = build_protocol(annotations, protocol_ids)
|
| 1402 |
summary = protocol_summary(protocol, before_filter)
|
| 1403 |
summary_path = args.work_dir / "protocol-summary.json"
|
| 1404 |
summary_path.write_text(
|
|
|
|
| 1409 |
|
| 1410 |
media_root = (args.media_root or args.work_dir / "media").resolve()
|
| 1411 |
if args.download:
|
|
|
|
| 1412 |
download_ids = (
|
| 1413 |
load_download_ids(args.download_id_file, protocol_ids)
|
| 1414 |
if args.download_id_file is not None
|
|
|
|
| 1424 |
sleep_min=args.sleep_interval,
|
| 1425 |
sleep_max=args.max_sleep_interval,
|
| 1426 |
extra_args=tuple(args.yt_dlp_arg),
|
| 1427 |
+
source_overrides=source_overrides,
|
| 1428 |
limit=args.limit,
|
| 1429 |
failure_log=args.work_dir / "download-failures.jsonl",
|
| 1430 |
)
|
|
|
|
| 1465 |
|
| 1466 |
media_manifest_path = args.work_dir / "media-manifest.jsonl"
|
| 1467 |
write_media_manifest(
|
| 1468 |
+
protocol_ids,
|
| 1469 |
media,
|
| 1470 |
media_manifest_path,
|
| 1471 |
+
source_overrides,
|
| 1472 |
)
|
| 1473 |
print(f"Wrote {media_manifest_path}")
|
| 1474 |
|
|
|
|
| 1476 |
revision = push_dataset(
|
| 1477 |
protocol,
|
| 1478 |
media,
|
| 1479 |
+
source_overrides,
|
| 1480 |
+
construction_assets,
|
| 1481 |
repo_id=args.repo_id,
|
| 1482 |
work_dir=args.work_dir,
|
| 1483 |
summary=summary,
|
|
|
|
| 1486 |
print(f"Pushed {args.repo_id} @ {revision}")
|
| 1487 |
elif should_package:
|
| 1488 |
output_dir = args.output_dir or args.work_dir / "mteb_export"
|
| 1489 |
+
export_local_dataset(protocol, media, source_overrides, output_dir)
|
| 1490 |
print(f"Wrote local MTEB datasets to {output_dir}")
|
| 1491 |
|
| 1492 |
|