HelmetWatch is a practical starting point for a city-police safety platform that detects likely helmet violations, stores evidence, and surfaces hotspots for follow-up action.
Detecting individual helmet use from true live satellite imagery is generally not realistic because the spatial resolution is too low for reliable per-person safety analysis. This MVP is designed so the same pipeline can ingest:
- traffic camera frames
- drone or aerial feeds
- roadside CCTV
- high-resolution geotagged images
You can still plug in any upstream source labeled as "satellite" later, but the compliance detector should ideally run on higher-resolution imagery.
- FastAPI backend
- SQLite incident store
- upload-based video analysis pipeline
- heuristic detection pipeline with replaceable detector interface
- police dashboard with summary cards, hotspot map, source coverage, and recent incidents
- API endpoints for frame ingest, video ingest, list, pipeline status, and analytics
backend/
app/
api/
services/
static/
templates/
media/
uploads/
- Create a virtual environment.
- Install dependencies:
pip install -r requirements.txt- Run the server:
uvicorn backend.app.main:app --reload- Open the dashboard:
http://127.0.0.1:8000/
curl -X POST http://127.0.0.1:8000/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{
"source_name": "Ward 12 Junction Camera",
"area_name": "Ward 12",
"latitude": 25.5941,
"longitude": 85.1376,
"captured_at": "2026-04-17T08:30:00",
"image_url": "https://example.com/frame-001.jpg",
"vehicle_count": 9
}'curl -X POST http://127.0.0.1:8000/api/v1/analyze/video \
-F "media=@sample.mp4" \
-F "source_name=Ward 12 Drone Patrol" \
-F "area_name=Ward 12" \
-F "latitude=25.5941" \
-F "longitude=85.1376" \
-F "captured_at=2026-04-17T08:30:00" \
-F "source_type=drone" \
-F "sample_every=30"GET /api/v1/healthbasic health checkGET /api/v1/pipelinedetector mode and CV availabilityPOST /api/v1/analyzeanalyze a single structured frame observationPOST /api/v1/analyze/videoupload and sample a video fileGET /api/v1/incidentslist incidentsGET /api/v1/statsaggregate dashboard analytics
The active detector lives in backend/app/services/detection.py. Replace the HeuristicHelmetDetector with a trained pipeline such as:
- vehicle detector to isolate bikes and scooters
- rider or person detector
- helmet classifier on rider head crops
- confidence thresholding and evidence frame export
The video ingestion flow lives in backend/app/services/video.py, so you can later add:
- RTSP ingestion
- scheduled stream polling
- frame buffering
- clip retention for police evidence
If you already created helmetwatch.db with the older schema, remove it before the first run of this upgraded version so SQLite can recreate the new columns cleanly.
- replace the heuristic detector with a real helmet detector
- connect to RTSP/video stream ingestion
- add geofencing and beat-level police assignment
- add evidence review workflow and audit trail
- add anonymization and retention policies