🔍 Surveillance System

Real-time person detection · loitering alerts · motion heatmaps

YOLOv8n DeepSORT Flask OpenCV
⚠️ LOITERING DETECTED

🎥 Live Simulation Demo

Raw Feed
Processed Feed
0
Persons Tracked
0
Frames Processed
0
Loitering Alerts
0
FPS
👤

Person Detection

YOLOv8n runs at 4 fps on CPU; GPU accelerates to 30+ fps.

🎯

Persistent Tracking

DeepSORT assigns stable IDs so people can be followed across occlusions.

🚨

Loitering Alerts

Red bounding box + banner fires after ~37 s of stillness. Threshold is tunable.

🗺️

Motion Heatmap

A 36×48 grid accumulates activity; rendered as a JET colourmap overlay on end.

🌐

Browser-based UI

No desktop app — just open localhost:5000. Works on any OS.

Modular Codebase

Clean separation: core/tracker.py, heatmap.py, routes.py.

🏗️ Request Flow

Browser (JS) │ captures frame every 250 ms via <canvas> │ POST /upload { image: base64 JPEG } ▼ Flask /upload (routes.py) │ decode → YOLOv8n detect → DeepSORT track │ update grid_heatmap, check loitering │ annotate frame → return base64 + threat JSON ▼ Browser │ display annotated frame │ show/hide loitering banner ▼ [End Feed clicked] │ POST /end_feed │ overlay JET heatmap onto last frame └─ display final heatmap

🛠️ Run It Locally

Clone the repo

git clone https://github.com/YOUR_USERNAME/surveillance-system.git cd surveillance-system

Create a virtual environment & install deps

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

Start the server (weights auto-download on first run)

python app.py

Open in your browser

http://127.0.0.1:5000
View on GitHub