Skip to content

Prathmesh2931/Smart-Surveillance-system

Repository files navigation

AI-Based Surveillance System

An intelligent surveillance solution using LLaVA-7B, built for both pre-recorded and live webcam feeds. The system analyzes visual input, detects abnormal or violent behavior, and sends real-time alerts via Telegram, along with storing all flagged data in MongoDB Atlas.


⚙️ Core Features

  • 🧠 LLaVA-7B-based Vision-to-Text Analysis
  • 🎥 Pre-recorded video frame analysis
  • 📡 Real-time surveillance via phone/webcam (IP stream)
  • 📬 Telegram Bot Alerts (triggered only on detected violence/anomaly)
  • 🗃️ MongoDB Atlas for storing frame data, timestamps, and captions

Ensure you have Python 3.8+ and run:

pip install -r requirements.txt

📥 Model Requirement

Download and set up the LLaVA-7B model using Ollama.
Once setup is complete, make sure the model is accessible via:

ollama run llava

🧪 1. Pre-recorded Video Analysis

Run the Jupyter notebook for analyzing a recorded video:

jupyter notebook llava_prevideo.ipynb

What It Does:

  • Extracts frames at every 30-frame interval
  • Sends each frame to Model for caption generation
  • Stores results in MongoDB Atlas
  • Triggers Telegram alert only if a frame contains violence or anomaly

📸 Example Outputs:

  • Processed frame

Violence

  • Output Provided By Model

Screenshot from 2025-04-05 00-53-40

  • Screenshot of triggered Telegram alert

Telegram_API


🔴 2. Live Webcam Surveillance

Run the live surveillance script using:

python llava_multi.py

What It Does:

  • Captures frames from live webcam (can use phone camera via IP)
  • Sends them to Model for real-time analysis
  • If violence/anomaly is detected:
    • Triggers Telegram alert
    • Includes frame description, timestamp, and IP-based location
  • Saves flagged frames and captions to MongoDB Atlas

📸 Example Outputs:

  • Live flagged frame

Screenshot from 2025-04-05 01-06-25

  • Description of frame

Screenshot from 2025-04-05 01-56-58


🛡️ Conclusion

This project showcases a powerful and flexible AI-driven surveillance pipeline:

  • Processes both offline and live video
  • Alerts only when anomalies occur
  • Stores event data for traceability and further investigation
  • Highly modular: extendable with gesture recognition, facial ID, object detection

▶️ How to Run

# Install dependencies
pip install -r requirements.txt

# For Pre-recorded Analysis
jupyter notebook llava_prevideo.ipynb

# For Live Webcam Surveillance
python llava_multi.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published