This notebook contains code of car phone violations tailored in Rwandan context with local datasets
# Car-Phone Violations — Driver Distraction Detection (YOLOv8)
This repository contains a YOLOv8-based object detection workflow for identifying distracted driving behaviors (e.g., phone use while driving). It includes the trained model artifact (`driver_model.pt`), a training/validation notebook, and dataset integration via Roboflow.
- Researcher ID:
orcid.org
- Research lab:
alabs.kwartisans.com
## Contents
- `driver_model.pt`: Trained YOLOv8 model (detect)
- `train_yolov8_object_detection_on_custom_dataset.ipynb`: End-to-end setup, training, validation, inference
- `datasets/`: Roboflow-exported dataset structure (train/valid/test)
## Quick Start (Windows)
1. Create and activate a virtual environment:
```powershell
python -m venv .venv
.venv\Scripts\activate
```
2. Install core packages:
```powershell
pip install ultralytics==8.2.103 supervision
```
3. Install Roboflow. If you encounter Windows file lock issues (WinError 5), either:
- Preferred:
```powershell
pip install requests-toolbelt
pip install roboflow --no-deps
```
- Or standard (may update OpenCV dependencies):
```powershell
pip install roboflow
```
## Dataset
The dataset is downloaded via Roboflow in the notebook and placed under `datasets/ /`. It follows the YOLOv8 format with `images/` and `labels/` for each split (`train/`, `valid/`, `test/`).
To re-download programmatically in Python (with your API key and workspace/project/version):
```python
from roboflow import Roboflow
rf = Roboflow(api_key=" ")
project = rf.workspace(" ").project(" ")
version = project.version( )
dataset = version.download("yolov8")
```
## Training Procedure
Training was conducted with YOLOv8 using the following typical configuration (see the notebook for exact commands and any changes):
- Base model: `yolov8s.pt`
- Task: `detect`
- Epochs: `50`
- Image size: `800`
- Plots: `True`
CLI example (inside the notebook or terminal):
```powershell
# from repository root
# ensure dataset.loca …