Author: Pedro Vinícius A. B. Venâncio1
This repository contains the models and source codes of hybrid systems for fire detection implemented during my master's degree, as well as some baseline models for comparison purposes. The proposed hybrid systems are composed of two sequential stages: (i) spatial detection, which consists of identifying and locating fire and smoke events on the scene based on spatial patterns, and (ii) temporal analysis of the events detected in the previous stage, in order to make a final decision on whether a fire is actually taking place. The baseline models are simple convolutional neural networks for fire classification proposed in the literature.
The first stage of the hybrid system is a YOLOv5 network (small or large) and the second stage can be a area variation technique (AVT) or a temporal persistence technique (TPT). We recommend AVT for outdoor scenes and TPT for indoor scenes.
After running the system, the videos with the detections are saved in runs/detect/exp/
.
If you want to use the hybrid system YOLOv5+AVT, run the following command:
python detect.py --source <video_file> --weights <weights_file> --temporal tracker
where <video_file>
is the video in which you will detect fire and <weights_file>
is the file with the network weights (can be yolov5s.pt or yolov5l.pt). You can change the parameters of the area variation technique by specifying the additional flags --area-thresh
and window-size
.
If you want to use the hybrid system YOLOv5+TPT, run the following command:
python detect.py --source <video_file> --weights <weights_file> --temporal persistence
where <video_file>
is the video in which you will detect fire and <weights_file>
is the file with the network weights (can be yolov5s.pt or yolov5l.pt). You can change the parameters of the persistence temporal technique by specifying the additional flags --persistence-thresh
and window-size
.
If you want to use only the YOLOv5 network, run the following command:
python detect.py --source <video_file> --imgsz 640 --weights <weights_file>
where <video_file>
is the video in which you will detect fire and <weights_file>
is the file with the network weights (can be yolov5s.pt or yolov5l.pt). You can change the parameters of the YOLOv5 network by specifying the additional flags --img-size
, --conf-thres
and --iou-thres
.
If you want to use a baseline model, run the following command:
python baseline.py --video <video_file> --model <model_name>
where <video_file>
is the video in which you will detect fire and <model_name>
is the name of the model to be used (can be 'firenet'
or 'mobilenet'
).
Download the model weights from the root of this repository by running the ./scripts/download_models.sh
script or manually using the links below.
To install the dependencies, run the following command:
pip install -r requirements.txt
Please cite the following paper if you use the proposed YOLOv4 models for fire and smoke detection:
-
Pedro Vinícius Almeida Borges de Venâncio, Adriano Chaves Lisboa, Adriano Vilela Barbosa: An automatic fire detection system based on deep convolutional neural networks for low-power, resource-constrained devices. In: Neural Computing and Applications, 2022.
Please cite the following paper if you use FireNet for fire and smoke classification:
-
Arpit Jadon, Mohd. Omama, Akshay Varshney, Mohammad Samar Ansari, Rishabh Sharma: FireNet: A Specialized Lightweight Fire & Smoke Detection Model for Real-Time IoT Applications. In: arXiv, 2019.
Please cite the following paper if you use MobileNet for fire classification:
-
Debajyoti Mukhopadhyay, Ramya Iyer, Sagarika Kadam, Rakshanda Koli: FPGA Deployable Fire Detection Model for Real-Time Video Surveillance Systems Using Convolutional Neural Networks. In: IEEE Global Conference for Advancement in Technology (GCAT), 2019, Bangalore, India.