A method, system, apparatus, and medium for detecting a smoke fire

By using a linear statistical method involving edge pixels and non-edge pixels, the problem of false detection of vehicle lights and streetlights in fireworks detection was solved, achieving higher accuracy and real-time performance.

CN115761578BActive Publication Date: 2026-06-02JINAN BOGUAN INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN BOGUAN INTELLIGENT TECH CO LTD
Filing Date
2022-11-07
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing methods for detecting fireworks are easily interfered with by vehicle lights and streetlights, resulting in a high false detection rate and difficulty in accurately distinguishing between fireworks and non-smoke targets.

Method used

By acquiring edge and non-edge pixels of the image to be detected, a straight line is drawn along the gradient direction of the edge pixels, and the number of times the non-edge pixels cross the straight line is counted. A threshold and a classifier are then used to determine whether the image is fireworks.

Benefits of technology

It reduced the false detection rate, improved the accuracy and real-time performance of smoke and fire detection, and reduced the dependence on light and color.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115761578B_ABST
    Figure CN115761578B_ABST
Patent Text Reader

Abstract

The application discloses a method, system and device for detecting fireworks and a medium, and relates to the field of detecting fireworks. The method for detecting fireworks provided by the application comprises the following steps: acquiring a to-be-detected picture and edge pixel points and non-edge pixel points corresponding to the to-be-detected picture, acquiring straight lines along the gradient directions of the edge pixel points, acquiring the number of times that each non-edge pixel point passes through the straight lines, and finally determining whether the picture is a fireworks picture according to the number of times that each non-edge pixel point passes through the straight lines. The method is a false detection filtering method that uses the edges of a picture to determine the type of the picture, is not affected by light and the color of the picture, and is simpler than the prior art method of extracting the features of multiple frames of images for comprehensive judgment, does not affect the real-time performance of the overall detection process, and further ensures the accuracy of the detection of fireworks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of fireworks detection, and in particular to a method, system, apparatus and medium for fireworks detection. Background Technology

[0002] With the continuous advancement of surveillance technology, analyzing and judging behaviors observed in surveillance footage has always been a key focus in the industry. Among these, smoke and fire detection technology is becoming increasingly important in scenarios such as fire emergency response and production safety. Deep learning methods are currently the main approach in video surveillance for smoke and fire detection. However, in the process of using computer vision for smoke and fire detection, the brightness and shape of vehicle lights and streetlights are similar to smoke and fire, making it extremely easy for the smoke and fire detection model to misjudge and report them as flame targets. Solving the problem of false detection of such targets has always been a primary goal for improving smoke and fire detection.

[0003] In recent years, two common detection methods have been used for fireworks detection. The first method combines traditional deep learning with image processing. This method first obtains preprocessed regions based on image color differences and video frame differences, which can lead to region selection errors. Some difficult-to-distinguish false positives are easily misjudged by traditional image recognition methods, thus increasing the overall false positive rate. The second method determines the contour features of the fireworks image and then obtains the motion region of the fireworks image. The motion region is first fed into the network for detection, and then the image feature information in the first, second, and third color spaces of the fireworks detection image is obtained to determine the target fireworks recognition result. This method, which uses color space to obtain image feature information, is easily affected by lighting, and there are also significant differences in color space at different spatial locations, which can also reduce the accuracy of fireworks detection and increase the probability of false positives. Regardless of the detection method, false positives are the most important problem in fireworks detection.

[0004] In view of the above-mentioned technologies, finding a method to eliminate false detections of vehicle lights and streetlights in smoke and fire detection is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a method, system, apparatus, and medium for detecting fireworks. This application determines the type of an image by using its edges to identify whether it is a fireworks image. This application is unaffected by light and color, reducing the probability of false detection and improving safety.

[0006] To address the aforementioned technical problems, this application provides a method for detecting fireworks, the method comprising:

[0007] Obtain the image to be detected, as well as the corresponding edge pixels and non-edge pixels;

[0008] Obtain the straight line passing through the gradient direction of each edge pixel;

[0009] Get the number of times each non-edge pixel crosses the straight line;

[0010] Whether the image to be detected is a fireworks image is determined by the number of times each non-edge pixel crosses a straight line.

[0011] Preferably, obtaining the image to be detected and the corresponding edge pixels and non-edge pixels of the image to be detected includes:

[0012] Acquire video frames;

[0013] The target image to be detected is obtained from the video frame, and the target image is subjected to smoke and fire detection using a preset target detection network to obtain the image to be detected.

[0014] Edge detection is performed on the image to be detected to obtain the corresponding edge pixels and non-edge pixels.

[0015] Preferably, edge detection of the image to be detected includes:

[0016] The Sobel operator is used to process the image to be detected;

[0017] The non-maximum suppression method is used to obtain the edge points in the image to be detected;

[0018] A dual thresholding method is used to remove edge points caused by noise or color changes, resulting in edge pixels and non-edge pixels.

[0019] Preferably, determining whether the image to be detected is a fireworks image is based on the number of times each non-edge pixel crosses a straight line, including:

[0020] The number of non-edge pixels that cross a straight line more than a preset threshold is obtained.

[0021] If the number of non-edge pixels is less than the preset number, the image to be detected is determined to be a non-smoke image.

[0022] Preferably, determining whether the image to be detected is a fireworks image based on the number of times each non-edge pixel crosses a straight line further includes:

[0023] When the number of non-edge pixels is not less than the preset number;

[0024] Get the top N non-edge pixels that traverse a straight line in terms of the number of times they traverse the line;

[0025] If the difference between the value of one or two non-edge pixels and the value of the other non-edge pixels is greater than a preset value, and the value of the corresponding non-edge pixel is greater than a set threshold K, then the image to be detected is determined to be a fireworks image and reported to the management center.

[0026] If three or more non-edge pixels have values ​​greater than a set threshold K when passing through a straight line, then the number of times the non-edge pixels pass through the straight line is normalized to obtain a normalized image.

[0027] The normalized image is sent to the classifier for prediction;

[0028] When the image to be detected corresponding to the prediction result is a fireworks image, it is reported to the management center.

[0029] Preferably, before processing the image to be detected using the Sobel operator, the method further includes:

[0030] The target image is preprocessed using grayscale transformation, noise reduction, and binarization.

[0031] Preferably, after obtaining the number of times each non-edge pixel traverses the straight line, the method further includes:

[0032] Create an array to record the number of times each non-edge pixel crosses the line, and sort the counts in descending order.

[0033] To address the aforementioned problems, this application also provides a smoke detection system, which includes:

[0034] The first acquisition module is used to acquire the image to be detected and the corresponding edge pixels and non-edge pixels of the image to be detected.

[0035] The second acquisition module is used to acquire the straight line passing through the gradient direction of each edge pixel;

[0036] The third acquisition module is used to acquire the number of times each non-edge pixel point passes through the straight line;

[0037] The determination module is used to determine whether the image to be detected is a fireworks image based on the number of times each non-edge pixel crosses a straight line.

[0038] To address the aforementioned technical problems, this application also provides a smoke and fire detection device, including a memory for storing a computer program;

[0039] A processor is used to execute computer programs to implement the steps of the fire detection method described above.

[0040] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the smoke detection method described above.

[0041] This application provides a method for detecting fireworks. The method first acquires the image to be detected, along with its corresponding edge and non-edge pixels. Then, it acquires straight lines traversing the gradient directions of each edge pixel, and counts the number of times each non-edge pixel traverses these lines. Finally, it determines whether the image is a fireworks image based on the number of times each non-edge pixel traverses the lines. This method is a false positive filtering approach, using the image's edges to determine its type. It is unaffected by lighting or image color. The entire false positive filtering method, which uses information and features from a single frame for false positive filtering, is simpler than existing methods that extract features from multiple frames for comprehensive judgment. It does not affect the real-time performance of the overall detection process, further ensuring the accuracy of fireworks detection. Attached Figure Description

[0042] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 A flowchart of a method for detecting fireworks provided in this application;

[0044] Figure 2 The edge image of the non-smoke image in the embodiments of this application;

[0045] Figure 3 The edge image of the fireworks image in the embodiments of this application;

[0046] Figure 4 This is an edge gradient direction map of a non-smoke image under ideal conditions in the embodiments of this application;

[0047] Figure 5 This is an edge gradient direction map of a fireworks image under ideal conditions in the embodiments of this application;

[0048] Figure 6 This is an edge gradient direction map of a non-smoke image in the actual situation described in the embodiments of this application;

[0049] Figure 7 This is a normalized image of a non-smoke / firework image in the actual situation described in the embodiments of this application;

[0050] Figure 8 This is a normalized image of a non-smoke / firework image under ideal conditions in the embodiments of this application;

[0051] Figure 9 This is a normalized image of a fireworks picture under ideal conditions in the embodiments of this application;

[0052] Figure 10 This is a flowchart of non-smoke image processing in the embodiments of this application;

[0053] Figure 11 This is a flowchart of the fireworks image processing in the embodiments of this application;

[0054] Figure 12 This application provides an overall flowchart of a method for detecting fireworks.

[0055] Figure 13 A block diagram of a smoke detection system provided in another embodiment of this application;

[0056] Figure 14 This is a structural diagram of a smoke detection device provided in another embodiment of this application. Detailed Implementation

[0057] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0058] The core of this application is to provide a method, system, device, and medium for detecting smoke and fire.

[0059] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0060] Figure 1 A flowchart of a method for detecting fireworks provided in this application is shown below. Figure 1 As shown, the method includes:

[0061] S10: Obtain the image to be detected and the corresponding edge pixels and non-edge pixels of the image to be detected.

[0062] In a specific embodiment, the image to be detected can be acquired in real time, with the monitored video being transmitted to the MCU in real time, or it can be acquired periodically, with the image sent to the MCU after a period of monitoring. This application does not impose any limitations and users can configure it according to their needs.

[0063] The MCU extracts the images to be detected from the video to obtain the target image. After processing the target image, it obtains the image to be detected and its edge and non-edge pixels, thus obtaining the edge contour of the image to be detected. This is achieved through grayscale transformation, noise reduction, and binarization. Grayscale transformation ensures that the overall and local chroma and highlight levels in the grayscale image are consistent with those in the color image. Noise reduction preserves high-frequency information such as edges in the target image. Binarization highlights the features and edge contour information of the target image, facilitating the acquisition of edge pixels in the image to be detected.

[0064] In this process, the Sobel operator is used to calculate the pixel gradient of the image obtained after grayscale transformation, noise reduction, and binarization, thereby obtaining the image to be detected and its edge and non-edge pixels. This application does not limit the processing method; users can choose according to their needs.

[0065] A pixel refers to a small square that divides an image into.

[0066] In practice, this application does not limit the acquisition of edge pixels and non-edge pixels of the image to be detected, and users can choose the acquisition method according to their needs.

[0067] In a specific embodiment, the entire fireworks detection method is implemented using a deep network, which can be a YOLO-V4 network. This application does not limit the choice and users can select the appropriate network according to their needs.

[0068] This embodiment is a false detection filtering method for obtaining the image to be detected and performing subsequent processing. It filters out false detections of initially detected smoke targets to determine the type of the image to be detected.

[0069] It should be noted that the grayscale transformation, noise reduction, binarization, and pixel gradient calculation using the Sobel operator in this embodiment are only one implementation method and do not represent that this is the only implementation method. This application does not limit the implementation method and users can set it according to their own needs.

[0070] S11: Obtain the straight line passing through the gradient direction of each edge pixel.

[0071] In a specific embodiment, edge pixels are obtained in the above-mentioned image to be detected, and straight lines are drawn along the gradient direction for the edge pixels. Starting from an edge pixel, straight lines are drawn along the gradient direction, and all edge pixels in the image to be detected are traversed.

[0072] The pixel gradient can be calculated using the Sobel operator. This application does not impose any restrictions on this method, and users can set it themselves according to their needs.

[0073] The gradient represents the directional derivative of a function at a given point, where it reaches its maximum value along that direction. In other words, the function changes most rapidly and has the highest rate of change at that point along that direction. Specifically, the edge points in the image being detected represent the points where the function changes most rapidly in that direction.

[0074] S12: Get the number of times each non-edge pixel passes through the straight line.

[0075] In a specific embodiment, when non-edge pixels are obtained in the above embodiment, when an edge pixel moves along the gradient direction, the coordinates of the non-edge pixel are substituted into the equation of the straight line to determine whether the non-edge pixel has been passed by the straight line. The MCU needs to obtain the number of times the non-edge pixel has passed by the straight line. An accumulator counting method can be used to set a corresponding accumulator for the non-edge pixel. When it is determined that the non-edge pixel has been passed by the straight line, the accumulator count is incremented by one.

[0076] An array can be set to count and record the number of times each non-edge pixel passes through the straight line. This application does not impose any restrictions and users can set it themselves according to their needs.

[0077] This application does not limit the calculation method for the number of times, nor does it limit the accumulation method; users can choose according to their needs.

[0078] S13: Determine whether the image to be detected is a fireworks image based on the number of times each non-edge pixel crosses a straight line.

[0079] In a specific embodiment, after obtaining the number of times each non-edge pixel point passes through the straight line, the type of the image to be detected is determined based on the number of times, whether it is a fireworks image or a non-smoke image, i.e., a false detection image of streetlights or car lights.

[0080] This application does not limit the specific rules. The determination can be based on the sorting of the number of times non-edge pixels cross the line, or it can be based on comparing the number of times non-edge pixels cross the line with a certain value, and then determining the number of non-edge pixels whose number of times cross the line is greater than the certain value. This application is not limited and can be set according to the user's needs.

[0081] This application provides a method for detecting fireworks. The method first acquires the image to be detected, along with its corresponding edge and non-edge pixels. Then, it obtains straight lines drawn along the gradient direction of each edge pixel, and counts the number of times each non-edge pixel traverses these lines. Finally, it determines whether the image is a fireworks image based on the number of times each non-edge pixel traverses the lines. This method uses the image's edges to determine its type, is unaffected by lighting or color, and is simpler than existing methods that extract features from multiple frames for comprehensive judgment. It does not affect the real-time performance of the overall detection process, further ensuring the accuracy of fireworks detection.

[0082] Based on the above embodiments, as a preferred embodiment, obtaining the image to be detected and the corresponding edge pixels and non-edge pixels of the image to be detected includes:

[0083] Acquire video frames;

[0084] The target image to be detected is obtained from the video frame, and the target image is subjected to smoke and fire detection using a preset target detection network to obtain the image to be detected.

[0085] Edge detection is performed on the image to be detected to obtain the corresponding edge pixels and non-edge pixels.

[0086] In a specific embodiment, the monitoring system records video frames and transmits them to the MCU. The MCU obtains the target image to be detected in the video frame, preprocesses the target image, and then performs edge detection on the image to be detected to obtain the corresponding edge pixels and non-edge pixels.

[0087] In this embodiment, the image to be detected, along with its corresponding edge and non-edge pixels, is obtained by monitoring video frames and extracting the image to be detected from the video for processing. However, this acquisition method is only a preferred embodiment; users can choose their own acquisition method according to their needs, and this application does not impose any limitations.

[0088] The acquisition can be real-time or timed, acquiring video frames from the monitoring every ten minutes. This application does not impose any restrictions and users can choose according to their needs.

[0089] In a specific embodiment, the preset target detection network is implemented using a deep network, which can be a YOLO-V4 network. This application does not limit the choice and users can select the network according to their needs.

[0090] It should be noted that the monitoring mentioned in this embodiment is only one way to acquire video, and does not mean that this is the only way. Users can choose according to their needs.

[0091] It should be noted that edge pixels and non-edge pixels constitute the edge image.

[0092] In this embodiment, by acquiring video frames, then acquiring the target image to be detected in the video frames, and processing the target image, the image to be detected and the corresponding edge pixels and non-edge pixels are obtained. This embodiment improves the accuracy and speed of subsequent classification processing.

[0093] Based on the above embodiments, as a preferred embodiment, edge detection of the image to be detected includes:

[0094] The Sobel operator is used to process the image to be detected;

[0095] The non-maximum suppression method is used to obtain the edge points in the image to be detected;

[0096] A dual thresholding method is used to remove points in the edge points caused by noise or color changes, thus obtaining the edge pixels and non-edge pixels.

[0097] In a specific embodiment, such as Figure 2 , Figure 3 As shown, Figure 2 The edge image of the non-smoke image in the embodiments of this application is... Figure 3 This is the edge image of the fireworks image in this embodiment of the application; the Sobel operator is used to process the image to be detected, which can determine the magnitude and direction of the pixel gradient. The main function of the Sobel operator is edge detection. Using this operator, the gradient of each pixel in the horizontal direction and the gradient in the vertical direction can be obtained, and thus the magnitude and direction of the final gradient can be obtained.

[0098] This method employs non-maximum suppression. After obtaining the magnitude and direction of the gradients for all pixels, all non-edge points are removed. The decision rule is as follows: a 3x3 filter is used to move along the output (gradient magnitude and direction) from the previous step. If the point is a local maximum on the positive / negative gradient, it is retained; otherwise, it is suppressed (reset to zero). The decision rule in this embodiment is only one implementation method and does not represent the only possible implementation method. Users can customize the implementation according to their needs.

[0099] The process involves using a dual thresholding method to determine the edges. After completing the above steps, the target edge pixels have been obtained. However, some edge pixels may be caused by noise or color changes. To remove such edge pixels, a dual thresholding method is used to finally obtain the target edge.

[0100] The Sobel operator, nonmaximum suppression method, and dual threshold method in this embodiment are only preferred embodiments. This application does not limit them. Users can choose the image processing method according to their needs, as long as the above requirements are met.

[0101] In this embodiment, the Sobel operator is used to process the image to be detected, and the non-maximum suppression method is used to obtain the edge points in the image to be detected. The double threshold method is used to remove the points generated by noise or color changes in the edge points, so as to avoid misjudging the points generated by noise or color changes as edge points when obtaining edge pixels, which would cause misjudgment.

[0102] Based on the above embodiments, as a preferred embodiment, determining whether the image to be detected is a fireworks image based on the number of times each non-edge pixel crosses a straight line includes:

[0103] The number of non-edge pixels that cross a straight line more than a preset threshold is obtained.

[0104] If the number of non-edge pixels is less than the preset number, the image to be detected is determined to be a non-smoke image.

[0105] In a specific embodiment, since the number of times non-edge pixels cross a straight line is obtained in the above embodiment, if the number of non-edge pixels whose number of times cross a straight line is greater than a preset threshold is less than a preset number, and the number of times the non-edge pixels whose number of times cross a straight line is greater than the number of times other non-edge pixels cross a straight line is significantly greater, then the image to be detected is determined to be a non-smoke image, i.e., a false detection image.

[0106] like Figure 4 As shown, in an ideal scenario, after calculating the gradients of the three edge points B, C, and D of a regular circular image and drawing straight lines along the gradient direction, the gradients will converge at the center point A. According to the theorem that the perpendicular line to the tangent of a circle passes through the center, all pixels on the edge image will have their lines drawn along the gradient direction passing through point A. At this point, the number of times non-edge pixels at A pass through the line is at its maximum. Because the edge of the target image is infinitely close to a circle, the image to be detected can be considered a false positive, and thus a non-smoke image. However, as... Figure 5 As shown, when straight lines are drawn along the gradient direction at pixels A, D, and E at the edges of the fireworks image, the intersecting points B and C are relatively dispersed and do not converge at a single point. There is no phenomenon where a non-edge pixel passes through the straight line a particularly high number of times. This can be used to distinguish between fireworks detection targets and false detections of vehicle lights and streetlights.

[0107] The preset threshold and preset number in this embodiment are not limited by this application and can be set by the user according to their needs.

[0108] In this embodiment, the number of non-edge pixels that cross a straight line more than a preset threshold is determined. When the number of non-edge pixels that meet the condition is within the preset range, the image to be detected can be determined to be a non-smoke image, which is a false detection image.

[0109] Based on the above embodiments, as a preferred embodiment, determining whether the image to be detected is a fireworks image based on the number of times each non-edge pixel crosses a straight line further includes:

[0110] When the number of non-edge pixels is not less than the preset number;

[0111] Get the top N non-edge pixels that traverse a straight line in terms of the number of times they traverse the line;

[0112] If the difference between the value of one or two non-edge pixels and the value of the other non-edge pixels is greater than a preset value, and the value of the corresponding non-edge pixel is greater than a set threshold K, then the image to be detected is determined to be a fireworks image and reported to the management center.

[0113] If three or more non-edge pixels have values ​​greater than a set threshold K when passing through a straight line, then the number of times the non-edge pixels pass through the straight line is normalized to obtain a normalized image.

[0114] The normalized image is sent to the classifier for prediction;

[0115] When the image to be detected corresponding to the prediction result is a fireworks image, it is reported to the management center.

[0116] In a specific embodiment, the number of non-edge pixels that traverse a straight line more than a preset threshold was obtained in the above embodiment. However, due to image or structural reasons, the straight line in the gradient direction of edge pixels sometimes deviates from the true center of the circle. Sometimes the deviation even exceeds 30 degrees, which leads to a larger number of non-edge pixels near the center of the circle traversing the straight line, resulting in multiple cases with high values, such as... Figure 6 As shown, after drawing straight lines along the gradient, the intersections of points A, B, C, and D are relatively dispersed. When the number of times a non-edge pixel passes through the straight line is greater than a preset threshold and the number of non-edge pixels is not less than a preset number, the number of times the top N non-edge pixels pass through the straight line is obtained, where N is a positive integer. The number of times the non-edge pixels pass through the straight line is normalized to obtain a normalized image. The normalized image is sent to the classifier for prediction. When the image to be detected corresponding to the prediction result is a fireworks image, it is reported to the management center.

[0117] In this embodiment, the number of times each non-edge pixel traverses a straight line is counted can be determined using an accumulator. This accumulator facilitates obtaining the number of times each of the top N non-edge pixels traverses a straight line, and the pixels can be sorted according to their relative numbers. The accumulator and sorting methods described in this embodiment are only preferred implementations and are not limited by this application. Users can set them according to their needs. N is a positive integer and can be selected by the user.

[0118] Normalization refers to the process of performing a series of standard transformations on an image to convert it into a fixed standard form. This standard image is called a normalized image, such as... Figure 7 As shown, the number of times non-edge pixels pass through a straight line is normalized to obtain a normalized image. The height of each vertical line in the image represents the normalized size of a non-edge pixel after passing through the straight line. Figure 8 and Figure 9 As can be seen from the comparison, there is a clear difference in the height range and the number of obviously taller vertical lines in the image.

[0119] The classifier's main structure, as a preferred method, employs a ResNet18 network. Positive training samples are selected based on distinct features and clear edges, clearly distinguishable from false positives like vehicle lights and streetlights. Negative samples are typical false positives from vehicle lights and streetlights, generally selected based on smooth, clear edges, minimal halos, and high contrast between the streetlight and background. Normalized images of both classes are generated and fed into the classifier for training. The trained classifier then makes predictions. When the normalized image to be classified is fed into the classifier, the classifier predicts its value, yielding the final classification result. If the predicted image corresponds to a firework image, it is reported to the management center.

[0120] In this embodiment, normalizing the number of times non-edge pixels cross a straight line to obtain a normalized image is only a preferred embodiment, and the classifier obtains the image for easier detection. This application is not limited and can be configured according to user needs.

[0121] In this embodiment, a judgment is made on the case where the number of non-edge pixels is not less than a preset number, and the classifier comprehensive processing is added to reduce the false judgment rate.

[0122] Based on the above embodiments, as a preferred embodiment, before processing the image to be detected using the Sobel operator, the method further includes:

[0123] The target image is preprocessed using grayscale transformation, noise reduction, and binarization.

[0124] In a specific embodiment, video frames are first acquired, and then the target image to be detected within those frames is obtained. The target image is in color, and grayscale transformation, noise reduction, and binarization are applied to process it, resulting in an image containing the false detections themselves and a small amount of noise information, such as... Figure 10 and Figure 11 As shown, this facilitates subsequent processing and reduces computational load.

[0125] The grayscale transformation is one of the steps. First, the target image is processed by grayscale transformation, converting the original RGB image into a GRAY image. This step reduces the computational load for subsequent image processing, while ensuring that the overall and local chroma and highlight levels and characteristics in the grayscale image remain consistent with those in the color image, thus not affecting subsequent operations.

[0126] Noise Reduction Processing. After obtaining the grayscale image of the target image, noise reduction processing is required. This application uses Gaussian filtering for noise reduction. The image after Gaussian filtering can weaken the noise intensity of debris in false street light detections, while the edges of real street lights and vehicle lights are not significantly affected, preserving high-frequency information such as edges. Gaussian filtering is only one possible method and does not represent the only possible implementation method. Users can set their own methods according to their needs; this application does not impose any limitations.

[0127] Binarization processing. The target image after Gaussian filtering basically contains the streetlights and vehicle lights that were falsely detected, as well as other surrounding information. Since the falsely detected streetlights and vehicle lights are quite bright and have a high contrast with the surrounding environment, the target image is binarized to highlight the features and edge contour information.

[0128] In this embodiment, the streetlights, vehicle lights, etc., are all non-smoking.

[0129] The grayscale transformation, noise reduction, and binarization processing methods described in this embodiment are merely preferred embodiments. Users can choose the appropriate image processing method according to their needs, and this application does not impose any limitations.

[0130] In this embodiment, by performing grayscale transformation, noise reduction, and binarization on the target image, an image containing the false detection itself and a small amount of noise information is obtained, which reduces the false detection rate and improves the accuracy of the firework detection in this application.

[0131] Based on the above embodiments, as a preferred embodiment, after obtaining the number of times each non-edge pixel traverses the straight line, the method further includes:

[0132] Create an array to record the number of times each non-edge pixel crosses the line, and sort the counts in descending order.

[0133] In a specific embodiment, after obtaining the number of times each non-edge pixel passes through the straight line, a one-dimensional array is established to record the number of times, and the number of times is sorted in ascending order. This makes it easier to obtain the number of times the top N non-edge pixels pass through the straight line, and also makes it easier to obtain the number of non-edge pixels whose number of times they pass through the straight line is greater than a preset threshold.

[0134] The method of creating an array to record the number of times each non-edge pixel passes through the straight line and sorting the number of times in ascending order is only a preferred implementation method. Users can choose and set it themselves according to their needs. This application does not limit this method.

[0135] Based on the preferred embodiments described above, the method for detecting fireworks in this application includes: Figure 12 As shown;

[0136] S21: Acquire video frames.

[0137] S22: Obtain the target image to be detected in the video frame.

[0138] S23: Perform grayscale transformation, noise reduction, and binarization on the target image to obtain the image to be detected.

[0139] S24: Edge detection is performed on the image to be detected.

[0140] S25: Obtain target edge pixels and non-edge pixels.

[0141] S26: Obtain the straight line passing through the gradient direction of each edge pixel.

[0142] S27: Get the number of times each non-edge pixel passes through the straight line.

[0143] S28: Sort the number of times non-edge pixels cross the straight line.

[0144] S29: Determine whether the number of non-edge pixels that have passed through a straight line more than a preset threshold is less than a preset number.

[0145] S30: Normalized image.

[0146] S31: Classifier prediction.

[0147] S32: Output the classification results.

[0148] S24 and S25 include the steps described in the above embodiments: using the Sobel operator to determine the magnitude and direction of the pixel gradient in the target image, using the non-maximum suppression method to obtain the edge points in the target image, and using the double thresholding method to remove the points in the edge points that are generated by noise or color changes.

[0149] In the above embodiments, S10 includes steps S21, S22, S23, S24 and S25, S11 corresponds to S26, S12 corresponds to S27, and S13 includes steps S28, S29, S30, S31 and S32.

[0150] This application provides a method for detecting fireworks. The method first acquires the image to be detected, along with its corresponding edge and non-edge pixels. Then, it acquires straight lines traversing the gradient directions of each edge pixel, and counts the number of times each non-edge pixel traverses these lines. Finally, it determines whether the image is a fireworks image based on the number of times each non-edge pixel traverses the lines. This method uses the image's edges to determine its type, unaffected by lighting or color. Furthermore, this application offers real-time processing, enabling rapid judgment of each detected image. The proposed method, which combines threshold settings and classifier results to quickly identify false positives, can rapidly obtain results for different targets. Unlike other false positive classification schemes that require accumulating multiple frames for comprehensive analysis, this method significantly improves classification speed and reduces memory usage.

[0151] The above embodiments have described a method for detecting fireworks in detail. This application also provides embodiments of a device for detecting fireworks. It should be noted that this application describes the embodiments of the device from two perspectives: one is based on functional modules, and the other is based on hardware.

[0152] like Figure 13 As shown, a smoke detection system includes:

[0153] The first acquisition module 11 is used to acquire the image to be detected and the edge pixels and non-edge pixels corresponding to the image to be detected.

[0154] The second acquisition module 12 is used to acquire the straight line passing through the gradient direction of each edge pixel point;

[0155] The third acquisition module 13 is used to acquire the number of times each non-edge pixel point passes through the straight line;

[0156] The determination module 14 is used to determine whether the image to be detected is a fireworks image based on the number of times each non-edge pixel point passes through a straight line.

[0157] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.

[0158] Figure 14 A structural diagram of a smoke detection device provided in another embodiment of this application is shown below. Figure 14As shown, the smoke detection device includes: a memory 20 for storing computer programs;

[0159] The processor 21 is used to execute a computer program to implement the steps of the fire detection method mentioned in the above embodiments.

[0160] The smoke detection device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.

[0161] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.

[0162] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the fireworks detection method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc.

[0163] In some embodiments, the smoke detection device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0164] Those skilled in the art will understand that Figure 14 The structure shown does not constitute a limitation on the device for detecting smoke and fire, and may include more or fewer components than shown.

[0165] The smoke detection apparatus provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: a smoke detection method.

[0166] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.

[0167] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0168] The foregoing has provided a detailed description of a method, system, apparatus, and medium for detecting fireworks. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0169] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for detecting smoke and fire, characterized in that, include: Obtain the image to be detected, as well as the edge pixels and non-edge pixels corresponding to the image to be detected; Obtain a straight line passing through the gradient direction of each edge pixel; Obtain the number of times each of the non-edge pixels passes through the straight line; Whether the image to be detected is a fireworks image is determined based on the number of times each non-edge pixel passes through the straight line; The step of determining whether the image to be detected is a fireworks image based on the number of times each of the non-edge pixels passes through the straight line includes: The number of non-edge pixels that pass through the straight line more than a preset threshold is obtained. When the number is not less than a preset number, obtain the top N times that the non-edge pixels pass through the straight line. If the difference between the value of one or two non-edge pixels and the value of other non-edge pixels is greater than a preset value, and the value of the corresponding non-edge pixel is greater than a set threshold K, then the image to be detected is determined to be a fireworks image and reported to the management center. If three or more of the non-edge pixels have values ​​greater than the set threshold K when they pass through the straight line, the number of times the non-edge pixels pass through the straight line is normalized to obtain a normalized image; the normalized image is sent to a classifier for prediction; when the image to be detected corresponding to the prediction result is a fireworks image, it is reported to the management center.

2. The method for detecting fireworks according to claim 1, characterized in that, The step of obtaining the image to be detected and the corresponding edge pixels and non-edge pixels of the image to be detected includes: Acquire video frames; The target image to be detected is obtained from the video frame, and the target image is subjected to smoke and fire detection using a preset target detection network to obtain the image to be detected; Edge detection is performed on the image to be detected to obtain the corresponding edge pixels and non-edge pixels.

3. The method for detecting fireworks according to claim 2, characterized in that, The step of performing edge detection on the image to be detected includes: The image to be detected is processed using the Sobel operator; The edge points in the image to be detected are obtained by using the non-maximum suppression method; A dual thresholding method is used to remove points in the edge points that are caused by noise or color changes, resulting in edge pixels and non-edge pixels.

4. The method for detecting fireworks according to claim 1, characterized in that, The step of determining whether the image to be detected is a fireworks image based on the number of times each of the non-edge pixels passes through the straight line includes: When the number is less than the preset number, the image to be detected is determined to be a non-smoke image.

5. The method for detecting fireworks according to claim 4, characterized in that, After obtaining the number of times each of the non-edge pixels traverses the straight line, the method further includes: An array is created to record the number of times each non-edge pixel passes through the straight line, and the number of times is sorted in descending order.

6. The method for detecting fireworks according to claim 3, characterized in that, Before processing the image to be detected using the Sobel operator, the method further includes: The target image is preprocessed using grayscale transformation, noise reduction, and binarization.

7. A system for detecting smoke and fire, characterized in that, include: The first acquisition module is used to acquire the image to be detected and the edge pixels and non-edge pixels corresponding to the image to be detected. The second acquisition module is used to acquire a straight line passing through the gradient direction of each edge pixel point; The third acquisition module is used to acquire the number of times each of the non-edge pixels passes through the straight line; The determination module is used to determine whether the image to be detected is a fireworks image based on the number of times each of the non-edge pixels passes through the straight line; The determining module is specifically used to: obtain the number of non-edge pixels whose number of times they pass through the straight line is greater than a preset threshold; when the number is not less than the preset number, obtain the number of times the top N non-edge pixels pass through the straight line. If the difference between the value of one or two non-edge pixels and the value of other non-edge pixels is greater than a preset value, and the value of the corresponding non-edge pixel is greater than a set threshold K, then the image to be detected is determined to be a fireworks image and reported to the management center. If three or more of the non-edge pixels have values ​​greater than the set threshold K when they pass through the straight line, the number of times the non-edge pixels pass through the straight line is normalized to obtain a normalized image; the normalized image is sent to a classifier for prediction; when the image to be detected corresponding to the prediction result is a fireworks image, it is reported to the management center.

8. A device for detecting smoke and fire, characterized in that, Includes memory used to store computer programs; A processor, configured to implement the steps of the method for detecting fireworks as described in any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method for detecting fireworks as described in any one of claims 1 to 6.