# Laboratory Flame Smoke Detection Based on an Improved YOLOX Algorithm
## 1 Introduction  
College laboratories are important sites for teaching and research, and are characterized by a large number and variety of equipment and varying levels of operators, leading to the existence of objective safety hazards. In recent years, a number of fire accidents have occurred in university laboratories, resulting in casualties and property damage. In the past decade or so, there have been more than 10,000 fire accidents of various types in laboratories in schools across the country, with nearly 100 deaths and injuries [1], and the Ministry of Education has repeatedly issued notices and working opinions on strengthening laboratory safety. At present, laboratory fire detection is mostly based on smoke and temperature sensors, but there are general problems regarding small coverage, the use of a single scene, and, to prevent sensors false alarm, it is difficult to detect the smoke or flame at the beginning of the fire until the smoke alarm or temperature alarm is triggered or the fire becomes larger, increasing the difficulty of extinguishing. With the development of deep learning, image recognition technology has been increasingly used for flame smoke recognition, which can detect and warn of small fires when they are very small. [PERSON] [2] proposed a smoke video detection method based on deep learning in the spatiotemporal domain. [PERSON] [3] et al. used deep separable convolution to improve flame detection models and use various data enhancement techniques to improve detection accuracy. [PERSON] [4] used a YOLOv4 framework-based UAV for real-time flame detection. [PERSON] [5] proposed a forest fire detection method based on the channel pruning YOLOv3 algorithm. The channel pruning idea is introduced into the algorithm to achieve effective compression of the model. [PERSON] [6] addressed the problem of high false alarm rates of smoke and open fires in visible video and used the idea of combining video frame information and motioninformation to detect them using the YOLOv3 algorithm. [PERSON] [7] et al. proposed an improved YOLOv3 fire detection algorithm for the problems of low detection rates of small targets in fire detection, low detection accuracy, and untimely detection in complex scenes. [PERSON] [8] et al. used an improved Mask R-CNN to achieve high-accuracy detection of flames by bottom-up feature fusion and an improved loss function. However, the models of the above methods have problems pertaining to slow detection and not having high enough detection accuracy. To solve these problems, this paper proposes an improved YOLOX detection model for detecting flames and smoke in laboratory fire scenes. The improvements of this algorithm are as follows.  
(1) The backbone network CSPDarknet of the YOLOX network is replaced with Swin Transformer architecture, and the convergence speed and detection accuracy are improved compared with the training results of the original YOLOX algorithm on the same flame smoke data.  
(2) Add CBAM attention mechanism after the three effective output networks of the backbone network to make the network pay more attention to the target to be detected, improve the detection effect, and solve the situation of easy error and omission detection in the context of a complex environment.  
(3) The PANet network model in the Neck part of the original YOLOX algorithm is replaced by the Slim Neck network model, which still keeps the model with sufficient accuracy while reducing the computational effort and network complexity.