File size: 2,863 Bytes
f94b78d f0562ce f94b78d f0562ce f94b78d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# State Farm Distracted Driver Detection Model
## Model Description
This is a YOLOv8 classification model trained on the State Farm Distracted Driver Detection dataset. The model is designed to classify driver behavior into 10 distinct categories to detect distracted driving activities.
## Model Architecture
- **Model**: YOLOv8n-cls (YOLOv8 Nano for classification)
- **Input Size**: 224x224 pixels
- **Number of Classes**: 10
- **Parameters**: 1.45 million
- **Training Framework**: Ultralytics YOLO
## Class Labels
The model predicts the following 10 classes of driver behavior:
- c0: safe driving
- c1: texting - right
- c2: talking on the phone - right
- c3: texting - left
- c4: talking on the phone - left
- c5: operating the radio
- c6: drinking
- c7: reaching behind
- c8: hair and makeup
- c9: talking to passenger
## Training Details
- **Training Epochs**: 12
- **Final Training Loss**: 0.0603
- **Validation Accuracy**: 99.6%
- **Top-5 Accuracy**: 100%
- **Training Time**: 0.27 hours
- **Dataset Split**: 70% train, 15% validation, 15% test
- **Total Training Images**: 15,692
- **Total Validation Images**: 3,358
## Performance Metrics
The model achieved excellent performance on the validation set:
- Top-1 Accuracy: 99.6%
- Top-5 Accuracy: 100%
- Consistent convergence across all epochs
- Low validation loss indicating good generalization
## Installation and Usage
### Requirements
```bash
pip install ultralytics
```
## Basic Usage
```
from ultralytics import YOLO
# Load the model from Hugging Face
model = YOLO('Safe-Drive-TN/State-farm-detection')
# Perform prediction on an image
results = model.predict('path_to_your_image.jpg')
# Get prediction results
predicted_class = results[0].probs.top1
confidence_score = results[0].probs.top1conf
class_names = results[0].names
print(f"Predicted class: {class_names[predicted_class]}")
print(f"Confidence: {confidence_score:.2%}")
````
## Dataset Information
The model was trained on the State Farm Distracted Driver Detection dataset, which contains images of drivers performing various activities in a vehicle. The dataset ensures driver separation between train and test splits to prevent data leakage.
## Limitations
The model was trained in a controlled environment and may not generalize perfectly to real-world driving conditions
Performance may vary with different camera angles, lighting conditions, and vehicle types
The model classifies single frames and does not incorporate temporal information
## Citation
If you use this model, please cite:
```
@misc{state-farm-detection-2025,
title = {State Farm Detection in Vehicle — Yolov8n-cls},
author = {Malek Messaoudi, Yassine Mhirsi},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Safe-Drive-TN/State-farm-detection}}
}
````
## License
License : MIT |