Accumulated water detection method and device, electronic equipment, storage medium and program product
By combining target detection and saliency detection to screen and verify water accumulation areas in video frames, the problem of low water accumulation detection accuracy in the existing technology is solved, and higher detection accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202410876649.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-10-01
AI Technical Summary
Existing water accumulation detection technology has high costs and unbalanced target detection performance during data collection and preprocessing. It is especially difficult to detect when the target is occluded or the scale changes, resulting in low accuracy.
Combining target detection and saliency detection, through video frame splitting and overlap matching count updates, accurate water accumulation areas are screened out to avoid interference from highly salient moving objects and improve detection accuracy.
It improves the accuracy and robustness of water accumulation detection, reduces false alarms and false negatives, and is suitable for water accumulation monitoring in different scenarios.
Smart Images

Figure CN118736413A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of water accumulation detection, and in particular to a water accumulation detection method, device, electronic device, storage medium and program product. Background Art
[0002] Due to the concern about natural disasters and urban waterlogging, waterlogging detection technology has gradually gained people's attention. Road surfaces, rivers, sewers and other places in cities are easily affected by waterlogging during heavy rain or floods, which harms the travel of vehicles and pedestrians, causing traffic jams, traffic safety hazards and other problems. In order to detect and respond to these situations in a timely manner, waterlogging detection technology has been developed to achieve real-time monitoring and early warning of urban waterlogging.
[0003] The existing technology usually uses deep visual neural network target detection methods to detect waterlogging scenes. However, since waterlogging does not have fixed shape features and unique texture features, the target detection method needs to spend a lot of cost to screen waterlogging pictures of different shapes and states during data collection and preprocessing. In some scenarios, the imbalance in the number of target categories will also cause the target detection method to have poor detection performance for a certain category. In addition, when the target is blocked by other objects or the scale of the target changes, the target detection method has difficulty in detection.
[0004] Therefore, there is an urgent need for a method to improve the accuracy of water accumulation detection. Summary of the invention
[0005] The embodiments of the present application provide a water accumulation detection method, device, electronic device, storage medium and program product to achieve the effect of improving the accuracy of water accumulation detection.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting water accumulation, comprising:
[0007] Splitting the target video according to a preset period to obtain a plurality of video frames, performing target detection and saliency detection on each video frame to obtain a plurality of detection results, each of the detection results comprising at least one detection bounding box obtained by performing target detection on the video frame and at least one saliency segmentation region obtained by performing saliency detection;
[0008] For each detection bounding box in each group of detection results, when the overlap between the detection bounding box and the at least one significant segmented area reaches a preset threshold, the detection bounding box is used as a candidate water accumulation area;
[0009] Acquire a reference waterlogging region located at the same position as the candidate waterlogging region in the video frame in a reference frame, and update a matching count of the candidate waterlogging region according to a matching result between the candidate waterlogging region and the reference waterlogging region at the same position, wherein the reference frame is a previous video frame of the video frame;
[0010] The candidate water accumulation area corresponding to the matching count reaching the preset threshold is used as the water accumulation area, and the water accumulation detection result is output.
[0011] In a possible implementation, target detection and saliency detection are performed on each video frame to obtain multiple detection results, including:
[0012] Inputting the video frame into an object detection model to obtain at least one detection bounding box;
[0013] Inputting the video frame into a saliency detection model, wherein the saliency detection model is used to divide the video frame into regions to obtain at least one candidate region;
[0014] A characteristic contrast of each candidate region is acquired respectively, and at least one significant segmentation region is obtained in the candidate region according to the characteristic contrast, wherein the characteristic contrast includes color contrast and space contrast.
[0015] In a possible implementation manner, respectively acquiring a feature contrast of each candidate region, and obtaining at least one significant segmentation region in the candidate region according to the feature contrast, includes:
[0016] quantizing the color space of each candidate area to obtain the main color tone of the color space;
[0017] According to the main color tone, a color contrast of the candidate area is obtained, where the color contrast is a weighted sum of the color space distances between each main color tone in the candidate area and each main color tone in other candidate areas;
[0018] Obtaining a saliency value of the candidate region according to the color contrast and spatial contrast of the candidate region, wherein the spatial contrast is a weighted sum of spatial distances between the candidate region and other candidate regions;
[0019] Each candidate region is segmented according to the significance value of each candidate region to obtain at least one significant segmented region.
[0020] In a possible implementation manner, segmenting each candidate region according to the significance value of each candidate region to obtain at least one significant segmented region includes:
[0021] Performing edge detection on the candidate region according to the saliency value to determine a segmentation boundary of the candidate region;
[0022] According to the adaptive threshold segmentation method and the segmentation boundary, the candidate area is segmented into a significant area and a non-significant area;
[0023] The salient region in each candidate region is used as the salient segmentation region to obtain at least one salient segmentation region.
[0024] In a possible implementation, for each detection bounding box in each group of detection results, when the overlap between the detection bounding box and the at least one significant segmentation region reaches a preset threshold, using the detection bounding box as a candidate water accumulation region includes:
[0025] For each detection boundary box in each group of detection results, respectively obtain the significant pixels in each of the significant segmentation areas, and determine whether the proportion of the significant pixels to the pixels in the detection boundary box exceeds a preset threshold;
[0026] If yes, construct a connected area based on the significant pixels, and determine whether the intersection-over-union ratio of the detection bounding box and the connected area is greater than a preset threshold;
[0027] If so, the detected bounding box is used as a candidate water accumulation area.
[0028] In a possible implementation manner, updating the matching count of the candidate waterlogging area according to the matching result of the candidate waterlogging area and the reference waterlogging area at the same position includes:
[0029] Determine whether the video frame is the first frame, and if so, record the candidate waterlogging area and the matching count corresponding to the video frame in a historical detection queue, and use the video frame as a reference frame and the candidate waterlogging area as the reference waterlogging area;
[0030] If not, reading the reference water accumulation area corresponding to the reference frame from the historical detection queue, and determining whether an intersection-and-union ratio of the candidate water accumulation area of the reference frame and the reference water accumulation area of the video frame at the same position is greater than a preset threshold;
[0031] If so, the value of the matching count of the video frame is increased by one, the video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as the reference water accumulation area, and the reference water accumulation area and the matching count are recorded in a historical detection queue.
[0032] In a possible implementation manner, if an intersection-over-union ratio of the reference water accumulation region of the reference frame and the candidate water accumulation region of the video frame at the same position is less than the preset threshold;
[0033] Initializing the value of the match count of the video frame to one;
[0034] The video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as the reference water accumulation area, and the reference water accumulation area and the matching count are recorded in a historical detection queue.
[0035] In a possible implementation manner, the step of taking the candidate water accumulation area corresponding to the matching count reaching a preset threshold as the water accumulation area and outputting the water accumulation detection result includes:
[0036] Determine whether the value of the matching count of the video frame exceeds a preset threshold value, and if so, use the candidate water accumulation area corresponding to the video frame as the water accumulation area, and output the water accumulation detection result;
[0037] If not, the matching step is continued until the video frame outputs a water accumulation detection result.
[0038] In a second aspect, an embodiment of the present application provides a water accumulation detection device, comprising:
[0039] an acquisition module, configured to split the target video into multiple video frames according to a preset period, perform target detection and saliency detection on each video frame, and obtain multiple detection results, each of which includes at least one detection bounding box obtained by performing target detection on the video frame and at least one saliency segmentation region obtained by performing saliency detection;
[0040] a processing module, configured to, for each detection bounding box in each group of detection results, use the detection bounding box as a candidate water accumulation area when the overlap between the at least one significant segmentation area and the detection bounding box reaches a preset threshold;
[0041] The processing module is further used to obtain, in a reference frame, a reference waterlogging region located at the same position as the candidate waterlogging region in the video frame, and update a matching count of the candidate waterlogging region according to a matching result between the candidate waterlogging region and the reference waterlogging region at the same position, wherein the reference frame is a previous video frame of the video frame;
[0042] The control module is used to take the candidate water accumulation area corresponding to the matching count reaching a preset threshold as the water accumulation area and output the water accumulation detection result.
[0043] In a third aspect, an embodiment of the present application provides a water accumulation detection device, comprising: a memory, and a memory communicatively connected to the processor;
[0044] The memory stores computer-executable instructions;
[0045] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0047] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0048] The water accumulation detection method, device, electronic device, storage medium and program product provided in the embodiments of the present application combine target detection with saliency detection, process the same video frame separately, obtain at least one detection bounding box and at least one saliency segmentation area, and then for each detection bounding box, cross-validate it with each saliency segmentation area to obtain a detection bounding box that satisfies the overlap condition, and then use the detection bounding box as an alternative water accumulation area. Then, by verifying the overlap between the alternative water accumulation area in the current video frame and the reference water accumulation area in the reference frame, update the matching count of the alternative water accumulation area, and finally use the alternative water accumulation area corresponding to the matching count that reaches a preset threshold as the water accumulation area. By performing target detection and saliency detection on the same video frame separately, the saliency detection can integrate the underlying features that are easily lost in target detection with the target detection results, and can cross-validate through the two results, so as to screen out more accurate water accumulation areas. By continuously verifying the similarity between the current frame and the reference frame at the same position, the alternative water accumulation area at the corresponding position in the current frame can be used as the water accumulation area only when the similarity between the current frame and the reference frame at the same position does not change significantly, that is, when the matching count of the alternative water accumulation area and the reference water accumulation area at the same position reaches a preset threshold, thereby avoiding the interference of highly significant moving objects on the detection results, thereby achieving the effect of improving the accuracy of water accumulation detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0050] Figure 1 System architecture diagram provided for this application;
[0051] Figure 2 Schematic diagram of the process of water accumulation detection method provided in this application Figure 1 ;
[0052] Figure 3 Schematic diagram of the process of water accumulation detection method provided in this application Figure 2 ;
[0053] Figure 4 Schematic diagram of the process of water accumulation detection method provided in this application Figure 3 ;
[0054] Figure 5 Schematic diagram of the process of water accumulation detection method provided in this application Figure 4 ;
[0055] Figure 6 A schematic diagram of the structure of the water accumulation detection device provided in this application;
[0056] Figure 7 This is a schematic diagram of the structure of the water accumulation detection equipment provided in this application.
[0057] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0059] Figure 1 The system architecture diagram provided for this application is as follows: Figure 1As shown, the system of the present application includes a recording end 103, a water accumulation detection system 101 and a client 102. The water accumulation detection system 101 of the present application includes a control module, an acquisition module and a processing module. Among them, the recording end 103 can be a device for capturing, recording or taking images and videos. Specific devices may include but are not limited to the following: camera, smart phone, webcam, dash cam, drone, surveillance camera, action camera, virtual reality device. The acquisition module in the water accumulation detection system 101 can obtain the target video recorded by the recording end 103 and process the target video. That is, the target video is split according to a preset period to obtain multiple video frames. Then, target detection and significance detection can be performed for each video frame respectively to obtain multiple detection results. The processing module in the water accumulation detection system 101 can obtain the candidate water accumulation area according to the detection result, and then verify the candidate water accumulation area and update the matching count of the candidate water accumulation area. The control module in the waterlogging detection system 101 can determine whether the candidate waterlogging area is a waterlogging area according to the matching count of the candidate waterlogging area. That is, the control module can take the candidate waterlogging area corresponding to the matching count reaching the preset threshold as the waterlogging area, and output the waterlogging detection result to the client 102.
[0060] The specific application scenario of this application can be urban waterlogging detection. The system provided by this application can monitor the waterlogging in urban roads, tunnels, underground parking lots and other places, and can promptly discover and deal with the waterlogging problem. The specific application scenario of this application can also be industrial plant flooding detection. The system provided by this application can detect flooding in industrial production sites or warehouses to prevent damage to equipment and goods caused by flooding. The specific application scenario of this application can also be farmland and dam monitoring. The system provided by this application can monitor the waterlogging in farmland or water conservancy projects, and take timely measures. The specific application scenario of this application can also be underground pipeline waterlogging detection. The system provided by this application can monitor the waterlogging in underground pipelines or basements to ensure the normal operation of municipal engineering.
[0061] In combination with the above scenarios, it can be seen that in the prior art, detecting and identifying water accumulation only through target detection results in an imbalance in the number of target categories, which makes the target detection method have poor detection performance for a certain category, thereby leading to a technical problem of low accuracy in water accumulation detection.
[0062] The water accumulation detection method provided by the present application combines target detection with saliency detection, processes the same video frame separately, and obtains at least one detection boundary box and at least one saliency segmentation area. The saliency detection can integrate the underlying features that are easily lost in target detection with the target detection results, and by cross-validating the two results, a more accurate water accumulation area can be screened out. By continuously verifying the similarity between the current frame and the reference frame at the same position, only when the similarity between the current frame and the reference frame at the same position does not change significantly, that is, when the matching count of the candidate water accumulation area and the reference water accumulation area at the same position reaches a preset threshold, the candidate water accumulation area at the corresponding position in the current frame can be used as the water accumulation area, thereby avoiding the interference of highly significant moving objects on the detection results, thereby achieving the effect of improving the accuracy of water accumulation detection.
[0063] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0064] Figure 2 Schematic diagram of the process of water accumulation detection method provided in this application Figure 1 ,like Figure 2 As shown, the method includes:
[0065] S201. Split a target video into multiple video frames according to a preset period, perform target detection and saliency detection on each video frame, and obtain multiple detection results, each detection result including at least one detection bounding box obtained by performing target detection on the video frame and at least one saliency segmentation region obtained by performing saliency detection.
[0066] Specifically, the target video can be a video recorded by the recording end obtained by the water accumulation detection system provided by the present application. Performing target detection and saliency detection on each video frame respectively to obtain multiple detection results means inputting the video frame into the target detection model and the saliency detection model respectively, thereby obtaining at least one detection bounding box and at least one saliency segmentation area. Optionally, the target detection model can be a target detection model based on deep learning. For example, DETR (Detection Transformer), SSD (Single Shot MultiBox Detector), etc. The target detection model can extract feature representations in the image through a convolutional neural network, and then predict the position and size of the target frame from the extracted features through the network layer used to regress the position and size of the target frame in the target detection model. The generated target frame is screened and optimized to eliminate overlapping frames and retain the most confident target frame. Finally, the final detection frame is output according to the position and size of the target frame predicted by the target detection model and the category information. The saliency detection model can extract color contrast features and spatial contrast features from the video frame, extract the video frame according to the color contrast features and spatial contrast features, and then obtain a saliency map. Then extract the salient regions from the saliency map. Usually, the regions in the saliency map that are higher than the threshold are marked as salient regions according to a preset threshold. The salient regions can include candidate waterlogging regions. Finally, further analyze the salient regions to identify the regions that may be waterlogging and use them as salient segmentation regions.
[0067] In a possible design, the preset period can be 2s. Furthermore, the water accumulation detection system splits the target video into 2s periods to obtain multiple video frames, thereby forming a new video frame sequence. For example, the frame rate of the input target video is 30 frames per second, and the preset period is 2s. The water accumulation detection system extracts a video frame every 60 frames to obtain a new video frame sequence.
[0068] S202: for each detection bounding box in each group of detection results, if the overlap between the detection bounding box and at least one significant segmented region reaches a preset threshold, use the detection bounding box as a candidate water accumulation region.
[0069] Specifically, the case where the overlap reaches the preset threshold can include that the proportion of the significant pixels in each significant segmentation region to the pixels in the detection boundary box exceeds 50%. The case where the overlap reaches the preset threshold can also include that the intersection and union ratio of the connected area formed by the significant pixels in each significant segmentation region and the detection boundary box is greater than another preset threshold. Optionally, the other preset threshold can be 0.5.
[0070] Intersection over Union (IoU) is an indicator used to measure the degree of overlap between two regions or objects. It calculates the ratio of the intersection area to the union area. The specific calculation formula is: IoU = intersection area / union area. The larger the IoU, the higher the degree of overlap between the two regions. In tasks such as object detection, IoU is often used to confirm the accuracy and overlap of detection results. It usually judges the overlap and degree of association between two regions based on a set threshold.
[0071] S203, obtaining a reference water accumulation area in the reference frame that is located at the same position as the candidate water accumulation area in the video frame, and updating the matching count of the candidate water accumulation area according to the matching results of the candidate water accumulation area and the reference water accumulation area at the same position, wherein the reference frame is a previous video frame of the video frame.
[0072] Specifically, obtaining the matching result of the candidate water accumulation area and the reference water accumulation area at the same position can be used to determine whether the intersection-and-union ratio between the candidate water accumulation area and the reference water accumulation area is greater than a preset threshold. If the intersection-and-union ratio between the candidate water accumulation area and the reference water accumulation area in the video frame and the reference frame is greater than the preset threshold, it is considered that the current target has not moved. Further, the matching result can be reflected by the matching count. If the intersection-and-union ratio of the candidate water accumulation area and the reference water accumulation area in the video frame and the reference frame is greater than the preset threshold, the value of the matching count corresponding to the video frame is increased by one. If the intersection-and-union ratio of the candidate water accumulation area and the reference water accumulation area in the video frame and the reference frame is less than the preset threshold, the value of the matching count corresponding to the video frame is initialized to one.
[0073] S204: taking the candidate water accumulation area corresponding to the matching count reaching the preset threshold as the water accumulation area, and outputting the water accumulation detection result.
[0074] In one possible design, the preset threshold of the matching count can be 3. Further, after updating the matching count corresponding to the video frame, the water accumulation detection system can determine whether the matching count value of the candidate water accumulation area of the video frame reaches 3. In the case where the matching count of the video frame is greater than or equal to 3, the water accumulation detection system can use the candidate water accumulation area with a matching count greater than or equal to 3 in the current video frame as the water accumulation area and output the water accumulation detection result. In the case where the matching count of the video frame does not exceed 3, the water accumulation detection system can use the video frame as a reference frame, the candidate water accumulation area of the video frame as a reference water accumulation area, and record the reference water accumulation area and the matching count in the historical detection queue.
[0075] The water accumulation detection method provided by the embodiment of the present application combines target detection with saliency detection, and processes the same video frame respectively to obtain at least one detection boundary box and at least one saliency segmentation area. The underlying features that are easily lost in target detection are integrated with the target detection results through saliency detection, and a more accurate water accumulation area can be screened out by cross-validating the two results. By continuously verifying the similarity between the current frame and the reference frame at the same position, only when the similarity between the current frame and the reference frame at the same position does not change significantly, that is, when the matching count of the candidate water accumulation area and the reference water accumulation area at the same position reaches a preset threshold, the candidate water accumulation area at the corresponding position in the current frame can be used as the water accumulation area, thereby avoiding the interference of highly significant moving objects on the detection results, thereby achieving the effect of improving the accuracy of water accumulation detection.
[0076] Figure 3 Schematic diagram of the process of water accumulation detection method provided in this application Figure 2 ,like Figure 3 As shown, in this embodiment Figure 2 Based on the embodiment, the process of obtaining a significant segmentation region is described in detail. The method includes:
[0077] S301: Split a target video into multiple video frames according to a preset period.
[0078] S302: Input the video frame into the target detection model to obtain at least one detection bounding box.
[0079] S303: Input the video frame into a saliency detection model. The saliency detection model is used to divide the video frame into regions to obtain at least one candidate region.
[0080] In a possible design, the water accumulation detection system can divide each pixel in the video frame into different regions based on the similarity of spatial features or based on the image grayscale or based on the image edge features, thereby obtaining at least one candidate region. For example, the video frame is divided into regions using a level set method. Optionally, the candidate regions can include water accumulation regions and non-water accumulation regions.
[0081] The level set method is a numerical technique for tracking and analyzing curves and surfaces, and is widely used in image processing, computer vision, computational geometry, and fluid dynamics. The level set method represents a curve or surface through an implicit function (usually called a level set function). Specifically, the curve or surface is represented as a zero level set of a high-dimensional function (i.e., a set of points where the function value is zero). This representation method allows the curve or surface to undergo topological changes (such as splitting and merging) during the evolution process without explicitly handling these changes. The method is obtained by setting a parameterized prior surface φ(x, y, z) = 0 (called a level set function) with an evolution time of t, and iterating with t to evolve the surface and gradually approximate the real surface. Optionally, t can be 0.01.
[0082] In the specific implementation process, the specific steps of level set segmentation of video frames are as follows:
[0083] S303a, initialize the level set function. Select the initial level set φ(x, y, z) = 0, which defines the initial curve position. This application uses the circular curve of the random center point i as the initial level set function, which can be expressed as
[0084]
[0085] Among them, xi, yi are the horizontal and vertical coordinates of point i in the image plane, and ri is the initial radius of the circular curve corresponding to each point i. Specifically, if a point in the image is within the enclosed area of the level set function, its level set function is less than 0, otherwise it is greater than 0. If a point in the image is on the level set function, the level set function is equal to 0.
[0086] S303b, calculate the evolution equation. The evolution equation can be used to guide the evolution of the circular curve. The present application updates the evolution equation based on the method of the velocity function, and its calculation formula is as follows:
[0087]
[0088] Among them, F is the speed function, which represents the speed and direction of the circular curve evolution. is the spatial gradient norm of the level set function.
[0089] This application calculates the velocity function F by combining edge information and curvature information:
[0090] F=μ·edge(I)·sign(φ)-ν·curve(φ)
[0091] Where I is the two-dimensional matrix representation of the image, μ and ν are constant control factors based on experience, representing edge weight and curvature weight respectively. Since reflective road surface water often has a large difference from the original road surface, and it often has a relatively smooth boundary line. Therefore, μ = 0.5, ν = 0.01. edge(I) is the intensity value of the pixel space gradient of the image.
[0092]
[0093] sign(φ) is the sign function of the level set function.
[0094]
[0095] curve(φ) is the curvature information.
[0096]
[0097] Where n is the unit normal vector of the φ curve, is the divergence of the unit normal vector, that is, the partial derivative of the level set function in the width and height (x, y) directions of the image.
[0098]
[0099] The edge information can be the intensity value of the pixel space gradient of the image, and the product of the intensity value and the sign function of the level set function is used to indicate the evolution direction of the level set.
[0100] S303c, solving the evolution equation by numerical methods. For example, finite difference method, finite element method, etc. For each evolution time t, repeat the following steps until the termination condition is met: Update the velocity function F. Update φ according to the solution of the evolution equation. Further, when the velocity function F changes very little in several consecutive evolution times, it can be considered that the solution of the evolution equation meets the termination condition. Alternatively, when the residual between the solution of the current evolution time and the solution of the previous evolution time reaches a preset threshold, it can be considered that the solution of the evolution equation meets the termination condition. The preset threshold of the residual can be 0.001-0.0001.
[0101] S303d, extracting the zero level set: when the evolution is stable, extracting the zero level set, that is, the point set where φ(x, y, t)=0, from the level set function, defining the final segmentation boundary through the point set, and then obtaining at least one candidate region.
[0102] S303e, performing a closing operation on the segmentation result to remove small holes in the image to improve the segmentation quality.
[0103] S304, quantize the color space of each candidate area to obtain the main color of the color space. Since the image has many colors in the RGB color feature space, it takes a lot of time to compare them one by one. In order to improve the calculation speed, this application quantizes the color space.
[0104] In the specific implementation process, the color space of each candidate area is quantized to obtain the main color tone of the color space. The specific steps are as follows:
[0105] First, the color channels of the image are changed from RGB channels to LAB channels to obtain a color space representation that is closer to human visual perception.
[0106] Second, the color components of each channel are quantized to 16, that is, the total dimension of the color space is 16^3. This can reduce the amount of calculation and improve the analysis efficiency while ensuring the visual effect of saliency detection.
[0107] Third, extract the main color of the candidate area and thin it out. For each candidate area, calculate the top n colors in the color histogram, and use the above colors as the main color of the candidate area. Optionally, n=3.
[0108] S305 . Obtain a color contrast ratio of the candidate region according to the main color tone. The color contrast ratio is a weighted sum of the color space distances between each main color tone in the candidate region and each main color tone in other candidate regions.
[0109] In a possible design, the color contrast Dr of two regions r1 and r2 can be obtained by weighted addition of the color space distance D between each of their main hues:
[0110]
[0111] Among them, f(c k,i ) is the ratio of the i-th color of the k-th candidate area to all the colors that appear in the pixels of the area. 1,i ,c 2,j ) represents the color space distance between the i-th color of the first candidate area and the j-th color of the second candidate area.
[0112] S306 . Obtain a saliency value of the candidate region according to the color contrast and the spatial contrast of the candidate region, where the spatial contrast is the weighted sum of the spatial distances between the candidate region and other candidate regions.
[0113] In one possible design, a candidate region r k The saliency value of is obtained by summing the color contrast of the candidate region and all other candidate regions:
[0114]
[0115] Furthermore, the present application uses the Euclidean distance measure dis(r k ,r i ) The regional significance value obtained in the previous step is weighted. The geometric center of gravity can be represented by the arithmetic mean of the coordinates of each point of the circumscribed rectangle of the region. In addition, the present application stipulates that the spatial contrast between each candidate region is negatively correlated with its spatial distance. As shown below:
[0116]
[0117] S307: Perform edge detection on the candidate region according to the saliency value to determine the segmentation boundary of the candidate region.
[0118] In one possible design, the segmentation boundary of the candidate region can be determined by combining an edge detection algorithm with a saliency value. The saliency value is applied as a weight to the edge detection algorithm to enhance the edge detection effect. For example, the segmentation boundary of the candidate region can be determined by combining a Canny edge detection method with a saliency value.
[0119] Further, for example, the current video frame has three candidate regions A, B, and C, and the corresponding significance values are 0.8, 0.5, and 0.3, respectively. The present application can apply the significance value as a weight to edge detection. For candidate region A, its edge detection result can be multiplied by its corresponding significance value 0.8 to enhance the segmentation boundary of candidate region A.
[0120] S308 : Segment the candidate region into a significant region and a non-significant region according to an adaptive threshold segmentation method and a segmentation boundary.
[0121] In a possible design, the candidate region can be segmented into a salient region and a non-salient region by using an adaptive threshold segmentation method, such as the Otsu method.
[0122] The Otsu method, also known as the maximum inter-class variance method, was proposed by Japanese scholar Nobuyuki Otsu. This method is an adaptive threshold determination method, which is particularly suitable for automatically obtaining thresholds in bimodal situations. The Otsu method divides an image into two parts: background and target based on the grayscale characteristics of the image. By calculating the inter-class variance between the background and the target, the Otsu method can find an expected threshold that maximizes the difference between the two parts. The principle of selecting this threshold is to minimize the probability of misclassification.
[0123] For example, the adaptive threshold of candidate region A calculated using the Otsu method is 128. If the pixel value in candidate region A is greater than or equal to 128, the corresponding region is regarded as a significant region. If the pixel value in candidate region A is less than 128, the corresponding region is regarded as a non-significant region.
[0124] S309: Taking the salient region in each candidate region as a salient segmentation region to obtain at least one salient segmentation region.
[0125] S310: For each detection bounding box in each group of detection results, if the overlap between the detection bounding box and at least one significant segmented region reaches a preset threshold, use the detection bounding box as a candidate water accumulation region.
[0126] S311. Obtain a reference water accumulation area in a reference frame that is located at the same position as the candidate water accumulation area in the video frame, and update a matching count of the candidate water accumulation area according to a matching result between the candidate water accumulation area and the reference water accumulation area at the same position. The reference frame is a video frame that is the previous video frame.
[0127] S312: taking the candidate water accumulation area corresponding to the matching count reaching the preset threshold as the water accumulation area, and outputting the water accumulation detection result.
[0128] Steps S310-S312 and Figure 2 Steps S202 to S204 in the embodiment are similar and will not be described in detail in this embodiment.
[0129] The water accumulation detection method provided in the embodiment of the present application combines target detection with saliency detection, and introduces color and spatial features in saliency detection to analyze candidate areas, which can more comprehensively describe the characteristics of the area, help accurately identify the true saliency area, avoid excessive reliance on a certain feature, and improve the robustness and stability of the water accumulation detection system. By adopting the adaptive threshold segmentation method and the matching count update method, it is possible to perform real-time detection of water accumulation areas in different scenarios, and can adaptively adjust the segmentation threshold and matching threshold according to changes in specific scenarios, thereby improving the applicability and flexibility of the water accumulation detection system.
[0130] Figure 4 Schematic diagram of the process of water accumulation detection method provided in this application Figure 3 ,like Figure 4 As shown, in this embodiment Figure 2 Based on the embodiment, the process of obtaining the candidate waterlogging area is described in detail. The method includes:
[0131] S401. Split the target video into multiple video frames according to a preset period, perform target detection and saliency detection on each video frame, and obtain multiple detection results, each detection result including at least one detection bounding box obtained by performing target detection on the video frame and at least one saliency segmentation area obtained by performing saliency detection.
[0132] S402 : For each detection boundary box in each group of detection results, respectively obtain salient pixel points in each salient segmentation region.
[0133] Specifically, the salient segmentation regions are regions obtained after processing the video frames by the saliency detection model. These regions are visually considered to be important or prominent parts. The salient segmentation regions are usually obtained through global or local feature analysis. The salient segmentation regions usually contain multiple discontinuous salient pixels, and the boundaries of the salient segmentation regions may also be discontinuous. In this case, the salient segmentation regions may include multiple small salient regions.
[0134] S403: Determine whether the ratio of significant pixels to pixels in the detection boundary box exceeds a preset threshold. If yes, execute S404. If no, execute S408.
[0135] In the specific implementation process, the water accumulation detection system traverses each significant segmentation area, obtains the significant pixels in each significant segmentation area, and determines whether the ratio of the significant pixels in each significant segmentation area to the pixels in the detection boundary box exceeds a preset threshold. Optionally, the preset threshold here can be 0.5. If yes, a connected area is constructed based on the significant pixels. If not, it is considered that the significant segmentation area does not match the detection boundary box and the significant segmentation area is abandoned.
[0136] S404: construct a connected region based on the significant pixels, and determine whether the intersection-over-union ratio of the detection bounding box and the connected region is greater than a preset threshold. If yes, execute S405. If no, execute S408.
[0137] S405: Use the detected bounding box as a candidate water accumulation area.
[0138] Specifically, since it is mentioned above that a salient segmentation region may include multiple small salient regions, it is necessary to connect discontinuous salient pixels in the salient segmentation region through a connected region algorithm to form a connected region.
[0139] In the specific implementation process, the water accumulation detection system connects the significant pixel points in the significant segmentation area that matches the detection bounding box through a connected region algorithm to form a continuous area. The connected region algorithm can be a Flood Fill algorithm. After constructing the connected area through significant pixel points, the water accumulation detection system calculates the intersection and union ratio of the connected area and the detection bounding box, and determines whether the intersection and union ratio of the connected area and the detection bounding box is greater than a preset threshold. Optionally, the preset threshold here can be 0.5. If so, the detection bounding box is used as an alternative water accumulation area. If not, the significant segmentation area is abandoned.
[0140] S406. Obtain a reference water accumulation region in the reference frame that is located at the same position as the candidate water accumulation region in the video frame, and update the matching count of the candidate water accumulation region according to the matching result between the candidate water accumulation region and the reference water accumulation region at the same position. The reference frame is the previous video frame of the video frame.
[0141] S407: taking the candidate water accumulation area corresponding to the matching count reaching the preset threshold as the water accumulation area, and outputting the water accumulation detection result.
[0142] Steps S406-S407 and Figure 2 Steps S203-S204 in the embodiment are similar and will not be described in detail in this embodiment.
[0143] S408: Abandon the significant segmented region.
[0144] The water accumulation detection method provided in the embodiment of the present application can screen out the area that has a significant impact on the detection boundary box by judging whether the proportion of significant pixels in the detection boundary box exceeds a preset threshold, thereby helping the water accumulation detection system to identify the area that is important to the target object in terms of significance, which helps to judge whether there is a water accumulation area. By constructing a connected area and judging whether the intersection and union ratio of the detection boundary box and the connected area is greater than a preset threshold, the potential water accumulation area can be further confirmed, and the degree of contact with the target object can be verified, thereby helping the system to exclude the error area that is considered to be a water accumulation area only due to high significance, thereby improving the accuracy of water accumulation detection.
[0145] Figure 5 Schematic diagram of the process of water accumulation detection method provided in this application Figure 4 ,like Figure 5 As shown, in this embodiment Figure 2 Based on the embodiment, a process of updating the matching count of the candidate waterlogging area according to the matching results of the candidate waterlogging area and the reference waterlogging area at the same position, and outputting the waterlogging detection result according to the matching count is described in detail. The method includes:
[0146] S501: split the target video into multiple video frames according to a preset period, perform target detection and saliency detection on each video frame, and obtain multiple detection results.
[0147] S502: For each detection bounding box in each group of detection results, if the overlap between the detection bounding box and at least one significant segmented region reaches a preset threshold, use the detection bounding box as a candidate water accumulation region.
[0148] Steps S501-S502 and Figure 2 Steps S201-S202 in the embodiment are similar and will not be described in detail in this embodiment.
[0149] S503: Acquire, in the reference frame, a reference water accumulation region located at the same position as the candidate water accumulation region in the video frame.
[0150] In a possible design, the reference frame can be a previous frame of the video frame.
[0151] In the specific implementation process, the water accumulation detection system represents the candidate water accumulation area in the current frame in the form of a quadruple of center point coordinates, width, and height. Specifically, the upper left corner vertex coordinates and the lower right corner vertex coordinates of the detection bounding box corresponding to the candidate water accumulation area are obtained. The center point coordinates are calculated based on the upper left corner vertex coordinates and the lower right corner vertex coordinates. The width can be obtained by calculating the width of the detection bounding box. The height can be obtained by calculating the height of the detection bounding box.
[0152] S504: Determine whether the video frame is the first frame. If yes, execute S505. If no, execute S506.
[0153] S505: Record the candidate water accumulation area and the matching count corresponding to the video frame in a historical detection queue, and use the video frame as a reference frame and the candidate water accumulation area as a reference water accumulation area.
[0154] S506: Read the reference water accumulation area corresponding to the reference frame from the historical detection queue.
[0155] In the specific implementation process, the water accumulation detection system obtains the index or timestamp of the current video frame to determine whether the current video frame is the first frame. If so, the video frame is used as the reference frame and the candidate water accumulation area is used as the reference water accumulation area. If not, the reference water accumulation area corresponding to the reference frame is read from the historical detection queue. The purpose of determining whether the current video frame is the first frame is to initialize the reference frame and matching count in the water accumulation detection process, and then establish a historical detection queue to ensure the continuity and consistency of the detection process.
[0156] S507: Determine whether the intersection-over-union ratio of the candidate water accumulation region of the reference frame and the reference water accumulation region of the video frame at the same position is greater than a preset threshold. If yes, execute S508. If no, execute S510.
[0157] S508: Increase the value of the matching count of the video frame by one.
[0158] S509: Use the video frame as a reference frame, use the candidate water accumulation area of the video frame as a reference water accumulation area, and record the reference water accumulation area and the matching count in a historical detection queue.
[0159] S510: Initialize the value of the matching count of the video frame to one.
[0160] S509: Use the video frame as a reference frame, use the candidate water accumulation area of the video frame as a reference water accumulation area, and record the reference water accumulation area and the matching count in a historical detection queue.
[0161] In the specific implementation process, the water accumulation detection system determines whether the intersection and union ratio of the candidate water accumulation area of the reference frame and the reference water accumulation area of the video frame at the same position is greater than a preset threshold. Optionally, the preset threshold here can be 0.5. If so, the value of the matching count of the video frame is increased by one, the video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as a reference water accumulation area, and the reference water accumulation area and the matching count are recorded in the historical detection queue. If not, the value of the matching count of the video frame is initialized to one. The video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as a reference water accumulation area, and the reference water accumulation area and the matching count are recorded in the historical detection queue. The appearance of the candidate water accumulation area in the continuous video frames can be updated by updating the matching count of the video frame. If the candidate water accumulation area appears in multiple continuous frames, the matching count will increase, indicating that the candidate water accumulation area is a real water accumulation area, not noise or accidental phenomenon, so that short-term and accidental false alarms can be effectively filtered out, and the robustness and reliability of water accumulation detection can be improved.
[0162] S511, determine whether the value of the matching count of the video frame exceeds a preset threshold. If yes, execute S512. If no, execute S507.
[0163] In a possible design, the preset threshold here can be 3.
[0164] S512: taking the candidate water accumulation area corresponding to the video frame as the water accumulation area, and outputting the water accumulation detection result.
[0165] The water accumulation detection method provided in the embodiment of the present application can improve the reliability and continuity of water accumulation detection by obtaining a reference water accumulation area in the reference frame that is located at the same position as the candidate water accumulation area in the video frame, thereby matching and updating the position change and evolution of the candidate water accumulation area at different time points or between different frames. By setting a matching count and stipulating that the candidate water accumulation area can only be determined as a water accumulation area when it appears in multiple consecutive video frames, the interference of highly significant moving objects on the detection results is avoided, thereby improving the accuracy of water accumulation detection.
[0166] Figure 6 The schematic diagram of the structure of the water accumulation detection device provided in this application is as follows: Figure 6 As shown, the water accumulation detection device 60 provided in this embodiment includes:
[0167] The acquisition module 601 is used to split the target video according to a preset period to obtain multiple video frames, perform target detection and saliency detection on each video frame, and obtain multiple detection results, each detection result includes at least one detection boundary box obtained by performing target detection on the video frame and at least one saliency segmentation area obtained by performing saliency detection.
[0168] The processing module 602 is configured to, for each detection bounding box in each group of detection results, use the detection bounding box as a candidate water accumulation area when the overlap between the detection bounding box and at least one significant segmented area reaches a preset threshold.
[0169] The processing module 602 is also used to obtain a reference water accumulation area in the reference frame that is located at the same position as the alternative water accumulation area in the video frame, and update the matching count of the alternative water accumulation area according to the matching results of the alternative water accumulation area and the reference water accumulation area at the same position, where the reference frame is the previous video frame of the video frame.
[0170] The control module 603 is used to take the candidate water accumulation area corresponding to the matching count reaching the preset threshold as the water accumulation area and output the water accumulation detection result.
[0171] In a possible implementation, the acquisition module 601 is further configured to:
[0172] Input the video frame into the object detection model to obtain at least one detection bounding box;
[0173] Inputting the video frame into a saliency detection model, the saliency detection model is used to divide the video frame into regions to obtain at least one candidate region;
[0174] The characteristic contrast of each candidate region is obtained respectively, and at least one significant segmentation region is obtained in the candidate region according to the characteristic contrast, wherein the characteristic contrast includes color contrast and space contrast.
[0175] In a possible implementation, the acquisition module 601 is further configured to:
[0176] Quantify the color space of each candidate area to obtain the main color tone of the color space;
[0177] According to the main color tone, a color contrast of the candidate area is obtained, where the color contrast is a weighted sum of the color space distances between each main color tone in the candidate area and each main color tone in other candidate areas;
[0178] According to the color contrast and spatial contrast of the candidate region, a saliency value of the candidate region is obtained, and the spatial contrast is the weighted sum of the spatial distances between the candidate region and other candidate regions;
[0179] Each candidate region is segmented according to the saliency value of each candidate region to obtain at least one saliency segmented region.
[0180] In a possible implementation, the acquisition module 601 is further configured to:
[0181] Perform edge detection on the candidate region according to the saliency value to determine the segmentation boundary of the candidate region;
[0182] According to the adaptive threshold segmentation method and the segmentation boundary, the candidate area is segmented into a significant area and a non-significant area;
[0183] The salient region in each candidate region is used as a salient segmentation region to obtain at least one salient segmentation region.
[0184] In a possible implementation, the processing module 602 is further configured to:
[0185] For each detection bounding box in each set of detection results, obtain the significant pixels in each significant segmentation area respectively, and determine whether the proportion of the significant pixels to the pixels in the detection bounding box exceeds a preset threshold;
[0186] If yes, then a connected region is constructed based on the significant pixels, and it is determined whether the intersection-over-union ratio of the detection bounding box and the connected region is greater than a preset threshold;
[0187] If so, the detected bounding box is used as a candidate water accumulation area.
[0188] In a possible implementation, the processing module 602 is further configured to:
[0189] Determine whether the video frame is the first frame. If so, record the candidate water accumulation area and the matching count corresponding to the video frame in the historical detection queue, and use the video frame as a reference frame and the candidate water accumulation area as a reference water accumulation area;
[0190] If not, read the reference water accumulation area corresponding to the reference frame from the historical detection queue, and determine whether the intersection-and-union ratio of the candidate water accumulation area of the reference frame and the reference water accumulation area of the video frame at the same position is greater than a preset threshold;
[0191] If so, the value of the matching count of the video frame is increased by one, the video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as a reference water accumulation area, and the reference water accumulation area and the matching count are recorded in a historical detection queue.
[0192] In a possible implementation, the processing module 602 is further configured to:
[0193] If the intersection-over-union ratio of the reference water accumulation region of the reference frame and the candidate water accumulation region of the video frame at the same position is less than a preset threshold;
[0194] Initialize the value of the match count of the video frame to one;
[0195] The video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as a reference water accumulation area, and the reference water accumulation area and the matching count are recorded in a historical detection queue.
[0196] In a possible implementation, the control module 603 is further configured to:
[0197] Determine whether the value of the matching count of the video frame exceeds a preset threshold. If so, take the candidate water accumulation area corresponding to the video frame as the water accumulation area and output the water accumulation detection result;
[0198] If not, the matching step is continued until the video frame outputs the water accumulation detection result.
[0199] The water accumulation detection device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.
[0200] Figure 7 This is a schematic diagram of the structure of the water accumulation detection device provided in this application. Figure 7 As shown, the electronic device 70 provided in this embodiment includes: at least one processor 701 and a memory 702. Optionally, the device 70 further includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus 704.
[0201] In a specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that at least one processor 701 executes the above method.
[0202] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0203] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0204] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0205] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0206] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0207] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0208] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0209] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0210] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0211] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0212] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0213] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of 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, etc. Various media that can store program codes.
[0214] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0215] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for detecting water accumulation, characterized in that: include: Splitting the target video according to a preset period to obtain a plurality of video frames, performing target detection and saliency detection on each video frame to obtain a plurality of detection results, each of the detection results comprising at least one detection bounding box obtained by performing target detection on the video frame and at least one saliency segmentation region obtained by performing saliency detection; For each detection bounding box in each group of detection results, when the overlap between the detection bounding box and the at least one significant segmented area reaches a preset threshold, the detection bounding box is used as a candidate water accumulation area; Acquire a reference waterlogging region located at the same position as the candidate waterlogging region in the video frame in a reference frame, and update a matching count of the candidate waterlogging region according to a matching result between the candidate waterlogging region and the reference waterlogging region at the same position, wherein the reference frame is a previous video frame of the video frame; The candidate water accumulation area corresponding to the matching count reaching the preset threshold is used as the water accumulation area, and the water accumulation detection result is output.
2. The method according to claim 1, characterized in that: The target detection and saliency detection are performed on each video frame to obtain multiple detection results, including: Inputting the video frame into an object detection model to obtain at least one detection bounding box; Inputting the video frame into a saliency detection model, wherein the saliency detection model is used to divide the video frame into regions to obtain at least one candidate region; A characteristic contrast of each candidate region is acquired respectively, and at least one significant segmentation region is obtained in the candidate region according to the characteristic contrast, wherein the characteristic contrast includes color contrast and space contrast.
3. The method according to claim 2, characterized in that The step of respectively acquiring the feature contrast of each candidate region and obtaining at least one significant segmentation region in the candidate region according to the feature contrast comprises: quantizing the color space of each candidate area to obtain the main color tone of the color space; According to the main color tone, a color contrast of the candidate area is obtained, where the color contrast is a weighted sum of the color space distances between each main color tone in the candidate area and each main color tone in other candidate areas; Obtaining a saliency value of the candidate region according to the color contrast and spatial contrast of the candidate region, wherein the spatial contrast is a weighted sum of spatial distances between the candidate region and other candidate regions; Each candidate region is segmented according to the significance value of each candidate region to obtain at least one significant segmented region.
4. The method according to claim 3, characterized in that The step of segmenting each candidate region according to the significance value of each candidate region to obtain at least one significant segmented region includes: Performing edge detection on the candidate region according to the saliency value to determine a segmentation boundary of the candidate region; According to the adaptive threshold segmentation method and the segmentation boundary, the candidate area is segmented into a significant area and a non-significant area; The salient region in each candidate region is used as the salient segmentation region to obtain at least one salient segmentation region.
5. The method according to claim 4, characterized in that For each detection bounding box in each group of detection results, when the overlap between the detection bounding box and the at least one significant segmentation area reaches a preset threshold, the detection bounding box is used as a candidate water accumulation area, including: For each detection boundary box in each group of detection results, respectively obtain the significant pixels in each of the significant segmentation areas, and determine whether the proportion of the significant pixels to the pixels in the detection boundary box exceeds a preset threshold; If yes, construct a connected area based on the significant pixels, and determine whether the intersection-over-union ratio of the detection bounding box and the connected area is greater than a preset threshold; If so, the detected bounding box is used as a candidate water accumulation area.
6. The method according to claim 5, characterized in that The updating of the matching count of the candidate waterlogging area according to the matching result of the candidate waterlogging area and the reference waterlogging area at the same position includes: Determine whether the video frame is the first frame, and if so, record the candidate waterlogging area and the matching count corresponding to the video frame in a historical detection queue, and use the video frame as a reference frame and the candidate waterlogging area as the reference waterlogging area; If not, reading the reference water accumulation area corresponding to the reference frame from the historical detection queue, and determining whether an intersection-and-union ratio of the candidate water accumulation area of the reference frame and the reference water accumulation area of the video frame at the same position is greater than a preset threshold; If so, the value of the matching count of the video frame is increased by one, the video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as the reference water accumulation area, and the reference water accumulation area and the matching count are recorded in a historical detection queue.
7. The method according to claim 6, characterized in that The method further comprises: If the intersection-over-union ratio of the reference water accumulation area of the reference frame and the candidate water accumulation area of the video frame at the same position is less than the preset threshold; Initializing the value of the match count of the video frame to one; The video frame is used as a reference frame, the candidate water accumulation area of the video frame is used as the reference water accumulation area, and the reference water accumulation area and the matching count are recorded in a historical detection queue.
8. The method according to claim 7, characterized in that The step of taking the candidate waterlogging area corresponding to the matching count reaching the preset threshold as the waterlogging area and outputting the waterlogging detection result includes: Determine whether the value of the matching count of the video frame exceeds a preset threshold value, and if so, use the candidate water accumulation area corresponding to the video frame as the water accumulation area, and output the water accumulation detection result; If not, the matching step is continued until the video frame outputs a water accumulation detection result.
9. A water accumulation detection device, characterized in that: include: an acquisition module, configured to split the target video into multiple video frames according to a preset period, perform target detection and saliency detection on each video frame, and obtain multiple detection results, each of which includes at least one detection bounding box obtained by performing target detection on the video frame and at least one saliency segmentation region obtained by performing saliency detection; a processing module, configured to, for each detection bounding box in each group of detection results, use the detection bounding box as a candidate water accumulation area when the overlap between the detection bounding box and the at least one significant segmented area reaches a preset threshold; The processing module is further used to obtain, in a reference frame, a reference waterlogging region located at the same position as the candidate waterlogging region in the video frame, and update a matching count of the candidate waterlogging region according to a matching result between the candidate waterlogging region and the reference waterlogging region at the same position, wherein the reference frame is a previous video frame of the video frame; The control module is used to take the candidate water accumulation area corresponding to the matching count reaching a preset threshold as the water accumulation area and output the water accumulation detection result.
10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.
12. A computer program product, comprising a computer program, which implements the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Cited By
Accumulated water identification method, device, equipment and medium
CN120656122A
Road waterlogging detection method and equipment
CN120766217A
Accumulated water detection method and device based on false alarm filtering, medium and equipment
CN122200517A
