drishya1's picture
Update annotations and dataset card
23aed67 verified
|
Raw
History Blame Contribute Delete
11.1 kB
---
task_categories:
- video-classification
language:
- en
tags:
- soccer
- football
- action-spotting
- temporal-action-localization
- sports
- video
size_categories:
- 10K<n<100K
---
# SN-GAR Action Spotting - video
64 whole-match broadcast videos at 398x224, with 87,939 action-spotting annotations across 10 labels.
This is one of a **pair** of datasets built in a single pass from the same raw
source. `SNGAR-Action-Spotting-Tracking` ships tracking tables,
`SNGAR-Action-Spotting-Video`
ships the broadcast video, and both carry **byte-identical ground truth** - the
same games, the same splits, the same event lists in the same order. A
tracking-vs-video comparison run on this pair measures the modality and nothing
else. The companion repo is the `tracking` one.
## Layout
```
annotations_train.json 45 games
annotations_valid.json 9 games
annotations_test.json 10 games
train/videos/<game_id>.mp4
valid/videos/<game_id>.mp4
test/videos/<game_id>.mp4
README.md
MANIFEST.sha256 sha256 of every shipped file
```
Payload: 28.2 GB across 64 games.
## Splits
| split | games | game ids | events |
|---|---:|---|---:|
| `train` | 45 | 3812-3840, 10502-10517 | 62,159 |
| `valid` | 9 | 3841-3849 | 12,091 |
| `test` | 10 | 3850-3859 | 13,689 |
Splits are assigned by **string-sorted** game id, so the `105xx` games sort
before the `38xx` ones. This is not random and not stratified - it is the
original SN-GAR contract, preserved so results stay comparable with prior work.
## Labels
| label | train | valid | test | total |
|---|---:|---:|---:|---:|
| PASS | 40,745 | 7,762 | 9,009 | **57,516** |
| PLAYER SUCCESSFUL TACKLE | 7,716 | 1,537 | 1,690 | **10,943** |
| OUT | 4,184 | 810 | 884 | **5,878** |
| HEADER | 3,986 | 870 | 867 | **5,723** |
| THROW IN | 1,834 | 372 | 392 | **2,598** |
| CROSS | 1,514 | 314 | 347 | **2,175** |
| FREE KICK | 1,261 | 255 | 272 | **1,788** |
| SHOT | 720 | 135 | 186 | **1,041** |
| GOAL | 135 | 23 | 30 | **188** |
| HIGH PASS | 64 | 13 | 12 | **89** |
| **all** | **62,159** | **12,091** | **13,689** | **87,939** |
## One label per instant
The task is single-label: each `position_ms` in a game carries exactly one
event. The source stream does not come that way - a throw-in is also a high
pass, a headed shot is both a header and a shot - so where several labels land
on the same millisecond, `LABEL_PRIORITY` selects the intended one.
Worth knowing when reading per-class results, because it is lossy *across*
labels rather than uniformly. Least-preserved: **HIGH PASS** keeps 89 of 2,697 (3%); **SHOT** keeps 1,041 of 1,559 (67%). Those classes are
sparse by construction rather than by data quality, so a model scoring badly on
them is not necessarily doing badly.
## Source
64 games: the 2022 FIFA World Cup (`3812`-`3859`) plus 16 further matches
(`10502`-`10517`). Two raw inputs per game:
| input | content |
|---|---|
| `RawEventsData/<game>.json` | hand-annotated event stream, ~2,000 events per game, each with `gameEvents` / `possessionEvents` / `initialTouch` sub-objects |
| `PlayerPoseTracking/<game>.jsonl.bz2` | bz2 line-delimited JSON, one line per tracked frame at ~29.97 Hz, ~186k lines per game (11.9M total) |
## How it was built
**1. Tracking to table.** Each `.jsonl.bz2` is decoded line by line and
flattened. The non-obvious part is player roles: the source exposes
`position_group_type` only inside `game_event`, which appears on roughly 1% of
frames. The builder therefore makes a **first full pass** to construct a
`team_id -> jersey -> position` map plus the game-static home/away team ids,
then a **second pass** stamping `position` and `positionGroup` onto every
player on every frame. This tags 99.98% of player-frames; the original
converter resolved team ids per frame and so tagged only the sparse event
frames.
Rows are then sorted by `(videoTimeMs, frameNum)` and deduplicated on
`videoTimeMs` keeping the first, which removes 42,950 rows corpus-wide and
leaves a strictly monotone clock.
**2. Events to labels.** Each source event maps to zero or more of the 10 SN-GAR
labels:
```
possessionEventType == "PA" (pass) bodyType == "HE" -> HEADER
ballHeightType == "A" -> HIGH PASS
passType == "H" -> THROW IN
otherwise -> PASS
== "CR" (cross) -> CROSS
== "SH" (shot) bodyType == "HE" -> HEADER |
always -> SHOT | all that
shotOutcomeType == "G" -> GOAL | apply
== "CH" (challenge) challengeWinnerPlayerId -> PLAYER SUCCESSFUL TACKLE
== "CL" (clearance) bodyType == "HE" -> HEADER
gameEventType == "OUT" -> OUT
setpieceType == "T" -> THROW IN
== "F" -> FREE KICK
```
Every rule that matches fires, so **one event can emit several labels**, each
becoming its own annotation at the same `position_ms`. A headed goal produces
three: HEADER, SHOT and GOAL. `position_ms` is `int(eventTime * 1000)`, and
`eventTime` is on the same video clock as `videoTimeMs` - which is what makes
step 3 possible.
**3. Alignment.** For each event, find the tracking row with the nearest
`videoTimeMs`. If it is further than `tolerance_ms` (10.0 ms)
away, drop the event: there is no tracking against which to localise it.
> **Note.** At 10.0 ms this window is narrower than half a native
> frame period (16.69 ms). Because the tracking clock ticks every
> ~33.4 ms, an event timestamped at an arbitrary millisecond can be up to
> 16.69 ms from the nearest row and still be perfectly aligned.
> This build therefore also drops 441 such events, chosen deliberately to
> reproduce the historical event count. A tolerance of 34.0 ms (one full
> frame period) keeps them.
```
94,285 extracted
-4,963 removed by priority dedup
-1,383 dropped as unalignable
=======
87,939 final
```
Most dropped events are post-match, where the source keeps annotating
tracking has stopped; at this tolerance the rest are the mid-frame
events described above.
**4. Write.** Both modalities' annotation files are written from the *same*
in-memory event lists - identical ground truth by construction rather than by a
follow-up sync - followed by the sha256 manifest and this card.
## Annotation format
OpenSportsLib v2, one file per split:
```json
{
"version": "2.0",
"task": "action_spotting",
"dataset_name": "action_spotting_video_valid",
"metadata": {"modality": "video", "aligned": true,
"tolerance_ms": 10.0,
"deduplicated_events": true,
"events_identical_across_modalities": true},
"labels": {"action": {"type": "single_label", "labels": ["PASS", "HEADER", ...]}},
"data": [{
"game_id": "3841",
"split": "valid",
"inputs": [{"type": "video_mp4", "path": "valid/videos/3841.mp4", "fps": 30.0}],
"events": [{"head": "action", "label": "PASS", "position_ms": 190256,
"gameTime": "1 - 00:00", "team": "home", "visibility": "visible"}]
}]
}
```
`position_ms` is the only field you need to localise an event. `gameTime` is
the `period - MM:SS` match clock, useful for display but **not** for
indexing.
## Payload format
### `{split}/videos/<game_id>.mp4`
Whole-match broadcast video, 398x224 at 29.97 fps (30000/1001), H.264.
Durations run 98.9-157.6 minutes (median 104.4); files are 359-685 MB
(median 431).
The video and the tracking clock **start at different points**: `videoTimeMs`
in the tracking modality is time on this video's timeline, so `position_ms`
addresses both modalities identically. Note that annotations declare
`"fps": 30.0` while the true rate is 29.97 - the OpenSportsLib video loader
reads the real rate from the container with OpenCV and ignores that field.
No tracking parquets are shipped here; the companion repo holds those.
## Loading
```python
import json, cv2
ann = json.load(open("annotations_test.json"))
game = ann["data"][0]
cap = cv2.VideoCapture(game["inputs"][0]["path"])
fps = cap.get(cv2.CAP_PROP_FPS) # 29.97, not the declared 30.0
for event in game["events"][:5]:
cap.set(cv2.CAP_PROP_POS_MSEC, event["position_ms"])
ok, frame = cap.read()
print(event["label"], event["position_ms"], ok, frame.shape)
```
## Time, and how to index it
The mp4 timeline is continuous, so unlike the tracking modality a frame index
here *is* linear in time - but two things still catch people out:
**The video starts before kickoff.** The first event in a game sits 40-211
seconds in, and the video runs through half-time and stoppages with no
annotations. Long unlabelled stretches are expected, not missing data.
**The rate is 29.97 fps, not 30.** Over a 100-minute match, indexing with 30.0
drifts by roughly 6 seconds by the final whistle - far beyond the 1-second
tight-mAP tolerance. Seek by milliseconds (`CAP_PROP_POS_MSEC`) or read the
real rate from the container; do not multiply `position_ms` by a hardcoded 30.
The companion tracking modality carries the same events on the same clock, but
its rows are *not* evenly spaced - see that repo's card before comparing the
two frame-by-frame.
## Other known properties
Real characteristics of the source, not defects to be cleaned:
- **Events do not cover the whole video.** Between the pre-kickoff head, the
post-match tail and stretches over a minute with no events, an unannotated
6.1-67.4 minutes per game (median 15.0) is expected, not missing data. The
long tail of that range is tracking outages, since events with no tracking
coverage were dropped from both modalities alike.
- **Three games have extra time** (`10506`, `10508`, `10517`).
- **Broadcast footage**, so it carries replays, cutaways and graphics. The
tracking modality has none of these - a point in its favour when comparing
the two.
## Build contract
| setting | value | why |
|---|---|---|
| label resolution | one label per instant, resolved by priority | see above |
| `tolerance_ms` | `10.0` | **tighter than half a native frame period** (16.69 ms), so it also rejects events that sit correctly on the clock between two rows |
| `dedupe_video_time_ms` | `True` | the source emits repeated `videoTimeMs`; removing them makes the clock strictly monotone |
| `aligned` | `True` | tracking cannot localise events outside its coverage |
| splits | 45 / 9 / 10 | alphabetical by game id, the original contract |
## Integrity
`MANIFEST.sha256` lists a sha256 for every shipped file:
```bash
sha256sum -c MANIFEST.sha256
```
## Access
Access is gated. Approval covers internal research use; check with the dataset
owners before redistributing.
Built by `build_sngar_spotting.py` on 2026-08-28.