# 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