Skip to content

BehzadHassan/SentinelCV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SentinelCV - Intelligent Perimeter Breach System

SentinelCV is a state-of-the-art, real-time security surveillance pipeline. It ingests live video feeds, detects objects and people with ultra-high precision, tracks them across frames, and triggers automated alerts based on highly customizable polygon zones (e.g., restricted entry, loitering, abandoned objects).

It was built from the ground up to offer a sleek, professional-grade Next.js frontend dashboard paired with a blazingly fast Python/FastAPI backend powered by Ultralytics YOLOv8 and ByteTrack.


System Showcase

Live Monitoring Dashboard

A dynamic, real-time monitoring dashboard that displays the live camera feed, active zones, and system status. It tracks all objects and dynamically displays their class labels and confidence scores.

Live Feed

Alerts History & Analytics

A comprehensive alerts history dashboard that tracks every single breach, loitering incident, and abandoned object. It saves snapshots of the exact moment the breach occurred.

Alerts History Alerts Filter Analytics Dashboard Analytics Details

Zone Calibration Editor

A fully interactive tool to visually draw and map out surveillance zones directly on top of your camera feed.

Zone Calibration

Configuration & Settings

Easily switch between live webcams, RTSP streams, and uploaded video files.

System Settings


Architecture & Design

SentinelCV is built on a decoupled, microservice-inspired architecture to ensure that heavy AI inference does not bottleneck the UI or API layers.

1. The Computer Vision Pipeline (Backend)

  • Video Source: Asynchronous frame ingestion from Webcams, MP4 files, or RTSP streams to prevent I/O blocking.
  • Detector & Tracker (YOLOv8 + ByteTrack): Detects all objects in the frame (cars, animals, people) but intelligently filters the ByteTrack persistent ID assignments and alerts to specific threat vectors (people, backpacks, suitcases).
  • Zone Engine: A heavily optimized OpenCV ray-casting/polygon math logic engine that calculates centroids of bounding boxes to determine if a target has breached a "Restricted Zone", surpassed a threshold timer in a "Loitering Zone", or left a bag in an "Abandoned Object Zone".
  • Alert Manager: Deduplicates noisy alerts, captures high-res frame snapshots, saves records to SQLite, and broadcasts real-time alerts via WebSockets.
  • FastAPI Server: Serves the MJPEG stream to the frontend with zero-latency, handles REST endpoints for zone configurations, and manages the WebSocket connections.

2. The User Interface (Frontend)

  • Next.js & React: A highly responsive, single-page application built on Next.js.
  • Modern Aesthetics: Designed with a "cyberpunk/security-terminal" aesthetic using Tailwind CSS. It features glassmorphism, glowing accents, and high-contrast color palettes specifically designed for low-light surveillance monitoring rooms.
  • Interactive Canvas: The Zone Calibration tool uses the native HTML5 <canvas> API to allow users to click and draw complex polygons, which are serialized and sent to the backend.

Technology Stack

  • AI/ML: Ultralytics YOLOv8, ByteTrack, PyTorch
  • Computer Vision: OpenCV (cv2)
  • Backend: Python, FastAPI, Uvicorn, SQLite, WebSockets
  • Frontend: TypeScript, Next.js, React, Tailwind CSS, Lucide Icons

Getting Started

Prerequisites

Make sure you have conda installed and Node.js (v18+) for the frontend.

1. Backend Setup

  1. Create and activate the conda environment:
    conda create -n cv python=3.10
    conda activate cv
  2. Install the required Python packages:
    pip install -r requirements.txt
  3. Run the backend server:
    uvicorn backend.main:app --host 0.0.0.0 --port 8000

(Note: The YOLOv8 weights will automatically download on the first run).

2. Frontend Setup

  1. Open a new terminal and navigate to the frontend directory:
    cd frontend
  2. Install the Node modules:
    npm install
  3. Start the Next.js development server:
    npm run dev
  4. Open http://localhost:3000 in your browser.

How It Was Created

SentinelCV was built with the goal of creating a completely automated, AI-driven perimeter security tool that rivals enterprise software.

The core challenge was optimizing the tracking logic. Initially, naive object detection would trigger false positives on every frame. By implementing ByteTrack for persistent ID assignment and a cooldown-based Alert Manager, the system accurately filters out noise and only alerts on genuine threats. The visual identity of the frontend was carefully curated to look exactly like modern command-center dashboards, prioritizing data density and immediate visual feedback via red/amber/green status indicators.

About

An intelligent, real-time perimeter security surveillance system powered by YOLOv8, ByteTrack, and FastAPI, featuring a sleek Next.js dashboard for custom zone alerts (breaches, loitering, abandoned objects).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors