CoolFace
Datasetpublic

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.

sourceHugging Facemitupdated 4mo agoView on Hugging Face
1likes101downloads
Dataset Card

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), and mnist
  • 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

SourceGearsStyle
TDS Racing IMSA Sebring 2026 (original)1-6White digit on gray RPM gauge face
Sebring Q Tobi Lap 61-6White digit on dark semi-transparent overlay
Paul Ricard Alpine LMPh1-7White digit on dark circle
MNIST supplement0-9Handwritten digits (generalization)

Train distribution

DigitRacing (orig)SebringPaul RicardAugMNISTTotal
00000196196
1864363501961,167
21,3447410501961,719
3364991620196821
43768491196396
5107138490196490
610679350196416
719045137196397
80000196196
90000196196

Adding new video sources

  1. 1.Extract gear crops from a video:
bash
   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.

  1. 1.Label by reading the contact sheet and creating labels/<source>.csv:
csv
   start,end,label
   0,14,5
   15,39,6

Each row maps a frame range (inclusive, 0-indexed) to a gear digit.

  1. 1.Build the dataset:
bash
   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

python
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 identifier

Context

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.