Skip to content

praxshant/SentryVision

Repository files navigation

SentryVision - Critical Region Object Throw Detection System

Overview

SentryVision is an advanced system that detects fast-moving thrown objects (such as sacks, stones, or tools) entering a user-defined critical region in real-time video feeds. It is designed to minimize false positives from birds, animals, and natural environmental motion using state-of-the-art computer vision techniques.

Features

  • Real-time video input from webcam, RTSP streams, or video files
  • Interactive ROI (Region of Interest) selection with visual feedback
  • Advanced background subtraction (MOG2) with adaptive learning
  • High-speed motion and size filtering with configurable thresholds
  • Morphological noise reduction and contour analysis
  • Visual and console alerts with comprehensive event logging
  • Automatic snapshot saving on detection with metadata
  • Robust error handling and system recovery
  • Modern web-based dashboard with real-time monitoring
  • Event database with search and export capabilities
  • Video recording and playback functionality

File Structure

  • main.py: Main application and GUI interface
  • app.py: Web-based dashboard and API endpoints
  • motion_detector.py: Advanced motion detection logic with object tracking
  • roi_manager.py: ROI selection and management with persistence
  • alert_system.py: Alert generation and logging system
  • event_db.py: Event database management and querying
  • config.py: Configurable parameters and system settings
  • requirements.txt: Python dependencies
  • templates/: Web interface HTML templates
  • api/: API endpoints and dashboard logic

Setup

  1. Install dependencies:
    pip install -r requirements.txt
  2. Run the web dashboard:
    python app.py
  3. Run the desktop GUI (optional):
    python main.py

Usage

  • Web Interface: Open browser to http://localhost:5000
  • ROI Selection: Draw region of interest on video feed
  • Detection Control: Start/stop detection and recording
  • Event Review: Browse detected events and snapshots
  • Settings: Adjust detection parameters in real-time

Production Deployment

SentryVision is production-ready with Gunicorn and Nginx support.

Setup

  1. Install Nginx for reverse proxy
  2. Run web interface:
    gunicorn --worker-class eventlet -w 1 -b 0.0.0.0:5000 app:app
  3. Run with multiple workers for scalability:
    gunicorn --worker-class eventlet -w 4 -b 0.0.0.0:5000 app:app

Nginx Configuration

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:5000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # Static file serving
    location /static/ {
        alias /path/to/sentryvision/static/;
        expires 30d;
    }
}

Performance Optimization

  • Use load balancer with sticky sessions for multiple workers
  • Enable gzip compression in Nginx
  • Configure proper caching headers
  • Monitor system resources and adjust worker count accordingly

Security Features

  • Input validation and sanitization
  • Secure file upload handling
  • SQL injection prevention
  • XSS protection
  • Rate limiting support

Monitoring and Maintenance

  • Event logging with structured data
  • Performance metrics collection
  • Automatic error recovery
  • Database maintenance utilities

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published