Skip to content

Aniket-a14/fire-detection-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fire Detection Model 🔥

This repository contains a real-time fire detection model based on the YOLO (You Only Look Once) architecture. The model is designed to identify fire outbreaks quickly and accurately, making it a critical tool for early fire detection and prevention.

Features

  • Real-Time Detection: Identifies fire in live video streams or pre-recorded footage with high accuracy.
  • YOLO Architecture: Leverages the power of YOLO for fast and efficient object detection.
  • Customizable: Easily adaptable for different use cases by retraining the model with domain-specific datasets.
  • Scalable: Suitable for implementation in drones, surveillance systems, or IoT devices.

Getting Started

Prerequisites

Before using this repository, ensure you have the following installed:

  • Python 3.7 or higher
  • OpenCV
  • PyTorch
  • NumPy
  • Matplotlib
  • Other dependencies listed in requirements.txt

To install the required dependencies, run:

pip install -r requirements.txt

Dataset Preparation

  1. Collect Fire and Non-Fire Images: Gather a dataset of images containing fire and non-fire scenarios.
  2. Annotate Data: Use tools like LabelImg to annotate the dataset with bounding boxes for fire regions.
  3. Organize Data:
    • Place annotated images in the data/images folder.
    • Store annotation files in data/annotations.

Training the Model

To train the YOLO-based fire detection model, follow these steps:

  1. Prepare Configuration Files:

    • Adjust YOLO configuration files for your dataset (classes, input size, etc.).
  2. Start Training:

    python train.py --data data/fire.yaml --cfg cfg/yolov5s.yaml --weights yolov5s.pt --epochs 50
  3. Monitor Progress:

    • Training logs will display metrics like loss, mAP, and confidence thresholds.

Testing the Model

Run the model on test images or videos to evaluate performance:

python detect.py --weights runs/train/exp/weights/best.pt --source data/test/video.mp4

Replace data/test/video.mp4 with the path to your test file.


Deployment

To deploy the model in a real-time application:

  1. Setup Camera Feed: Use OpenCV to capture video streams.
  2. Integrate Model: Load the trained YOLO weights and process each frame for fire detection.
  3. Trigger Alerts: Implement notifications or alarms when fire is detected.

Project Structure

fire-detection-model/
│
├── data/
│   ├── images/            # Training and test images
│   ├── annotations/       # Annotation files
│   ├── test/              # Test videos or images
│
├── models/                # YOLO model configuration files
├── runs/                  # Trained models and results
├── utils/                 # Utility scripts for data preprocessing
│
├── train.py               # Training script
├── detect.py              # Inference script
├── requirements.txt       # Dependencies
├── README.md              # Project documentation

Results

The model achieves high detection accuracy and low false positive rates on the test dataset. Below are some example outputs:

Metric Value
Precision 95.2%
Recall 93.5%
[email protected] 94.7%

Future Enhancements

  • Support for multi-class fire detection (e.g., smoke, flame size, etc.).
  • Integration with IoT devices for automated response systems.
  • Optimization for edge computing devices.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests for enhancements, bug fixes, or additional features.


License

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


Acknowledgments

  • YOLO for the detection framework.
  • Open-source contributors for pre-trained weights and tools.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published