CoolFace
Apppublic

savageomiee/BlindSpot-Traffic

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
App README

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

  1. 1.Python ML Pipeline (`pipeline/`):
  2. 2.scorer.py: Applies Bayesian smoothing to raw violation counts, adjusting for officer exposure bias.
  3. 3.congestion.py: Clusters violations using DBSCAN near physical road junctions to determine proximity multipliers.
  4. 4.predictor.py: Trains an enforcement-blind XGBoost model on a temporal split (March 1, 2024) to predict risk, utilizing SHAP for local explanation.
  5. 5.optimizer.py: Formulates a linear programming optimization problem (solved via SciPy's HiGHS solver) to allocate a 1000-hour patrol budget.
  6. 6.precompute.py: Orchestrates pipeline computation and saves static outputs to /data.
  1. 1.FastAPI Backend (`api/`):
  2. 2.main.py: Exposes precomputed datasets via structured API endpoints and integrates Groq API (Llama 3 70B) for generating officer briefings.
  1. 1.React Frontend (`frontend/`):
  2. 2.Built on Vite, Tailwind CSS, Leaflet Maps, and Recharts.
  3. 3.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:

env
CSV_PATH=./dataset.csv
GROQ_API_KEY=your_groq_api_key_here

3. Installation

Install Python dependencies:

bash
python -m venv .venv
source .venv/bin/activate  # Or .venv\Scripts\activate on Windows
pip install -r requirements.txt

Install React Frontend dependencies:

bash
cd frontend
npm install

4. Running the Application

Launch both backend and frontend servers using the Python runner:

bash
python run.py

Or use the shell script (on unix environments):

bash
./run.sh
  • —Frontend Console: http://localhost:5173/
  • —API Docs: http://localhost:8000/docs