An early fire detection and warning method and system
Through the real-time video frame background modeling of the camera and the yolo algorithm to initially locate the fire location, it solves the problem of the existing fire warning system issuing warnings only after the fire is large, achieving early fire detection and efficient positioning, and reducing the risk of false warnings and the amount of calculations. .
Patent Information
- Application Number
- CN202111660151.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing fire warning systems are based on temperature and smoke detection, and usually issue warnings only after the fire is large, resulting in high risks and easy false warnings. They also require a large amount of calculation and low efficiency.
Background modeling is performed through real-time video frames of the camera to obtain foreground information, initially locate the fire location, and use the yolo algorithm to reduce the detection area, reduce the amount of calculation, and improve the accuracy and efficiency of fire location.
It achieves early fire detection, improves the accuracy of fire location and detection efficiency, reduces the risk of false warnings, and improves the feasibility of fire control.
Smart Images

Figure CN114267149B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of fire protection technology, and in particular to an early fire detection and warning method and system. Background Art
[0002] At present, fire warnings in houses, factories, warehouses, etc. are based on temperature or smoke detectors to determine whether there is a fire. However, fire judgment based on temperature and smoke detectors is often not issued until the fire is large enough. This may cause the fire to be out of control before it is discovered, resulting in greater risks. In addition, fire judgment based on temperature and smoke detectors may lead to false warnings. Summary of the invention
[0003] One of the inventive purposes of the present invention is to provide an early fire detection and warning method and system. The method and system obtain real-time video frames from a camera, perform background modeling on the real-time video frames, and determine the location information of the fire based on the results of the background modeling, thereby achieving rapid warning in the early stages of a fire.
[0004] Another inventive object of the present invention is to provide an early fire detection and warning method and system, which compares the background image generated by background modeling with the video frame collected in real time by the camera to obtain foreground information, and initially locates the fire according to the color of the foreground information. After obtaining the initial positioning result, it is input into the fire detection algorithm to obtain the final fire location, thereby improving the accuracy of fire positioning.
[0005] Another object of the present invention is to provide an early fire detection and warning method and system, which adopts the YOLO algorithm as a fire detection algorithm, and reduces the detection area for re-detection and positioning based on the initial positioning, thereby reducing the calculation amount of the fire detection algorithm, improving the detection efficiency and also improving the positioning accuracy.
[0006] In order to achieve at least one of the above-mentioned invention objects, the present invention further provides an early fire detection and warning method, the method comprising the following steps:
[0007] Obtain real-time video frames of the scene and perform background modeling based on the video frames;
[0008] Obtain background information of a fixed area of a video frame, and compare the background image with the real-time video frame to obtain foreground information of the video frame;
[0009] Extracting fire source information from the video frame according to the foreground information, and initially locating the fire source information;
[0010] The results of the initial positioning are input into the fire source detection algorithm to determine whether there is a real fire source.
[0011] According to one of the preferred embodiments of the present invention, the background modeling method includes: comparing fixed position pixels of a video frame with other multiple video frames under the same video stream, obtaining the number of identical pixels after comparison, setting a pixel number threshold, and if the number of identical pixels after comparison is greater than the similarity number threshold, using the pixel as a background pixel to construct background information of the shooting scene.
[0012] According to another preferred embodiment of the present invention, the method for obtaining image background information includes: splitting a video frame into three RGB channels, traversing the video frame pixel values, and using the absolute value of the difference between the background image pixel and the corresponding video frame grayscale image pixel value as a basis for judging the background information, wherein an absolute value threshold is set, and pixels with an absolute value of the difference less than the absolute value threshold are set as background pixel values to generate a binary threshold map.
[0013] According to another preferred embodiment of the present invention, the method for obtaining image foreground information includes: splitting a video frame into three RGB channels, traversing the video frame pixel values, and using the absolute value of the difference between the background image pixel and the video frame pixel as a basis for judging the foreground information, wherein an absolute value threshold is set, and the pixel of the absolute value of the difference of the absolute value threshold is set as the foreground pixel value, and a binary threshold map is generated.
[0014] According to another preferred embodiment of the present invention, the method for obtaining image foreground information also includes: updating the background pixel value with a preset probability, and calculating the difference between the updated background image pixel and the video frame pixel, judging whether the updated pixel is still a foreground pixel value based on the difference, setting a continuous foreground pixel detection threshold, and when a pixel is judged to be a foreground pixel after being updated n times in a row, the foreground pixel value is changed to a background pixel value, wherein n is greater than the continuous foreground pixel detection threshold.
[0015] According to another preferred embodiment of the present invention, after the foreground information is generated or updated, the edge value of each foreground pixel point in the video frame is calculated, the foreground pixel points that meet the fire source color and motion are processed with a mask image, and the background pixel points around the foreground pixel points are changed to foreground pixel values.
[0016] According to another preferred embodiment of the present invention, the pixels that meet the color and motion requirements of the fire source are updated and stored in two images respectively, one of which contains dynamic information of the fire source and the other filters out redundant pixels.
[0017] According to another preferred embodiment of the present invention, the initial positioning method also includes: performing contour extraction on the two saved images, wherein useless contours in the two images are respectively screened out, and contour areas after the fire source information in the two images are screened out are respectively compared with their respective binary threshold maps for ROI areas, and overlapping contour areas are each set as an area, and further the areas set in the two images are respectively compared for ROI areas to obtain the final fire source initial positioning position information.
[0018] In order to achieve at least one of the above-mentioned objects, the present invention further provides an early fire detection and warning system, wherein the system executes the early fire detection and warning method.
[0019] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the above-mentioned early fire detection and warning method. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 Shown is a schematic flow chart of an early fire detection and warning method of the present invention.
[0021] Figure 2 Shown is a schematic diagram of the original image of an early fire in the present invention.
[0022] Figure 3 Shown is a prospective image of early fire screening in accordance with the present invention.
[0023] Figure 4 What is shown is the initial location diagram of the fire source of the early stage fire in the present invention.
[0024] Figure 5 What is shown is the initial location diagram of the fire source of the early stage fire in the present invention.
[0025] Figure 6 What is shown is the optimized effect diagram of the early stage fire in the present invention.
[0026] Figure 7 What is shown is a final effect diagram of the detection of the present invention. DETAILED DESCRIPTION
[0027] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art can think of other obvious variations. The basic principles of the present invention defined in the following description can be applied to other embodiments, variations, improvements, equivalents, and other technical solutions that do not deviate from the spirit and scope of the present invention.
[0028] It is to be understood that the term "one" should be understood as "at least one" or "one or more", that is, in one embodiment, the number of an element may be one, while in another embodiment, the number of the element may be multiple, and the term "one" should not be understood as a limitation on the quantity.
[0029] Please combine Figure 1-Figure 7 The present invention discloses an early fire detection and warning method and system, wherein the method mainly includes the following steps: first, a real-time video of a scene needs to be captured by a camera in real time to obtain real-time video frames, and background modeling is performed based on the real-time video frames. After the background modeling is completed, foreground information is obtained based on the background image, and fire source information is extracted based on the color of the fire source. In the present invention, dynamic information and color information of the fire source are further extracted for initial positioning. After the initial positioning is completed, the fire source image is input into the fire source detection algorithm to further determine whether there is fire source information and feedback it to the client.
[0030] Specifically, the method of background modeling includes: selecting a video frame and multiple video frames under the same video stream to compare pixel values, wherein it is necessary to determine the number of times that the pixel values of the same fixed position pixel in multiple video frames are the same. The present invention sets a pixel count threshold. If the number of times the pixel values are the same is greater than the set pixel count threshold, the pixel at the fixed position is determined to be a background pixel, and all background pixels at corresponding positions based on the scene are combined to form the background image.
[0031] After completing the modeling of the background image of the video stream, the video is further split into three channels of RGB (red, green and blue). By traversing the pixel values of each video frame image, the pixel values in the background image and the corresponding video frame grayscale image pixel values are subtracted to obtain the absolute value. The present invention sets an absolute value threshold. When the absolute value obtained by subtracting the pixel values in the background image and the corresponding video frame grayscale image pixel values is less than the absolute value threshold, the corresponding pixel point is changed to the background pixel value 0. It is worth mentioning that if a pixel point is a background pixel, it has a probability of 1 / defaultSubsamplingFactor (default downsampling coefficient) to update its own model sample value (pixel value), and also has a probability of 1 / defaultSubsamplingFactor (default downsampling coefficient) to update the model sample value of its neighboring points. When the updated pixel value does not meet the constraint of the absolute value threshold on the background pixel value, the pixel value is changed to the foreground pixel value 225. It is worth mentioning that each time a pixel in a video frame is updated, it is necessary to check whether the updated pixel is a background pixel or a foreground pixel. Since there may be fixed-frequency moving devices in the video, such as alarm clocks, electric fans and other devices, in multiple detection results, if the pixel position is in the moving electric fan and alarm clock position area, a foreground pixel will be detected. However, in fact, these fixed motion changing areas should be attributed to background pixels. Therefore, the present invention further sets a continuous foreground pixel detection threshold. When the number of times a pixel is continuously detected as a foreground pixel is greater than the continuous foreground pixel detection threshold, the foreground pixel 255 is changed to a background pixel value of 0. The foreground information is obtained from the background image in the above manner, and a binary threshold map of the fire source area is further obtained based on the split RGB (red, green and blue) three channels (such as Figure 3 as shown).
[0032] After obtaining the binary threshold map of the fire source area, the fire source area needs to be optimized. The optimization method includes: obtaining foreground information and background information, calculating the adjacent value of each foreground pixel point, and judging whether the adjacent value of the foreground pixel point is a foreground pixel point, wherein the adjacent value is the value of the adjacent pixels around the pixel point, and if the foreground pixel point is surrounded by background pixels, then the background pixel point is changed to a foreground pixel point (such as Figure 4 The present invention selects a satisfying area according to the fire source color and motion information for mask processing, and changes the background pixels around each foreground pixel in the satisfying area to foreground pixels, thereby realizing the expansion operation of the area satisfying the fire source color and motion information.
[0033] Furthermore, after traversing the video frames and completing the selection of flame color and motion information, we update the pixels in the satisfying area and store them in two photos. In one of the photos, we compare the pixels of the previous video frame with the pixels of the next video frame to determine the motion trajectory of the pixels and perform expansion operations on the information determined as motion status (such as Figure 4 ), so that we can save the flame dynamic information. After completing the saving of the flame dynamic information, we can directly locate and save the flame information based on the color (such as Figure 5 ). After completing the screening process of the fire source area, the present invention further locates the fire source area, and the positioning operation includes the following steps: obtaining two images after the above-mentioned processing optimization, wherein the saved image that directly extracts the flame based on the color is defined as a, and the image that saves the dynamic information of the fire source is defined as b, firstly performing contour extraction on the b image, and comparing the contour extracted from the a image to screen out useless contours. The contours after screening are compared with the ROI area, and the contour area of the repeated position is set as one area to obtain an area of the a image (there may be multiple areas). After completing the processing of the a image, the b image is further subjected to contour extraction, and the contours extracted from the b image are compared and screened out useless contours. The filtered contours are compared with the ROI area, and the contour area of the repeated position is set as one area (there may be multiple areas) to obtain an area of the b image. Further, the area selected by the a and the area selected by the b are compared with the ROI area to screen out the common area of the a and b images, and the common area of the a and b images is used as the final selected initial positioning area (such as Figure 6 ).
[0034] After the initial positioning of the fire source area is completed, the fire source area after the initial positioning is input into the trained fire source detection algorithm for identification (such as Figure 7 ), the fire source detection algorithm described in the present invention preferably uses the yolo algorithm, adopts Darknet53 as the backbone network, uses 50,000 data for training to obtain the final model, and converts the type of the yolo model through TensorRT to reduce the size of the bytes, so that it can be used on the GPU, and optimizes and accelerates it in this way. Originally, one frame took 1 second to process, but after being accelerated by TensorRT, it can achieve real-time detection in 0.5 milliseconds per frame. Combined with the above method, the detection area we obtain will be greatly reduced, because the motion state is added when the fire source is initially located, so it not only reduces the detection area but also improves the accuracy of the secondary detection of the fire source.
[0035] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part, and / or installed from a removable medium. When the computer program is executed by the central processing unit (CPU), the above-mentioned functions defined in the method of the present application are executed. It should be noted that the above-mentioned computer-readable medium of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of an electrical, magnetic, optical, electromagnetic, infrared segment, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more wire segments, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, electrical wire, optical cable, RF, etc., or any suitable combination of the foregoing.
[0036] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0037] Those skilled in the art should understand that the embodiments of the present invention described above and shown in the accompanying drawings are only examples and do not limit the present invention. The objectives of the present invention have been fully and effectively achieved. The functional and structural principles of the present invention have been demonstrated and explained in the embodiments. Without departing from the principles, the implementation methods of the present invention may be deformed or modified in any way.
Claims
1. An early fire detection and warning method, characterized in that: The method comprises the following steps: Acquire a real-time video frame of the scene, and perform background modeling based on the video frame. The background modeling method includes: comparing pixels at fixed positions of a video frame with pixels of other multiple video frames under the same video stream, obtaining the number of identical pixels after comparison, setting a pixel number threshold, and if the number of identical pixels after comparison is greater than the pixel number threshold, using the pixel as a background pixel to construct background information of the shooting scene; Obtain background information of a fixed area of a video frame, and compare the background image with the real-time video frame to obtain foreground information of the video frame; Extracting fire source information from the video frame according to the foreground information, and performing preliminary positioning of the fire source information, wherein the preliminary positioning of the fire source information specifically includes: updating pixel points that meet the color and motion of the fire source, and saving them in two images respectively, wherein one image contains dynamic information of the fire source, and the other image filters redundant pixel points, performing contour extraction on the two saved images, filtering out useless contours in the two images respectively, and comparing the contour areas after the fire source information in the two images is filtered with their respective binary threshold maps for ROI areas, setting the overlapping contour areas as one area respectively, and further comparing the ROI areas of the areas set in the two images respectively to obtain the final preliminary positioning position information of the fire source; The results of the initial positioning are input into the fire source detection algorithm to determine whether there is a real fire source; The method for obtaining background information includes: splitting a video frame into three RGB channels, traversing the pixel values of the video frame, and using the absolute value of the difference between the background image pixel and the video frame pixel or the corresponding video frame grayscale image pixel as a basis for judging the background information, wherein an absolute value threshold is set, and pixels with an absolute value of the difference less than the absolute value threshold are set as background pixel values to generate a binary threshold map.
2. An early fire detection and warning method according to claim 1, characterized in that: The method for obtaining foreground information also includes: updating the background pixel value with a preset probability, and calculating the difference between the updated background image pixel and the video frame pixel, judging whether the updated pixel is still a foreground pixel value according to the difference, setting a continuous foreground pixel detection threshold, and when the pixel is judged to be a foreground pixel after n consecutive updates, the foreground pixel value is changed to a background pixel value, wherein n is greater than the continuous foreground pixel detection threshold.
3. An early fire detection and warning method according to claim 2, characterized in that: After the foreground information is generated or updated, the edge value of each foreground pixel in the video frame is calculated, the foreground pixels that meet the fire source color and motion are processed with a mask image, and the background pixels around the foreground pixels are changed to foreground pixel values.
4. An early fire detection and warning system, characterized in that: The system executes an early fire detection and warning method as described in any one of claims 1-3.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement an early fire detection and warning method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Flame video recognition method and fire hazard monitoring method and system
CN101441712A
Video image processing-based fire detection system and detection method
CN105788142A
Daylight fire disaster video detection method
CN105976398A
Image processing method and image processing device
CN106251358A
Kinect-based image matting method
CN107133964A
