SilvioGiancola's picture
Upload README.md with huggingface_hub
c086a10 verified
---
pretty_name: "SoccerNet-XFoul (OSL Video Captioning)"
tags:
- soccer
- video
- captioning
- refereeing
- fouls
- sports-analytics
license: other
language:
- en
- fr
- de
- es
- it
- pt
- nl
viewer: false
---
# SoccerNet-XFoul Video Captioning Dataset
This repository provides the SoccerNet-XFoul dataset converted into the OpenSportsLab (OSL)
video captioning JSON format.
It contains three official splits:
- Train
- Validation
- Test
Each split consists of:
- A structured OSL JSON annotation file
- A corresponding folder containing all referenced video clips
---
## Dataset structure
```
annotations_train.json
annotations_valid.json
annotations_test.json
train/
valid/
test/
````
---
## Annotation files
### `annotations_train.json`
Contains all training samples in OSL video captioning format.
### `annotations_valid.json`
Contains validation samples for model development and tuning.
### `annotations_test.json`
Contains test samples for final evaluation and benchmarking.
Each JSON file includes:
- Structured metadata per video action
- Video inputs with relative paths
- Natural language captions describing the action
- Optional question context stored as metadata
---
## Video folders
Each annotation file references video clips stored in its corresponding folder:
| JSON file | Video folder |
|----------|-------------|
| `annotations_train.json` | `train/` |
| `annotations_valid.json` | `valid/` |
| `annotations_test.json` | `test/` |
The relative paths inside each JSON file directly map to these folders.
Example:
```json
"path": "test/action_0/clip_0.mp4"
````
corresponds to:
```
test/action_0/clip_0.mp4
```
---
## Downloading the video data using the JSON annotations
All video paths are explicitly listed inside the JSON files.
You can automatically download only the required video files by parsing the JSON annotations.
This ensures:
* No unnecessary downloads
* Perfect alignment between annotations and videos
* Fully reproducible dataset reconstruction
---
### Requirements
```bash
pip install huggingface_hub
```
---
### Download all test split videos
Run this command in the directory containing `annotations_test.json`:
```bash
python3 - <<'PY'
import json
from pathlib import Path
from huggingface_hub import hf_hub_download
DATASET_ID = "OpenSportsLab/soccernetpro-description-xfoul"
REVISION = "main"
JSON_FILE = Path("annotations_test.json").resolve()
root = JSON_FILE.parent
with JSON_FILE.open("r", encoding="utf-8") as f:
data = json.load(f)
paths = []
for item in data["data"]:
for inp in item["inputs"]:
if inp["type"] == "video":
paths.append(inp["path"])
paths = sorted(set(paths))
print(f"Downloading {len(paths)} video files...")
for p in paths:
dest = root / p
dest.parent.mkdir(parents=True, exist_ok=True)
hf_hub_download(
repo_id=DATASET_ID,
filename=p,
repo_type="dataset",
revision=REVISION,
local_dir=str(root),
local_dir_use_symlinks=False,
)
print("Download completed.")
PY
```
---
### Download other splits
Simply replace the JSON file:
```bash
annotations_train.json
annotations_valid.json
```
and rerun the same command.
---
## Advantages of JSON-driven video retrieval
* Guarantees annotation-video consistency
* Avoids downloading unused data
* Enables programmatic dataset reconstruction
* Supports scalable training pipelines
---
## Format
The dataset follows the OpenSportsLab (OSL) video captioning schema:
```json
{
"task": "video_captioning",
"dataset_name": "...",
"data": [
{
"inputs": [{ "type": "video", "path": "..." }],
"captions": [{ "lang": "en", "text": "..." }]
}
]
}
```
---
## Citation
If you use this dataset, please cite SoccerNet-XFoul and OpenSportsLab accordingly.