Flame and smoke detection method and device

The deep learning model is combined with three-frame interpolation and background subtraction to detect the dynamic features of flame smoke, and the color model and LBP method are used to obtain static features, which solves the problem of high complexity of static features and poor recognizability in traditional detection methods, and achieves high efficiency. , Accurate flame smoke detection.

CN111832392BActive Publication Date: 2024-09-06HUBEI JIUGAN TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010463044.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-27
Publication Date
2024-09-06
Estimated Expiration
2040-05-27

AI Technical Summary

Technical Problem

When traditional flame smoke detection methods detect fires, the mixture of static features and dynamic features affects the continuity of image information, resulting in unsatisfactory detection results, long time consumption, and difficulty in accurately detecting static features due to their high complexity and poor recognizability.

Method used

A deep learning model combined with three-frame interpolation and background subtraction is used to detect the dynamic features of flame smoke, and static features are obtained through the color model and LBP method. After separation and detection, comprehensive judgment is performed to improve detection accuracy.

Benefits of technology

It greatly shortens the flame smoke detection time, improves the detection accuracy, and meets the requirements of real-time detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111832392B
    Figure CN111832392B
Patent Text Reader

Abstract

The embodiment of the present invention provides a flame smoke detection method and device, the method comprising: obtaining the dynamic features of the flame smoke in each frame of the video, and obtaining the dynamic detection results of the flame smoke in each frame according to the dynamic features in each frame; obtaining the static features of the flame smoke in each frame of the video, and determining the static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame, inputting the static area into a deep learning model, and outputting the static detection results of the flame smoke in each frame; and determining the final detection results of the flame smoke according to the dynamic detection results and the static detection results of the flame smoke in each frame. The embodiment of the present invention greatly shortens the detection time of the flame smoke, meets the real-time requirements of the flame smoke detection, and has a higher detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of intelligent security, and in particular relates to a flame and smoke detection method and device. Background Art

[0002] Fire is one of the most common disasters in daily life, which often causes huge losses to people's lives and property. Therefore, fire prevention and detection are very important.

[0003] Traditional flame smoke detection methods often combine the static and dynamic characteristics of flame smoke for detection when detecting fires. This detection method has major drawbacks. The reason is that when the static and dynamic motion characteristics of flame smoke are mixed together for detection, it will affect the continuity of the image information required for dynamic feature detection, making the final real-time detection effect not very ideal and time-consuming.

[0004] Considering that the movement of flames and smoke has some unique motion characteristics when a fire occurs, traditional image processing methods can quickly detect these dynamic characteristics; however, in a certain scenario, when a fire occurs, the static characteristics of flames and smoke hardly change, or the changes that occur are small, and they are highly complex and have poor identifiability. It is difficult to accurately detect them using traditional image processing methods. Summary of the invention

[0005] In order to overcome the problem of poor detection effect of the above-mentioned existing flame and smoke detection methods or at least partially solve the above-mentioned problem, an embodiment of the present invention provides a flame and smoke detection method and device.

[0006] According to a first aspect of an embodiment of the present invention, there is provided a flame and smoke detection method, comprising:

[0007] The dynamic features of the flame and smoke in each frame of the video are obtained, and the dynamic detection results of the flame and smoke in each frame are obtained according to the obtained dynamic features in each frame;

[0008] Obtaining static features of flame smoke in each frame of the video, determining a static area of ​​flame smoke in each frame according to the static features of flame smoke in each frame, inputting the static area into a deep learning model, and outputting a static detection result of flame smoke in each frame;

[0009] The deep learning model is trained and acquired based on image samples of flame smoke and static detection results of flame smoke in the image samples;

[0010] The final detection result of the flame smoke is determined according to the dynamic detection result and the static detection result of the flame smoke in each frame.

[0011] Specifically, before the step of obtaining the dynamic characteristics of the flame and smoke in each frame of the video, the following steps are also included:

[0012] Detecting the motion area of ​​the flame and smoke in each frame of the video based on a three-frame interpolation method;

[0013] Detecting the motion area of ​​the flame smoke in each frame of the video based on background subtraction;

[0014] Performing an OR operation on the motion regions detected by the three-frame interpolation method and the background subtraction method in each frame to obtain the final motion region of the flame and smoke in each frame;

[0015] Accordingly, the steps of obtaining the dynamic characteristics of the flame smoke in each frame of the video include:

[0016] The dynamic characteristics of the flame smoke in the final motion area of ​​the flame smoke in each frame are obtained.

[0017] Specifically, the step of determining the motion area of ​​the flame smoke in each frame of the video based on the three-frame interpolation method includes:

[0018] Calculating a differential image between a current frame of the video and a frame immediately before the current frame, and a differential image between a frame immediately after the current frame and the current frame;

[0019] Performing an AND operation on the two differential images;

[0020] The result of the AND operation is binarized, and the result of the binarization is morphologically processed to obtain the motion area of ​​the flame smoke detected by the three-frame interpolation method in the current frame.

[0021] Specifically, the motion area of ​​the flame smoke in each frame of the video is detected based on background subtraction using the following formula:

[0022]

[0023]

[0024]

[0025] Among them, P(x,y,i) is the result of background subtraction operation on the pixel with coordinates (x,y) in the i-th frame of the video, B(x,y,i) is the background intensity of the pixel with coordinates (x,y) in the i-th frame of the video, B(x,y,i+1) is the background intensity of the pixel with coordinates (x,y) in the i+1-th frame of the video, T(x,y,i) is the motion threshold of the pixel with coordinates (x,y) in the i-th frame of the video, f(x,y,i) is the pixel value with coordinates (x,y) in the i-th frame of the video, and λ is the adjustment parameter.

[0026] Specifically, the steps of obtaining the dynamic features of the flame smoke in the final motion region of the flame smoke in each frame and obtaining the dynamic detection result of the flame smoke in each frame according to the obtained dynamic features in each frame include:

[0027] Obtaining the position of the final motion region in each frame, comparing the positions of the final motion region between two adjacent frames, and determining whether the final motion region meets the characteristics of overall movement stability of flame smoke;

[0028] Counting the areas of the final motion region in two adjacent frames, comparing the areas of the final motion region in two consecutive adjacent frames, and determining whether the area of ​​the final motion region meets the characteristic that the area of ​​the flame smoke gradually increases over time;

[0029] Obtaining the main motion direction of the final motion area based on the optical flow method, and determining whether the main motion direction conforms to the characteristic that the flame smoke moves from bottom to top;

[0030] If the final movement region meets the characteristics of overall movement stability of the flame smoke, gradual increase in area over time, and movement from bottom to top, then it is known that the final movement region is the flame smoke region, otherwise it is not the flame smoke region.

[0031] Specifically, the step of obtaining the position of the final motion region in each frame and judging whether the final motion region meets the characteristics of the overall movement stability of the flame smoke according to the position includes:

[0032] Acquire the center point of the final motion region in each frame, and a target pixel point located directly above a pixel point at the bottom of the final motion region and at a distance from the pixel point at the bottom by a preset ratio of the height of the final motion region;

[0033] Calculating the relative motion rates of the center point in the horizontal direction and the vertical direction, and the relative motion rates of the target pixel point in the horizontal direction and the vertical direction in two adjacent frames;

[0034] If the relative movement rates of the center point in the horizontal and vertical directions, and the relative movement rates of the target pixel point in the horizontal and vertical directions are both within a preset range, it is known that the final motion region meets the characteristics of the overall movement stability of the flame smoke.

[0035] Specifically, the steps of obtaining the static features of the flame smoke in each frame of the video and determining the static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame include:

[0036] Obtaining a suspected flame and smoke region in each frame of the video based on a flame and smoke color model;

[0037] Acquire the texture features of the suspected flame and smoke area based on the LBP method;

[0038] A flame smoke target region in the flame smoke suspected region is acquired according to the texture feature, and the flame smoke target region is used as a static region of the flame smoke.

[0039] Specifically, the color model of the flame smoke is:

[0040] R≥G>B;

[0041] R>R T ;

[0042]

[0043] |RG| T ;

[0044] |RB| T ;

[0045] |GB| T ;

[0046] Among them, R is the value of the red channel of the flame smoke pixel in the RGB color space, G is the value of the green channel of the flame smoke pixel in the RGB color space, and R is the value of the blue channel of the flame smoke pixel in the RGB color space. T , S T and I T is the preset threshold, and S is the saturation of the flame smoke pixel.

[0047] According to a second aspect of an embodiment of the present invention, a flame and smoke detection device is provided, comprising:

[0048] A dynamic detection module is used to obtain the dynamic features of the flame and smoke in each frame of the video, and obtain the dynamic detection result of the flame and smoke in each frame according to the obtained dynamic features in each frame;

[0049] A static detection module, used to obtain static features of the flame smoke in each frame of the video, determine a static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame, input the static area into a deep learning model, and output a static detection result of the flame smoke in each frame;

[0050] The deep learning model is trained and acquired based on image samples of flame smoke and static detection results of flame smoke in the image samples;

[0051] The fusion detection module is used to determine the final detection result of the flame and smoke according to the dynamic detection result and the static detection result of the flame and smoke in each frame. ​​​

[0052] According to a third aspect of an embodiment of the present invention, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor calls the program instructions to execute a flame and smoke detection method provided by any possible implementation of the various possible implementations of the first aspect.

[0053] The embodiment of the present invention provides a flame smoke detection method and device. The method uses two asynchronous threads to realize the separate detection of static characteristics and dynamic characteristics of flame smoke, and then uses a third overall detection thread to make a comprehensive judgment on the dynamic detection results and the static detection results at each time point to obtain the final flame smoke detection result, which greatly shortens the detection time of flame smoke, meets the real-time requirements of flame smoke detection, and has higher detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0055] Figure 1 A schematic diagram of the overall process of the flame and smoke detection method provided by an embodiment of the present invention;

[0056] Figure 2 A schematic diagram of a process for detecting static characteristics of flame smoke using a deep learning convolutional neural network in a flame smoke detection method provided in an embodiment of the present invention;

[0057] Figure 3 A complete flow chart of the flame and smoke detection method provided by an embodiment of the present invention;

[0058] Figure 4 A schematic diagram of the overall structure of a flame and smoke detection device provided in an embodiment of the present invention;

[0059] Figure 5 A schematic diagram of the overall structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0061] In one embodiment of the present invention, a flame and smoke detection method is provided. Figure 1 The overall flow diagram of the flame smoke detection method provided by the embodiment of the present invention comprises: S101, obtaining the dynamic features of the flame smoke in each frame of the video, and obtaining the dynamic detection result of the flame smoke in each frame according to the obtained dynamic features in each frame;

[0062] Specifically, before performing flame and smoke detection on each frame in the video, each frame in the video is preprocessed, and the preprocessing includes color balancing. There are two steps in color balancing. The first is to estimate the brightness and chromaticity of each frame in a standardized manner through a scaling factor. Assuming that there is a good color distribution in each frame, the gray world algorithm is used to calculate the average value of the image intensity in the R, G, and B planes on each frame. The vectors of the three image intensities obtained are called the light values ​​of the image; the second is to scale each R, G, and B plane independently using a multiplication factor, which converts the grayscale value into the average intensity of each frame in the R, G, and B planes. If the scaled value is greater than the maximum possible intensity, it is determined to be the maximum value. After color balancing, the image sequence in the video to be detected will be subjected to independent flame and smoke static and dynamic feature detection.

[0063] The dynamic features are the dynamic features of the flame smoke in adjacent frames. When detecting the dynamic features of the flame smoke, it is analyzed whether the dynamic features of the flame smoke in adjacent frames conform to the actual dynamic features of the flame smoke, so as to obtain the dynamic detection results of the flame smoke in each frame. The actual dynamic features of the flame smoke include the relative stability of the overall movement of the flame smoke area, the characteristics of the area of ​​the flame smoke area gradually increasing over time, and the main movement direction of the flame smoke area is from bottom to top.

[0064] S102, obtaining static features of flame smoke in each frame of the video, determining a static area of ​​flame smoke in each frame according to the static features of flame smoke in each frame, inputting the static area into a deep learning model, and outputting a static detection result of flame smoke in each frame; wherein the deep learning model is trained and obtained according to image samples of flame smoke and static detection results of flame smoke in the image samples;

[0065] The static features of flame smoke are mainly the color, texture and other surface features of flame smoke. The color of flame is usually in the range of red-yellow or red, and at least when the fire starts, the color of smoke varies from blue-white to white. Since the color of objects such as clouds and fog in the natural environment is similar to the color of smoke, and the static features of flame smoke are highly complex and poorly recognizable, it is not feasible to detect flame smoke simply by color. Texture features do not depend on changes in image color or brightness, and can reflect the homogeneity of images. Therefore, color and texture features can be used as static features for flame smoke detection, and detection can achieve good results. However, the final determination of whether a fire has occurred must be based on the detection results of the dynamic features of flame smoke.

[0066] In this embodiment, the static area detected by using static features is input into the deep learning model for detection. The deep learning model is a convolutional neural network, which includes a convolutional layer, a pooling layer, and a fully connected layer. Among them, the convolutional layer is responsible for extracting local features in the image, the pooling layer is used to significantly reduce the magnitude of parameters, and the fully connected layer is similar to the part of the traditional neural network, which is used to output the results. In the convolutional layer and the pooling layer, the nodes of each layer are connected to some nodes of the previous layer, and all nodes in the fully connected layer are connected to all nodes in the previous layer, and the output can be obtained after passing through the fully connected layer.

[0067] The convolutional neural network is trained using the preprocessed fire smoke image sample set, and combined with the Mobilenet deep separable convolutional network model, only the static features of the fire smoke are extracted, and the dynamic features and static features of the fire smoke image are separated and detected. Mobilenet can decompose the standard convolutional neural network into deep convolution and point-by-point convolution, which can reduce the amount of calculation and control the training model from being too large. The convolutional neural network (CNN) uses a region proposal network to generate proposed regions that may contain objects, and uses these proposed regions to fine-tune to classify and locate objects. The entire processing process is about 7 frames per second, but this is far from meeting the real-time requirements. In practical applications, if the fire cannot be detected in time, it will cause huge losses to people's lives and property safety. For this reason, Mobilenet-ssd is used to cancel the accelerated processing process of the region proposal network, and finally the static features of the fire smoke are extracted and trained under the Tensorflow-Gpu (Gpu accelerated version) framework. The Tensorflow deep learning framework is a symbolic mathematical system based on dataflow programming, which is widely used in the programming implementation of various deep learning algorithms. The use of the Tensorflow-Gpu (Gpu accelerated version) framework effectively improves the extraction training efficiency and meets the real-time requirements of static feature detection of flames and smoke.

[0068] The specific process of using deep learning convolutional neural network to detect the static characteristics of flame smoke is as follows: Figure 2 As shown in the figure. The upper part is the flame smoke static feature sample set extraction training process. After data normalization and other preprocessing, the flame smoke static feature image data set is sent to the convolutional neural network model for training to obtain a trained network model. The lower part is the flame smoke static feature detection process. After a series of processing of the transmitted real-time video stream to be detected, the static area image is sent to the trained network model for detection, and finally the flame smoke static feature detection result is obtained. This detection result will be combined with the dynamic feature detection result of the flame smoke to obtain the final flame smoke detection result.

[0069] S103, determining a final detection result of the flame and smoke according to the dynamic detection result and the static detection result of the flame and smoke in each frame.

[0070] Since the dynamic and static features of flame smoke are detected separately using asynchronous threads, the execution processes of the two threads do not interfere with each other. The deep learning method is used to detect only the static features of flame smoke, while the detection of dynamic features of flame smoke can be performed simultaneously with the detection of static features of flame smoke, or before the detection of static features. Finally, the third overall detection line is used to take each preset frame image in the video image sequence, such as three frames of images, to make a fusion judgment of the dynamic and static detection results, such as the 1st frame, the 5th frame, the 9th frame... etc. The specific method of comprehensive judgment is the final flame smoke detection result R final The static characteristics of flame smoke detection result R Q And the dynamic feature detection result R S And we get R final =R Q ∩R S , when the flame smoke static feature detects flame smoke, R Q =1, otherwise R Q = 0; when the flame smoke dynamic feature detects flame smoke, R S =1, otherwise R S =0, then:

[0071]

[0072] As long as the fusion judgment result of one frame of image detects the presence of flame and smoke, it will be shown that there is a fire in the video to be detected. The complete flow chart of flame and smoke detection is as follows: Figure 3 shown.

[0073] This embodiment uses two asynchronous threads to realize the separate detection of the static characteristics and dynamic characteristics of flame smoke, and then uses the third overall detection thread to make a comprehensive judgment on the dynamic detection results and the static detection results at each time point to obtain the final flame smoke detection result, which greatly shortens the detection time of flame smoke, meets the real-time requirements of flame smoke detection, and has higher detection accuracy.

[0074] On the basis of the above-mentioned embodiment, before the step of obtaining the dynamic characteristics of the flame smoke in each frame of the video, the present embodiment also includes: detecting the motion area of ​​the flame smoke in each frame of the video based on the three-frame interpolation method; detecting the motion area of ​​the flame smoke in each frame of the video based on the background subtraction method; performing an OR operation on the motion area detected by the three-frame interpolation method and the background subtraction in each frame to obtain the final motion area of ​​the flame smoke in each frame; accordingly, the step of obtaining the dynamic characteristics of the flame smoke in each frame of the video includes: obtaining the dynamic characteristics of the flame smoke in the final motion area of ​​the flame smoke in each frame.

[0075] Specifically, it is usually assumed that the visual sensor used for flame smoke detection is fixed at a certain position and direction, keeping the field of view and background scene fixed. As the air in the environment flows, the shape of the flame smoke will change over time, thereby presenting a state of rapid movement, and the flame will present a shaking state. Therefore, to analyze the dynamic characteristics of the flame smoke in the video, it is first necessary to detect the motion area of ​​the flame smoke in each frame of the video. In a video to be detected, the difference between two adjacent frames is the change value of the pixel, and the changed pixel is the motion area. Therefore, this embodiment first uses the three-frame interpolation method to determine the motion area of ​​the flame smoke in each frame of the video; then the background subtraction method is used to detect the motion area; finally, the detection result of the three-frame interpolation method and the detection result of the background subtraction method are ORed to obtain the final motion area. After determining the final motion area, analyze whether the dynamic characteristics of the final motion area conform to the actual dynamic characteristics of the flame smoke.

[0076] This embodiment detects the video image by three-frame interpolation and background subtraction, which can ensure that the detected motion area is more complete and accurate, and lay a foundation for the subsequent accurate analysis of the dynamic characteristics of flames and smoke.

[0077] On the basis of the above embodiment, the step of determining the motion area of ​​the flame smoke in each frame of the video based on the three-frame interpolation method in this embodiment includes: calculating a differential image between a current frame of the video and a previous frame immediately adjacent to the current frame, and a differential image between a subsequent frame immediately adjacent to the current frame and the current frame;

[0078] Assume that the images of the i-1th frame, i-th frame and i+1th frame in the n-frame image sequence of the video to be detected are f(i-1), f(i) and f(i+1) respectively, and the grayscale values ​​of any pixel with coordinates (x, y) are f(x, y, i-1), f(x, y, i) and f(x, y, i+1) respectively. The difference images D(x, y, i) and D(x, y, i+1) are:

[0079] D(x,y,i)=|f(x,y,i)-f(x,y,i-1)|;

[0080] D(x,y,i+1)=|f(x,y,i+1)-f(x,y,i)|;

[0081] Performing an AND operation on the two differential images;

[0082] Perform an AND operation on the difference images D(x,y,i) and D(x,y,i+1) to obtain D′(x,y,i), that is

[0083] D′(x,y,i)=D(x,y,i)∩D(x,y,i+1);

[0084] The result of the AND operation is binarized, and the result of the binarization is morphologically processed to obtain the motion area of ​​the flame smoke detected by the three-frame interpolation method in the current frame.

[0085] Then D′(x,y,i) is binarized to obtain the binarized image D″(x,y,i):

[0086]

[0087] Wherein, T is a preset threshold when binarizing the image D′(x, y, i), and the preset threshold T is determined by applying the Otsu algorithm to the i-th frame image f(i).

[0088] Finally, morphological processing such as connectivity analysis is performed on D″(x, y, i) to obtain the motion area D″′(x, y, i) of the flame smoke.

[0089] On the basis of the above embodiment, in this embodiment, the moving area of ​​the flame smoke in each frame of the video is detected based on the background subtraction method using the following formula:

[0090]

[0091]

[0092]

[0093] Wherein, P(x,y,i) is the result of background subtraction operation on the pixel with coordinates (x,y) in the i-th frame of the video, B(x,y,i) is the background intensity of the pixel with coordinates (x,y) in the i-th frame of the video, B(x,y,i+1) is the background intensity of the pixel with coordinates (x,y) in the i+1-th frame of the video, B is the dynamic background model for flame smoke detection, T(x,y,i) is the adaptive motion threshold of the pixel with coordinates (x,y) in the i-th frame of the video, f(x,y,i) is the pixel value with coordinates (x,y) in the i-th frame of the video, λ is an adjustment parameter, and this embodiment uses the same adjustment parameter λ to update the adaptive motion threshold and background model.

[0094] Finally, the detection result D″′(x, y, i) of the three-frame interpolation method is ORed with the detection result P(x, y, i) of the background subtraction method to obtain the final motion area S(x, y, i). S(x, y, i) is the final motion area in the current frame of the video.

[0095] On the basis of the above embodiment, in this embodiment, the dynamic features of the flame smoke in the final motion area of ​​the flame smoke in each frame are obtained, and the step of obtaining the dynamic detection result of the flame smoke in each frame according to the obtained dynamic features in each frame includes: obtaining the position of the final motion area in each frame, comparing the positions of the final motion area between two adjacent frames, and judging whether the final motion area meets the characteristics of the overall movement stability of the flame smoke;

[0096] Specifically, when a fire occurs, combustion is a continuous process, and the combustion process will not suddenly disappear without human interference. As new combustibles are ignited, the flame and smoke area will move as a whole and be relatively stable. Even when the fire is spreading rapidly, the flame and smoke will not move in a jumpy manner. Therefore, if the moving area in the video moves in a jumpy manner, it can be excluded.

[0097] Counting the areas of the final motion region in two adjacent frames, comparing the areas of the final motion region in two consecutive adjacent frames, and determining whether the area of ​​the final motion region meets the characteristic that the area of ​​the flame smoke gradually increases over time;

[0098] During a fire, as new combustibles are ignited, the area of ​​the flame smoke movement region will gradually increase. This embodiment counts the area of ​​the flame smoke movement region in two adjacent frames, and then compares the size of the area to determine whether the flame smoke movement region gradually increases over time. The size of the movement region is obtained by counting the number of pixels contained in the movement region. The algorithm steps are as follows:

[0099] (1) First, set an access tag V(x,y) for each pixel in the binary image S(x,y,i), and initialize V(x,y)=0 for all pixels. Set an empty queue Q and a variable Sum, which is used to count the number of pixels entering the queue, that is, the number of pixels in the motion area. Initialize Sum=0, and then scan the entire binary image frame line by line.

[0100] (2) When a pixel point P(x0, y0) with a pixel value of 255 is scanned, the access bit V(x0, y0) is set to 1, indicating that the pixel point has been visited, and the pixel point P(x0, y0) is placed in the queue, and Sum is increased by 1;

[0101] (3) Take the last element in the queue, select a pixel with a pixel value of 255 from the four neighborhoods of the pixel, and then repeat step (2). If there is no pixel with a pixel value of 255 in its four neighborhoods, repeat (3);

[0102] (4) When the queue is empty, the algorithm ends. The value of Sum is the size of the motion area.

[0103] Obtaining the main motion direction of the final motion area based on the optical flow method, and determining whether the main motion direction conforms to the characteristic that the flame smoke moves from bottom to top;

[0104] When using the optical flow method to determine the direction of motion of the final motion region, a velocity vector is first assigned to each pixel in the final motion region, thus forming an optical flow field. According to the motion of the final motion region, the changes in the video are detected, and the corresponding relationship between the previous frame and the current frame is found by using the changes in the pixels in the image sequence in the time domain and the correlation between adjacent frames, so as to calculate the motion direction of the final motion region between adjacent frames.

[0105] If the final movement region meets the characteristics of overall movement stability of the flame smoke, gradual increase in area over time, and movement from bottom to top, then it is known that the final movement region is a flame smoke region.

[0106] On the basis of the above embodiment, in this embodiment, the steps of obtaining the position of the final motion region in each frame, comparing the positions of the final motion region between two adjacent frames, and judging whether the final motion region meets the characteristics of the overall movement stability of the flame smoke include: obtaining the center point of the final motion region in each frame, and a target pixel point located directly above the pixel point at the bottom of the final motion region and whose distance from the pixel point at the bottom is a preset ratio of the height of the final motion region;

[0107] Specifically, in order to more accurately describe the moving speed of the moving object, this embodiment uses the relative moving speed of the center point of the moving area and the target pixel point located just above the bottom pixel point of the moving area and at a preset ratio of the moving area height from the bottom as the basis for judging the overall movement of the moving area. For example, the preset ratio is 1 / 3. First, obtain the coordinates of the center point of the moving area (X k ,Y k ) and the target pixel coordinates (X k ,Y k ). Let the size of the kth motion region in the current frame be M k ×N k , then the pixel coordinates in the motion area are (x k ,y k ), then the coordinates of the center pixel are:

[0108]

[0109] Similarly, the coordinates of the target pixel point located directly above the bottom pixel point of the motion area and whose distance from the bottom is a preset ratio of the motion area height can be obtained (X k ,Y k ).

[0110] Calculating the relative motion rates of the center point in the horizontal direction and the vertical direction, and the relative motion rates of the target pixel point in the horizontal direction and the vertical direction in two adjacent frames;

[0111] Use (x k (i),y k (i)) and (x) k (i+1),y k (i+1)) represent the motion areas in the binary images of two adjacent frames, (X k (i),Y k (i)) and (X) k (i+1),Y k (i+1)) represent the coordinates of the center point of the motion area in the binary images of two adjacent frames, ( X k (i), Y k (i)) and ( X k (i+1), Y k V (i+1)) represent the target pixel coordinates of the motion area in the binary images of two adjacent frames. kx (i) and V ky (i) respectively represent the relative motion speed of the center point of the kth motion region in the i-th frame in the horizontal and vertical directions, then

[0112]

[0113] If the relative movement rates of the center point in the horizontal and vertical directions, and the relative movement rates of the target pixel point in the horizontal and vertical directions are both within a preset range, it is known that the final motion region meets the characteristics of the overall movement stability of the flame smoke.

[0114] In the above formula, V kx (i),V ky (i)∈[P1,P2]. P1 and P2 are its upper and lower limits, and both are real numbers between 0 and 1. Similarly, the relative motion rates of the target pixel in the horizontal and vertical directions can be obtained. If the relative motion rates of the center point of the motion region and the relative motion rates of the target pixel are both within the upper and lower limits, it means that the motion region has the characteristics of overall motion stability and is a flame smoke region; otherwise, the motion region is excluded.

[0115] On the basis of the above embodiments, in this embodiment, the static features of the flame smoke in each frame of the video are obtained, and the steps of determining the static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame include: obtaining a suspected flame smoke area in each frame of the video based on a color model of the flame smoke; obtaining texture features of the suspected flame smoke area based on the LBP method; obtaining a flame smoke target area in the suspected flame smoke area according to the texture features, and using the flame smoke target area as the static area of ​​the flame smoke.

[0116] Specifically, the color features of the flame smoke are first used to detect the suspected flame smoke area in each frame of the video based on a separate color model. Then, the texture features are detected to exclude image areas in the environment with colors similar to those of the flame smoke, and the flame smoke area is obtained. The flame smoke area detected using the static features is used as the static area of ​​the flame smoke.

[0117] Interference objects such as clouds and fog in the natural environment are difficult to distinguish based on color features. The difference between them is the difference in the spatial distribution and combination of colors, which means different textures. Therefore, texture features are further extracted from the suspected flame and smoke area. This embodiment uses the LBP (Local Binary Patterns) method to extract the texture features of the suspected flame and smoke area. The LBP method is an operator used in computer vision to describe the local texture features of an image. It has significant advantages such as rotation invariance and grayscale invariance.

[0118] In order to adapt to texture features of different scales and meet the requirements of grayscale and rotation invariance, this embodiment uses an improved LBP operator, which expands the 3×3 neighborhood to an arbitrary neighborhood and replaces the square neighborhood with a circular neighborhood, allowing any number of pixels in a circular neighborhood with a radius of R. This embodiment uses the improved LBP operator to process the flame smoke video image to obtain a flame smoke target area image, which is then sent to the deep learning model for detection.

[0119] On the basis of the above embodiments, the color model of the flame smoke in this embodiment is:

[0120] R≥G>B;

[0121] R>R T ;

[0122]

[0123] |RG| T ;

[0124] |RB| T ;​​

[0125] |GB| T ;

[0126] Among them, R is the value of the red channel of the flame smoke pixel in the RGB color space, G is the value of the green channel of the flame smoke pixel in the RGB color space, and R is the value of the blue channel of the flame smoke pixel in the RGB color space. T , S T and I T is the preset threshold, and S is the saturation of the flame smoke pixel.

[0127] Specifically, to find the flame pixels, the first filter selects pixels with the appropriate hue in the HSI color space. Then, any pixels outside the red-yellow range of 0° to 60° are not considered for H. Let the intensity of the considered pixel be the red channel R, the green channel G, and the blue channel B. The color filter corresponds exactly to the RGB region, where R≥G, G>B. The result of the filter is that for all selected pixels, R≥G>B in the RGB color space.

[0128] To prevent the selection of low brightness and low saturation red pixels, low red and low saturation pixels are further filtered out. For the red level, a simple threshold is applied, i.e., R>R T . Where R is the red level of the pixel, R T is an empirical threshold for red levels determined by calibrating the training videos. For saturation, slightly more complex rules are applied. The final step filters out any values ​​below the threshold I T The flame pixel intensity. Threshold I T It can be determined by Otsu algorithm. The color characteristics of flame smoke can be obtained through the color model of flame smoke.

[0129] In another embodiment of the present invention, a flame and smoke detection device is provided, which is used to implement the methods in the above embodiments. Therefore, the description and definition in the above embodiments of the flame and smoke detection method can be used to understand the various execution modules in the embodiments of the present invention. Figure 4 The overall structure diagram of the flame and smoke detection device provided in the embodiment of the present invention includes a dynamic detection module 401, a static detection module 402 and a fusion detection module 403; wherein:

[0130] The dynamic detection module 401 is used to obtain the dynamic features of the flame smoke in each frame of the video, and obtain the dynamic detection result of the flame smoke in each frame according to the obtained dynamic features in each frame;

[0131] ​The dynamic features are the dynamic features of the flame smoke in adjacent frames. When the dynamic detection module 401 detects the dynamic features of the flame smoke, it analyzes whether the dynamic features of the flame smoke in adjacent frames conform to the actual dynamic features of the flame smoke, thereby obtaining the dynamic detection results of the flame smoke in each frame. The actual dynamic features of the flame smoke include the relative stability of the overall movement of the flame smoke area, the characteristic that the area of ​​the flame smoke area gradually increases over time, and the main movement direction of the flame smoke area is from bottom to top.

[0132] The static detection module 402 is used to obtain the static features of the flame smoke in each frame of the video, determine the static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame, input the static area into the deep learning model, and output the static detection result of the flame smoke in each frame; wherein the deep learning model is trained and obtained according to the image samples of the flame smoke and the static detection results of the flame smoke in the image samples;

[0133] The static features of flame smoke are mainly the color, texture and other surface features of flame smoke. The color of flame is usually in the range of red-yellow or red, and at least when the fire starts, the color of smoke varies from blue-white to white. Since the color of objects such as clouds and fog in the natural environment is similar to the color of smoke, and the static features of flame smoke have the characteristics of high complexity and poor recognizability, it is not feasible to detect flame smoke simply by color. Texture features do not depend on changes in image color or brightness, and can reflect the homogeneity of the image. Therefore, the static detection module 402 can use color and texture features as static features for flame smoke detection, and detect them, which can achieve better results. However, the final determination of whether a fire has occurred still requires the comprehensive detection results of the dynamic features of flame smoke.

[0134] The static detection module 402 inputs the static area detected using the static features into the deep learning model for detection. The deep learning model is a convolutional neural network, which includes a convolutional layer, a pooling layer, and a fully connected layer. Among them, the convolutional layer is responsible for extracting local features in the image, the pooling layer is used to significantly reduce the parameter magnitude, and the fully connected layer is similar to the part of the traditional neural network, which is used to output the results. In the convolutional layer and the pooling layer, the nodes of each layer are connected to some nodes of the previous layer, and all nodes in the fully connected layer are connected to all nodes in the previous layer, and the output can be obtained after passing through the fully connected layer.

[0135] The fusion detection module 403 is used to determine the final detection result of the flame and smoke according to the dynamic detection result and the static detection result of the flame and smoke in each frame.

[0136] Since the dynamic and static features of flame smoke are detected separately by asynchronous threads, the execution processes of the two threads do not interfere with each other. The deep learning method is used to detect only the static features of flame smoke, and the detection of the dynamic features of flame smoke can be performed synchronously with the detection of the static features of flame smoke, or before the detection of the static features. The fusion detection module 403 uses the third overall detection line to take each preset frame image in the video image sequence to make a fusion judgment of the dynamic and static detection results.

[0137] This embodiment uses two asynchronous threads to realize the separate detection of the static characteristics and dynamic characteristics of flame smoke, and then uses the third overall detection thread to make a comprehensive judgment on the dynamic detection results and the static detection results at each time point to obtain the final flame smoke detection result, which greatly shortens the detection time of flame smoke, meets the real-time requirements of flame smoke detection, and has higher detection accuracy.

[0138] On the basis of the above embodiments, the present embodiment also includes an acquisition module, which is used to detect the motion area of ​​the flame smoke in each frame of the video based on the three-frame interpolation method; detect the motion area of ​​the flame smoke in each frame of the video based on the background subtraction method; perform an OR operation on the motion area detected by the three-frame interpolation method and the background subtraction in each frame to obtain the final motion area of ​​the flame smoke in each frame; accordingly, the dynamic monitoring module is specifically used to: obtain the dynamic characteristics of the flame smoke in the final motion area of ​​the flame smoke in each frame.

[0139] On the basis of the above-mentioned embodiment, the acquisition module in this embodiment is used to calculate the differential image between the current frame of the video and the previous frame immediately adjacent to the current frame, and the differential image between the next frame immediately adjacent to the current frame and the current frame; perform an AND operation on the two differential images; perform a binarization process on the result of the AND operation, perform morphological processing on the result of the binarization process, and obtain the motion area of ​​the flame smoke detected by the three-frame interpolation method in the current frame.

[0140] On the basis of the above embodiment, in this embodiment, the acquisition module detects the motion area of ​​the flame smoke in each frame of the video based on background subtraction using the following formula:

[0141]

[0142]

[0143]

[0144] Among them, P(x,y,i) is the result of background subtraction operation on the pixel with coordinates (x,y) in the i-th frame of the video, B(x,y,i) is the background intensity of the pixel with coordinates (x,y) in the i-th frame of the video, B(x,y,i+1) is the background intensity of the pixel with coordinates (x,y) in the i+1-th frame of the video, T(x,y,i) is the motion threshold of the pixel with coordinates (x,y) in the i-th frame of the video, f(x,y,i) is the pixel value with coordinates (x,y) in the i-th frame of the video, and λ is the adjustment parameter.

[0145] On the basis of the above-mentioned embodiment, the dynamic detection module in this embodiment is specifically used for: obtaining the position of the final motion area in each frame, comparing the positions of the final motion area between two adjacent frames, and judging whether the final motion area meets the characteristics of the overall movement stability of the flame smoke; counting the area of ​​the final motion area in two adjacent frames, comparing the area of ​​the final motion area in two consecutive adjacent frames, and judging whether the area of ​​the final motion area meets the characteristics that the area of ​​the flame smoke gradually increases over time; obtaining the main motion direction of the final motion area based on the optical flow method, and judging whether the main motion direction meets the characteristics that the flame smoke moves from bottom to top; if the final motion area meets the characteristics of the overall movement stability of the flame smoke, the area gradually increases over time, and the movement from bottom to top, it is known that the final motion area is the flame smoke area, otherwise it is not the flame smoke area.

[0146] On the basis of the above embodiments, the dynamic detection module in this embodiment is used to: obtain the center point of the final motion area in each frame, and the target pixel point directly above the pixel point at the bottom of the final motion area and the distance from the pixel point at the bottom to the preset ratio of the height of the final motion area; calculate the relative movement rate of the center point in the horizontal and vertical directions in two adjacent frames, and the relative movement rate of the target pixel point in the horizontal and vertical directions; if the relative movement rate of the center point in the horizontal and vertical directions, and the relative movement rate of the target pixel point in the horizontal and vertical directions are both within the preset range, it is known that the final motion area meets the characteristics of the overall movement stability of the flame smoke.

[0147] On the basis of the above embodiments, the static detection module in this embodiment is used to: obtain the suspected flame smoke area in each frame of the video based on the color model of the flame smoke; obtain the texture features of the suspected flame smoke area based on the LBP method; obtain the flame smoke target area in the suspected flame smoke area according to the texture features, and use the flame smoke target area as the static area of ​​the flame smoke.

[0148] Based on the above embodiment, the color model of the flame smoke in this embodiment is:

[0149] R≥G>B;

[0150] R>RT;

[0151]

[0152] |RG| T ;

[0153] |RB| T ;

[0154] |GB| T ;

[0155] Among them, R is the value of the red channel of the flame smoke pixel in the RGB color space, G is the value of the green channel of the flame smoke pixel in the RGB color space, and R is the value of the blue channel of the flame smoke pixel in the RGB color space. T , S T and I T is the preset threshold, and S is the saturation of the flame smoke pixel.

[0156] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 communicate with each other through the communication bus 504. The processor 501 may call the logic instructions in the memory 503 to execute the following method: obtaining the dynamic features of the flame smoke in each frame of the video, and obtaining the dynamic detection result of the flame smoke in each frame according to the dynamic features in each frame; obtaining the static features of the flame smoke in each frame of the video, and determining the static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame, inputting the static area into the deep learning model, and outputting the static detection result of the flame smoke in each frame; determining the final detection result of the flame smoke according to the dynamic detection result and the static detection result of the flame smoke in each frame.

[0157] ​​​In addition, the logic instructions in the above-mentioned memory 503 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0158] The present embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions enable a computer to execute the methods provided by the above-mentioned method embodiments, for example, including: obtaining dynamic features of flame smoke in each frame of a video, and obtaining dynamic detection results of flame smoke in each frame according to the obtained dynamic features in each frame; obtaining static features of flame smoke in each frame of the video, determining a static area of ​​flame smoke in each frame according to the static features of flame smoke in each frame, inputting the static area into a deep learning model, and outputting static detection results of flame smoke in each frame; determining a final detection result of the flame smoke according to the dynamic detection results and static detection results of the flame smoke in each frame.

[0159] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0160] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0161] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A flame smoke detection method, characterized in that: include: The dynamic features of the flame and smoke in each frame of the video are obtained, and the dynamic detection results of the flame and smoke in each frame are obtained according to the obtained dynamic features in each frame; Obtaining static features of flame smoke in each frame of the video, determining a static area of ​​flame smoke in each frame according to the static features of flame smoke in each frame, inputting the static area into a deep learning model, and outputting a static detection result of flame smoke in each frame; The deep learning model is trained and acquired based on image samples of flame smoke and static detection results of flame smoke in the image samples; Determining a final detection result of the flame smoke according to a dynamic detection result and a static detection result of the flame smoke in each frame; The step of obtaining the dynamic characteristics of the flame smoke in each frame of the video also includes: Detecting the motion area of ​​the flame and smoke in each frame of the video based on a three-frame interpolation method; Detecting the motion area of ​​the flame smoke in each frame of the video based on background subtraction; Performing an OR operation on the motion regions detected by the three-frame interpolation method and the background subtraction method in each frame to obtain the final motion region of the flame and smoke in each frame; Accordingly, the steps of obtaining the dynamic characteristics of the flame smoke in each frame of the video include: Obtaining the dynamic characteristics of the flame smoke in the final motion area of ​​the flame smoke in each frame; The steps of obtaining the dynamic features of the flame smoke in the final motion region of the flame smoke in each frame and obtaining the dynamic detection result of the flame smoke in each frame according to the obtained dynamic features in each frame include: Obtaining the position of the final motion region in each frame, comparing the positions of the final motion region between two adjacent frames, and determining whether the final motion region meets the characteristics of overall movement stability of flame smoke; Counting the areas of the final motion region in two adjacent frames, comparing the areas of the final motion region in two consecutive adjacent frames, and determining whether the area of ​​the final motion region meets the characteristic that the area of ​​the flame smoke gradually increases over time; Obtaining the main motion direction of the final motion area based on the optical flow method, and determining whether the main motion direction conforms to the characteristic that the flame smoke moves from bottom to top; If the final movement area meets the characteristics of overall movement stability of the flame smoke, gradual increase in area over time, and movement from bottom to top, then it is known that the final movement area is the flame smoke area, otherwise it is not the flame smoke area; The steps of obtaining the position of the final motion region in each frame and judging whether the final motion region meets the characteristics of the overall movement stability of the flame smoke according to the position include: Acquire the center point of the final motion region in each frame, and a target pixel point located directly above a pixel point at the bottom of the final motion region and at a distance from the pixel point at the bottom by a preset ratio of the height of the final motion region; Calculating the relative motion rates of the center point in the horizontal direction and the vertical direction, and the relative motion rates of the target pixel point in the horizontal direction and the vertical direction in two adjacent frames; If the relative movement rates of the center point in the horizontal direction and the vertical direction, and the relative movement rates of the target pixel point in the horizontal direction and the vertical direction are both within a preset range, it is known that the final movement area meets the characteristics of the overall movement stability of the flame smoke; The dynamic characteristics of flame smoke and the static characteristics of flame smoke are detected separately by asynchronous threads, and the execution processes of the two threads do not interfere with each other; the deep learning method is used to detect only the static characteristics of flame smoke; the detection of the dynamic characteristics of flame smoke and the detection of the static characteristics of flame smoke are carried out synchronously; Then, at each time point, the third overall detection thread is used to make a comprehensive judgment on the dynamic detection results and the static detection results to obtain the final detection results of the flame and smoke.

2. The flame and smoke detection method according to claim 1, characterized in that: The step of determining the motion area of ​​the flame smoke in each frame of the video based on the three-frame interpolation method includes: Calculating a differential image between a current frame of the video and a frame immediately before the current frame, and a differential image between a frame immediately after the current frame and the current frame; Performing an AND operation on the two differential images; The result of the AND operation is binarized, and the result of the binarization is morphologically processed to obtain the motion area of ​​the flame smoke detected by the three-frame interpolation method in the current frame.

3. The flame smoke detection method according to claim 1, characterized in that: The motion area of ​​the flame smoke in each frame of the video is detected based on background subtraction using the following formula: ; ; ; in, is the result of background subtraction operation on the pixel with coordinates (x, y) in the i-th frame of the video, is the background intensity of the pixel with coordinates (x, y) in the i-th frame of the video, The background intensity of the pixel with coordinates (x, y) in the i+1th frame of the video, is the motion threshold of the pixel with coordinates (x, y) in the i-th frame of the video, The pixel value with coordinates (x, y) in the i-th frame of the video, To adjust the parameters.

4. The flame smoke detection method according to any one of claims 1 to 3, characterized in that: The steps of obtaining the static features of the flame smoke in each frame of the video and determining the static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame include: Obtaining a suspected flame and smoke region in each frame of the video based on a flame and smoke color model; Acquire the texture features of the suspected flame and smoke area based on the LBP method; A flame smoke target region in the flame smoke suspected region is acquired according to the texture feature, and the flame smoke target region is used as a static region of the flame smoke.

5. The flame smoke detection method according to claim 4, characterized in that: The color model of the flame smoke is: ; ; ; |R-G|<I T ; |R-B|<I T ; |G-B|<I T ; Among them, R is the value of the red channel of the flame smoke pixel in the RGB color space, G is the value of the green channel of the flame smoke pixel in the RGB color space, B is the value of the blue channel of the flame smoke pixel in the RGB color space, R T , S T and I T is the preset threshold, and S is the saturation of the flame smoke pixel.

6. A flame and smoke detection device, characterized in that: include: A dynamic detection module is used to obtain the dynamic features of the flame and smoke in each frame of the video, and obtain the dynamic detection result of the flame and smoke in each frame according to the obtained dynamic features in each frame; A static detection module, used to obtain static features of the flame smoke in each frame of the video, determine a static area of ​​the flame smoke in each frame according to the static features of the flame smoke in each frame, input the static area into a deep learning model, and output a static detection result of the flame smoke in each frame; The deep learning model is trained and acquired based on image samples of flame smoke and static detection results of flame smoke in the image samples; A fusion detection module, used to determine the final detection result of the flame smoke according to the dynamic detection result and the static detection result of the flame smoke in each frame; The step of obtaining the dynamic characteristics of the flame smoke in each frame of the video also includes: Detecting the motion area of ​​the flame and smoke in each frame of the video based on a three-frame interpolation method; Detecting the motion area of ​​the flame smoke in each frame of the video based on background subtraction; Performing an OR operation on the motion regions detected by the three-frame interpolation method and the background subtraction method in each frame to obtain the final motion region of the flame and smoke in each frame; Accordingly, the steps of obtaining the dynamic characteristics of the flame smoke in each frame of the video include: Obtaining the dynamic characteristics of the flame smoke in the final motion area of ​​the flame smoke in each frame; The steps of obtaining the dynamic features of the flame smoke in the final motion region of the flame smoke in each frame and obtaining the dynamic detection result of the flame smoke in each frame according to the obtained dynamic features in each frame include: Obtaining the position of the final motion region in each frame, comparing the positions of the final motion region between two adjacent frames, and determining whether the final motion region meets the characteristics of overall movement stability of flame smoke; Counting the areas of the final motion region in two adjacent frames, comparing the areas of the final motion region in two consecutive adjacent frames, and determining whether the area of ​​the final motion region meets the characteristic that the area of ​​the flame smoke gradually increases over time; Obtaining the main motion direction of the final motion area based on the optical flow method, and determining whether the main motion direction conforms to the characteristic that the flame smoke moves from bottom to top; If the final movement area meets the characteristics of overall movement stability of the flame smoke, gradual increase in area over time, and movement from bottom to top, then it is known that the final movement area is the flame smoke area, otherwise it is not the flame smoke area; The steps of obtaining the position of the final motion region in each frame and judging whether the final motion region meets the characteristics of the overall movement stability of the flame smoke according to the position include: Acquire the center point of the final motion region in each frame, and a target pixel point located directly above a pixel point at the bottom of the final motion region and at a distance from the pixel point at the bottom by a preset ratio of the height of the final motion region; Calculating the relative motion rates of the center point in the horizontal direction and the vertical direction, and the relative motion rates of the target pixel point in the horizontal direction and the vertical direction in two adjacent frames; If the relative movement rates of the center point in the horizontal direction and the vertical direction, and the relative movement rates of the target pixel point in the horizontal direction and the vertical direction are both within a preset range, it is known that the final movement area meets the characteristics of the overall movement stability of the flame smoke; The dynamic characteristics and static characteristics of flame smoke are detected separately by asynchronous threads, and the execution processes of the two threads do not interfere with each other; the deep learning method is used to detect only the static characteristics of flame smoke; the detection of dynamic characteristics of flame smoke is carried out simultaneously with the detection of static characteristics of flame smoke; and then a third overall detection thread is used at each time point to make a comprehensive judgment on the dynamic detection results and the static detection results to obtain the final detection result of flame smoke.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the flame and smoke detection method according to any one of claims 1 to 5 are implemented.