/AI-Surveillance-System-with-Chatbot

A project leveraging image-to-text processing and person detection to automate surveillance tasks. Utilizes a local Large Language Model (LLM) hosted via LM Studio for generating security logs. Features include real-time camera feed monitoring via Telegram Bot integration. Powered by OpenAI-inspired technologies.

Primary LanguagePythonMIT LicenseMIT

AI Surveillance System with Chatbot

The AI Surveillance System is a project designed to provide automated surveillance capabilities using artificial intelligence. This system utilizes image-to-text processing to describe images and detect the presence of individuals within camera frames. Upon detecting a person, the system initiates a 5-second video recording and generates a security log file containing the date and time of the event. The security log file is produced by employing our locally hosted Large Language Model (LLM) from LM Studio, which initializes a local HTTP server emulating the operations of OpenAI's API. Addtionally, a Telegram Bot has been deployed to facilitate a more user-friendly interface and control over the system.

Features

  • Image-to-text processing for image description using moondream1 (Built by @vikhyatk using SigLIP, Phi-1.5 and the LLaVa training dataset)
  • Person detection within camera frames
  • Automated 5-second video recording upon person detection
  • Generation of security log files with date and time stamps
  • Local HTTP server simulation of OpenAI's API behavior
  • Utilization of local Large Language Model (LLM) for security log file generation
  • Integration with Telegram Bot for user access and interaction
  • Telegram Bot functions include:
    • Starting the surveillance server
    • Checking real-time camera feed

Getting Started

To get started with the AI Surveillance System, follow these steps:

  1. Clone the Repository:

    git clone https://github.com/YouXuan2010/AI-Surveillance-System-with-Chatbot.git
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Configure Telegram Bot:

    • Obtain a Telegram Bot token from the BotFather.
    • Create .env file under the project directory:
    TELEGRAM_BOT_TOKEN=XXXXXXXXXXX
  4. Setup Camera and LM Studio server:

    • Download IP Webcam from Playstore (Only tested using Android phone, Apple user can find others)
    • Start camera server and update stream_url in aiss.py
    • Install LM Studio and download any LLM model from HuggingFace Model Hub
    • Start your local LLM server and update the base_url in aiss.py
  5. Run the System:

    python telebot.py
  6. Access the Telegram Bot:

    • Search for your Telegram Bot by its username.
    • Interact with your Bot to start the surveillance server and check real-time camera feed.

Example Demo

The camera will process the image and detect if there's any people in the image
For example at some point, the camera captured this: image

The image-to-text model will detect the presence of people and then imform the user via telegram app: image

The security log will be saved in the Security_Logs.txt for future references: image

Contributing

Contributions are welcome! If you'd like to contribute to the AI Surveillance System, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/new-feature).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature/new-feature).
  6. Create a new Pull Request.

License

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

Contact

For any inquiries or feedback regarding the AI Surveillance System, please contact ME.