Skip to content

Repository files navigation

🛡️ Campus Sentinel — AI-Powered Campus Security & Threat Detection Platform

Streamlit App GitHub repo Python YOLOv11 FastAPI

Live Deployment: https://campussentinel-njcgrtipxgucvuuckmedby.streamlit.app/


🌐 Live Demo & Deployment

Access the interactive live application on Streamlit Community Cloud: 👉 Launch Campus Sentinel Live Demo


📌 Overview

Campus Sentinel is an intelligent, real-time computer vision and surveillance monitoring platform engineered for academic institutions, research facilities, and smart campuses. Powered by YOLOv11 object detection and dynamic threat-scoring heuristics, Campus Sentinel automates perimeter security, restricted zone monitoring, crowd density tracking, and anomaly detection.

🌟 Key Capabilities

  • 🎯 Real-Time Threat Detection: Powered by Ultralytics YOLOv11 for high-accuracy person, vehicle, and object identification.
  • 🛑 Restricted Zone Incursion: Configurable geofenced polygons/bounding zones with instant alert triggers.
  • 👥 Crowd Density & Loitering Analytics: Tracks lingering duration and sudden surges in localized foot traffic.
  • 📊 Dynamic Threat Gauge (0–100): Real-time mathematical scoring matrix that elevates threat levels during simultaneous incidents and decays over calm periods.
  • 🗂️ Incident Evidence & Logging: Automated logging, threat categorization, and CSV export for post-incident audits.
  • ⚡ Multi-Tier Architecture:
    • Streamlit Web Application for instant cloud deployment & demonstration.
    • Single-File Browser Client (campus_sentinel/index.html) for client-side evaluation.
    • Production FastAPI Backend with ByteTrack, multi-camera RTSP ingestion, WebSockets, and PostgreSQL.

🏗️ Architecture

                                 ┌─────────────────────────────────┐
                                 │      CCTV / RTSP / Webcam       │
                                 └──────────────┬──────────────────┘
                                                │
                                                ▼
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│                               Campus Sentinel Core Engine                               │
│                                                                                         │
│   ┌────────────────────┐      ┌────────────────────┐      ┌─────────────────────────┐   │
│   │ YOLOv11 Object     │ ───► │ ByteTrack Motion   │ ───► │ Threat Scoring Matrix   │   │
│   │ Detection Pass     │      │ & Loitering Engine │      │ (Decay & Surge Logic)   │   │
│   └────────────────────┘      └────────────────────┘      └────────────┬────────────┘   │
└────────────────────────────────────────────────────────────────────────┼────────────────┘
                                                                         │
                                       ┌─────────────────────────────────┴───────────────────────────────┐
                                       ▼                                                                 ▼
                    ┌─────────────────────────────────────┐                           ┌─────────────────────────────────────┐
                    │      Streamlit Cloud Interface      │                           │      FastAPI + WebSocket Push       │
                    │  (Live Demo & Visual Analytics)     │                           │    (Production Ingest & Alerts DB)  │
                    └─────────────────────────────────────┘                           └─────────────────────────────────────┘

🚀 Getting Started Locally

1. Run the Streamlit Application

# Clone the repository
git clone https://github.com/harish07-ctrl/campus_sentinel.git
cd campus_sentinel

# Install requirements
pip install -r requirements.txt

# Launch the Streamlit dashboard
streamlit run streamlit_app.py

2. Run the Production FastAPI Backend

cd campus_sentinel_backend/campus_sentinel_backend

# Install backend dependencies
pip install -r requirements.txt

# Start backend server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Or run everything using Docker Compose:

docker compose up --build

📁 Repository Structure

campus_sentinel/
├── README.md                          # Main project overview & deployment link
├── streamlit_app.py                   # Streamlit Community Cloud live application
├── requirements.txt                   # Dependencies for Streamlit deployment
├── yolo11n.pt                         # YOLOv11 nano model weights
├── campus_sentinel/
│   └── index.html                     # Standalone browser-based prototype & simulator
└── campus_sentinel_backend/
    └── campus_sentinel_backend/       # Enterprise FastAPI + WebSocket backend
        ├── app/
        │   ├── main.py                # FastAPI entrypoint
        │   ├── detection.py           # YOLOv11 inference pipeline
        │   ├── tracker.py             # ByteTrack multi-object tracking
        │   ├── threat_scoring.py      # Real-time threat gauge logic
        │   ├── camera_manager.py      # Ingestion & camera streaming
        │   └── websocket_manager.py   # Live WebSocket alert broadcast
        ├── Dockerfile
        ├── docker-compose.yml
        └── README.md

🔗 Live Links


📄 License

Distributed under the MIT License. See LICENSE for more information.

Releases

Packages

Contributors

Languages