Smoke and fire detection method and device, electronic equipment and storage medium

By acquiring video frame images during firework detection, cropping the target area, calculating feature similarity and weighted summation, the problem of high false alarm rate and low efficiency of existing firework detection methods is solved, and higher detection accuracy and efficiency are achieved. , and reduce operating costs.

CN118799546APending Publication Date: 2024-10-18CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD +1

Patent Information

Application Number
CN202311595729.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-27
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing firework detection methods based on surveillance video are prone to false alarms and have low detection efficiency. It is difficult to effectively reduce the false alarm rate by improving existing algorithms, and have high real-time requirements, which increases costs and affects performance.

Method used

By acquiring video frame images, perform fireworks detection, crop the target area, calculate feature similarity, and perform weighted summation based on initial confidence and feature similarity to determine the fireworks detection results, improve detection accuracy, and save operating costs.

Benefits of technology

It improves the accuracy and efficiency of firework detection, reduces the false alarm rate, reduces the dependence on complex algorithms, saves operating costs, and enhances detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118799546A_ABST
    Figure CN118799546A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, and provides a smoke and fire detection method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a first video frame image; performing smoke and fire detection based on the first video frame image to obtain an initial confidence coefficient of smoke and fire in the first video frame image and a detection frame coordinate; performing smoke and fire area cutting on the first video frame image based on the detection frame coordinates to obtain a target area image; performing feature similarity calculation based on the target area image to obtain feature similarity; and determining a smoke and fire detection result based on the initial confidence coefficient and the feature similarity. According to the smoke and fire detection method provided by the embodiment of the invention, based on the feature similarity, the initial confidence degree obtained in the initial smoke and fire detection result can be corrected, the smoke and fire detection result is determined, the smoke and fire detection accuracy is improved, meanwhile, the smoke and fire detection process does not need to be calculated by a complex algorithm, the operation cost is saved, and the efficiency is improved. The algorithm performance is improved, and the smoke detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a smoke and fire detection method, device, electronic equipment and storage medium. Background Art

[0002] Fire can cause great harm to people's personal and property safety, and timely warning can avoid greater losses. In existing technical solutions, smoke and fire detection based on surveillance video can provide fire alarm services for home security users without introducing additional equipment. However, smoke and fire detection based on surveillance video is prone to false alarms, which brings troubles to users.

[0003] The existing technology improves the detection algorithm itself, but the effect of reducing the false alarm rate is actually limited. Alternatively, it is necessary to detect adjacent video frames, which places high demands on the real-time performance of the algorithm. Under cost constraints, the performance of the algorithm itself will be greatly affected, resulting in low detection efficiency. Summary of the invention

[0004] The embodiments of the present invention provide a method, device, electronic device and storage medium for detecting fireworks, so as to solve the problems of low accuracy and low efficiency of fireworks detection.

[0005] In a first aspect, an embodiment of the present invention provides a method for detecting smoke and fire, comprising:

[0006] Acquire a first video frame image;

[0007] Performing fireworks detection based on the first video frame image to obtain initial confidence and detection frame coordinates of fireworks in the first video frame image; the detection frame coordinates are used to identify the area where the fireworks are located;

[0008] Based on the detection frame coordinates, the first video frame image is cropped for the fireworks area to obtain a target area image;

[0009] Performing feature similarity calculation based on the target area image to obtain feature similarity;

[0010] A smoke and fire detection result is determined based on the initial confidence and the feature similarity.

[0011] In one embodiment, the calculating of feature similarity based on the target area image to obtain feature similarity includes:

[0012] Perform feature extraction based on the target area image to obtain target area image features;

[0013] A feature similarity calculation is performed based on the target area image features to obtain the feature similarity.

[0014] In one embodiment, the feature similarity includes a first feature similarity; the feature similarity calculation based on the target area image feature to obtain the feature similarity includes:

[0015] The cosine similarity of the target area image features and the background area image features is calculated to obtain the first feature similarity; the background area image features are obtained by extracting features based on the background image; the background image is determined based on the collected second video frame image.

[0016] In one embodiment, the background image is determined by the following steps:

[0017] Acquire a second video frame image;

[0018] Based on a Gaussian mixture model, background modeling is performed on the second video frame image to obtain the background image.

[0019] In one embodiment, the feature similarity includes a second feature similarity; and the feature similarity calculation based on the target area image feature to obtain the feature similarity includes:

[0020] Performing cosine similarity calculation on the target area image features and each fireworks image feature to obtain at least one similarity value; the fireworks image features are obtained by extracting features based on fireworks images stored in a database;

[0021] Based on the similarity values, a maximum similarity value is determined as the second feature similarity.

[0022] In one embodiment, determining the smoke and fire detection result based on the initial confidence and the feature similarity includes:

[0023] Based on a first weighted value, weight calculation is performed on the first feature similarity to obtain a first weighted similarity;

[0024] Based on the second weighted value, weight calculation is performed on the second feature similarity to obtain a second weighted similarity;

[0025] Based on the third weighted value, weight calculation is performed on the initial confidence to obtain a third weighted confidence;

[0026] Performing weighted summation based on the first weighted similarity, the second weighted similarity and the third weighted confidence to obtain a target confidence;

[0027] The smoke and fire detection result is determined based on the target confidence.

[0028] In one embodiment, determining the smoke and fire detection result based on the target confidence level includes:

[0029] If it is determined that the target confidence is greater than a preset threshold, determining that the fireworks detection result is that fireworks exist;

[0030] If it is determined that the target confidence is less than or equal to a preset threshold, the fireworks detection result is determined to be that there is no fireworks.

[0031] In a second aspect, an embodiment of the present invention provides a smoke and fire detection device, comprising:

[0032] An acquisition module, used for acquiring a first video frame image;

[0033] A detection module, configured to perform fireworks detection based on the first video frame image, and obtain an initial confidence level and detection frame coordinates of the fireworks in the first video frame image; the detection frame coordinates are used to identify an area where the fireworks are located;

[0034] A cropping module, used for cropping the fireworks area of ​​the first video frame image based on the detection frame coordinates to obtain a target area image;

[0035] A similarity calculation module is used to perform feature similarity calculation based on the target area image to obtain feature similarity;

[0036] A determination module is used to determine a smoke and fire detection result based on the initial confidence and the feature similarity.

[0037] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory storing a computer program, wherein the processor implements the smoke and fire detection method described in the first aspect when executing the program.

[0038] In a fourth aspect, an embodiment of the present invention provides a storage medium, which is a computer-readable storage medium and includes a computer program. When the computer program is executed by a processor, the smoke and fire detection method described in the first aspect is implemented.

[0039] The fireworks detection method, device, electronic device and storage medium provided by the embodiments of the present invention perform fireworks detection based on the acquired first video frame image, determine the area where the fireworks are located in the first video frame image, and crop the fireworks area to obtain a target area image, and perform feature similarity calculation based on the target area image to obtain feature similarity, which can correct the initial confidence obtained in the initial fireworks detection result, and then determine the fireworks detection result, thereby improving the accuracy of fireworks detection. At the same time, there is no need for complex algorithms to calculate the fireworks detection process, saving operating costs, thereby improving algorithm performance and improving fireworks detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0041] Figure 1 is a flow chart of a smoke and fire detection method provided by an embodiment of the present invention;

[0042] Figure 2 is a schematic diagram of regional image cropping provided by an embodiment of the present invention;

[0043] Figure 3 is a schematic diagram of feature extraction provided by an embodiment of the present invention;

[0044] Figure 4 is a flow chart of the overall solution of the smoke and fire detection method provided by an embodiment of the present invention;

[0045] Figure 5 is a functional module schematic diagram of an embodiment of a smoke and fire detection device of the present invention;

[0046] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, in the absence of mutual contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0048] The smoke and fire detection method, device, electronic device and storage medium provided by the present invention are described in detail below in conjunction with the embodiments.

[0049] Figure 1 FIG. 1 is a flow chart of a method for detecting smoke and fire provided in an embodiment of the present invention. Figure 1 , an embodiment of the present invention provides a method for detecting smoke and fire, which may include:

[0050] Step 100, obtaining a first video frame image;

[0051] Step 200, performing fireworks detection based on the first video frame image to obtain initial confidence and detection frame coordinates of fireworks in the first video frame image;

[0052] Step 300, based on the detection frame coordinates, the first video frame image is cropped for the fireworks area to obtain a target area image;

[0053] Step 400, performing feature similarity calculation based on the target area image to obtain feature similarity;

[0054] Step 500: Determine a smoke and fire detection result based on the initial confidence and the feature similarity.

[0055] It should be noted that the smoke and fire detection method provided in the embodiment of the present invention is implemented based on the smoke and fire detection device. The smoke and fire detection method is applied to the scene of smoke and flame detection based on monitoring video. Based on the target detection algorithm, the video frame image captured by the monitoring video can be identified to obtain the area of ​​the smoke and fire in the image and its confidence level. Then, based on metric learning, the features of the smoke and fire area are extracted, and the feature similarity is calculated to obtain the feature similarity, so as to correct the confidence level obtained in the initial smoke and fire detection result, thereby determining the smoke and fire detection result. Therefore, the embodiment of the present invention takes the smoke and fire detection device as the execution subject to describe the smoke and fire detection method.

[0056] It should be further explained that when the smoke and fire detection method is deployed or when the system time reaches the set time node, the smoke and fire detection device will collect video frame images through the monitoring video when no fire occurs, and determine the current background image based on the collected video frame images, and store the current background image in the database. The background image obtained during the initial deployment will be deleted later, and the background image of the set time node will be updated every day thereafter, for example, 8 o'clock in the morning, 12 o'clock in the afternoon or 8 o'clock in the evening as the preset time node, that is, the background image will be replaced according to the video frame image obtained at the latest preset time point.

[0057] Specifically, the smoke and fire detection device captures a video frame image based on the surveillance video captured by the camera to obtain a first video frame image. It should be noted that the smoke and fire detection device will capture a video frame image of the surveillance video based on a preset video frame interval to obtain at least one video frame image, and perform smoke and fire detection on each video frame image, wherein the preset video frame interval is set according to actual conditions. Since frame-by-frame processing is not required, a smaller video frame interval can be set for capture, such as capturing a video frame image every 5 frames. The embodiment of the present invention describes the smoke and fire detection method of the embodiment of the present invention by obtaining one of the first video frame images.

[0058] Furthermore, the smoke and fire detection device performs smoke and fire detection based on the first video frame image to obtain the initial confidence and detection frame coordinates of the smoke and fire in the first video frame image. It should be noted that if it is detected that there is no smoke and fire detection in the first video frame image, the smoke and fire detection device skips the first video frame image of the current frame, captures the video frame image of the monitoring video based on the preset video frame interval, and performs smoke and fire detection on the next video frame image.

[0059] Therefore, it can be understood that the fireworks detection device inputs the first video frame image into the target detection model, and obtains the fireworks category, the detection frame coordinates of the fireworks, and the corresponding confidence of the fireworks in the first video frame image output by the target detection model, wherein the detection frame coordinates of the fireworks are used to identify the area where the fireworks are located, and the confidence of the fireworks is used to characterize the reliability of the target detection model in detecting the existence of fireworks in the first video frame image. In one embodiment, the target detection model adopts the YOLOX (You Only Look Once X) model, which is pre-trained using a large-scale image dataset that covers many different categories of objects and scenes.

[0060] Furthermore, the fireworks detection device determines the position of the fireworks detection frame based on the detection frame coordinates, and according to the position of the fireworks detection frame, crops the fireworks region of the first video frame image to obtain the target region image. It should be noted that the detection frame is generally a rectangular frame, and the detection frame coordinates output by the target detection model are the coordinates of the points in the upper left corner of the rectangular frame and the coordinates of the points in the lower right corner of the rectangular frame. The position of the rectangular frame can be determined according to the coordinates of the points in the upper left corner of the rectangular frame and the coordinates of the points in the lower right corner of the rectangular frame, that is, the position of the fireworks detection frame can be determined.

[0061] Furthermore, the fireworks detection device obtains the background image stored in the database, determines the rectangular frame position of the detection frame coordinates in the background image based on the detection frame coordinates output by the target detection model, and crops the background area of ​​the background image according to the rectangular frame position to obtain a background area image. Figure 2 , Figure 2: is a schematic diagram of regional image cropping provided by an embodiment of the present invention, wherein (x1, y1) represents the coordinates of the point in the upper left corner of the rectangular box, and (x2, y2) represents the coordinates of the point in the lower right corner of the rectangular box.

[0062] Furthermore, the smoke and fire detection device calculates feature similarity based on the target area image to obtain feature similarity, wherein the feature similarity includes a first feature similarity and a second feature similarity, that is, the smoke and fire detection device calculates feature similarity based on the target area image to obtain a first feature similarity and a second feature similarity.

[0063] Furthermore, the smoke and fire detection device performs weighted summation based on the initial confidence and the feature similarity to obtain a target confidence, and determines the smoke and fire detection result according to the target confidence.

[0064] The fireworks detection method, device, electronic device and storage medium provided by the embodiments of the present invention perform fireworks detection based on the acquired first video frame image, determine the area where the fireworks are located in the first video frame image, and crop the fireworks area to obtain a target area image, and perform feature similarity calculation based on the target area image to obtain feature similarity, which can correct the initial confidence obtained in the initial fireworks detection result, and then determine the fireworks detection result, thereby improving the accuracy of fireworks detection. At the same time, there is no need for complex algorithms to calculate the fireworks detection process, saving operating costs, thereby improving algorithm performance and improving fireworks detection efficiency.

[0065] Further, the calculating of feature similarity based on the target area image to obtain feature similarity includes:

[0066] Perform feature extraction based on the target area image to obtain target area image features;

[0067] A feature similarity calculation is performed based on the target area image features to obtain the feature similarity.

[0068] Specifically, the smoke and fire detection device performs feature extraction based on the target area image to obtain the target area image features, and performs feature extraction based on the background area image to obtain the background area image features.

[0069] Therefore, it can be understood that the fire and smoke detection device inputs the target area image into the feature extraction model to obtain the target area image features, and inputs the background area image into the feature extraction model to obtain the background area image features. In one embodiment, the feature extraction model uses ShuffleNet V2 as the backbone network, and the final output feature is a 1×1024 size vector, such as Figure 3 As shown, Figure 3It is a schematic diagram of feature extraction provided by an embodiment of the present invention. ShuffleNet V2 is a lightweight backbone network that can ensure the thrust speed of the model and avoid excessively high operating costs. Therefore, the feature extraction model with ShuffleNet V2 as the backbone network has a feature representation obtained after training that has certain semantic information and distinctiveness. These features can be used as input in metric learning. By measuring the similarity between data, samples are mapped to the feature space, thereby achieving a measurement of the similarity between samples. In an embodiment of the present invention, when training the feature extraction model, a large number of smoke images and flame images are used as training data to improve the feature extraction effect of related targets.

[0070] It should be noted that before performing the fireworks detection process, the fireworks detection device will input a large number of smoke images and flame images into the feature extraction model in advance, obtain multiple fireworks image features output by the feature extraction model, and store the multiple fireworks image features in a database, where the fireworks image features include smoke image features and flame image features.

[0071] Furthermore, the smoke and fire detection device calculates feature similarity based on the target area image features to obtain feature similarity, wherein the feature similarity includes a first feature similarity and a second feature similarity.

[0072] Therefore, it can be understood that the fireworks detection device calculates feature similarity based on the target area image features and the background image features to obtain the first feature similarity, and calculates feature similarity based on the target area image features and the fireworks image features to obtain the second feature similarity.

[0073] The embodiment of the present invention performs feature extraction based on the target area image to obtain the target area image features, and performs feature similarity calculation based on the target area image features to obtain the feature similarity, which can realize the correction of the initial confidence obtained in the initial fireworks and fire detection results, and then determine the fireworks and fire detection results, thereby improving the accuracy of fireworks and fire detection. At the same time, there is no need for complex algorithms to calculate the fireworks and fire detection process, saving operating costs, thereby improving algorithm performance and improving fireworks and fire detection efficiency.

[0074] Further, the feature similarity includes a first feature similarity; the feature similarity calculation based on the target area image feature to obtain the feature similarity includes:

[0075] The cosine similarity of the target area image features and the background area image features is calculated to obtain the first feature similarity; the background area image features are obtained by extracting features based on the background image; the background image is determined based on the collected second video frame image.

[0076] Specifically, the smoke and fire detection device performs cosine similarity calculation on the target area image features and the background area image features according to the target area image features and the background area image features to obtain a first feature similarity, wherein the calculation formula of the cosine similarity is:

[0077]

[0078] It should be noted that the first feature similarity is used to correct the initial confidence obtained in the initial smoke and fire detection results to eliminate the smoke and fire false detection results of the target detection model. Since the background image refers to the surveillance video frame when no fire occurs, the higher the first feature similarity, the lower the probability of false detection of smoke and fire in the target detection model. On the contrary, the lower the first feature similarity, the greater the probability of false detection of smoke and fire in the target detection model. In other words, the first feature similarity is inversely correlated with the probability of false detection of smoke and fire in the target detection model.

[0079] The embodiment of the present invention calculates the cosine similarity of the target area image features and the background area image features to obtain the first feature similarity, which can correct the initial confidence obtained in the initial smoke and fire detection results, and then determine the smoke and fire detection results, thereby improving the accuracy of smoke and fire detection. At the same time, there is no need to use complex algorithms to calculate the smoke and fire detection process, which saves operating costs, thereby improving algorithm performance and improving smoke and fire detection efficiency.

[0080] Furthermore, the background image is determined by the following steps:

[0081] Acquire a second video frame image;

[0082] Based on a Gaussian mixture model, background modeling is performed on the second video frame image to obtain the background image.

[0083] Specifically, the smoke and fire detection device captures a video frame image at a preset time point based on the surveillance video captured by the camera to obtain a second video frame image, wherein the preset time point is set according to actual conditions. It should be noted that the second video frame image refers to the video frame image obtained at the latest preset time point.

[0084] Furthermore, the fire and smoke detection device inputs the acquired second video frame image into the Gaussian mixture model, performs background modeling on the second video frame image, and obtains a background image. It should be noted that the background modeling process is usually as follows: the first video frame image of the surveillance video is used as the background model of the entire scene, and based on the Gaussian mixture model, the background model is updated for the pixel values ​​of the video frame image acquired thereafter, and background subtraction is performed based on the updated background model, that is, to eliminate the interference of the moving target, thereby achieving the replacement of the background image.

[0085] The embodiment of the present invention obtains a second video frame image and performs background modeling on the second video frame image based on a Gaussian mixture model to obtain a background image, thereby accurately capturing static background information in the video and improving the accuracy of background modeling. In addition, the Gaussian mixture model can better adapt to dynamic changes in the scene, improve the stability and reliability of background modeling, and provide a better basis for subsequently eliminating false detections of fireworks in the target detection model through the background image.

[0086] Further, the feature similarity includes a second feature similarity; the feature similarity calculation based on the target area image feature to obtain the feature similarity includes:

[0087] Performing cosine similarity calculation on the target area image features and each fireworks image feature to obtain at least one similarity value; the fireworks image features are obtained by extracting features based on fireworks images stored in a database;

[0088] Based on the similarity values, a maximum similarity value is determined as the second feature similarity.

[0089] Specifically, the fireworks detection device performs cosine similarity calculation on the target area image features and each fireworks image feature according to the target area image features and each fireworks image feature to obtain at least one similarity value.

[0090] Further, the smoke and fire detection device compares the numerical values ​​of the similarity values ​​to obtain a similarity value comparison result. Further, the smoke and fire detection device determines a maximum similarity value according to the similarity value comparison result, and determines the maximum similarity value as the second feature similarity.

[0091] It should be noted that the second feature similarity is used to correct the initial confidence obtained in the initial fireworks detection results to eliminate the fireworks false detection results of the target detection model. Since the fireworks image can reflect the accuracy of the detected fireworks, the higher the second feature similarity, the greater the probability of fireworks false detection of the target detection model. On the contrary, the lower the second feature similarity, the smaller the probability of fireworks false detection of the target detection model. In other words, the second feature similarity is positively correlated with the probability of fireworks false detection of the target detection model.

[0092] The embodiment of the present invention calculates the cosine similarity of the target area image features and each fireworks image feature to obtain at least one similarity value, and based on the similarity value, determines the maximum similarity value as the second feature similarity, so as to correct the initial confidence obtained in the initial fireworks detection result, and then determine the fireworks detection result, thereby improving the accuracy of fireworks detection. At the same time, there is no need for complex algorithms to calculate the fireworks detection process, saving operating costs, thereby improving algorithm performance and improving fireworks detection efficiency.

[0093] Further, the determining of the smoke and fire detection result based on the initial confidence and the feature similarity includes:

[0094] Based on a first weighted value, weight calculation is performed on the first feature similarity to obtain a first weighted similarity;

[0095] Based on the second weighted value, weight calculation is performed on the second feature similarity to obtain a second weighted similarity;

[0096] Based on the third weighted value, weight calculation is performed on the initial confidence to obtain a third weighted confidence;

[0097] Performing weighted summation based on the first weighted similarity, the second weighted similarity and the third weighted confidence to obtain a target confidence;

[0098] The smoke and fire detection result is determined based on the target confidence.

[0099] Specifically, the fireworks detection device performs weight calculation on the first feature similarity based on the first weighted value to obtain the first weighted similarity, wherein the first weighted value is set according to the actual situation. Since the first feature similarity is inversely correlated with the probability of false detection of fireworks by the target detection model, that is, the first feature similarity is a negative indicator, the first weighted value is negative. In one embodiment, the first weighted value is w1, and the first feature similarity is P A Therefore, the first weighted similarity is P1 = w1 × P A .

[0100] Furthermore, the fireworks detection device performs weight calculation on the second feature similarity based on the second weighted value to obtain the second weighted similarity, wherein the second weighted value is set according to the actual situation. Since the second feature similarity is positively correlated with the probability of false detection of fireworks by the target detection model, that is, the second feature similarity is a positive indicator, the second weighted value is a positive number. In one embodiment, the second weighted value is w2, and the second feature similarity is P B Therefore, the second weighted similarity is P2 = w2 × P B .

[0101] Further, the smoke and fire detection device performs weight calculation on the initial confidence based on the third weighted value to obtain a third weighted confidence, wherein the third weighted value is set according to the actual situation. Since the initial confidence is a positive indicator, the third weighted value is a positive number. In one embodiment, the third weighted value is w3, and the initial confidence is P C Therefore, the third weighted confidence is P3 = w3 × P C .

[0102] Furthermore, the smoke and fire detection device performs weighted summation on the first weighted similarity, the second weighted similarity and the third weighted confidence to obtain a target confidence. In one embodiment, the first weighted similarity is P1=w1×P A , the second weighted similarity is P2 = w2 × P B , the third weighted confidence is P3 = w3 × P C , then, the target confidence obtained by the smoke and fire detection device based on the weighted sum of the first weighted similarity, the second weighted similarity and the third weighted confidence is:

[0103] P=P1+P2+P3=w1×P A +w2×P B +w3×P C

[0104] Among them, w1 is a negative number, w2 is a positive number, and w3 is a positive number.

[0105] Furthermore, the smoke and fire detection device determines a smoke and fire detection result based on the target confidence.

[0106] The embodiment of the present invention performs weight calculation on the first feature similarity based on the first weight value to obtain the first weighted similarity, performs weight calculation on the second feature similarity based on the second weight value to obtain the second weighted similarity, performs weight calculation on the initial confidence based on the third weight value to obtain the third weighted confidence, further performs weighted summation on the first weighted similarity, the second weighted similarity and the third weighted confidence to obtain the target confidence, and determines the fireworks detection result based on the target confidence, which can realize the correction of the initial confidence obtained in the initial fireworks detection result, and then determine the fireworks detection result, thereby improving the accuracy of fireworks detection. At the same time, there is no need for complex algorithms to calculate the fireworks detection process, saving operating costs, thereby improving algorithm performance and improving fireworks detection efficiency.

[0107] Further, the determining the smoke and fire detection result based on the target confidence level includes:

[0108] If it is determined that the target confidence is greater than a preset threshold, determining that the fireworks detection result is that fireworks exist;

[0109] If it is determined that the target confidence is less than or equal to a preset threshold, the fireworks detection result is determined to be that there is no fireworks.

[0110] It should be noted that the smoke and fire detection results include smoke only, flame only, smoke and flame, and smoke and flame. The benchmark for judging the smoke and fire detection result is whether the target confidence is greater than a preset threshold, and the preset threshold includes a smoke threshold and a flame threshold. The smoke threshold and the flame threshold can be set to the same value or different values ​​according to actual conditions.

[0111] Specifically, the smoke and fire detection device compares the target confidence with the smoke threshold and the flame threshold according to the target confidence.

[0112] Further, if it is determined that the target confidence is greater than the smoke threshold and less than or equal to the flame threshold, the smoke and fire detection device determines that the smoke and fire detection result is that only smoke exists.

[0113] Further, if it is determined that the target confidence is greater than the flame threshold and less than or equal to the smoke threshold, the smoke and fire detection device determines that the smoke and fire detection result is that only flame exists.

[0114] Further, if it is determined that the target confidence is greater than the smoke threshold and greater than the flame threshold, the smoke and fire detection device determines that the smoke and fire detection result is that smoke and flame exist.

[0115] Further, if it is determined that the target confidence is less than or equal to the smoke threshold and less than or equal to the flame threshold, the smoke and fire detection device determines that the smoke and fire detection result is that there is no smoke and flame.

[0116] The embodiment of the present invention determines whether the smoke and fire detection result is the presence or absence of smoke and fire based on the numerical comparison result of the target confidence and the preset threshold value, determines multiple smoke and fire detection results through threshold comparison, improves the accuracy of smoke and fire detection, and improves the flexibility of the system.

[0117] Further, refer to Figure 4 , Figure 4 FIG. 1 is a flow chart of the overall solution of the smoke and fire detection method provided by an embodiment of the present invention. Therefore, the overall process of the smoke and fire detection method provided by the present invention can be understood as follows:

[0118] Before performing the fireworks detection process, the fireworks detection device pre-captures a video frame image at a preset time point based on the surveillance video taken by the camera to obtain a second video frame image, wherein the second video frame image refers to the video frame image acquired at the latest preset time point. Furthermore, the fireworks detection device inputs the acquired second video frame image into a Gaussian mixture model, performs background modeling on the second video frame image, and obtains a background image.

[0119] Before performing the fireworks detection process, the fireworks detection device inputs a large number of smoke images and flame images into the feature extraction model in advance, obtains multiple fireworks image features output by the feature extraction model, and stores the multiple fireworks image features into a database, wherein the fireworks image features include smoke image features and flame image features.

[0120] When performing the smoke and fire detection process, the smoke and fire detection device captures a video frame image based on the monitoring video captured by the camera to obtain a first video frame image.

[0121] Furthermore, the fireworks detection device inputs the first video frame image into the target detection model to obtain the fireworks category, the fireworks detection frame coordinates and the corresponding confidence of the fireworks in the first video frame image output by the target detection model.

[0122] Furthermore, the fireworks detection device determines the position of the fireworks detection frame based on the detection frame coordinates, and crops the fireworks area of ​​the first video frame image according to the position of the fireworks detection frame to obtain a target area image.

[0123] Furthermore, the fireworks detection device obtains the background image stored in the database, determines the rectangular frame position of the detection frame coordinates in the background image based on the detection frame coordinates output by the target detection model, and crops the background area of ​​the background image according to the rectangular frame position to obtain a background area image.

[0124] Furthermore, the smoke and fire detection device inputs the target area image into a feature extraction model to obtain target area image features, and inputs the background area image into a feature extraction model to obtain background area image features.

[0125] Furthermore, the smoke and fire detection device calculates cosine similarity between the target area image features and the background area image features according to the target area image features and the background area image features to obtain a first feature similarity.

[0126] Furthermore, the fireworks detection device performs cosine similarity calculation on the target area image features and each fireworks image feature based on the target area image features and each fireworks image feature to obtain at least one similarity value. Furthermore, the fireworks detection device compares the numerical values ​​of each similarity value to obtain a similarity value comparison result. Furthermore, the fireworks detection device determines the maximum similarity value based on the similarity value comparison result, and determines the maximum similarity value as the second feature similarity.

[0127] Furthermore, the smoke and fire detection device performs weight calculation on the first feature similarity based on the first weighted value to obtain the first weighted similarity, performs weight calculation on the second feature similarity based on the second weighted value to obtain the second weighted similarity, and performs weight calculation on the initial confidence based on the third weighted value to obtain the third weighted confidence.

[0128] Furthermore, the smoke and fire detection device performs weighted summation on the first weighted similarity, the second weighted similarity and the third weighted confidence based on the first weighted similarity, the second weighted similarity and the third weighted confidence to obtain a target confidence.

[0129] Furthermore, the smoke and fire detection device compares the target confidence with the smoke threshold and the flame threshold according to the target confidence.

[0130] Further, if it is determined that the target confidence is greater than the smoke threshold and less than or equal to the flame threshold, the smoke and fire detection device determines that the smoke and fire detection result is that only smoke exists.

[0131] Further, if it is determined that the target confidence is greater than the flame threshold and less than or equal to the smoke threshold, the smoke and fire detection device determines that the smoke and fire detection result is that only flame exists.

[0132] Further, if it is determined that the target confidence is greater than the smoke threshold and greater than the flame threshold, the smoke and fire detection device determines that the smoke and fire detection result is that smoke and flame exist.

[0133] Further, if it is determined that the target confidence is less than or equal to the smoke threshold and less than or equal to the flame threshold, the smoke and fire detection device determines that the smoke and fire detection result is that there is no smoke and flame.

[0134] Furthermore, the present invention also provides a smoke and fire detection device.

[0135] Reference Figure 5 , Figure 5 It is a functional module diagram of an embodiment of a smoke and fire detection device of the present invention.

[0136] The smoke and fire detection device comprises:

[0137] An acquisition module 510 is used to acquire a first video frame image;

[0138] A detection module 520 is used to perform fireworks detection based on the first video frame image to obtain an initial confidence level and detection frame coordinates of the fireworks in the first video frame image; the detection frame coordinates are used to identify the area where the fireworks are located;

[0139] A cropping module 530, configured to crop the first video frame image for a fireworks area based on the detection frame coordinates to obtain a target area image;

[0140] A similarity calculation module 540 is used to perform feature similarity calculation based on the target area image to obtain feature similarity;

[0141] The determination module 550 is configured to determine a smoke and fire detection result based on the initial confidence and the feature similarity.

[0142] The fireworks detection device provided in the embodiment of the present invention performs fireworks detection based on the acquired first video frame image, determines the area where the fireworks are located in the first video frame image, and crops the fireworks area to obtain a target area image, and performs feature similarity calculation based on the target area image to obtain feature similarity, which can correct the initial confidence obtained in the initial fireworks detection result, and then determine the fireworks detection result, thereby improving the accuracy of fireworks detection. At the same time, there is no need for complex algorithms to calculate the fireworks detection process, saving operating costs, thereby improving algorithm performance and improving fireworks detection efficiency.

[0143] In one embodiment, the smoke and fire detection device is further used for:

[0144] Acquire a second video frame image;

[0145] Based on a Gaussian mixture model, background modeling is performed on the second video frame image to obtain the background image.

[0146] In one embodiment, the similarity calculation module 540 is further used to:

[0147] Perform feature extraction based on the target area image to obtain target area image features;

[0148] A feature similarity calculation is performed based on the target area image features to obtain the feature similarity.

[0149] In one embodiment, the similarity calculation module 540 is further used to:

[0150] The feature similarity includes a first feature similarity;

[0151] The cosine similarity of the target area image features and the background area image features is calculated to obtain the first feature similarity; the background area image features are obtained by extracting features based on the background image; the background image is determined based on the collected second video frame image.

[0152] In one embodiment, the similarity calculation module 540 is further used to:

[0153] The feature similarity includes a second feature similarity;

[0154] Performing cosine similarity calculation on the target area image features and each fireworks image feature to obtain at least one similarity value; the fireworks image features are obtained by extracting features based on fireworks images stored in a database;

[0155] Based on the similarity values, a maximum similarity value is determined as the second feature similarity.

[0156] In one embodiment, the determining module 550 is further configured to:

[0157] Based on a first weighted value, weight calculation is performed on the first feature similarity to obtain a first weighted similarity;

[0158] Based on the second weighted value, weight calculation is performed on the second feature similarity to obtain a second weighted similarity;

[0159] Based on the third weighted value, weight calculation is performed on the initial confidence to obtain a third weighted confidence;

[0160] Performing weighted summation based on the first weighted similarity, the second weighted similarity and the third weighted confidence to obtain a target confidence;

[0161] The smoke and fire detection result is determined based on the target confidence.

[0162] In one embodiment, the determining module 550 is further configured to:

[0163] If it is determined that the target confidence is greater than a preset threshold, determining that the fireworks detection result is that fireworks exist;

[0164] If it is determined that the target confidence is less than or equal to a preset threshold, the fireworks detection result is determined to be that there is no fireworks.

[0165] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call a computer program in the memory 630 to execute the steps of the smoke and fire detection method, for example including:

[0166] Acquire a first video frame image;

[0167] Performing fireworks detection based on the first video frame image to obtain initial confidence and detection frame coordinates of fireworks in the first video frame image; the detection frame coordinates are used to identify the area where the fireworks are located;

[0168] Based on the detection frame coordinates, the first video frame image is cropped for the fireworks area to obtain a target area image;

[0169] Performing feature similarity calculation based on the target area image to obtain feature similarity;

[0170] A smoke and fire detection result is determined based on the initial confidence and the feature similarity.

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

[0172] On the other hand, an embodiment of the present invention further provides a medium, which is a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and the computer program is used to enable a processor to execute the steps of the methods provided in the above embodiments, for example, including:

[0173] Acquire a first video frame image;

[0174] Performing fireworks detection based on the first video frame image to obtain initial confidence and detection frame coordinates of fireworks in the first video frame image; the detection frame coordinates are used to identify the area where the fireworks are located;

[0175] Based on the detection frame coordinates, the first video frame image is cropped for the fireworks area to obtain a target area image;

[0176] Performing feature similarity calculation based on the target area image to obtain feature similarity;

[0177] A smoke and fire detection result is determined based on the initial confidence and the feature similarity.

[0178] The computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.

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

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

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

Claims

1. A method for detecting fireworks, characterized in that: include: Acquire a first video frame image; Performing fireworks detection based on the first video frame image to obtain initial confidence and detection frame coordinates of fireworks in the first video frame image; the detection frame coordinates are used to identify the area where the fireworks are located; Based on the detection frame coordinates, the first video frame image is cropped for the fireworks area to obtain a target area image; Performing feature similarity calculation based on the target area image to obtain feature similarity; A smoke and fire detection result is determined based on the initial confidence and the feature similarity.

2. The method for detecting smoke and fire according to claim 1, characterized in that: The calculating feature similarity based on the target area image to obtain feature similarity includes: Perform feature extraction based on the target area image to obtain target area image features; A feature similarity calculation is performed based on the target area image features to obtain the feature similarity.

3. The method for detecting smoke and fire according to claim 2, characterized in that: The feature similarity includes a first feature similarity; the feature similarity calculation based on the target area image feature to obtain the feature similarity includes: The cosine similarity of the target area image features and the background area image features is calculated to obtain the first feature similarity; the background area image features are obtained by extracting features based on the background image; the background image is determined based on the collected second video frame image.

4. The method for detecting smoke and fire according to claim 3, characterized in that: The background image is determined by the following steps: Acquire a second video frame image; Based on a Gaussian mixture model, background modeling is performed on the second video frame image to obtain the background image.

5. The method for detecting smoke and fire according to claim 4, characterized in that: The feature similarity includes a second feature similarity; the feature similarity calculation based on the target area image feature to obtain the feature similarity includes: Performing cosine similarity calculation on the target area image features and each fireworks image feature to obtain at least one similarity value; the fireworks image features are obtained by extracting features based on fireworks images stored in a database; Based on the similarity values, a maximum similarity value is determined as the second feature similarity.

6. The method for detecting smoke and fire according to claim 5, characterized in that: The determining of the smoke and fire detection result based on the initial confidence and the feature similarity includes: Based on a first weighted value, weight calculation is performed on the first feature similarity to obtain a first weighted similarity; Based on the second weighted value, weight calculation is performed on the second feature similarity to obtain a second weighted similarity; Based on the third weighted value, weight calculation is performed on the initial confidence to obtain a third weighted confidence; Performing weighted summation based on the first weighted similarity, the second weighted similarity and the third weighted confidence to obtain a target confidence; The smoke and fire detection result is determined based on the target confidence.

7. The method for detecting smoke and fire according to claim 6, characterized in that: The determining the smoke and fire detection result based on the target confidence level includes: If it is determined that the target confidence is greater than a preset threshold, determining that the fireworks detection result is that fireworks exist; If it is determined that the target confidence is less than or equal to a preset threshold, the fireworks detection result is determined to be that there is no fireworks.

8. A smoke and fire detection device, characterized in that: include: An acquisition module, used for acquiring a first video frame image; A detection module, configured to perform fireworks detection based on the first video frame image, and obtain an initial confidence level and detection frame coordinates of the fireworks in the first video frame image; the detection frame coordinates are used to identify an area where the fireworks are located; A cropping module, used for cropping the fireworks area of ​​the first video frame image based on the detection frame coordinates to obtain a target area image; A similarity calculation module, used for performing feature similarity calculation based on the target area image to obtain feature similarity; A determination module is used to determine a smoke and fire detection result based on the initial confidence and the feature similarity.

9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the smoke and fire detection method according to any one of claims 1 to 7 is implemented.

10. A storage medium, the storage medium being a computer-readable storage medium, comprising a computer program, characterized in that: When the computer program is executed by a processor, the smoke and fire detection method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • YOLOV3-based smoke and fire automatic detection and early warning method

    CN112132090A

  • Processing method, device and equipment for smoke and fire identification of edge AI equipment

    CN117095346A

  • Flame detection method and apparatus, device, and storage medium

    WO2023143498A1

Cited By

  • Histopathologic identification method and device for prostate cancer lymph node metastasis

    CN119992033A

  • Histopathological Identification Method and Device for Lymph Node Metastasis of Prostate Cancer

    CN119992033B