Skip to content

livelyvision/detfire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-time Fire and Smoke Detection

This project is a web application that connects to an RTSP live video stream, displays it on the frontend, and analyzes the last frame to detect the presence of smoke and/or fire. The results, including probability scores for each category, are displayed in real-time on the frontend.

Features

  • Real-time video streaming from an RTSP or HTTP (JPG/MJPEG) source.
  • Fire and smoke detection using a pre-trained deep learning model.
  • Real-time display of detection results with probability scores.
  • User-configurable threshold for highlighting detection results.
  • User-configurable analysis framerate.
  • Webhook Notifications: Send alerts to a configurable webhook URL (e.g., Discord) upon detection, including detection scores and the triggering image frame.

Setup

  1. Clone the repository:

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

    pip install -r backend/requirements.txt
  3. Configure Webhook (Optional): Create a .env file in the project root and add your webhook URL:

    WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-id/your-webhook-token
    

    Replace with your actual Discord webhook URL or any other webhook endpoint.

Running the Application

Locally (without Docker)

  1. Start the backend server:

    uvicorn backend.main:app --reload --port 5000
  2. Open the frontend: Open localhost:5000 in your web browser.

Running with Docker

This is the recommended way to run the application on a server.

  1. Prerequisites:

    • Docker and Docker Compose must be installed on your server.
  2. Create .env file: If you haven't already, create a .env file in the project root. This is where you'll put your webhook URL.

    nano .env

    Add your webhook URL:

    WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-url
    
  3. Build and Run: From the project root, run the following command:

    docker-compose up --build -d

    The -d flag runs the application in the background.

  4. Access the Application: Open a web browser and navigate to http://<your_server_ip>:5000.

  5. To Stop:

    docker-compose down

Usage

  • The live video stream will be displayed on the page.
  • The detection results (Normal, Smoke, Fire) will be displayed with their probability scores in percentages.
  • You can adjust the detection threshold using the slider. Categories with scores above the threshold will be highlighted (Fire/Smoke in red/grey, Normal in green).
  • If configured, webhook notifications will be sent to your specified URL upon detection.

Demo

  • You can use the built-in demo stream suggestions for quick testing.
  • Here is a screenshot of the application in action:

Fire and Smoke Detection Demo

About

Fire and smoke real detection from real time video sources. Webhook notifications in case of fire or smoke detected. Demo App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors