Design and Implementation of A Smoke/Fire Detection Using Computer Vision and Edge Computing
Design and Implementation of A Smoke/Fire Detection Using Computer Vision and Edge Computing
ISSN No:-2456-2165
Fig 1 Market Fire Outbreak Frequency in Nigeria within 2019 and 2020 (Orodata, 2020)
Activation Functions Get the list of all images and their corresponding labels
The ReLU activation function is used for all the layers from the data directory.
except the last dense layer which uses a Softmax activation Convert labels to integers and then one-hot encode them.
function. The ReLU function in this work is the standard Convert one-hot encoded labels to single labels.
function which selects an element-wise maximum of 0 and
the input data. It introduces a bias value, 𝑏 on the Perform k-fold Cross-Validation:
convoluted output of each layer and it is calculated as seen
in Equation 3.7, where 𝑐 is the output at the layer where the For each fold in the k-fold Cross-Validation:
activation function is applied.
Initialize a Sequential model and add layers to it. This
𝑐 = 𝜙𝑎 (𝑀 ∗ 𝑇 + 𝑏) (7) includes Conv2D, MaxPooling2D, Flatten, Dense, and
Dropout layers.
The Softmax function, used in the last dense layer, acts Compile the model with Adam optimizer, categorical
as a classifier because it returns a vector as a probability cross-entropy loss, and accuracy metrics.
value and the elements of its output vector results as 1. In Load and pre-process the training and test images.
this case, we have four probability classifications for the Fit the model on the training data and validate it on the
model. The Softmax activation is performed using equation test data.
3.9 where 𝑧 is the output of the previous dense layer. Use the model to predict the test set and store the
predictions and actual labels in the lists.
𝑠𝑜𝑓𝑡𝑚𝑎𝑥(𝑧) =
exp (𝑧)
(8) Save the model in the list of models.
∑ exp(𝑧)
Fig 2 Flowchart
Fig 3 The Confusion Matrix of True and Predicted Labels of the Proposed Model
The accuracy of our model over the training and validation data is evaluated as shown in Figure 4. A total of 25 epochs was
used to train the CNN model and a maximum accuracy of over 60% was recorded. The model is then evaluated in terms of the
loss metric. The model produces a minimal loss of 0.8 after training due to implementation of thee cross-validation algorithm and
the Adam optimizer function.
Fig 4 (a) Graph Depicting a Gradual Increase in Training and Validation Accuracy (b) Graph Depicting a Steady Reduction for
the Training and Validation Loss for the CNN Model
Fig 5 Graph Depicting the ROC Curves of the Proposed Model with Specified AUC Values of each Classification Category as it
Relates to (a) Class 0 (b) Class 1 (c) Class 2 (d) Class 3 of the CNN Model
Fig 6 Accuracy and loss performance of the CNN across the folds of the cross-validation algorithm after
While there are a lot of false positives and false [1]. Abeku, T., Michael, D., Akpan-Nsoh, I., Udeajah, G.,
negatives in the case of smokes, the custom convolutional Ogugbuaja, C., Oyewole, R., Godwin, A., &
neural network has a high accuracy rate for detecting flames Agboluaje, R. (2021). Losses to market fires hit
in both indoor and outdoor contexts. Efficient early smoke N41.54 billion in two years. The Guardian
detection is another feature of the developed model. To Newspaper. https://guardian.ng/news/losses-to-
construct a simulated alarm system setting, play sound market-fires-hit-n41-54-billion-in-two-years/
module of the OpenCV library was utilized. The "Alarm [2]. Alamgir, N. (2020). Computer Vision Based Smoke
Sound.mp3" mp3 audio file was linked to the deep learning and Fire Detection for Outdoor Environments.
model and access to the webcam is also granted to the Published PhD Dissertation, School of Electrical
program. Once smoke or a potential fire is detected through Engineering and Robotics, Science and Engineering
the captured image frames, the alarm sound is played and Faculty, Queensland University of Technology.
the user is alerted to the impending danger. https://eprints.qut.edu.au/201654/1/Nyma_Alamgir_
Thesis.pdf
VI. CONCLUSION [3]. Avazov, K., Hyun, A. E., Sami S, A. A., Khaitov, A.,
Abdusalomov, A. B., & Cho, Y. I. (2023). Forest fire
This research presented a novel computer-vision based detection and notification method based on AI and
fire and smoke detection system that is running on an edge IoT approaches. Future Internet, 15(2), 61.
server. The proposed system aims to overcome the issues of doi:10.3390/fi15020061
fire and smoke detection in two stages: First, the captured [4]. Daily Trust (2022). How Fire Wreaked 700 shops,
image is pre-processed so as to highlight the key features Killed 19 in 3 months. Daily Trust.
present in the image. This was achieved using the OpenCV https://dailytrust.com/how-fire-wreaked-700-shops-
library implementation in Python programming language. killed-19-in-3-months/
Afterwards, the CNN model is trained on the processed [5]. Grari, M., Idrissi, I., Boukabous, M., Moussaoui, O.,
image in order to properly classify it into the related class Azizi, M., & Moussaoui, M. (2022). Early wildfire
(fire, smoke and neither). The CNN model was built using detection using machine learning model deployed in
Python programming and the deep learning framework, the fog/edge layers of IoT. Indonesian Journal of
Keras, was utilized to ensure ease of implementation. Electrical Engineering and Computer Science, 27(2),
1062. doi:10.11591/ijeecs.v27.i2.pp1062-1073
The use of a k-fold cross validation algorithm has been [6]. Khan, S., Muhammad, K., Mumtaz, S., Baik, S. W.,
proved on a simplified CNN model which has a small & de Albuquerque, V. H. C. (2019). Energy-efficient
number layers in order to improve the performance of the deep CNN for smoke detection in foggy IoT
image classification. The experimental analysis of the model environment. IEEE Internet of Things Journal, 6(6),
show that the proposed system is capable of classifying fire 9237-9245.
and smoke images accordingly with an ROC value of over [7]. Kukuk, S. B., & Ki̇ li̇ mci̇ , Z. H. (2021).
0.67 in each class. Likewise, the accuracy is observed to Comprehensive analysis of forest fire detection using
increase by 15% across each fold of the training process. deep learning models and conventional machine
This model is recommended for use in deep learning tasks learning algorithms. International Journal of
that require automatic feature extraction and object detection Computational and Experimental Science and
in image processing applications. Engineering, 7(2), 84–94.
doi:10.22399/ijcesen.950045
Future Research on the Topic can be Carried Out in [8]. Lee, Y., & Shim, J. (2019). False positive
Areas Pertaining to: decremented research for fire and smoke detection in
surveillance camera using spatial and temporal
The investigation of the use of other deep architectures features based on deep learning. Electronics, 8(10),
like Deep Belief Networks and Recurrent Neural 1167. doi:10.3390/electronics8101167
Network for the detection of smoke and fire. [9]. Liang, S., Wu, H., Zhen, L., Hua, Q., Garg, S.,
The fire detection using a moving camera. Kaddoum, G., Hassan, M. M., & Yu, K. (2022). Edge
The monitoring of the fire spread and direction of YOLO: Real-time intelligent object detection system
movement. based on edge-cloud cooperation in autonomous
vehicles. IEEE Transactions on Intelligent
Transportation Systems, 23(12), 25345-25360.