Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 4, No. 3, 2023 28 Fire Detection of yolov8 Model based on Integrated SE Attention Mechanism Zihe Wei * University of Science and Technology Liaoning, Anshan 114051, China Abstract: Our proposed method utilizes YOLOv8 and SE attention mechanism for detecting fires, which is crucial for early detection and prevention. Our method balances accuracy and real-time performance while detecting fires in various scenarios. The proposed method achieves an average mAP0.5 value of 0.730, with an improvement from the original model's mAP0.5 value of 0.707 after incorporating the SE attention mechanism. We evaluated our model on a benchmark dataset and demonstrated its effectiveness in accurately detecting and localizing fires with high precision and recall rates. Experimental results confirm the effectiveness of our proposed method in accurately detecting and localizing fires, demonstrating its potential for wide application and promotion in the fire safety industry. Keywords: Fire Detection; YOLOv8; SE Attention Mechanism. 1. Introduction Fire detection is crucial for ensuring the safety of people and property, as fires can cause significant damage and threaten lives. Various methods have been proposed for fire detection, including those based on traditional sensors such as smoke and heat detectors, as well as those based on computer vision and deep learning technology. Among these methods, the fire detection method using YOLOv8 and SE attention mechanism has shown promising results in achieving high accuracy and real-time performance. This method combines the YOLOv8 object detection algorithm with SE attention mechanism to enhance the model's ability to identify fires in various scenarios. Compared to traditional fire detection methods, which often rely on costly and complex sensor systems [1][2], and it is not easy to achieve a good detection effect outdoors. Today, many application cases of Yolov8 have also emerged. For example, Yuan's team [3] used the improved Yolov8 model to detect and identify fish in the electronic monitoring data of commercial fishing boats, The YOLOv8 and SE attention- based method is more cost-effective and easier to implement and scale. Additionally, it can detect and locate fires in real- time, which is essential for early detection and prevention. Overall, the fire detection method using YOLOv8 and SE attention mechanism has great potential to be applied in various settings, such as public spaces, homes, and industrial environments, to enhance fire safety and prevent potential damages and losses. 2. Introduction of YOLOv8 Figure 1. The network structure of YOLOv8 As shown in Figure 1, YOLOv8 is an advanced model that builds on the design principles of YOLOv5 and YOLOv7 ELAN to enhance performance and flexibility. It retains the basic framework of YOLOv5 while introducing new features, such as a new backbone network architecture, an Anchor-Free detection head, and a new loss function. The model offers different size models, ranging from N/S/M/L/X scales, which are adjusted based on scaling coefficients. The backbone network and Neck sections of YOLOv8 are based on the design philosophy of YOLOv7 ELAN, with adjustments made to improve model performance. In the Head section, YOLOv8 has undergone significant changes, using the decoupled head structure to separate the classification and detection heads and changing the detection head from Anchor-Based to Anchor-Free. The Loss calculation uses the TaskAlignedAssigner positive sample allocation strategy and the Distribution Focal Loss. Overall, YOLOv8 is an advanced model that builds upon the success of previous YOLO models while introducing new features and improvements. It offers different size models and incorporates various design changes to improve performance and flexibility. 3. Introduction of SE Attention Mechanism Figure 2. Structure of SE attention As shown in Figure 2, The SE (squeeze-and-excitation) [4] attention mechanism is a channel-wise attention mechanism 29 that improves the interdependencies between channels in a feature map. SE attention mechanisms (Squeeze and Excitation Networks) incorporate attention mechanisms in the channel dimension, with the main operations being squeeze and excitation. By means of automatic learning, a new neural network is utilized to determine the significance of each channel within the feature map. This importance score is then used to assign a weight value to each feature, allowing the neural network to concentrate on particular feature channels that are pertinent to the current task, while suppressing those that are not. The figure 2 illustrates the impact of SE attention mechanism (Figure C on the right) in contrast to its absence (Figure C on the left), where the feature map channels all have the same level of importance prior to processing, but after SE attention, different weights are assigned to different channels, represented by different colors. This enables the neural network to prioritize channels with high weight values, which correspond to those that are most relevant to the given task. Figure 3. The location of the SE attention mechanism addition As shown in Figure 3, in this modified YOLOv8 network architecture, an SE attention mechanism has been added to the final layer of the backbone. This mechanism uses a new neural network to determine the importance of each channel within the feature map, and assigns weight values to each feature based on this importance. This allows the neural network to prioritize feature channels that are most relevant to the current task, while suppressing those that are not. The addition of the SE attention mechanism can improve the performance of the YOLOv8 network by allowing it to better focus on the most important features in the input data. This can lead to more accurate object detection, especially in complex scenes with many objects or cluttered backgrounds. The SE attention mechanism also has the advantage of being relatively lightweight and computationally efficient, making it well-suited for use in real-time applications. Overall, the addition of the SE attention mechanism to the YOLOv8 network architecture represents a significant improvement over the original architecture, and has the potential to greatly enhance the accuracy and efficiency of object detection tasks. 4. Experiment and Analysis The dataset we used in our research is called "fire-dataset- 2000", which contains a total of 2059 images. Each image includes one or more annotated bounding boxes of flames. An example image is shown in Figure 4. Figure 4. Example graphs for each category In our study, we trained the YOLOv8 model using the fire- dataset-2000. We used a stochastic gradient descent algorithm with a batch size of 8 and SGD as the optimizer. The learning rate was decayed to 0.01 after 100 iterations, and the training process continued for a total of 2.2 hours on an RTX3060 device. Figure 5. The PR (Precision-Recall) curve comparison between the original model (a) and the model (b) with the added SE attention mechanism. The PR (Precision-Recall) curve is a graphical representation that shows the trade-off between precision and recall for different classification thresholds in a machine learning model. The PR curve plots precision on the y-axis and recall on the x-axis, where each point on the curve corresponds to a different threshold value. A higher area under the PR curve indicates better model performance in terms of both precision and recall. The mAP@0.5 is a widely used metric for evaluating the performance of object detection models. It is the mean Average Precision computed at an IoU threshold of 0.5, which represents the overlap between the predicted and ground truth bounding boxes. As shown in Figure 5, the mAP@0.5 value for the original model (a) on the left is 0.707, while the mAP@0.5 value for the model (b) with the added SE attention mechanism on the right is 0.730. This suggests that the model with the SE attention mechanism has improved the overall performance of the object detection system, as it has achieved a higher mAP@0.5 value. The improvement in mAP@0.5 indicates that the model with the SE attention mechanism is better at accurately detecting and localizing objects with a moderate level of overlap between the predicted and ground truth bounding boxes. 30 5. Experimental Application and Results Figure 6 demonstrates that our trained model accurately detects and labels all potential targets in the images, even when they are partially or fully obscured. Notably, the model is not limited to distinguishing a single category per image but can identify multiple targets. It is important to highlight the remarkable performance of the model, considering its ability to process each image in just 20 milliseconds. This exceptional efficiency and speed make it an ideal choice for real-time applications. Figure 6. Classification prediction result 6. Conclusion Our study demonstrates the impressive performance of our trained model for fire detection and recognition tasks. The model accurately predicts and marks all possible targets in images, even when targets are partially or fully blocked, which is crucial for detecting and locating fires in complex scenarios. Additionally, the model's efficiency and speed, with each image processed in just 20 milliseconds, make it well-suited for real-time fire detection applications. Overall, our model has great potential for detecting fires and other image recognition tasks, improving the accuracy and speed of fire detection systems, and ultimately reducing the risk and impact of fires. References [1] GUO Zhuohao, Peng Jiechen, Zhuang Yihui et al. Design of multi-mode fire detection and alarm system [J]. Journal of Shaoguan University,2022,43(09):54-59. [2] XUN Lei. Design of laboratory fire monitoring and control system based on multi-sensor fusion [J]. Journal of Anhui Electronic Information Technical College, 2019,22(01):6-13. [3] Yuan Hongchun, Tao Lei. Fish detection and identification based on improved Yolov8 electronic monitoring data of commercial fishing vessels [J]. Journal of Dalian ocean university, 2023, 38 (03): 533-542. The DOI: 10.16535 / j. carol carroll nki dlhyxb. 2022-354. [4] Xiao Pengcheng, Xu Wenguang, Zhang Yan, Zhu Liguang, Zhu Rong, Xu Yunfeng. Scrap classification rating method based on SE attention mechanism [J]. Journal of engineering science, 2023, (8): 1342-1352. The DOI: 10.13374 / j.i ssn 2095-9389.2022.06.10.002.