Skip to content

Ashu-213/GaurdX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ IntelliGuardAI - Smart Surveillance System

An AI-powered surveillance system with real-time threat detection. This streamlined codebase supports a modern web interface and a simple CLI stream. Desktop GUI has been removed for a cleaner structure.

✨ Key Features Implemented

πŸŽ₯ Live Camera Feed Display

  • Real-time CCTV footage streaming with low-latency playback
  • Smooth video processing at configurable FPS (default: 30 FPS)
  • Support for webcam and IP cameras with easy configuration
  • Fullscreen mode support in web interface
  • Responsive video display that adapts to different screen sizes

πŸ” Real-Time Object Detection

  • YOLOv8-based object detection with 80+ COCO dataset objects
  • Real-time bounding box visualization with confidence scores
  • Dynamic object labeling on video feed
  • Color-coded detection boxes (red for threats, green for normal objects)
  • Configurable confidence thresholds for detection accuracy

⚠️ Threat Alert System

  • Automatic threat detection for weapons, violence, and suspicious activities
  • Visual alert indicators with color coding and animations
  • Audio alert notifications using Web Audio API
  • SMS integration via Twilio for immediate notifications
  • Emergency stop functionality for critical situations
  • Alert cooldown system to prevent spam notifications

🎨 Modern UI/UX

  • Clean, responsive web interface with live stats and logs
  • Mobile/tablet responsive design for remote monitoring
  • Dark mode styling and WebSocket real-time updates

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • Webcam or IP camera
  • CUDA-compatible GPU (optional, for faster processing)
  • Twilio account (for SMS alerts)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd IntelliGuardAI
  2. Install dependencies

    pip install -r requirements.txt
  3. Configure environment variables

    # Copy the example environment file
    cp .env.example .env
    
    # Edit .env with your Twilio credentials (for SMS alerts)
    # Get credentials from https://console.twilio.com/
  4. Configure the system (optional)

    # Edit config.py to customize settings
    # Or set environment variables
    export CAMERA_SOURCE=0
    export CONFIDENCE_THRESHOLD=0.5
    export SMS_ENABLED=true

πŸ–₯️ Usage

Web Interface (Recommended)

python main.py
  • URL: http://localhost:8000/web
  • Features: Live video feed, real-time alerts, statistics, logs
  • Best for: Remote monitoring, multiple users, mobile access

Command Line Stream

python detect_stream.py
  • Features: Terminal-based detection, SMS alerts, console output
  • Best for: Server deployment, automated monitoring, logging

πŸ“± Web Interface Features

Live Video Feed

  • Real-time camera stream with detection overlays
  • Fullscreen mode support
  • Automatic refresh and reconnection
  • Responsive design for all devices

Real-Time Alerts

  • Visual threat indicators with animations
  • Audio alert notifications
  • Alert history and details
  • Emergency stop button

Statistics Dashboard

  • Total detections counter
  • Active threats counter
  • Real-time detection list
  • System status indicators

Activity Log

  • Live detection logs
  • Threat-specific highlighting
  • Timestamp information
  • Scrollable history

πŸ”§ Configuration

Camera Settings

# config.py
CAMERA_SOURCE = 0              # Camera index or IP camera URL
CAMERA_WIDTH = 640            # Video width
CAMERA_HEIGHT = 480           # Video height
CAMERA_FPS = 30              # Frames per second

AI Model Settings

MODEL_PATH = "yolov8n.pt"     # YOLO model file
CONFIDENCE_THRESHOLD = 0.5    # Detection confidence (0.0-1.0)
USE_GPU = True               # Enable GPU acceleration

Threat Detection

THREAT_OBJECTS = [
    'knife', 'gun', 'fight', 'snatching', 
    'weapon', 'pistol', 'rifle', 'assault'
]
ALERT_COOLDOWN = 30          # Seconds between alerts

SMS Alerts

SMS alerts require a Twilio account. Configure via environment variables:

# Create .env file from template
cp .env.example .env

# Edit .env with your Twilio credentials
# Get credentials from https://console.twilio.com/

Environment variables:

SMS_ENABLED=true
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=+1234567890
TARGET_PHONE_NUMBER=+0987654321

⚠️ Never commit your actual credentials to version control!

🎯 Detection Capabilities

Supported Objects (80+ COCO Objects)

  • People: person, child, adult, man, woman
  • Vehicles: car, truck, bus, motorcycle, bicycle
  • Animals: dog, cat, bird, horse, cow
  • Objects: chair, table, phone, laptop, book
  • And many more...

Threat Detection

  • Weapons: knife, gun, weapon, pistol, rifle
  • Violence: fight, assault, attack
  • Crime: snatching, theft, robbery
  • Custom: Add your own threat categories

πŸ“Š Performance Optimization

GPU Acceleration

  • Automatic CUDA detection and usage
  • Significant performance improvement with NVIDIA GPUs
  • Fallback to CPU if GPU unavailable

Model Optimization

  • Use smaller models (yolov8n) for speed
  • Use larger models (yolov8l, yolov8x) for accuracy
  • Adjustable confidence thresholds

System Requirements

  • Minimum: 4GB RAM, CPU-only
  • Recommended: 8GB+ RAM, CUDA GPU
  • Optimal: 16GB+ RAM, RTX 3060+ GPU

πŸ”’ Security Features

Production Deployment

  • Configurable CORS settings
  • Rate limiting support
  • API key authentication (optional)
  • HTTPS support

Privacy Compliance

  • Local processing (no cloud dependencies)
  • Configurable data retention
  • Secure log storage
  • User consent mechanisms

πŸ› Troubleshooting

Common Issues

Camera not detected:

# Check camera permissions
# Try different camera index
# Update config.py: CAMERA_SOURCE = 1

Model loading error:

# Model will be downloaded automatically
# Or download manually:
wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt

Performance issues:

# Reduce resolution in config.py
CAMERA_WIDTH = 320
CAMERA_HEIGHT = 240

SMS not sending:

  • Create .env file from .env.example
  • Add your Twilio credentials to .env
  • Verify phone number format (+country code)
  • Ensure sufficient Twilio credits

Logs and Debugging

  • Check console output for errors
  • Monitor system resources
  • Verify camera permissions
  • Test with sample images

πŸ› οΈ Customization

Adding Custom Threat Categories

# In config.py
THREAT_OBJECTS = [
    'knife', 'gun', 'fight', 'snatching',
    'your_custom_threat'  # Add your own
]

Custom Alert Messages

ALERT_MESSAGES = {
    'knife': '⚠️ Knife detected! Potential threat identified.',
    'your_threat': '🚨 Your custom alert message!'
}

Custom Alert Actions

# Add custom alert handling in your interface
def custom_alert_handler(threat_type, confidence):
    # Your custom logic here
    pass

πŸ“ˆ API Endpoints

Core Endpoints

  • GET / - Health check
  • GET /web - Web interface
  • GET /video_feed - Live video stream
  • GET /api/status - System status
  • GET /api/threats - Current threats
  • GET /api/logs - Detection logs

Analysis Endpoints

  • POST /analyze - Analyze uploaded image
  • WebSocket /ws - Real-time updates

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Ultralytics for YOLOv8 implementation
  • OpenCV for computer vision capabilities
  • FastAPI for web framework
  • Twilio for SMS integration
  • Font Awesome for icons

⚠️ Important Notice: This system is designed for security and surveillance purposes. Please ensure compliance with local laws and regulations regarding camera usage and privacy rights.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors