Instructions to use maco018/in-car-distraction-yolo26 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use maco018/in-car-distraction-yolo26 with ultralytics:
# Couldn't find a valid YOLO version tag. # Replace XX with the correct version. from ultralytics import YOLOvXX model = YOLOvXX.from_pretrained("maco018/in-car-distraction-yolo26") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
ProVoice Distraction Classifiers β YOLO26 series
In-cabin driver-distraction image classifiers, fine-tuned from the full
Ultralytics YOLO26 size series (n / s / m / l / x)
on the State Farm Distracted Driver Detection
dataset. They classify a driver-facing cabin frame into one of four states β
safe, phone, drink, distracted β and are the perception backbone of the
ProActivity / ProVoice driver-monitoring stack.
Why this exists. Earlier ProVoice builds detected phones/drinks with a COCO-pretrained object detector. COCO is general web photography (phones at parties, cups on desks) and does not match a fixed driver-facing camera. These models are trained entirely on real in-cabin footage, so they target the actual deployment domain.
| Task | Image classification (whole-frame, 4 classes) |
| Base models | YOLO26-cls n/s/m/l/x |
| Training data | State Farm Distracted Driver Detection (22,424 labelled in-cabin images) |
| Input size | 224 Γ 224 (see β οΈ note below) |
| Best variant | l/model.pt β 94.6 % top-1 on unseen drivers |
| License | AGPL-3.0 (inherited from Ultralytics) |
Classes
| id | label | meaning | State Farm source classes |
|---|---|---|---|
| 0 | safe |
attentive, hands on wheel | c0 (safe driving) |
| 1 | phone |
texting or calling | c1βc4 (text/talk, left & right) |
| 2 | drink |
drinking | c6 (drinking) |
| 3 | distracted |
other distraction | c5 (radio), c7 (reaching behind), c8 (hair/makeup), c9 (talking to passenger) |
The 10 original State Farm behaviour classes are merged into these 4 ProVoice labels at dataset-build time.
Model variants
Validation is subject-aware: the 26 drivers are split 21 train / 5 val, so no driver appears in both splits β accuracy reflects generalisation to new people, not memorised faces.
| variant | params | size | top-1 acc | download |
|---|---|---|---|---|
| yolo26n-cls | 2.8 M | 3.0 MB | 89.2 % | n/model.pt |
| yolo26s-cls | 10 M | 10.5 MB | 91.3 % | s/model.pt |
| yolo26m-cls | 22 M | 19.9 MB | 91.3 % | m/model.pt |
| yolo26l-cls β | 26 M | 24.7 MB | 94.6 % | l/model.pt |
| yolo26x-cls | 59 M | 54.4 MB | 91.2 % | x/model.pt |
β l is the recommended default (best accuracy; classification at 224 px is
cheap even at this size). Use n or s if you need the lowest latency.
Each subfolder also contains results.csv, results.png (training curves), an
example.py, and a per-variant model card.
Usage
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
# Replace <your-hf-username> with the account that owns this repo.
REPO = "<your-hf-username>/in-car-distraction-yolo26"
# Pick a size: n / s / m / l / x (l = most accurate)
weights = hf_hub_download(REPO, "l/model.pt")
model = YOLO(weights)
# β οΈ ALWAYS run inference at imgsz=224 (the training resolution).
result = model.predict("driver_frame.jpg", imgsz=224)[0]
label = model.names[result.probs.top1] # "safe" | "phone" | "drink" | "distracted"
conf = float(result.probs.top1conf)
print(label, round(conf, 3))
β οΈ Run at
imgsz=224. These are classification models trained at 224 Γ 224. Running them at a detector-style 640 px collapses the predictions (the classifier head sees the wrong feature scale). Always passimgsz=224.
Use inside ProVoice
Point the runtime at any variant via the PROVOICE_YOLO_WEIGHTS environment
variable, or drop the file at
src/ProVoice/trained_models/distraction/distraction_best.pt. ProVoice's
perception.py auto-detects the classification task and selects 224 px
automatically.
Training data
State Farm Distracted Driver Detection β 22,424 labelled images of 26 drivers from a fixed in-cabin, driver-facing camera, across 10 behaviour classes.
- Split: subject-aware, 21 drivers train (18,047 images) / 5 drivers val (4,377 images).
- Label remap: 10 State Farm classes β 4 ProVoice labels (table above).
- Builder script:
scripts/build_statefarm_dataset.pyin the ProActivity repo.
Per-split class counts:
| split | safe | phone | drink | distracted | total |
|---|---|---|---|---|---|
| train | 2,039 | 7,352 | 1,859 | 6,797 | 18,047 |
| val | 450 | 1,904 | 466 | 1,557 | 4,377 |
Training configuration
| Base weights | yolo26{n,s,m,l,x}-cls.pt (Ultralytics) |
| Epochs | 50 (early stopping, patience 15) |
| Image size | 224 |
| LR schedule | cosine |
| Hardware | single NVIDIA RTX 5080 (CUDA 12.8) |
Reproduce:
uv run --no-sync python -m ProVoice.train_distraction \
--task classify \
--data datasets/distraction_sf \
--weights yolo26l-cls.pt \
--epochs 50 --imgsz 224 --cos-lr --device 0
Limitations
- Camera domain. Trained on the State Farm rig (passenger-side dashboard view, daylight). A different camera angle, mounting position, or night/IR illumination will degrade accuracy β collect a small set from your own camera to validate or fine-tune.
safeis the hardest class (~90 %); it is visually close todistractedsub-behaviours such as adjusting the radio or talking to a passenger.- Single-frame. No temporal smoothing β distraction is temporal, so a short rolling-window vote over consecutive frames is recommended downstream to suppress flicker.
smokeis not covered (absent from State Farm); add a smoking dataset to extend the label set.
License & attribution
- Models / code: AGPL-3.0, inherited from Ultralytics.
- Training images: from the State Farm Distracted Driver Detection Kaggle competition; subject to that competition's data terms. The images themselves are not redistributed in this repo β only model weights.
Built with Ultralytics YOLO26 Β· data from State Farm Distracted Driver Detection.
- Downloads last month
- 42