Fire detection method, electronic device, and readable storage medium
By performing initial screening and re-examination of video stream frame images, the overlap and area ratio of the shielded area are used to determine the flame alarm. A fire feature discrimination model is used to solve the false detection problem of convolutional networks in small flame recognition, thereby improving the accuracy of fire detection and reducing the false recognition rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-23
- Publication Date
- 2026-03-17
AI Technical Summary
Existing convolutional networks have a high false detection rate in small flame recognition, and cannot effectively identify and distinguish between real flames and falsely detected objects, resulting in insufficient accuracy in fire detection.
By initially screening the frame images of the video stream and identifying smoke and fire images, the overlap and area ratio of the shielded areas are used to determine whether an alarm is triggered. A fire feature discrimination model is then used for re-examination to reduce the false recognition rate.
It improves the accuracy of fire detection and reduces the false detection rate, especially the false detection rate in small flame detection.
Smart Images

Figure CN115830485B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of fire detection technology, specifically, it relates to a fire detection method, electronic device, and readable storage medium. Background Technology
[0002] Convolutional network image recognition technology has developed rapidly recently, with YOLOv5, Efficient-DET, and YOLOvX all achieving new technical highs in the field of image detection. In the field of image-based flame detection, convolutional network technology is also gradually becoming mainstream. However, traditional convolutional networks can only accurately detect large fires, and have a large number of false detections in the recognition of small flames, resulting in low practical application value.
[0003] Current smoke and fire detection increasingly utilizes deep learning technology. The common approach is to directly apply general object recognition networks for smoke and fire detection. The general implementation process consists of three parts: data collection and processing, model training, and comprehensive processing. Data collection and processing involves collecting smoke and fire-related data from networks or by setting up a custom environment and marking the locations of smoke and fire. The model typically uses general object detection algorithms such as Yolv3 and Efficient-DET, and training usually uses the backpropagation algorithm. Comprehensive processing involves determining whether a fire alarm has occurred based on the relationship between consecutive frames.
[0004] Applying detection algorithms directly to small flame recognition results in many false detections because small flames occupy a small area in an image, leading to numerous false positives. Examples include the bridge of a face's nose, light spots on a safety helmet, and distinctive patterns on clothing. False detections caused by fixed objects are easily filtered out by setting up masking areas, but false detections caused by people cannot be identified using common methods.
[0005] In view of this, the present invention is hereby proposed. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide a fire detection method. After initially screening the frame images of the video stream and identifying smoke images and / or fire images, the authenticity of the smoke images and / or fire images is further verified based on the shielded area, which can reduce the false identification rate in the fire detection process.
[0007] Another object of the present invention is to provide an electronic device.
[0008] Another object of the present invention is to provide a readable storage medium.
[0009] To solve the above-mentioned technical problems, the basic concept of the technical solution adopted by the present invention is as follows:
[0010] A fire detection method, comprising:
[0011] Retrieve frame images from a video stream;
[0012] In response to determining that the frame image includes a smoke image and / or a fire image, the region where the smoke image and / or the fire image is located is determined as the target detection region;
[0013] Whether to issue a fire alarm is determined based on the relationship between the target detection area and the shielding area;
[0014] The shielded area is the area containing objects that are falsely detected by flame detection.
[0015] In some implementations, determining whether to issue a flame alarm based on the relationship between the target detection area and the shielding area includes:
[0016] Determine the degree of overlap between the target detection area and the shielding area;
[0017] Whether to issue a fire alarm is determined based on the relationship between the degree of overlap and the set threshold.
[0018] In some implementations, when the area where the smoke image and / or the fire image is located is determined as the target detection area, the size of the target detection area is also determined;
[0019] When determining the shielding area in advance, the size of the shielding area is also determined.
[0020] Determining the overlap between the target detection area and the shielding area includes:
[0021] The ratio of the area of the intersection of the target detection area and the shielding area to the area of the target detection area is determined, and the ratio constitutes the overlap between the target detection area and the shielding area.
[0022] In some implementations, the shielding area includes a static shielding area and a dynamic shielding area;
[0023] The static shielding area is a pre-determined area containing static flame false detection objects, and the dynamic shielding area is a region determined based on the frame image containing dynamic flame false detection objects.
[0024] The process of determining whether to issue a fire alarm based on the relationship between the overlap degree and a set threshold includes:
[0025] If the overlap between the target detection area and the static shielding area is greater than a first preset threshold, the flame alarm of the target detection area is canceled.
[0026] In some implementations, determining whether to issue a flame alarm based on the relationship between the overlap degree and a set threshold further includes:
[0027] In response to the overlap between the target detection area and the static shielding area being less than or equal to the first preset threshold, the overlap between the target detection area and the dynamic shielding area is determined;
[0028] In response to the overlap between the target detection area and the dynamic shielding area being less than or equal to a second preset threshold, a flame alarm is issued for the target detection area.
[0029] In some implementations, determining whether to issue a flame alarm based on the relationship between the overlap degree and a set threshold further includes:
[0030] If the overlap between the target detection area and the dynamic shielding area is greater than the second set threshold, the target detection area is re-inspected to determine whether a flame alarm should be triggered.
[0031] In some implementations, re-inspecting the target detection area includes:
[0032] A re-inspection region is determined in the frame image, and the range of the re-inspection region covers the range of the target detection region.
[0033] Based on the re-inspection area, the re-inspection image is determined;
[0034] The re-examined image is scaled to a standard size and then input into a trained fire feature discrimination model to determine whether the target detection area has a real flame.
[0035] In some implementations, the fire feature discrimination model is obtained by performing deep learning of fire features on pre-collected fire data based on any one of ResNet18, VGG, or DenseNet.
[0036] An electronic device, comprising:
[0037] Processor; and
[0038] The memory is communicatively connected to the processor.
[0039] The memory stores a program that can be executed by a processor. When the program is executed by the processor, the processor is able to execute the fire detection method as described above.
[0040] A readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the fire detection method as described above.
[0041] By adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art.
[0042] This invention provides a fire detection method that, after initially screening the frame images of a video stream to identify smoke and / or fire images, further verifies the authenticity of the smoke and / or fire images based on a shielded area, thereby reducing the false identification rate during the fire detection process.
[0043] The specific embodiments of the present invention will now be described in further detail with reference to the accompanying drawings. Attached Figure Description
[0044] The accompanying drawings, as part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments and descriptions of the invention are used to explain the invention, but do not constitute an undue limitation of the invention. Obviously, the drawings described below are merely some embodiments, and those skilled in the art can obtain other drawings based on these drawings without creative effort. In the drawings:
[0045] Figure 1 This is a flowchart illustrating the fire detection method of the present invention;
[0046] Figure 2 This is a flowchart illustrating step S130 of the present invention;
[0047] Figure 3 This is a flowchart illustrating step S135 of the present invention;
[0048] Figure 4 This is a schematic diagram of the training method for the fire feature discrimination model of the present invention;
[0049] Figure 5 This is a schematic diagram of the training system for the fire feature discrimination model of the present invention;
[0050] Figure 6 This is a schematic diagram of the structure of an electronic device according to a first exemplary embodiment of the present invention;
[0051] Figure 7 This is a schematic diagram of the structure of an electronic device according to a second exemplary embodiment of the present invention.
[0052] It should be noted that these accompanying drawings and textual descriptions are not intended to limit the scope of the invention in any way, but rather to illustrate the concept of the invention to those skilled in the art by referring to specific embodiments. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments will be clearly and completely described below with reference to the accompanying drawings. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0054] In the description of this invention, it should be noted that the terms "upper", "lower", "front", "rear", "left", "right", "vertical", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.
[0055] An exemplary embodiment of this application proposes a fire detection method, comprising: acquiring frame images from a video stream; in response to determining that the frame images include smoke images and / or fire images, defining the area where the smoke images and / or fire images are located as a target detection area; determining whether to issue a fire alarm based on the relationship between the target detection area and a shielded area; wherein the shielded area is an area containing objects that falsely detect flames. In the above scheme, by initially screening the frame images of the video stream to identify smoke images and / or fire images, and then further verifying the authenticity of the smoke images and / or fire images based on the shielded area, the false identification rate during the fire detection process can be reduced.
[0056] In the following sections, specific examples of this solution will be described in more detail with reference to the accompanying drawings.
[0057] Figure 1 A flowchart of a fire detection method according to an embodiment of this application is shown. Figure 1 As shown, the fire detection method includes the following steps:
[0058] S110. Obtain frame images from the video stream;
[0059] S120. In response to determining that the frame image includes a smoke image and / or a fire image, the region where the smoke image and / or the fire image is located is determined as a target detection region;
[0060] S130. Determine whether to issue a flame alarm based on the relationship between the target detection area and the shielding area; wherein, the shielding area is the area with falsely detected flame objects.
[0061] It should be understood that the steps shown in the fire detection method are not exclusive, and the fire detection method may also include additional steps not shown and / or the steps shown may be omitted; the scope of this application is not limited in this respect. See below for reference. Figures 1 to 3 Describe steps S110 to S130 in detail.
[0062] S110
[0063] In step S110, frame images from the video stream are acquired.
[0064] The fire detection method is applied in a computer device. The computer device includes a camera, which acquires a video stream and obtains frame images from the video stream. Optionally, each frame image in the video stream is the object to be detected. Alternatively, several frames images in the video stream are selected as the objects to be detected according to a certain pattern.
[0065] In another embodiment, the computer device may acquire the video stream from its internal storage. In other embodiments, the computer device may also acquire the video stream from an electronic device communicatively connected to it. The electronic device may be, but is not limited to, a server, server cluster, mobile phone, tablet computer, etc. The computer device may communicate with the electronic device and acquire the video stream from the electronic device via a network. In one specific embodiment, the network supporting communication between the computer device and the electronic device may be a wired network or a wireless network, such as radio, Wireless Fidelity (WIFI), cellular, satellite, broadcast, etc.
[0066] It should be noted that, in order to improve the timeliness of fire detection in this invention, the video stream described above should preferably be a real-time video stream.
[0067] S120
[0068] In step S120, in response to determining that the frame image includes a smoke image and / or a fire image, the area where the smoke image and / or the fire image is located is determined as the target detection area.
[0069] In some implementations, the bounding boxes of smoke and / or fire images included in the frame image are determined based on image recognition.
[0070] For example, using pre-collected flame data, including smoke and fire data, any one of the neural network models LeNet, AlexNet, VGG, and GoogLeNet can be trained to obtain a fire detection model. Then, the trained fire detection model can be used to analyze frame images to obtain the smoke and fire images included in the frame images.
[0071] For example, the fire detection model outputs not only category information for smoke and fire images, but also location information for them. Optionally, the location information includes the center point coordinates (cx, cy), width w, and height h of the smoke and fire images. The area of the smoke and fire images can be determined based on this location information.
[0072] At this point, the region containing the smoke image and / or fire image in the frame image is determined as the target detection region.
[0073] S130
[0074] In step S130, it is determined whether to issue a flame alarm based on the relationship between the target detection area and the shielding area; wherein, the shielding area is the area with falsely detected flame objects.
[0075] For example, false flame detection objects can be stationary objects, such as flame symbols on walls or signs. False flame detection objects can also be moving objects, such as flame symbols on safety helmets or flame-like patterns on animal bodies. Especially in the detection of small flames, things like the bridge of a face's nose, light spots on a safety helmet, or distinctive patterns on clothing can all cause false detections. Therefore, this invention establishes a shielded area during fire detection; this shielded area is the area identified as containing false flame detection objects. In other words, if the smoke image and / or fire image determined in step 120 is the shielded area, then the smoke image and / or fire image determined in step 120 can be discarded.
[0076] In some implementations, the shielding area includes a static shielding area and a dynamic shielding area. The static shielding area is a pre-determined area containing static false flame objects. The dynamic shielding area is a region determined based on the frame image that contains dynamic false flame objects.
[0077] Specifically, the space covered by camera 11 can be pre-identified. If there are static flame false detection objects within this space, such as flame symbols on walls or signs, the area containing these objects is designated as a static shielding area. Furthermore, when determining the static shielding area, its location information should also be determined, such as the center point coordinates (jx, jy), width w, and height h. Based on this location information, the size of the static shielding area can be determined. It is understood that the static shielding area is also an image format.
[0078] However, the objects that are falsely detected by dynamic flames, such as people or animals, are not stationary and are random. Therefore, the dynamic shielding area is determined in real time during the fire detection process.
[0079] For example, a trained neural network model can be used to analyze the frame image to determine the dynamic masking region. Furthermore, when determining the dynamic masking region, its location information should also be determined, such as the center point coordinates (dx, dy), width w, and height h. Based on this location information, the size of the dynamic masking region can be determined. It is understood that the dynamic masking region is also an image format.
[0080] Optionally, the step of determining the dynamic shielding area can be performed simultaneously with the determination of the target detection area in step S120, or it can be performed when needed in step S130. The present invention does not limit this.
[0081] In some implementations, determining whether to issue a flame alarm based on the relationship between the target detection area and the shielding area in step S130 includes: determining the overlap between the target detection area and the shielding area; and determining whether to issue a flame alarm based on the relationship between the overlap and a set threshold.
[0082] Specifically, the aforementioned overlap can be obtained by determining the ratio of the area of the intersection of the target detection area and the shielding area to the area of the target detection area, and the ratio constitutes the overlap between the target detection area and the shielding area.
[0083] In some implementations, such as Figure 2 As shown, in step S130, determining whether to issue a fire alarm based on the relationship between the overlap degree and a set threshold includes:
[0084] S131. Determine the first overlap between the target detection area and the static shielding area;
[0085] S132. In response to the first overlap between the target detection area and the static shielding area being greater than a first preset threshold, cancel the flame alarm of the target detection area;
[0086] S133. In response to the first overlap between the target detection area and the static shielding area being less than or equal to the first set threshold, a second overlap between the target detection area and the dynamic shielding area is determined.
[0087] S134. In response to the second overlap between the target detection area and the dynamic shielding area being less than or equal to a second preset threshold, a flame alarm is issued for the target detection area.
[0088] S135. In response to the second overlap between the target detection area and the dynamic shielding area being greater than the second set threshold, the target detection area is re-inspected to determine whether a flame alarm should be reported.
[0089] Specifically, in step S131, the first overlap between the target detection area and the static shielding area is determined based on the proportion of the intersection of the target detection area and the static shielding area to the target detection area, and the relationship between the first overlap and the first set threshold is determined. The first set threshold can be set to 0.5 for example.
[0090] In step S132, if the first overlap degree is greater than the first preset threshold, it indicates that the target detection area is likely a static shielding area. In this case, the flame alarm for the target detection area can be canceled, and the smoke and fire image information can be deleted. If the first overlap degree is less than or equal to the first preset threshold, further analysis of the target detection area is required.
[0091] At this point, in step S133, the second overlap degree between the target detection area and the dynamic shielding area is determined based on the proportion of the intersection of the target detection area and the dynamic shielding area to the target detection area. The relationship between the second overlap degree and a second set threshold is then determined; this second set threshold can also be set to 0.5.
[0092] In step S134, if the second overlap degree is less than or equal to the second preset threshold, it indicates that the target detection area is likely neither a statically shielded area nor a dynamically shielded area, and a flame alarm should be reported immediately. In other words, this indicates that the smoke and fire images of the target detection area are real flame data.
[0093] In step S135, if the second overlap is greater than the second set threshold, it indicates that the smoke image and fire image of the target detection area may be images of objects that are falsely detected by dynamic flames. In this case, the target detection area should be re-examined to further determine the authenticity of the smoke image and fire image.
[0094] In the above scheme, the authenticity of smoke and fire images in the target detection area is verified by using static and dynamic shielding areas, which can further improve the accuracy of fire detection and reduce the false recognition rate.
[0095] It should be noted that the first and second threshold values mentioned above are merely illustrative examples. In practical applications, the first and second threshold values can be set to other optional values.
[0096] In some implementations, such as Figure 3 As shown, in step S135, the target detection area is re-inspected, including:
[0097] S1351. A re-inspection region is determined in the frame image, the range of the re-inspection region covering the range of the target detection region;
[0098] S1352. Based on the re-inspection area, determine the re-inspection image;
[0099] S1353. After scaling the re-inspection image to a standard size, input it into the trained fire feature discrimination model to determine whether the target detection area has a real flame.
[0100] Specifically, in step S1351, a re-inspection area is determined in the frame image, and the scope of the re-inspection area should cover the scope of the target detection area. In other words, the re-inspection area includes not only the smoke image and / or fire image mentioned above, but also the data surrounding the smoke image and / or fire image. For example, the ratio between the coverage area of the re-inspection area and the coverage area of the target detection area is greater than 1 and less than 1.5. Preferably, this ratio is 1.2.
[0101] In some implementations, the smoke and / or fire images determined above can be expanded by 20% in each of the four directions (up, down, left, and right), with the center position as a reference point. In this case, the re-inspection image of the re-inspection area determined in step S1352 will be larger than the standard image.
[0102] The neural network model requires a fixed image size for input. Therefore, in step S1353, the re-examination image needs to be scaled to a standard size before being input into the trained fire feature discrimination model to determine whether the target detection area contains a real flame. For example, the standard image size required by the fire feature discrimination model can be set to 112*112. The size of the standard image refers to the pixel values of the standard image.
[0103] In the above scheme, when re-examining smoke and / or fire images, data surrounding the target detection area is added. For small flames, if the smoke and / or fire images represent real flame data, then the surrounding data is environmental data; if the smoke and / or fire images represent a falsely detected object within a dynamic flame, then the surrounding data is data associated with that falsely detected object, such as a human face, a safety helmet, or an animal body. Therefore, by expanding the target detection area, the detection accuracy of small flames can be improved, and the false recognition rate of small flames can be reduced.
[0104] In some implementations, the fire feature discrimination model in step S1353 is obtained by performing deep learning of fire features on pre-collected fire data based on any one of ResNet18, VGG, or DenseNet.
[0105] It should be noted that the trained fire feature discrimination model described above can also be used in step S120 to determine the smoke image and / or fire image in the frame image. This can further improve the accuracy of fire detection in this invention.
[0106] An exemplary embodiment of this application proposes a training method for a fire feature discrimination model, comprising: collecting multiple images to establish a flame sample dataset, wherein some of the multiple images contain actual flame images and some contain false flame images; marking first target regions with flame features in the images of the flame sample dataset, and cutting the first target regions from the original images, the cut-out images of the first target regions constituting a positive sample classification dataset; inputting the flame sample dataset into a trained first fire detection model, the first fire detection model being used to detect the flame features in the flame sample dataset, marking second target regions with false flame features in the images of false positive output results, and cutting the second target regions from the original images, the cut-out images of the second target regions constituting a negative sample classification dataset; training a second fire detection model based on the positive sample classification dataset and the negative sample classification dataset, and using the second fire detection model as a fire feature discrimination model. In the above scheme, by training the fire feature discrimination model for re-examination when flame images are initially screened, the false recognition rate in the fire detection process can be reduced, ensuring the effectiveness of fire detection.
[0107] In the following sections, specific examples of this solution will be described in more detail with reference to the accompanying drawings.
[0108] Figure 4 A flowchart illustrating a training method for a fire feature discrimination model according to an embodiment of this application is shown. Figure 4 As shown, the training method for the fire feature discrimination model includes the following steps:
[0109] S210. Collect multiple images to establish a flame sample dataset, wherein some of the multiple images contain flame images and some of the multiple images contain fake flame images;
[0110] S220. Mark the first target region with flame features in the image of the flame sample dataset, and cut the first target region from the original image. The image of the cut first target region constitutes the positive sample classification dataset.
[0111] S230. Input the flame sample dataset into the trained first fire detection model. The first fire detection model is used to detect the flame features in the flame sample dataset. Mark the second target region with false flame features in the image of the false positive output result, and cut the second target region from the original image. The image of the cut second target region constitutes the negative sample classification dataset.
[0112] S240. Train a second fire detection model based on the positive sample classification dataset and the negative sample classification dataset, and use the second fire detection model as a fire feature discrimination model.
[0113] It should be understood that the steps shown in the fire detection method are not exclusive, and the training method may also include additional steps not shown and / or omit the steps shown; the scope of this application is not limited in this respect. See below for reference. Figure 4 Describe steps S210 to S240 in detail.
[0114] S210
[0115] In step S210, multiple images are collected to establish a flame sample dataset, some of which contain flame images and some of which contain fake flame images.
[0116] The sources of the aforementioned multiple images are not specifically required; they can be collected from a self-built environment or from the internet. However, at least some of the images must contain obvious flames. Furthermore, some images must also contain obvious false flames, such as lights, safety helmets, people, animals, flowers, the sun and moon, vehicles, signs, etc. For example, in step S210, at least 5000 images are collected. The number of images with obvious flames and the number of images with obvious false flames can be approximately equal. It is understood that the more images there are, and the more types of flames and false flames there are, the higher the recognition accuracy of the trained fire detection model. Therefore, the number and types of images collected can be determined in practical applications.
[0117] After collecting multiple images, the information of the objects in the images is labeled. Object information includes the object's category and location. Category information refers to whether the image is a flame or a simulated flame. Flame images include flames and smoke, while simulated flame images include lights, helmets, people, animals, flowers, the sun and moon, vehicles, and signs. Location information refers to the object's center coordinates (cx, cy), height (h), and width (w).
[0118] Then, the first fire detection model is obtained by performing deep learning of flame features on the pre-collected flame data based on any one of RCNN, Fast RCNN, Faster RCNN, or YOLO.
[0119] The aforementioned flame data includes images with clear flame images and images with clear fake flame images.
[0120] It should be noted that these fake flame images can be identified as flames in the first fire detection model, but the actual situation is that they are fake flames. If the fire detection model identifies it as a flame, but the actual situation is not a flame, the output result of the first fire detection model is called a false positive.
[0121] S220
[0122] In step S220, a first target region with flame features is marked in the image of the flame sample dataset, and the first target region is cut out from the original image. The image of the cut-out first target region constitutes a positive sample classification dataset.
[0123] In some implementations, marking a first target region with flame features in the images of the flame sample dataset includes marking a first target region with flame features in a first number of images of the flame sample dataset.
[0124] In some embodiments, marking a first target region with flame features in the image of the flame sample dataset further includes: marking a first rectangular box with flame features in the image of the flame sample dataset; expanding the range of the first rectangular box; and marking the area defined by the expanded first rectangular box as the first target region.
[0125] In some implementations, expanding the range of the first rectangle includes: using the first rectangle as a reference, expanding it in each direction according to a first predetermined ratio.
[0126] Specifically, the position of the flame in the M images of the positive sample dataset can be marked by a rectangle using manual annotation. Then, the rectangle is expanded by a first set ratio in each of the four directions (up, down, left, and right), for example, by 20%. Finally, the area defined by the expanded rectangle is cut out from the original image.
[0127] Then, by manually labeling, the position of the smoke in the N images of the positive sample dataset is marked with a rectangle. Then, the rectangle is expanded by a first set ratio in each of the four directions (up, down, left, and right), for example, by 20%. The area defined by the expanded rectangle is then cut out from the original image.
[0128] Understandably, the area defined by the enlarged rectangle when cut out from the original image exceeds the size of the standard image.
[0129] The neural network model requires a fixed image size as input, therefore, in step S220, the enlarged image needs to be scaled to a standard size. For example, the standard image size required by the neural network model can be set to 112*112 pixels. The standard image size refers to the pixel values of the standard image.
[0130] Then, the M flame images and / or N smoke images are used as the positive sample classification dataset.
[0131] In the above scheme, when determining the positive sample classification dataset, the rectangular box annotating the flame features is enlarged. This adds data surrounding the flame features to the images in the positive sample classification dataset, allowing for further verification of the flame feature's authenticity and improving the fire feature discrimination model's recognition rate. Especially for small flames, enlarging the annotation box improves the detection accuracy of this invention and reduces the false recognition rate of small flames.
[0132] S230
[0133] In step S230, the flame sample dataset is input into the previously trained first fire detection model. The first fire detection model detects the flame features in the flame sample dataset, marks second target regions with false flame features in the false positive output image, and cuts out the second target regions from the original image. The cut-out images of the second target regions constitute the negative sample classification dataset. False flame features include false flames and false smoke, such as lights, safety helmets, people, animals, flowers, the sun and moon, vehicles, and signs.
[0134] In some implementations, marking a second target region with false flame features in the images of the false positive output results includes: marking the second target region with the flame features in a second number of images with the highest confidence level in the false positive output results. The ratio of the first number to the second number in step S220 ranges from 1 to 1.2.
[0135] In the above scheme, the number of samples in the positive sample classification dataset and the negative sample classification dataset are roughly equal, which can improve the accuracy of the training method.
[0136] In some implementations, marking a second target region with false flame features in the image of the false positive output result further includes: marking a second rectangular frame with flame features in the image of the false positive output result; expanding the range of the second rectangular frame; and marking the area defined by the expanded second rectangular frame as the second target region.
[0137] In some embodiments, expanding the range of the second rectangle includes: using the second rectangle as a reference, expanding it in each direction according to a second predetermined ratio. The second predetermined ratio is equal to the first predetermined ratio in step S220.
[0138] Specifically, the location of the fake flames in the M' images of the negative sample dataset can be marked by a rectangle through manual annotation. Then, the rectangle is expanded by a second set ratio in each of the four directions (up, down, left, and right), for example, by 20%. The area defined by the expanded rectangle is then cut out from the original image.
[0139] Then, by manually labeling, the positions of the fake smoke in the negative sample dataset in N' images are marked with rectangular boxes. Then, the rectangular boxes are expanded by a second set ratio in each of the four directions (up, down, left, and right), for example, by 20%. The area defined by the expanded rectangular boxes is then cut out from the original image.
[0140] Understandably, the area defined by the enlarged rectangle when cut out from the original image exceeds the size of the standard image.
[0141] The neural network model requires a fixed image size as input, therefore, in step S230, the enlarged image needs to be scaled to a standard size. For example, the standard image size required by the neural network model can be set to 112*112 pixels. The standard image size refers to the pixel values of the standard image.
[0142] Then, M' fake flame images and / or N' fake smoke images are used as the negative sample classification dataset.
[0143] In the above scheme, when determining the negative sample classification dataset, the bounding boxes annotating the false flame features are enlarged. This adds data surrounding the false flame features to the images in the negative sample classification dataset, allowing for further determination of the authenticity of the false flame features and improving the fire feature discrimination model's recognition rate of flame features. Especially for small flames, enlarging the bounding boxes improves the detection accuracy of small flames and reduces the false recognition rate.
[0144] S240
[0145] In step S240, a second fire detection model is trained based on the positive sample classification dataset from step S220 and the negative sample classification dataset from step S230, and this second fire detection model is used as a fire feature discrimination model.
[0146] In some implementations, the second fire detection model is obtained by performing deep learning of flame features on the positive sample classification dataset and the negative sample classification dataset based on any one of ResNet18, VGG, and DenseNet.
[0147] It should be noted that those skilled in the art can refer to relevant technologies for the training process, and the present invention will not elaborate further here.
[0148] The present invention also provides a training system 300 for a fire feature discrimination model, comprising: a dataset construction module 310, a positive sample classification dataset construction module 320, a negative sample classification dataset construction module 330, and a fire feature discrimination model construction module 340.
[0149] The dataset construction module 310 is used to construct a flame sample dataset.
[0150] The positive sample classification dataset construction module 320 is used to mark the first target region with flame features in the image of the flame sample dataset, and cut the first target region from the original image. The image of the cut first target region constitutes the positive sample classification dataset.
[0151] The negative sample classification dataset construction module 330 is used to input the flame sample dataset into the trained first fire detection model. The first fire detection model is used to detect the flame features in the flame sample dataset, mark the second target region with false flame features in the image of the false positive output result, and cut the second target region from the original image. The image of the cut second target region constitutes the negative sample classification dataset.
[0152] The fire feature discrimination model construction module 340 is used to train a second fire detection model based on the positive sample classification dataset and the negative sample classification dataset, and to use the second fire detection model as the fire feature discrimination model.
[0153] The embodiments of this application are as follows: Figure 5 The training system 300 for the fire feature discrimination model shown can be used to implement the embodiments of this application, such as Figure 4 Steps S210 to S240 are shown. Therefore, the relevant content will not be described again in this application.
[0154] In addition, based on the above fire detection method, the embodiments of this application also provide an electronic device, such as a server, a cloud server, etc.
[0155] Figure 6 A schematic diagram of the structure of an electronic device according to a first exemplary embodiment of this application is shown.
[0156] like Figure 6As shown, the electronic device includes: at least one processor 701; and a memory 702 communicatively connected to the at least one processor 701; wherein the memory stores instructions executable by the at least one processor 701, which, when executed by the at least one processor 701, enable the at least one processor 701 to perform the fire detection method or the training method for a fire feature discrimination model mentioned in the above embodiments. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0157] Figure 7 A schematic diagram of the structure of an electronic device according to a second exemplary embodiment of this application is shown.
[0158] like Figure 7 As shown, the electronic device may also include, for example, an I / O interface 703, an input unit 704, an output unit 705, a communication unit 706, a read-only memory (ROM) 707, and a random access memory (RAM) 708. Specifically, the processor 701 can perform various appropriate actions and processes according to a computer program stored in the ROM 707 or a computer program loaded from the memory 702 into the RAM 708. The RAM 708 may also store various programs and data required for the operation of the electronic device. The processor 701, ROM 707, and RAM 708 are interconnected via a bus 709. The I / O interface (input / output interface) 703 is also connected to the bus 709.
[0159] Multiple components in the electronic device are connected to the I / O interface 703, including: an input unit 704, such as a keyboard, mouse, etc.; an output unit 705, such as various types of displays, speakers, etc.; a memory 702, such as a disk, optical disk, etc.; and a communication unit 706, such as a network card, modem, wireless transceiver, etc. The communication unit 706 allows the electronic device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0160] Processor 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 701 performs the various methods and processes described above, such as fire detection methods or methods for training fire feature recognition models. For example, in some embodiments, the fire detection method or the method for training a fire feature recognition model can be implemented as a computer software program tangibly contained in a computer-readable storage medium, such as memory 702. In some embodiments, part or all of the computer program can be loaded and / or installed on an electronic device via ROM 707 and / or communication unit 706. When the computer program is loaded into RAM 708 and executed by processor 701, one or more steps of the fire detection method or the method for training a fire feature recognition model described above can be performed. Alternatively, in other embodiments, the processor 701 may be configured to perform a fire detection method by any other suitable means (e.g., by means of firmware).
[0161] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0162] The program code for implementing the methods of this application may be written in any combination of one or more programming languages. The program code may be packaged into a computer program product. This program code or computer program product may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by processor 701, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a computer, partially on a computer, partially on a remote computer as a standalone software package, or entirely on a remote computer or server.
[0163] For a detailed description of the electronic equipment and its beneficial effects, please refer to the description of the fire detection method or the training method of the fire feature discrimination model mentioned above, which will not be repeated here.
[0164] Furthermore, it should be noted that this application also provides a computer-readable storage medium storing a computer program executed by the aforementioned fire detection method or fire feature discrimination model training method. The computer program includes program instructions, which, when executed by the processor, enable the execution of the aforementioned fire detection method or fire feature discrimination model training method. Therefore, these descriptions will not be repeated here. Additionally, the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application.
[0165] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0166] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-described technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A fire detection method, characterized by, The method comprises: acquiring a frame image in a video stream; in response to determining that the frame image comprises a smoke image and / or a fire image, determining a target detection area in which the smoke image and / or the fire image is located; determining whether to issue a fire alarm according to a relationship between the target detection area and a shielding area; wherein the shielding area is an area having a fire false detection object, and comprises a static shielding area and a dynamic shielding area; wherein when an overlap degree between the target detection area and the dynamic shielding area is greater than a second set threshold, the target detection area is rechecked, and whether to issue a fire alarm is determined according to a rechecking result; when rechecking the smoke image and / or the fire image, data around the target detection area is detected, and for a small fire, if the smoke image and / or the fire image is real fire data, data around the smoke image and / or the fire image is environmental data, and if the smoke image and / or the fire image is a dynamic fire false detection object, data around the smoke image and / or the fire image is data associated with the dynamic fire false detection object.
2. The fire detection method of claim 1, wherein, Determining whether to issue a fire alarm according to the relationship between the target detection area and the shielding area comprises: determining an overlap degree between the target detection area and the shielding area; determining whether to issue a fire alarm according to a relationship between the overlap degree and a set threshold.
3. The fire detection method according to claim 2, wherein: when the target detection area in which the smoke image and / or the fire image is located is determined, an area size of the target detection area is also determined; when the shielding area is determined in advance, an area size of the shielding area is also determined; wherein determining the overlap degree between the target detection area and the shielding area comprises: determining a ratio of an intersection area between the target detection area and the shielding area to an area of the target detection area, and the ratio constitutes the overlap degree between the target detection area and the shielding area.
4. The fire detection method according to claim 2 or 3, wherein: the static shielding area is a pre-determined area having a static fire false detection object, and the dynamic shielding area is a determined area having a dynamic fire false detection object based on the frame image; wherein determining whether to issue a fire alarm according to the relationship between the overlap degree and the set threshold comprises: in response to the overlap degree between the target detection area and the static shielding area being greater than a first set threshold, cancelling a fire alarm of the target detection area.
5. A fire detection method according to claim 4, wherein, Determining whether to issue a fire alarm according to the relationship between the overlap degree and the set threshold further comprises: in response to the overlap degree between the target detection area and the static shielding area being less than or equal to the first set threshold, determining an overlap degree between the target detection area and the dynamic shielding area; in response to the overlap degree between the target detection area and the dynamic shielding area being less than or equal to a second set threshold, issuing a fire alarm of the target detection area.
6. A fire detection method according to claim 5, wherein, Rechecking the target detection area comprises: determining a rechecking area in the frame image, a range of the rechecking area covering a range of the target detection area; and determining a rechecking image based on the rechecking area. The re-inspection image is input into the trained fire feature recognition model after being scaled to a standard size to determine whether the target detection region has a real flame.
7. The fire detection method of claim 6, wherein a ratio between a coverage of the re-inspection region and a coverage of the target detection region is greater than 1 and less than 1.
5.
8. The fire detection method of claim 7, wherein the fire feature recognition model is obtained by performing deep learning on flame features of pre-collected flame data based on any one of resnet18, vgg, and denseNet. The fire detection method comprises: a processor; 9. An electronic device, comprising: and a memory in communication connection with the processor; wherein the memory stores a program executable by the processor, and when the program is executed by the processor, the processor can execute the fire detection method according to any one of claims 1-8. A computer program is stored on a readable storage medium, and the computer program is executed by a processor to implement the fire detection method according to any one of claims 1-8. 10. A readable storage medium, characterized by,
Citation Information
Patent Citations
A flame detection method based on video analysis in combination with easy-to-mix target elimination
CN109684982A
Vehicle fire identification method in combination with YOLOv3 and optical flow method
CN113706815A