A lightweight fire detection algorithm for small targets based on YOLOv5s

Changzhi Lv,Haiyong Zhou,Yu Chen,Di Fan,Fangyi Di
DOI: https://doi.org/10.1038/s41598-024-64934-4
IF: 4.6
2024-06-21
Scientific Reports
Abstract:In response to the current challenges fire detection algorithms encounter, including low detection accuracy and limited recognition rates for small fire targets in complex environments, we present a lightweight fire detection algorithm based on an improved YOLOv5s. The introduction of the CoT (Contextual Transformer) structure into the backbone neural network, along with the creation of the novel CSP1_CoT (Cross stage partial 1_contextual transformer) module, has effectively reduced the model's parameter count while simultaneously enhancing the feature extraction and fusion capabilities of the backbone network; The network's Neck architecture has been extended by introducing a dedicated detection layer tailored for small targets and incorporating the SE (Squeeze-and-Excitation) attention mechanism. This augmentation, while minimizing parameter proliferation, has significantly bolstered the interaction of multi-feature information, resulting in an enhanced small target detection capability; The substitution of the original loss function with the Focal-EIoU (Focal-Efficient IoU) loss function has yielded a further improvement in the model's convergence speed and precision; The experimental results indicate that the modified model achieves an mAP@.5 of 96% and an accuracy of 94.8%, marking improvements of 8.8% and 8.9%, respectively, over the original model. Furthermore, the model's parameter count has been reduced by 1.1%, resulting in a compact model size of only 14.6MB. Additionally, the detection speed has reached 85 FPS (Frames Per Second), thus satisfying real-time detection requirements. This enhancement in precision and accuracy, while simultaneously meeting real-time and lightweight constraints, effectively caters to the demands of fire detection.
multidisciplinary sciences
What problem does this paper attempt to address?
The paper primarily addresses the challenges present in current fire detection algorithms, including low accuracy and limited recognition rates for small fire targets in complex environments. To tackle these challenges, the authors propose a lightweight fire detection algorithm based on an improved version of YOLOv5s. Specifically, the main contributions of this study are as follows: 1. **Network Structure Optimization**: To further reduce the number of parameters in the improved YOLOv5s network and enhance the fire feature extraction capability, the CoT (Contextual Transformer) structure is introduced into the CSP1 module, creating the CSP1_CoT structure, and replacing the original CSP1 module in the backbone network. 2. **Feature Fusion Enhancement**: To strengthen the ability of the improved YOLOv5s network to fuse fire features, the SE (Squeeze-and-Excitation) attention mechanism is combined with the CSP2 module, creating the CSP2_SE module, and replacing the original CSP2 module in the neck network. 3. **Improvement in Small Target Detection Capability**: To enhance the detection capability for small fire targets, a detection layer specifically for small targets is added to the YOLOv5s network, changing the original three-scale detection to four-scale detection. 4. **Loss Function Improvement**: The original YOLOv5s network uses the CIoU loss function, but considering that CIoU does not account for the imbalance between easy and hard samples, the loss function is replaced with Focal-EIoU. This further improves the model accuracy and accelerates the model convergence speed. Through the above improvements, the proposed model not only maintains a lightweight design and real-time performance but also significantly enhances the accuracy and precision of fire detection. Experimental results show that the improved model achieved 96% mAP@.5 and 94.8% accuracy, which are improvements of 8.8% and 8.9% respectively compared to the original model. Additionally, the model parameters were reduced by 1.1%, making the model size only 14.6MB, and the detection speed reached 85 FPS, meeting the requirements for real-time detection.