Loading repository data…
Loading repository data…
VirgileDjimgou / repository
AI-powered driver monitoring and video telematics prototype built with Python, YOLOv8, DeepSORT, MediaPipe. The system analyzes webcam or offline video clips to detect risky driver behaviors such as phone use, distraction, drowsiness, yawning, and seatbelt absence, then tracks incidents over time, computes a cumulative driver safety score.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
DriveGuard AI is a multi-surface driver monitoring prototype.
It combines:
The project is built as a product prototype, not as a production fleet platform. Its goal is to demonstrate the full chain:
The repository already includes two presentable product surfaces: a web operations dashboard and an Android edge app.
Today the repository can:
Typical risk signals and events currently covered:
Located mainly in driver_monitoring/.
This is the original CV core of the project. It handles:
Key files:
driver_monitoring/pipeline.pydriver_monitoring/event_engine.pydriver_monitoring/runner.pydriver_monitoring/gui.pydriver_monitoring/cli.pyThe backend persists uploaded videos, analysis jobs, sessions, incidents, artifacts, and Android edge context.
Key files:
driver_monitoring/api.pydriver_monitoring/backend/models.pydriver_monitoring/backend/services.pydriver_monitoring/backend/jobs.pyLocated in apps/driveguard-web/.
This is the browser HMI for:
Located in apps/driveguard-android/.
This is the on-device demo client. It currently supports:
device, device_session, and edge_event to the backendflowchart LR
Video["Video or camera source"] --> Python["Python analysis runtime"]
Browser["Web dashboard"] --> Backend["FastAPI backend"]
Android["Android edge app"] --> Backend
Python --> Backend
Backend --> Review["Jobs, sessions, incidents, reports"]
Review --> Browser
flowchart TD
subgraph Sources["Input surfaces"]
DesktopVideo["Desktop video files"]
BrowserLive["Browser live capture"]
AndroidCamera["Android camera stream"]
PythonWebcam["Python webcam / CLI / GUI"]
end
subgraph Edge["Android edge runtime"]
AndroidCamera --> CameraX["CameraX preview and rolling capture"]
CameraX --> Face["MediaPipe face signals"]
CameraX --> Objects["LiteRT YOLOv8n object detection"]
Face --> Rules["Local rule engine and suspicion score"]
Objects --> Rules
Rules --> Buffer["Useful clip buffer pre/post trigger"]
Buffer --> Room["Room local storage"]
Room --> AndroidWorker["WorkManager upload retry"]
end
subgraph Backend["FastAPI backend and persistence"]
Uploads["Uploaded videos"]
Jobs["Analysis jobs"]
Sessions["Analysis sessions"]
Incidents["Incidents"]
Artifacts["Report artifacts"]
Devices["Device / device_session / edge_event"]
end
subgraph PythonCore["Python CV runtime"]
PythonWebcam --> Pipeline["Detection + tracking + face monitor + scoring"]
DesktopVideo --> Pipeline
Pipeline --> Reports["JSON / CSV session reports"]
end
BrowserLive --> Uploads
BrowserLive --> Jobs
AndroidWorker --> Uploads
AndroidWorker --> Jobs
Rules --> Devices
Reports --> Sessions
Reports --> Incidents
Reports --> Artifacts
Uploads --> Jobs
Jobs --> Pipeline
Jobs --> Sessions
subgraph Web["Vue dashboard"]
Home["Home"]
NewAnalysis["New Analysis"]
LiveDemo["Live Demo"]
JobsView["Jobs"]
SessionDetail["Session Detail"]
end
Backend --> Web
Devices --> SessionDetail
Sessions --> SessionDetail
Incidents --> SessionDetail
ADAS_YOLOv8-and-OpenCV/
|-- README.md
|-- config.toml
|-- yolo.py
|-- driver_monitoring/
| |-- api.py
| |-- cli.py
| |-- gui.py
| |-- pipeline.py
| |-- event_engine.py
| `-- backend/
|-- apps/
| |-- driveguard-web/
| `-- driveguard-android/
|-- tests/
|-- backend_uploads/
|-- backend_artifacts/
`-- outputs/
Important generated directories:
backend_uploads/ stores uploaded videosbackend_artifacts/ stores persisted exported reportsoutputs/ stores local Python analysis outputsThe main runtime configuration lives in config.toml.
It defines:
Current backend defaults include:
sqlite:///driveguard_ai.dbinlinebackend_uploadsbackend_artifactshttp://localhost:5173 and http://127.0.0.1:5173If you want the fastest meaningful demo, start with the backend + web dashboard.
python -m pip install ultralytics opencv-python pillow deep-sort-realtime mediapipe fastapi uvicorn sqlalchemy redis rq python-multipart httpx
From the repo root:
python -m uvicorn driver_monitoring.api:app --host 127.0.0.1 --port 8000
Useful URLs:
cd apps/driveguard-web
npm install
npm run dev
Open the Vite URL shown in the terminal, usually:
Recommended browser flow:
New Analysis for desktop upload or Live Demo for browser captureJobsSession DetailThis runs the original local desktop analysis UI.
python yolo.py
Entry point:
yolo.pyUse the CLI when you want local analysis without the Tkinter GUI.
Single video:
python -m driver_monitoring.cli video --source path/to/video.mp4
Batch:
python -m driver_monitoring.cli batch --sources clip1.mp4 clip2.mp4
Webcam:
python -m driver_monitoring.cli webcam --device 0
python -m uvicorn driver_monitoring.api:app --host 127.0.0.1 --port 8000
If you want queue-based processing later, the repository also contains a worker entry point:
python -m driver_monitoring.worker --config config.toml
Note:
config.toml currently uses queue_backend = "inline", so jobs run locally in-process unless you change the configDevelopment:
cd apps/driveguard-web
npm install
npm run dev
Production build:
cd apps/driveguard-web
npm run build
Build a debug APK:
cd apps/driveguard-android
.\gradlew.bat app:assembleDebug
Then:
SettingsDriveEventsAndroid backend URL tips:
http://10.0.2.2:8000http://192.168.x.x:8000Use this when you want to test the CV pipeline directly:
python -m driver_monitoring.cli video --source path/to/video.mp4
Result:
outputs/New AnalysisJobsSession DetailLive DemoDrive and start a sessionMain backend endpoints:
GET /healthPOST /videosPOST /analysis-jobsGET /analysis-jobsGET /analysis-jobs/{id}POST /analysis-jobs/{id}/cancelGET /sessionsGET /sessions/{id}GET /sessions/{id}/incidentsGET /sessions/{id}/edge-summaryGET /reports/{id}Android-specific backend endpoints:
PUT /mobile/devices/{device_id}PUT /mobile/device-sessions/{device_session_id}PUT /mobile/edge-events/{edge_event_id}Development-only immediate analysis endpoints:
POST /dev/analyze/videoPOST /dev/analyze/batchFrom the repo root:
python -m unittest discover -s tests -v
Current automated coverage includes:
Test files:
tests/test_backend_api.pytests/test_event_engine.pytests/test_reporting.pytests/test_scoring.pyThe web app currently does not have a dedicated automated test suite. The practical validation command today is the production build:
cd apps/driveguard-web
npm run build
This validates:
The Android app currently uses build validation as the main safety c