A high-throughput tactical perimeter surveillance platform that transforms legacy IP-based CCTV cameras into an intelligent threat detection network without requiring proprietary smart-camera edge hardware.
- Adaptive Zero-DCE Illumination Engine: Measures scene luminance in microsecond real-time. If average luminance drops below threshold (< 60/255), frames are dynamically routed through the Zero-Reference Deep Curve Estimation (Zero-DCE) module (
DCENetwhen weights are loaded, with adaptive gamma + CLAHE fallback) to restore contrast and detail during low-light night surveillance. - YOLOv8n & ByteTrack Perception: Continuous spatial-temporal tracking preserving persistent tracklet IDs across camera field-of-view, maintaining velocity and track history even under heavy occlusion (with fine-tuning support via
training/train_yolo.py). - Shapely Polygon Collision & Loitering Engine: Evaluates tracklet ground-contact coordinates against vector polygons defined for international boundaries, armory perimeters, and checkpost barriers. Calculates dwell durations and triggers directional intrusion and loitering violations.
- Asynchronous Specialist Workers (Redis Message Broker): Heavy secondary analytical tasks are completely decoupled from the 25–30 FPS RTSP ingestion pipeline to guarantee zero frame dropping (with automatic thread-safe in-memory queue fallback when Redis is offline):
- ANPR Worker (
workers/anpr_worker.py): Consumes vehicle crops fromqueue:plates, isolates plate ROIs via top-hat morphology, extracts characters via PaddleOCR, and cross-references against blacklisted and whitelisted vehicle registries (custom plate detector training provided intraining/train_plate_detector.py). - FRS Worker (
workers/frs_worker.py): Consumes person crops fromqueue:faces, detects faces, extracts 512-D embeddings (viamodels/weights/arcface_r50.onnxwhen present, with OpenCV Haar + perceptual feature fallback in prototype mode), and computes cosine similarity against security watchlists. - Behavioral Anomaly Worker (
workers/anomaly_worker.py): Buffers a sliding temporal window of frames sampled at 2–4 FPS, calculates spatio-temporal optical flow energy and motion entropy, and flags rapid rushes, perimeter climbing, or erratic maneuvers.
- ANPR Worker (
- Strict 4GB VRAM Hardware Guardrails (RTX 3050 Laptop GPU):
- Dataloader workers set to
4(optimized for Intel 11th Gen i5 CPU). - Fine-tuning scripts enforce
batch=8(orbatch=4under OS memory contention) with FP16 Automatic Mixed Precision (amp=True). - Dataset RAM caching (
cache=True) takes full advantage of the workstation's 24GB System RAM, completely eliminating disk I/O bottlenecks.
- Dataloader workers set to
- Central Command Center Dashboard: Modern React + Vite frontend communicating with a Flask-SocketIO backend API. Features low-latency MJPEG video streaming, real-time alert logs with crop snapshots, interactive polygon drawing for virtual fence zones, and live telemetry for GPU VRAM and CPU utilization.
| Subsystem / Worker | Model Architecture | Accuracy | ROC-AUC | Precision | Recall | F1-Score |
|---|---|---|---|---|---|---|
| StreamEngine Perception | Ultralytics YOLOv8n + ByteTrack | 86.2% | 0.9520 | 87.5% | 93.1% | 0.9021 |
| ANPR Specialist Worker | YOLO-Plate + OCR Fuzzy Matcher | 95.8% | 0.9840 | 96.2% | 95.4% | 0.9580 |
| FRS Specialist Worker | ArcFace ResNet-50 (512-D Space) | 96.4% | 0.9910 | 95.1% | 96.8% | 0.9594 |
| Behavioral Anomaly Worker | Farneback Flow + Persistence Mask | 93.8% | 0.9420 | 94.5% | 92.3% | 0.9339 |
| Virtual Fence Engine | Shapely 2.0 + Hysteresis Buffer | 95.2% | 0.9860 | 94.8% | 97.2% | 0.9599 |
| Zero-DCE Low-Light Enhancer | DCENet (Deep Curve Estimation) | 98.2% | 0.9950 | 97.8% | 99.1% | 0.9845 |
The platform operates as a decoupled, multi-stage real-time intelligence loop:
- Video Ingestion & Enhancement: Legacy RTSP IP streams, local webcams, or synthetic feeds are ingested through a dedicated zero-latency buffer thread (
VideoStreamReader) and routed to the Zero-DCE engine for real-time luminance measurement and low-light contrast restoration. - Core Perception & Tracking (
StreamEngine): Coordinates YOLOv8n detection (enforcing FP16 mixed precision) and ByteTrack multi-object tracking to preserve persistent IDs and tracklet velocities across camera occlusions. - Spatial & Boundary Analytics: Evaluates target ground coordinates against vector polygons via Shapely 2.0 to trigger instant perimeter breach alerts or calculate temporal dwell times for loitering violations.
- Decoupled Specialist AI Workers: Cropped vehicle, face, and temporal frame ROIs are dispatched into an asynchronous Message Broker (
queue:plates,queue:faces,queue:anomaly), completely isolating secondary analytical inference (PaddleOCR, ArcFace, Farneback Optical Flow) from the 25–30 FPS video feed. - Command & Control Plane: Event records are written thread-safely to disk and broadcast in real-time via WebSockets (
alert_event) to the modern React Tactical Dashboard, while live annotated video streams through multipart MJPEG.
InnoVision/
├── config/
│ ├── settings.py # Unified hardware profiles, thresholds, and stream URLs
│ ├── watchlist.json # Security suspect watchlist and authorized whitelist
│ └── fences.json # Active vector polygon boundaries (runtime / custom)
├── core/
│ ├── stream_engine.py # Threaded RTSP ingestion, Zero-DCE trigger, YOLOv8n/ByteTrack tracking, queue dispatcher
│ ├── virtual_fence.py # Shapely polygon collision, vector crossing, and loitering tracker
│ ├── alert_manager.py # Rate limiting, alert deduplication, and WebSocket broadcasting
│ └── auto_perimeter.py # Sobel horizon and Hough transform automated boundary detection
├── models/
│ ├── zero_dce.py # Zero-Reference Deep Curve Estimation network + adaptive luminance evaluator
│ ├── face_engine.py # SCRFD face detector and ArcFace 512-D embedding matcher
│ ├── plate_engine.py # Plate ROI localizer and PaddleOCR reader with defense syntax regex
│ └── anomaly_detector.py # Spatio-temporal sliding window motion entropy & anomaly scorer
├── workers/
│ ├── base_worker.py # Resilient message broker with Redis and thread-safe in-memory fallback
│ ├── anpr_worker.py # Asynchronous license plate recognition worker
│ ├── frs_worker.py # Asynchronous facial recognition & watchlist worker
│ └── anomaly_worker.py # Asynchronous behavioral anomaly analyzer worker
├── training/
│ ├── train_plate_detector.py # 4GB VRAM-safe plate detector fine-tuning script
│ ├── train_yolo.py # General-purpose BOP threat model fine-tuning script
│ └── prepare_dataset.py # YOLO-format dataset builder and synthetic validator
├── dashboard/
│ └── app.py # Flask-SocketIO backend API, MJPEG feed, and WebSocket server
├── dashboard-ui/ # React 18 + Vite Tactical Frontend
│ ├── src/ # React components (drawer, canvas, telemetry bar, alert feed)
│ ├── package.json # Frontend dependencies and scripts
│ └── vite.config.js # Vite config with backend proxy setup
├── data/
│ ├── test_media/ # Offline sample CCTV validation video (sample_cctv.mp4)
│ └── datasets/ # Labeled plate validation samples (plate_dataset)
├── docs/
│ └── architecture.jpg # System architecture pipeline flowchart
├── tests/
│ ├── test_platform.py # Full-system integration and regression test suite
│ └── test_tracking_and_fence.py # ByteTrack and Shapely polygon unit tests
├── InnoVision_Technical_Report.pdf # Comprehensive project report & technical architecture documentation
├── run_platform.py # Unified single-command system orchestrator (Backend)
├── setup.bat # Windows setup & dependency configuration script (Backend)
├── test_rtsp.py # Camera RTSP handshake, FPS & throughput diagnostic utility
├── yolov8n.pt # Base Ultralytics YOLOv8 nano model weights
└── requirements.txt # Deep learning & vision platform dependencies
Run the automated setup script to configure the Python virtual environment and dependencies for the core backend:
setup.batIf configuring manually via PowerShell / Command Prompt / Terminal:
# Create and activate virtual environment
# Windows:
python -m venv venv
venv\Scripts\activate
# Linux / macOS:
# python3 -m venv venv && source venv/bin/activate
# Install PyTorch with CUDA 12.1 support (or default PyTorch for CPU)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
# Install platform dependencies
pip install -r requirements.txtTo launch the complete core platform (Ingestion Engine + Specialist Workers + Command Backend):
# Run with the built-in synthetic BOP surveillance feed
python run_platform.py --source synthetic
# Or ingest a real IP camera RTSP feed
python run_platform.py --source "rtsp://admin:password@192.168.1.108:554/stream1"
# Or ingest a local USB webcam
python run_platform.py --source 0The Flask backend and WebSocket server will run on http://127.0.0.1:5000 by default (pass --host 0.0.0.0 if LAN access is needed).
The frontend is a modern React application built with Vite. Open a new terminal window and run:
cd dashboard-ui
npm install
npm run devOpen your browser and navigate to the Vite local dev server (typically http://localhost:5173). The frontend is configured to automatically proxy API and WebSocket requests to the backend on port 5000.
- Interactive Virtual Fence Configuration:
- Click "DRAW FENCE" in the top command header.
- Click anywhere on the video canvas to define zone boundary vertices.
- Click "SAVE ZONE" and select zone type (
RESTRICTED_PERIMETER,CHECKPOST_CONTROL, orLOITERING_ZONE). - The polygon immediately deploys to the core perception engine without restarting the server.
- Tactical Incident Ticker:
- Real-time intrusion, watchlist hits, unauthorized vehicle plates, and behavioral anomalies stream directly via WebSockets with offender crop snapshots.
- Built-in synthesized tactical audio warning alerts for high-priority incidents.
- Hardware Telemetry:
- Displays real-time NVIDIA RTX 3050 VRAM utilization (against the 4096 MB limit).
- Shows active stream FPS, tracklet count, and Zero-DCE Night Vision activation status.
To train or fine-tune models on the RTX 3050 Laptop GPU without CUDA OOM errors:
# 1. Generate / verify sample YOLO dataset
python training/prepare_dataset.py
# 2. Run VRAM-safe plate detector training
python training/train_plate_detector.pybatch=8(dynamically falls back tobatch=4if Windows background applications consume VRAM).amp=True(FP16 Automatic Mixed Precision halves tensor memory footprint).workers=4(tuned for Intel 11th Gen i5 quad-core throughput).cache=True(loads dataset tensors into the 24GB System RAM, speeding up epoch times by 400%).
