tobil/racing-gears
Racing Gear Digits Image classification dataset for detecting gear numbers (0-9) from racing onboard camera telemetry overlays, supplemented with MNIST digits for robustness. Similar in spirit to MNIST but for a specific real-world application: reading the gear indicator from racing car onboard video feeds in real-time. Dataset 5,964 training / 1,003 validation images 32×32 grayscale PNG images 10 classes (digits 0-9) Source column distinguishes racing-original… See the full description on the dataset page: https://huggingface.co/datasets/tobil/racing-gears.
Racing Gear Digits
Image classification dataset for detecting gear numbers (0-9) from racing onboard camera telemetry overlays, supplemented with MNIST digits for robustness.
Similar in spirit to MNIST but for a specific real-world application: reading the gear indicator from racing car onboard video feeds in real-time.
Dataset
- 5,964 training / 1,003 validation images
- 32×32 grayscale PNG images
- 10 classes (digits 0-9)
- Source column distinguishes
racing-original,paul-ricard-alpine,sebring-tobi-lap6,racing_aug(augmented), andmnist - Proper stratified split — 15% of each racing source held out for validation
- Augmented minority classes — racing digits with <200 training samples augmented via random shifts, brightness/contrast jitter, and Gaussian noise
Racing sources
Train distribution
Adding new video sources
- Extract gear crops from a video:
uv run python scripts/extract.py <video_path> <source_name> <x> <y> <w> <h> This creates raw/<source>/unlabeled/ frames and a composites/<source>/unlabeled.png contact sheet.
- Label by reading the contact sheet and creating
labels/<source>.csv:
start,end,label
0,14,5
15,39,6Each row maps a frame range (inclusive, 0-indexed) to a gear digit.
- Build the dataset:
uv run python scripts/build_dataset.py This reads all raw/ sources and labels/ CSVs, does stratified train/val splitting, augments minority classes, and writes the parquet files.
Augmentations (racing_aug)
For racing classes with fewer than 200 training samples, synthetic samples are generated:
- Random translation — up to ±3px shift in x/y
- Brightness jitter — 0.7–1.3×
- Contrast jitter — 0.8–1.2×
- Gaussian noise — σ=8, 30% probability
Usage
from datasets import load_dataset
ds = load_dataset("tobil/racing-gears")
# Filter to real racing images only
racing = ds["train"].filter(lambda x: x["source"] not in ("mnist", "racing_aug"))
# Standard training loop
for example in ds["train"]:
image = example["image"] # PIL Image, 32x32 grayscale
label = example["label"] # int 0-9
source = example["source"] # source identifierContext
Built for the mpv racing telemetry plugin which reads baked-in telemetry from racing onboard videos using mpv's screenshot-raw API and renders a live overlay with throttle/brake traces, gear indicator, and steering position.
The gear digit is detected using a small CNN (ONNX) called via LuaJIT FFI from mpv's Lua scripting environment at 30fps.
