Datasets:

microanomaly / README.md
rekriz11's picture
Upload README.md with huggingface_hub
209b9d9 verified
|
Raw
History Blame Contribute Delete
11.7 kB
# microanomaly
A compact development set for **finding anomalies in fixed-camera streams**.
Each camera is a 24/7 live stream with one real anomaly event somewhere in its
footage. There is no user query — the task is intrinsic to the camera. Two evals
run over each camera's videos:
1. **Find the anomaly** — flag the anomalous video(s) among everything the camera
recorded (scored against `annotations/judgments.jsonl`).
2. **Generate claims** — describe the anomaly video(s) (scored against
`annotations/reference.json`).
`annotations/queries.jsonl` gives the per-camera grouping (which videos belong
to each camera) that both evals run over.
It is a focused spin-off of [`microvent`](../microvent):
the 4 cameras here are the 4 anomaly-sourced topics in microvent, but where
microvent kept only a handful of chunks per camera, microanomaly pulls **every**
chunk from each camera straight out of the `multivent-raw` shards.
---
## At a glance
| | |
|---|---|
| Cameras (topics / queries) | 4 |
| Source videos (captures) | 379 |
| Total chunks | 474 |
| Positives (relevance:1) | 11 |
| Negatives (relevance:0) | 463 |
| Total duration | ~23.5 h |
| On disk | ~21.5 GB |
| Shards | 6 |
A **chunk** is the unit of retrieval (≤300 s slice of one source capture);
single-capture sources are one chunk, longer ones split. Every artifact is
keyed by `chunk_id`. The IDs are the **multivent-raw** anonymized identifiers,
so this set joins cleanly with any multivent-raw-derived artifact.
---
## Directory layout
```
microanomaly/
├── README.md
├── shard_mapping.csv ← per-chunk crosswalk: multivent-raw source → microanomaly shard
├── annotations/ ← public eval inputs
│ ├── queries.jsonl per-camera task + video grouping (4 rows)
│ ├── judgments.jsonl 474 rows — full same-camera IR pool
│ └── reference.json 4 topics, MiRAGE claims + chunk-level evidence
├── scripts/ ← tooling (see scripts/README.md)
│ ├── serve.py zero-dependency web viewer
│ ├── slurm_serve.sh run the viewer as a 1-hour CPU SLURM job
│ ├── build_queries.py (re)build annotations/queries.jsonl grouping
│ ├── import_live_viewer_assets.py populate viewer_assets/ (copy from live_viewer)
│ ├── generate_assets.py populate viewer_assets/ (from-scratch, ffmpeg)
│ └── README.md
├── viewer_assets/ ← optional browsing aids (generated)
│ ├── posters/<camera>/<video_id>.jpg
│ ├── vtimelapse/<camera>/<video_id>.mp4
│ └── cam_timelapse/<camera>.mp4
└── videos/ ← .mp4 + per-chunk JSON
├── catalog.csv
└── shard_000000.tar … shard_000005.tar
```
## Viewer
`scripts/serve.py` is a self-contained (stdlib-only) web browser: per camera it
states the find-the-anomaly task, flags the relevant anomaly chunk(s), lists the
reference claims, and plays any chunk inline by streaming it from the shards. With
`viewer_assets/` generated, tiles get poster thumbnails + hover-preview and each
camera page opens with a history timelapse.
**Run it on a compute node as a 1-hour CPU SLURM job, then tunnel in:**
```bash
# from the dataset root (microanomaly/)
sbatch scripts/slurm_serve.sh # CPU, 1-hour cap, port 8083
squeue -u $USER -n manom_serve # NODELIST = <compute-host>
ssh -N -L 8083:<compute-host>:8083 $USER@<cluster-login>
# open http://localhost:8083/ · stop early: scancel <jobid>
```
Browsing aids are optional (the viewer works without them). To populate
`viewer_assets/`: `python3 scripts/import_live_viewer_assets.py` (fast copy from
the live_viewer) or `python3 scripts/generate_assets.py` (from scratch, ffmpeg).
Full details — routes, asset layout, local run — in `scripts/README.md`.
The private reverse-mapping (real camera IDs, capture timestamps, source
filenames) lives **outside** this dataset, in the sibling
`microanomaly_private/` — it is not part of the release.
---
## The 4 cameras / anomalies
| camera | anomaly_id | event | query lang | chunks | videos | size |
|--------|------------|-------|------------|-------:|-------:|-----:|
| `cam_00` | anom_001 | UK police van on the Abbey Road zebra crossing | english | 47 | 24 | 1.55 GB |
| `cam_01` | anom_002 | car parked off-road in a park, Ust-Kut, Russia | russian | 89 | 69 | 2.30 GB |
| `cam_02` | anom_004 | pier camera abruptly blocked by a blue container, Japan | japanese | 146 | 131 | 2.90 GB |
| `cam_03` | anom_005 | person sitting on the tram tracks, Netherlands | dutch | 192 | 155 | 14.73 GB |
Each camera maps to a contiguous shard range (see *Sharding*).
---
## Identifiers
| field | example | identifies |
|-------|---------|------------|
| `chunk_id` | `KwNWdCt382cjtmDB_0000` | one chunk; the join key across all artifacts |
| `video_id` | `KwNWdCt382cjtmDB` | the source capture the chunk came from |
| `camera` | `cam_00` | the anonymized fixed camera (1 per anomaly) |
| `anomaly_id`| `anom_001` | the anomaly event (stable label from the candidate set) |
| `capture_index` | `0` | chronological rank of this capture within its camera (0-based) |
* `chunk_id == f"{video_id}_{chunk_index:04d}"`, always 4-digit padded.
* `camera` and `capture_index` are anonymized stand-ins for the real YouTube
camera ID and capture timestamp; the private mapping is held separately.
* No ID starts with `-`, so filenames are safe for `tar`/`find`/`xargs`.
---
## Annotations (`annotations/`)
### `queries.jsonl` — 4 rows (the per-camera task + grouping)
This is **not** a retrieval queries file — there is no user query. Each row is
one eval unit (one camera / anomaly) and lists **which videos/chunks belong to
that camera**: the candidate pool both evals run over. One object per camera:
```json
{
"query_id": "28",
"camera": "cam_00",
"anomaly_id": "anom_001",
"topic_id": "TMrQshDs8aH0",
"n_videos": 24,
"n_chunks": 47,
"videos": [
{"video_id": "KwNWdCt382cjtmDB", "capture_index": 0,
"chunks": ["KwNWdCt382cjtmDB_0000", "KwNWdCt382cjtmDB_0001"]},
...
]
}
```
It is **answer-agnostic** — it enumerates every video/chunk of the camera but
never marks which are anomalous (that's `judgments.jsonl` / `reference.json`).
`query_id` is kept as the stable join key into those two files. Regenerate with
`scripts/build_queries.py`. `videos` are ordered by `capture_index`
(chronological); `chunks` by chunk index within a video.
### `judgments.jsonl` — 474 rows (the IR pool)
The retrieval pool for each query is **the full set of that camera's chunks**,
judged exhaustively: the anomaly footage is relevant, everything else from the
same camera is a hard negative.
Positive (`relevance:1`):
```json
{"query_id": "28", "chunk_id": "PxRXEWfLiL3w_E7y_0000", "relevance": 1, "language": "english"}
```
Negative (`relevance:0`) — every negative is by construction `same_camera`;
the subset originally mined by a microvent retrieval signal carries its
`rank_source`:
```json
{"query_id": "28", "chunk_id": "JER-mXhTCCEY0kPx_0000", "relevance": 0,
"language": "english", "distractor_type": "same_camera", "rank_source": "qwen3vl8b"}
```
Per query: pool = all camera chunks; positives are the anomaly capture's chunk(s).
| query | camera | pool | positives | negatives | (mined by microvent) |
|-------|--------|-----:|----------:|----------:|---------------------:|
| q28 anom_001 | cam_00 | 47 | 4 | 43 | 10 |
| q29 anom_002 | cam_01 | 89 | 2 | 87 | 10 |
| q30 anom_004 | cam_02 | 146 | 3 | 143 | 10 |
| q31 anom_005 | cam_03 | 192 | 2 | 190 | 10 |
Positives are at capture grain expanded to chunks: every chunk of a relevant
capture is positive (so a 2-chunk anomaly capture contributes 2 positive rows).
In this release every one of the 40 mined negatives (10 per query) carries
`rank_source: qwen3vl8b` (visual keyframe embedding) — the visual signal alone
surfaced the seed pool. The field may also take `ppocr` (OCR) or `qwen3asr`
(ASR) from microvent's other retrieval signals, but none were selected here.
### `reference.json` — 4 topics
MiRAGE ground truth. `{version, topics:[...]}`; each topic carries the oracle
`chunks` (== the query's positives) and a `claims` list, where each claim maps
supporting `chunk_id → [modalities]` (`video-text`, `video-non-text`,
`audio-speech`, `audio-non-speech`). Oracle/evidence chunks are all within the
topic's own camera.
```python
import json
ref = json.load(open("annotations/reference.json"))
topics_by_id = {t["topic_id"]: t for t in ref["topics"]}
```
---
## videos/
`<chunk_id>.mp4` + `<chunk_id>.json` (per-chunk metadata: duration, resolution,
fps, source-chunk offsets) per record, packed contiguously. `catalog.csv`
columns:
```
chunk_id, video_id, chunk_index, chunk_count, shard_index,
duration_sec, chunk_start_sec, chunk_end_sec, size_bytes, vcodec, acodec,
camera, anomaly_id, capture_index
```
All video is H.264. 6 of 474 chunks have no audio stream (`acodec=NONE`,
silent live captures) — faithful to the source. Chunks were byte-copied out
of the multivent-raw shards (`-c copy`, no re-encode; md5-verified).
---
## shard_mapping.csv
Per-chunk crosswalk from the source `multivent-raw` shards to the microanomaly
shards — both human-readable provenance and the driver for rebuilding:
```
anomaly_id, camera, capture_index, video_id, chunk_id, chunk_index, chunk_count,
size_bytes, src_shard, src_shard_index, dst_shard, dst_shard_index
```
`src_shard` is the chunk's location in
`/exp/scale26/datasets/multivent-raw/videos/`; `dst_shard` is its microanomaly
shard. Rows are in pack order (`dst_shard → capture_index → video_id →
chunk_index`).
---
## Sharding
6 shards, one camera per shard except the large tram camera, which is split
into 3 (~5 GB cap). A source capture's chunks never span shards; chunks are
ordered by capture datetime.
| shard | camera | chunks | size |
|-------|--------|-------:|-----:|
| `shard_000000.tar` | cam_00 (anom_001) | 47 | 1.55 GB |
| `shard_000001.tar` | cam_01 (anom_002) | 89 | 2.30 GB |
| `shard_000002.tar` | cam_02 (anom_004) | 146 | 2.90 GB |
| `shard_000003.tar` | cam_03 (anom_005), part 1 | 62 | 4.95 GB |
| `shard_000004.tar` | cam_03 (anom_005), part 2 | 69 | 4.97 GB |
| `shard_000005.tar` | cam_03 (anom_005), part 3 | 61 | 4.81 GB |
---
## Provenance protection
Camera identifiers are anonymized (`cam_00`…`cam_03`) and capture timestamps
are replaced by a per-camera `capture_index`; original YouTube camera IDs,
capture datetimes, and source filenames are not in the release. `chunk_id` /
`video_id` are the already-anonymized multivent-raw identifiers. The private
mapping back to original identifiers is held in the sibling
`microanomaly_private/` and is not redistributed.
Note: query/persona/background text describes the underlying real events in
natural language, by design (these are the eval inputs).
---
## Provenance / build
Built from `/exp/scale26/datasets/multivent-raw/videos/` (the 4 anomaly
cameras, all captures), driven by the authoritative
`webdataset_private/catalog_v2.csv` mapping. Annotations were translated from
`microvent` (the 4 anomaly topics) into multivent-raw IDs via
`source_id`+`chunk_index`. Completeness was verified three ways (built catalog,
post-redownload source manifest, physical tar membership) — all 474 chunks
confirmed present.