savageomiee/BlindSpot-Traffic
0
BlindSpot: AI-Powered Illegal Parking Intelligence System
BlindSpot is an illegal parking intelligence system designed for the Bengaluru Traffic Police. It transitions parking enforcement from reactive patrol patterns (which over-index on active officer location) to proactive, risk-weighted spatial-temporal deployment.
[!NOTE] For a deep dive into the mathematical formulations, machine learning methodologies (Bayesian smoothing, DBSCAN clustering, XGBoost modeling, SHAP explanations), and API/Frontend specifications, please check the System Documentation.
Architecture Overview
- Python ML Pipeline (`pipeline/`):
scorer.py: Applies Bayesian smoothing to raw violation counts, adjusting for officer exposure bias.congestion.py: Clusters violations using DBSCAN near physical road junctions to determine proximity multipliers.predictor.py: Trains an enforcement-blind XGBoost model on a temporal split (March 1, 2024) to predict risk, utilizing SHAP for local explanation.optimizer.py: Formulates a linear programming optimization problem (solved via SciPy's HiGHS solver) to allocate a 1000-hour patrol budget.precompute.py: Orchestrates pipeline computation and saves static outputs to/data.
- FastAPI Backend (`api/`):
main.py: Exposes precomputed datasets via structured API endpoints and integrates Groq API (Llama 3 70B) for generating officer briefings.
- React Frontend (`frontend/`):
- Built on Vite, Tailwind CSS, Leaflet Maps, and Recharts.
- Provides three dashboards: Command Console, Patrol Briefing, and Analyst Workspace.
Getting Started
1. Prerequisites
- Python 3.10+
- Node.js 18+
2. Environment Setup
Create a .env file in the root folder with:
CSV_PATH=./dataset.csv
GROQ_API_KEY=your_groq_api_key_here3. Installation
Install Python dependencies:
python -m venv .venv
source .venv/bin/activate # Or .venv\Scripts\activate on Windows
pip install -r requirements.txtInstall React Frontend dependencies:
cd frontend
npm install4. Running the Application
Launch both backend and frontend servers using the Python runner:
python run.pyOr use the shell script (on unix environments):
./run.sh- Frontend Console:
http://localhost:5173/ - API Docs:
http://localhost:8000/docs
