Dec 1, 2022This study aims to develop a vision-based indoor fire and smoke detection system.
The system takes input from a video camera and on analyzing the input, decides whether fire pixels are present in the input feed or not. To analyze, the system uses color and luminance features of the input images. Based on the decision, the system can raise a fire alarm.
First, the algorithm locates regions of the video where there is movement. From these regions fire- colored pixels are extracted using a perceptron. Lastly, we use dynamic texture analysis to confirm that these moving, fire-colored regions have the temporal and motion charac- teristics of fire.
Can computer vision and deep learning detect wildfires?
The short answer is, yes, computer vision and deep learning can be used to detect wildfires:
IoT/Edge devices equipped with cameras can be deployed strategically throughout hillsides ridges and high elevation areas automatically monitoring for signs of smoke or fire. ,
Can computer vision and smoke sensor-based fire detection be combined?
In this paper, we proposed a hybrid model that incorporates computer vision and smoke sensor-based fire detection into a single system to devise a more accurate and smart fire detection system.
Our vision-based fire detection model utilizes color and motion attributes of fire combustion.
,
Creating Our Training Script
Our training script will be responsible for:.
1) Loading our Fire and Non-firecombined dataset from disk.
2) Instantiating our FireDetectionNetarchitecture.
3) Finding our optimal learning rate by using our LearningRateFinderclass.
4) Taking the optimal learning rate and training our network for the full set of epochs.
Let’s get started! Open up the.
,
How to detect fire?
Spatial variance analysis is another popular approach to detect fire, which Chowdhury et al. [ 25] had incorporated in their studies.
Often for improving efficiency and reducing false detection rate, researchers utilize multi-feature-based techniques for fire detection.
,
Implementing Our Fire Detection Convolutional Neural Network
In this section we’ll implement FireDetectionNet, a Convolutional Neural Network used to detect smoke and fire in images.
This network utilizes depthwise separable convolutionrather than standard convolution as depthwise separable convolution:.
1) Is more efficient,as Edge/IoT devices will have limited CPU and power draw.
2) Requires less memory,as .
,
Making Predictions on Fire/Non-Fire Images
Given our trained fire detection model, let’s now learn how to:.
1) Load the trained model from disk.
2) Sample random images from our dataset.
3) Classify each input image using our model.
Open up predict_fire.pyand insert the following code: Lines 2-9 handle our imports, namely load_model, so that we can load our serialized TensorFlow/Keras model .
,
Our Configuration File
This project will span multiple Python files that will need to be executed, so let’s store all important variables in a single config.pyfile.
Open up config.pynow and insert the following code: We’ll use the os module for combining paths (Line 2).
Lines 5-7 contain paths to our (1) Fire images, and (2) Non-fireimages.
Line 10is a list of our two cl.
,
Our Fire and Smoke Dataset
The dataset we’ll be using for fire and smoke examples was curated by PyImageSearch reader, Gautam Kumar.
Guatam gathered a total of 1,315 images by searching Google Images for queries related to the term “fire”, “smoke”, etc.
However, the original dataset has not been cleansed of extraneous, irrelevant images that are not related to fire and smoke.
,
Preparing Our Fire and Non-Fire Combined Dataset
Preparing our Fire and Non-firedataset involves a four-step process:.
1) Step #1: Ensure you followed the instructions in the previous section to grab and unzip today’s files from the “Downloads”section.
2) Step #2: Download and extract the fire/smoke dataset into the project.
3) Step #3:Prune the fire/smoke dataset for extraneous, irrelevant files..
,
Project Structure
Go ahead and grab today’s .zip from the source code and pre-trained model using the “Downloads”section of this blog post.
From there you can unzip it on your machine and your project will look like Figure.
4) There is an exception: neither dataset .zip (white arrows) will be present yet.
We will download, extract, and prune the datasets in the next .
,
The 8-Scenes Dataset
The dataset we’ll be using for Non-fire examples is called 8-scenes as it contains 2,688 imageexamples belonging to eight natural scene categories (all without fire):.
1) Coast.
2) Mountain.
3) Forest.
4) Open country.
5) Street.
6) Inside city.
7) Tall buildings.
8) Highways The dataset was originally curated by Oliva and Torralba in their 2001 paper, Mod.
,
Training The Fire Detection Model with Keras
Training our fire detection model is broken down into three steps:.
1) Step #1: Run the train.py script with the --lr-findcommand line argument to find our optimal learning rate.
2) Step #2: Update Line 17 of our configuration file (config.py ) to set our INIT_LRvalue as the optimal learning rate.
3) Step #3: Execute the train.pyscript again, but th.
,
What is a vision-based fire detection model?
Our vision-based fire detection model utilizes color and motion attributes of fire combustion.
Rule-based color segmentation is performed for classifying fire color regions and a modified image difference technique is used for detecting the motion of fire regions in consecutive frames.