A tunnel fire monitoring method based on image recognition
Through the YOLOv8 model combining color, energy and morphological characteristics judgment, the accuracy of smoke recognition in tunnel fire monitoring is solved, and early warning and accurate alarm of fires in tunnels is achieved.
Patent Information
- Application Number
- CN202410432124.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-11
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2044-04-11
AI Technical Summary
The existing tunnel fire monitoring technology cannot identify fire smoke in a timely manner in the tunnel environment, and is susceptible to light and dust, resulting in false alarms and insufficient accuracy.
The YOLOv8 model is used to detect video frame objects, combine color characteristics, energy characteristics and morphological characteristics to judge smoke generation through time sequence statistical analysis, and realize fire alarms under preset rules, and adaptive background updates to deal with light changes.
It improves the accuracy and reliability of fire monitoring in the tunnel, reduces false alarms, and enhances the real-time and adaptability of the system.
Smart Images

Figure CN118038338B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tunnel fire monitoring, and particularly relates to a tunnel fire monitoring method based on image recognition. Background Art
[0002] In recent years, the safety issues of highway tunnels have attracted increasing attention from the world. Among the safety accidents that occur in highway tunnels, fires are the most harmful type. However, in such large-space, large-area, and relatively harsh environments, traditional fire detectors cannot give fire alarms in a timely manner, and they cannot provide information such as the specific location of the fire, scale, and spread degree of the flame, which brings many inconveniences to the rescue work; false alarms also occur from time to time. With the rapid development of computer technology and machine vision technology, a brand-new fire detector, namely a video-based fire detection system, has emerged. Currently, the image-based fire and smoke detection technology is still in its infancy compared with traditional fire detection technologies. The existing technologies include: detecting smoke through the self-similarity of smoke texture; combining the hidden Markov model to model the change of the edge information of the smoke scene to determine whether there is smoke in the scene; judging whether there is smoke according to the spectral characteristics of the smoke, etc. However, the tunnel environment is relatively complex, the tone is relatively dull, and the influence of lighting is particularly significant. Detecting smoke only through texture is not accurate, and the edge features are not obvious. At the same time, the dust raised by driving may also be one of the factors affecting its false alarm; the existing patent document CN202311161222.7 discloses a tunnel fire recognition method and device, which relates to the technical field of fire recognition. The method includes: obtaining a real-time RGB monitoring image, and performing color space transformation on the RGB monitoring image to obtain an HSV monitoring image; using the RGB monitoring image and the HSV monitoring image as the input of a pre-constructed asymmetric double-branch fire recognition model, and the asymmetric double-branch fire recognition model outputs a prediction result of whether a fire has occurred according to the RGB monitoring image and the HSV monitoring image; wherein, the asymmetric double-branch fire recognition model includes a first branch network and a second branch network. The first branch network extracts the flame significant features from the RGB monitoring image and then outputs a first feature map, and the second branch network extracts the flame detail features from the HSV monitoring image and then outputs a second feature map. The prediction result is obtained by classifying and positioning the flame on the feature map after fusing the first feature map and the second feature map. The occurrence of the fire is determined by recognizing the flame. However, when a fire occurs, the earliest thing to appear is smoke, which appears earlier than the flame. Therefore, the monitoring of smoke is of great significance for the very early warning of the occurrence of a fire. In order to avoid the influence of other factors on smoke recognition, the present invention provides a tunnel fire monitoring method based on image recognition. Summary of the Invention
[0003] The present invention addresses the technical problems existing in the prior art and provides a tunnel fire monitoring method based on image recognition.
[0004] The technical solution of the present invention to solve the above technical problems is as follows: A tunnel fire monitoring method based on image recognition, comprising the following steps:
[0005] S1: Obtain the video frames of real-time monitoring and input the video frames into the YOLOv8 model;
[0006] S2: Perform target detection on the video frames, obtain the suspicious smoke areas, and synchronously update the background of the video frames;
[0007] S3: Perform feature judgment on the suspicious smoke areas, and the feature judgment includes color feature judgment, energy feature judgment, and morphological feature judgment;
[0008] S4: Based on the time series, statistically analyze the changes of each feature judgment. When the preset rules for the changes are met, it is determined that smoke has occurred, and a fire alarm is realized.
[0009] Further, in the tunnel fire monitoring method based on image recognition, the S2 step includes:
[0010] Perform differential operation on the video frame with the current frame and the current background image, and perform OTSU threshold segmentation on the differential result to obtain a binary motion mask image, separating the foreground and background pixel points:
[0011] ;
[0012] is the binary mask result, is the current video frame, CB is the current background image, the pixel value 255 represents the foreground target, 0 represents the background, is the pixel point coordinate;
[0013] Perform weighted average on each pixel of the current frame and the current background image to achieve adaptive background update:
[0014] ;
[0015] where is the background update factor.
[0016] Further, in the tunnel fire monitoring method based on image recognition, the color feature judgment includes:
[0017] Establish the YUV model and the HSI model, and use the comparison luminance Y and saturation S as color features;
[0018] The changes in contrast luminance Y and saturation S are measured by component energy:
[0019] ;
[0020] ;
[0021] For the smoke-suspected area will increase, while will decrease.
[0022] Furthermore, in the described tunnel fire monitoring method based on image recognition, the energy feature judgment includes:
[0023] Perform two-dimensional discrete wavelet transform on the smoke-suspected area, which is decomposed into a low-frequency molecular weight image and three high-frequency sub-molecular images. The three high-frequency sub-molecular images respectively include texture information in the horizontal direction, vertical direction, and diagonal direction. The sum of the energy values of the three high-frequency sub-molecular images constitutes a composite image. Then the energy of the smoke-suspected area is:
[0024] ;
[0025] ;
[0026] ;
[0027] Among them, LH, HL, and HH respectively represent the three high-frequency molecular images, is the energy value of the current background image, the energy value of the current video frame. Set a threshold difference W. If the difference between the energy value of the current background image and the energy value of the current video frame is greater than the threshold difference W, it is judged that the appearance of smoke causes the reduction of wavelet high-frequency energy.
[0028] Furthermore, in the described tunnel fire monitoring method based on image recognition, the morphological feature judgment includes:
[0029] Decompose the composite image into image blocks of the same size. Then the energy of the i-th image block is:
[0030] ;
[0031] is the i-th image block in the composite image, is the position in the composite image;
[0032] The smoke-suspected area occupies a part of the background image. According to the ratio between each image block and the background image block, the image block of the smoke-suspected area can be obtained:
[0033] ;
[0034] ;
[0035] Set an image block occupancy ratio for judging the suspicious smoke area , if the occupancy ratio exceeds the preset value, obtain the shape of the suspicious smoke area by connecting the image blocks of the suspicious smoke area:
[0036] ;
[0037] ES is the total number of image blocks of the suspicious smoke area, and S is the total area.
[0038] Furthermore, in the above-mentioned tunnel fire monitoring method based on image recognition, in the S4 step, it includes:
[0039] Set the time series t according to the order of video frames, and compare the color feature value, energy feature difference value and morphological feature value with the time series t respectively;
[0040] Establish independent time single linked lists for the color feature value, energy feature difference value and morphological feature value, and dynamically generate data nodes on the time single linked lists. If the data node of the current color feature value changes relative to the previous data node, then compare the data of the energy feature value and morphological feature value time single linked lists according to the initially set node quantity value, and judge whether smoke is generated by the change of this data node through the preset rules.
[0041] Furthermore, in the above-mentioned tunnel fire monitoring method based on image recognition, the preset rules include:
[0042] and ;
[0043] When two conditions are simultaneously satisfied, it is judged that fire smoke is generated.
[0044] Furthermore, in the above-mentioned tunnel fire monitoring method based on image recognition, introduce light change:
[0045] Set the brightness comparison function as: ;
[0046] The average brightness values of two images a and b are respectively and ;
[0047] The change of brightness will affect the energy value of the image, and because is the background update factor, a large value of can quickly capture the light change in the scene, then the value of
[0048] ;
[0049] wherein is the background update rate, is the instantaneous change response of background update, is the average value of brightness change caused by the instantaneous change response of background update.
[0050] An electronic device, comprising:
[0051] A memory for storing computer software programs;
[0052] A processor for reading and executing the computer software programs, thereby implementing any one of the described methods for monitoring fire in a tunnel based on image recognition.
[0053] A non-transitory computer-readable storage medium storing computer software programs, which, when executed by a processor, implement any one of the described methods for monitoring fire in a tunnel based on image recognition.
[0054] The beneficial effects of the present invention are:
[0055] Integrating multiple features: The method does not rely solely on a single feature for fire judgment, but comprehensively utilizes multiple features such as color features, energy features, and morphological features. By comprehensively analyzing the changes in these features, the accuracy and reliability of fire monitoring can be effectively improved.
[0056] Adaptive background update: A method of adaptively updating the background in real-time video frames is adopted, which can effectively cope with light changes and adjust the threshold change in a timely manner according to light changes.
[0057] Time series analysis: By establishing a time series for the changes in each feature and making a determination according to preset rules, it is convenient to accurately judge the generation of fire smoke; this time series-based analysis helps to improve the real-time performance and accuracy of the system. Description of the Drawings
[0058] Figure 1 is a schematic flowchart of a method for monitoring fire in a tunnel based on image recognition according to the present invention;
[0059] Figure 2 is a schematic diagram of an embodiment of an electronic device provided by an embodiment of the present invention;
[0060] Figure 3 is a schematic diagram of an embodiment of a computer-readable storage medium provided by an embodiment of the present invention. Detailed Embodiments
[0061] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0062] In the description of the present application, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present application, the meaning of "a plurality" is two or more, unless otherwise specifically defined.
[0063] In the description of the present application, the term "for example" is used to mean "serving as an example, illustration, or explanation". Any embodiment described as "for example" in the present application is not necessarily construed as being more preferred or having more advantages than other embodiments. In order for any person skilled in the art to implement and use the present invention, the following description is given. In the following description, details are set forth for the purpose of explanation. It should be understood that those of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other instances, well-known structures and processes will not be elaborated in detail to avoid unnecessary details from obscuring the description of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope that conforms to the principles and features disclosed in the present application.
[0064] A tunnel fire monitoring method based on image recognition includes the following steps:
[0065] S1: Obtain a real-time monitored video frame and input the video frame into the YOLOv8 model;
[0066] S2: Perform target detection on the video frame, obtain a suspicious smoke area, and synchronously update the background of the video frame;
[0067] S3: Perform feature judgment on the suspicious smoke area, and the feature judgment includes color feature judgment, energy feature judgment, and morphological feature judgment;
[0068] S4: Based on the time series, statistically analyze the changes in each feature judgment. When the preset rules for the changes are met, determine that smoke has occurred and implement a fire alarm.
[0069] In this embodiment, the YOLOv8 model consists of four parts: an input image, a Backbone main network to obtain the feature map of the image, a Head detection head to predict the target object and its location, and a Neck to fuse the features of different layers and transfer the image features to the prediction layer. After collecting the video frames of the tunnel, before the image enters the Backbone, a focus process is performed on it, that is, slicing the image operation. For every other pixel in the picture, four pictures are obtained, halving the length and width of the picture respectively, and expanding the number of channels to 4 times the original; this operation is similar to 2x downsampling, but it can ensure that the picture information is not lost; at the network input end, a Focus layer is used to replace three convolutional operations. After the replacement, the number of parameters becomes smaller, thus achieving the effect of improving the inference speed; at the same time, sufficient feature extraction can minimize the impact of data variability on mAP; subsequently, the video frames are input into the Backbone main network to obtain the features of each part in the image. In the feature extraction part of the network, the BottleneckCSP module is used to replace the previous C2f module. This module consists of a Bottleneck and a CSP structure, which can learn the network residual features and adjust the depth and width of the feature map. Compared with the C2f module in the original network, the BottleneckCSP module can reduce memory consumption and computational bottlenecks; the sub-module Bottleneck changes the number of channels of the data through convolutional calculations. The bottleneck layer of Bottleneck has various forms. The standard form is to perform a 1×1 and 3×3 convolution and then add its own shortcut connection. Thus, the number of operation parameters can be reduced in the main feature extraction stage, ensuring both the inference speed and accuracy, and reducing the model size, making the model more lightweight; through feature extraction, it is detected whether a smoke suspicious area is generated, and based on the analysis of color, energy, and shape, the smoke suspicious area is identified.
[0070] In one embodiment, the S2 step includes:
[0071] For the video frame, perform a difference operation between the current frame and the current background image, and perform OTSU threshold segmentation on the difference result to obtain a binary motion mask image, separating foreground and background pixel points:
[0072] ;
[0073] is the binary mask result, is the current video frame, CB is the current background image, the pixel value 255 represents the foreground target, and 0 represents the background, is the pixel point coordinate;
[0074] Perform a weighted average on each pixel of the current frame and the current background image to achieve adaptive background update:
[0075] ;
[0076] where is the background update factor.
[0077] In this embodiment, this step performs a differential operation on the current frame and the current background image to detect foreground objects, such as smoke or dust. After the differential operation, the OTSU threshold segmentation method is used to convert the differential result into a binary motion mask image, thereby separating foreground and background pixel points. In the binary image, a pixel value of 255 represents a foreground object, while a pixel value of 0 represents the background; by performing a weighted average on each pixel, the background image can be dynamically updated to adapt to light changes or other environmental changes occurring in the tunnel. In the weighted average formula, the parameter is the background update factor, which is used to adjust the influence degree of the current frame on the background update.
[0078] In one embodiment, the color feature judgment includes:
[0079] Establish a YUV model and an HSI model, and use the comparison luminance Y and saturation S as color features;
[0080] Measure the changes in the comparison luminance Y and saturation S through component energy:
[0081] ;
[0082] ;
[0083] For the smoke suspicious area will increase, while will decrease.
[0084] In this embodiment, the YUV model is a model for describing colors, where Y represents luminance and UV represents color information; the HSI model represents the hue H, saturation S, and luminance I of colors. When identifying the foreground object and the background image of the current frame, since the smoke in the initial stage of a fire is light white, the luminance component increases, and the smoke will block the color information in the background image, so the saturation will decrease.
[0085] In one embodiment, the energy feature judgment includes:
[0086] Perform a two-dimensional discrete wavelet transform on the smoke suspicious area, which is decomposed into a low-frequency molecular weight image and three high-frequency sub-molecular images. The three high-frequency sub-molecular images respectively include texture information in the horizontal direction, vertical direction, and diagonal direction. The sum of the energy values of the three high-frequency sub-molecular images constitutes a composite image. Then the energy of the smoke suspicious area is:
[0087] ;
[0088] ;
[0089] ;
[0090] Among them, LH, HL, and HH respectively represent three high-frequency molecular images, is the energy value of the current background image, the energy value of the current video frame. Set a threshold difference W. If the difference between the energy value of the current background image and the energy value of the current video frame is greater than the threshold difference W, it is determined that smoke appears and the wavelet high-frequency energy decreases.
[0091] In this embodiment, in the image of the current frame, after the background is blocked by smoke, the high-frequency energy value will decrease. It can be judged whether smoke is generated in the image of the current frame according to the difference between the two. Specifically: in a smoke-free background, the high-frequency energy value calculated according to the above high-frequency energy is 915624, and after the background is blocked by smoke, its high-frequency energy drops to 653252, further numerically verifying the weakening of the background high-frequency energy by smoke or dust. At the same time, due to the environmental problems in the tunnel, it is easily affected by vehicle dust. Here, a threshold difference W should be set, which can be determined by calculating the average value of the weakening of the background high-frequency energy by dust in the tunnel.
[0092] In one embodiment, the morphological feature judgment includes:
[0093] Decompose the composite image into image blocks of the same size, and the energy of the i-th image block is:
[0094] ;
[0095] is the i-th image block in the composite image, is the position in the composite image;
[0096] The smoke-suspected area occupies a part of the background image. According to the ratio between each image block and the background image block, the image blocks of the smoke-suspected area can be obtained:
[0097] ;
[0098] ;
[0099] Set a ratio of the image blocks of the smoke-suspected area , if the ratio exceeds the preset value, the shape of the smoke-suspected area is obtained by connecting the image blocks of the smoke-suspected area:
[0100] ;
[0101] ES is the total number of image blocks in the smoke-suspected area, and S is the total area.
[0102] In this embodiment, according to the characteristics of the smoke, it can be known that: during combustion, the diffusion path of its smoke is determined by the wind direction, etc. In adjacent video frames, the diffusion shape is basically the same; thus, the specific position of the smoke in the video frame can be obtained to determine the smoke area; at the same time, due to the diffusion of the smoke, it will cause smoke in all the image blocks in the entire image, resulting in an unclear judgment position of the combustion point. Here, an energy ratio K is set:
[0103] ;
[0104] ;
[0105] When the ratio is greater than or equal to K, the image block is not regarded as a smoke image block, while when the ratio is less than K, it is regarded as a smoke image block, which can better judge the diffusion path of the smoke, so as to realize the judgment of the combustion point;
[0106] In one embodiment, the step S4 includes:
[0107] Set a time series t according to the order of the video frames, and compare the color feature value, the energy feature difference value and the morphological feature value with the time series t respectively;
[0108] Establish independent time single-linked lists for the color feature value, the energy feature difference value and the morphological feature value, and dynamically generate data nodes on the time single-linked lists. If the data node of the current color feature value changes relative to the previous data node, then compare the data of the energy feature value and the morphological feature value time single-linked lists according to the initially set node quantity value, and judge whether smoke is generated by the change of this data node through a preset rule.
[0109] The preset rule includes:
[0110] and ;
[0111] When two conditions are simultaneously met, it is judged that fire smoke is generated.
[0112] In this embodiment, the color feature value is used to determine whether the background image is blocked by dust, smoke, etc. If it changes, the energy feature can be judged. Calculate the difference in the high-frequency energy between the foreground target and the background image to determine whether it is blocked by dust or smoke. At the same time, judge the change process of the high-frequency energy in the time series. If it is dust, since the amount of dust is fixed, it will decrease after the energy difference increases, while smoke is continuously generated during the combustion process, and its energy difference will show a continuous upward trend. At the same time, the shape is also jointly judged. The shape of the dust will deform after maintaining a fixed number of frames, while the diffusion path of the smoke is relatively fixed during combustion, that is, the shape of the background image it blocks is relatively fixed. Through these two aspects, it can be jointly judged whether it is dust or smoke that causes the color change.
[0113] In one embodiment, in a tunnel environment, the influence of external lights on the image also needs to be considered, and the light change is introduced:
[0114] Set the brightness comparison function as: ;
[0115] The average brightness values of two images a and b are respectively and ;
[0116] The change in brightness will affect the energy value of the image. Also, because is the background update factor, A large value can quickly capture the light change in the scene. Then The value of is:
[0117] ;
[0118] Where is the background update rate, is the background update instantaneous change response, is the average brightness change brought by the background update instantaneous change response.
[0119] In this embodiment, if vehicle lights irradiate the smoke area in the video frame, in the color feature judgment, its brightness will increase and the saturation will also increase. Similarly, in the energy feature value judgment, the energy in the background image will increase with the enhancement of the light. The scattering problem of the smoke also needs to be considered in the smoke, and the background image needs to be corrected here. Specifically, as in the above calculation process, by adjusting the background update factor, the pixel values and energy values in the background image are synchronously adjusted.
[0120] In a specific embodiment:
[0121] Please refer to Figure 2 , Figure 2Schematic diagram of an embodiment of an electronic device provided by an embodiment of the present invention. As Figure 2 shown, an embodiment of the present invention provides an electronic device 500, including a memory 510, a processor 520, and a computer program 511 stored on the memory 510 and executable on the processor 520. When the processor 520 executes the computer program 511, the following steps are implemented:
[0122] S1: Obtain a video frame of real-time monitoring, and input the video frame into the YOLOv8 model;
[0123] S2: Perform object detection on the video frame, obtain a suspicious smoke area, and synchronously update the background of the video frame;
[0124] S3: Perform feature judgment on the suspicious smoke area, and the feature judgment includes color feature judgment, energy feature judgment, and morphological feature judgment;
[0125] S4: Based on the time series, statistically analyze the changes in each feature judgment. When the preset rules for the changes are met, it is determined that smoke has occurred, and a fire alarm is implemented.
[0126] Please refer to Figure 3 , Figure 3 Schematic diagram of an embodiment of a computer-readable storage medium provided by an embodiment of the present invention. As Figure 3 shown, this embodiment provides a computer-readable storage medium 600, on which a computer program 611 is stored. When the computer program 611 is executed by a processor, the following steps are implemented:
[0127] S1: Obtain a video frame of real-time monitoring, and input the video frame into the YOLOv8 model;
[0128] S2: Perform object detection on the video frame, obtain a suspicious smoke area, and synchronously update the background of the video frame;
[0129] S3: Perform feature judgment on the suspicious smoke area, and the feature judgment includes color feature judgment, energy feature judgment, and morphological feature judgment;
[0130] S4: Based on the time series, statistically analyze the changes in each feature judgment. When the preset rules for the changes are met, it is determined that smoke has occurred, and a fire alarm is implemented.
[0131] It should be noted that in the above embodiments, the descriptions of each embodiment have their own emphases. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0132] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0133] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one or more of the processes Figure 1 or blocks.
[0134] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one or more of the processes Figure 1 or blocks.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the processes Figure 1 or blocks.
[0136] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic inventive concept. Therefore, the appended claims are intended to be construed as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0137] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.
Claims
1. A tunnel fire monitoring method based on image recognition, characterized in that It includes the following steps: S1: Obtain the real-time monitored video frames and input the video frames into the YOLOv8 model; S2: Perform target detection on the video frames, obtain the suspicious smoke areas, and synchronously update the background of the video frames; S3: Perform feature judgment on the suspicious smoke areas, and the feature judgment includes color feature judgment, energy feature judgment, and morphological feature judgment; S4: Based on the time series, statistically analyze the changes in each feature judgment. When the preset rules for the changes are met, determine that smoke has occurred and implement a fire alarm; The S2 step includes: Perform a difference operation on the video frame using the current frame and the current background image, and perform OTSU threshold segmentation on the difference result to obtain a binary motion mask image, separating foreground and background pixel points: ; is the binary mask result, is the current video frame, CB is the current background image, a pixel value of 255 represents the foreground target, and 0 represents the background; Perform weighted averaging on each pixel of the current frame and the current background image to achieve adaptive background update: ; wherein is the background update factor; The color feature judgment includes: Establish the YUV model and the HSI model, and use the comparison luminance Y and saturation S as color features; The changes in the contrast luminance Y and saturation S are measured by component energy: ; ; For the smoke-suspected area will increase, while will decrease; The energy feature judgment includes: Perform two-dimensional discrete wavelet transform on the suspicious smoke area, decompose it into a low-frequency molecular weight image and three high-frequency sub-molecular images. The three high-frequency sub-molecular images respectively include texture information in the horizontal direction, vertical direction, and diagonal direction. The sum of the energy values of the three high-frequency sub-molecular images constitutes a composite image. Then the energy of the suspicious smoke area is: ; ; ; Among them, LH, HL, and HH respectively represent three high-frequency molecular images, is the energy value of the current background image, the energy value of the current video frame. Set a threshold difference W. If the difference between the energy value of the current background image and the energy value of the current video frame is greater than the threshold difference W, it is determined that the reduction of wavelet high-frequency energy is caused by the appearance of smoke; The morphological feature judgment includes: Decompose the composite image into image patches of the same size. Then, the energy of the \(i\)-th image patch is as follows: ; is the i-th image block in the composite image, and is the position in the composite image; The suspicious smoke area occupies a part of the background image. The image block of the suspicious smoke area can be obtained according to the ratio between each image block and the background image block: ; ; Set an image block occupancy ratio for judging the suspicious smoke area , if the occupancy ratio exceeds the preset value, obtain the shape of the suspicious smoke area by connecting the image blocks of the suspicious smoke area: ; ES is the total number of image blocks in the smoke-suspected area, and S is the total area. At the same time, due to the spread of smoke, smoke will exist in all image blocks in the entire image, resulting in unclear judgment positions of the combustion points. Here, an energy ratio K is set: ; ; When the ratio is greater than or equal to K, this image block is not regarded as a smoke image block. When the ratio is less than K, it is regarded as a smoke image block, which can better judge the diffusion path of the smoke, thereby realizing the judgment of the combustion point; The S4 step includes: Set the time series t according to the order of the video frames, and compare the color feature values, energy feature differences, and morphological feature values in the time series t respectively; Establish independent time single linked lists for the color feature values, energy feature differences, and morphological feature values. Data nodes are dynamically generated on the time single linked lists. If the data node of the current color feature value changes relative to the previous data node, then compare the data of the energy feature value and morphological feature value time single linked lists according to the initially set node quantity value, and judge whether smoke has occurred by preset rules for the change of this data node; The preset rules include: ; When two conditions are met simultaneously, judge that fire smoke has occurred; Introduce light changes: Set the brightness comparison function to be: ; The average brightness values of two images a and b are respectively and ; The change in brightness will affect the energy value of the image. Also, since is the background update factor, a large value can quickly capture the light changes in the scene. Then the value of ; wherein is the background update rate, is the instantaneous change response of background update, is the average value of the brightness change brought about by the instantaneous change response of background update.
2. An electronic device, characterized in that, It includes: A memory for storing computer software programs; A processor for reading and executing the computer software program, thereby implementing a method for monitoring tunnel fires based on image recognition as described in claim 1.
3. A non-transitory computer-readable storage medium, characterized in that, The computer software program is stored in the storage medium, and when the computer software program is executed by the processor, it implements a method for monitoring tunnel fires based on image recognition as described in claim 1.
Citation Information
Patent Citations
A method and device for identifying tunnel fires
CN116895050B
Embedded image type kitchen fire alarm device
CN108932814A