Waterlogging detection method and device based on denoising diffusion model from the perspective of urban monitoring
Through the waterlogging detection method and device based on the denoising diffusion model, the problems of low urban waterlogging detection frequency, insufficient spatial representation and high cost have been solved, real-time and full-coverage waterlogging monitoring has been achieved, and detection accuracy and economy have been improved.
Patent Information
- Application Number
- CN202410944776.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-07-15
AI Technical Summary
Existing urban waterlogging detection methods have low detection frequency, insufficient spatial representation, limited real-time performance and high cost, and cannot achieve comprehensive, timely and accurate detection of urban waterlogging conditions.
Adopt a waterlogging detection method and device based on the denoising diffusion model, suppress the noise in the surveillance video image through the denoising diffusion model, build a multi-scale semantic segmentation model, extract the boundary and shape of the waterlogging area, and convert multi-viewpoint water patches Create a spatial and temporal distribution map of urban waterlogging to achieve real-time, full-coverage waterlogging detection.
It improves the real-time and accuracy of waterlogging detection, reduces detection costs, ensures comprehensive monitoring and timely response to urban waterlogging conditions, and provides a high-frequency, low-cost waterlogging monitoring solution.
Smart Images

Figure CN118470659B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing, and in particular relates to a method and device for detecting waterlogging based on a denoising diffusion model from the perspective of urban monitoring. Background Art
[0002] Urban waterlogging detection is a crucial task in urban management and natural disaster warning. With the expansion of urban construction and the impact of climate change, the problem of urban waterlogging has become increasingly prominent, posing a serious threat to urban traffic, housing safety, and people's lives and property. In this context, real-time and accurate detection of urban waterlogging has become one of the urgent needs of urban management. Traditional monitoring methods mainly rely on manual inspections and remote sensing technology (such as remote sensing observation methods such as drones and satellites) to assess urban waterlogging. However, existing methods have the following shortcomings:
[0003] (1) Low detection frequency
[0004] The frequency of manual inspections and drone inspections is low. Due to the constraints of flight time and weather, it is impossible to achieve a comprehensive inspection of urban waterlogging. At the same time, the low inspection frequency makes it impossible to obtain the changes in waterlogging events in a timely manner, which affects the timely response to waterlogging disasters.
[0005] (2) Insufficient spatial representation
[0006] Manual inspection and drone detection are not representative enough. Manual inspection is limited by the terrain and environment, and the detection range is limited; drone detection is limited by the endurance time and mileage, and it is difficult to meet the large-scale and continuous urban waterlogging detection needs.
[0007] (3) Limited real-time performance
[0008] The real-time nature of urban waterlogging monitoring is limited, mainly in terms of drone and satellite detection. Satellite remote sensing data processing has time delays and periodic return visits, and cannot provide real-time waterlogging detection data. Drone detection is limited by round-trip time, resulting in delayed detection feedback, which affects the real-time detection of waterlogging events.
[0009] (4) High cost
[0010] Existing urban waterlogging detection methods are costly. Manual inspections require a lot of human resources and equipment maintenance; drone and satellite remote sensing technology equipment purchase and maintenance costs are high, and require professional technicians to operate, greatly increasing the cost of urban waterlogging detection.
[0011] The widespread use of urban monitoring probes provides a new possibility for real-time high-resolution waterlogging detection. First, the deployment of monitoring probes covers a wide range. Whether in the city center or the edge area, comprehensive monitoring can be achieved by reasonably setting monitoring points. The use of in-situ monitoring equipment can achieve all-weather uninterrupted detection, greatly improving the detection frequency, and helping to capture the occurrence and changes of waterlogging events in real time; secondly, urban monitoring equipment can achieve real-time data transmission and detection feedback, effectively respond to waterlogging events, and reduce the losses and impacts caused by them; in addition, the installation and operation costs of monitoring equipment are relatively low, and it can be used for a long time after a one-time investment, making maximum use of existing urban monitoring equipment and reducing the high costs of manual inspections and remote sensing technology.
[0012] Urban surveillance cameras have important application value in waterlogging detection, but their application also faces a series of major challenges. For example, the images captured by surveillance cameras often have interference such as image background noise and raindrops, which leads to large errors in waterlogging detection; secondly, objects such as buildings and trees block the water area, resulting in incomplete water extraction and increasing the difficulty of waterlogging detection; in addition, the different viewing angles of each surveillance camera make it difficult to convert the acquired waterlogging water spots into a complete urban waterlogging spatiotemporal distribution map.
[0013] Therefore, in order to more effectively detect urban waterlogging areas, an advanced denoising diffusion semantic segmentation algorithm is needed to accurately extract the boundary information and overall distribution of waterlogging areas, reduce the impact of non-waterlogging water body noise in the image, and extract waterlogging areas with high precision. In addition, it is necessary to convert the waterlogging spots obtained by multi-viewpoint synchronous detection into a spatiotemporal distribution map of urban waterlogging. Summary of the invention
[0014] The present invention provides a waterlogging detection method and device based on a denoising diffusion model from the perspective of urban monitoring, aiming to improve the accuracy and real-time performance of waterlogging detection and provide reliable technical support for multiple fields such as urban planning and flood control management.
[0015] The present invention proposes a waterlogging detection method based on a denoising diffusion model from the perspective of urban monitoring, the method comprising the following steps:
[0016] Step (1) using a denoising diffusion model to suppress target noise in the waterlogged area of the surveillance video image, and reduce background noise interference, improve image clarity and quality, and enhance the color, contrast, and edge features of the water body in the waterlogged area;
[0017] Step (2) Based on the encoding module, backbone network and decoding module, multi-scale information and spatial attention mechanism are integrated to capture the characteristic information of waterlogging at different scales and improve the attention of the semantic segmentation model to the waterlogged area, build a semantic segmentation model for monitoring waterlogging, and extract the boundary and spatial distribution of the waterlogged area in the field of view;
[0018] Step (3) performs target positioning and geometric correction on the waterlogging spots identified by a single viewpoint, and converts its camera coordinates into world coordinates; spatially aligns and fuses the waterlogging spots obtained by multi-viewpoint synchronous detection to obtain a spatiotemporal distribution map of urban waterlogging within the monitoring range;
[0019] Step (4) provides an urban waterlogging detection device based on a denoising diffusion model from the perspective of urban monitoring. By using the deployed monitoring network in the city, the urban waterlogging detection is performed in real time in the area covered by the monitoring probes to obtain the waterlogging distribution data.
[0020] The present invention also proposes a waterlogging detection device based on a denoising diffusion model from the perspective of urban monitoring, the device comprising a monitoring video acquisition module, a time series image acquisition module, a denoising diffusion module, a waterlogging segmentation module, and a waterlogging spatiotemporal distribution map module, wherein:
[0021] Surveillance video acquisition module: according to weather forecast information and historical rainfall data, set rainfall threshold, filter the start and end frames of effective rainfall events, and extract and collect urban surveillance videos of different time periods in real time;
[0022] Time-series image acquisition module: Use formulas to dynamically calculate the image acquisition frequency and extract complete time-series images;
[0023] De-noising diffusion module: reduces background noise interference of time series images and improves image clarity and water characteristics;
[0024] Waterlogging segmentation module: Build a waterlogging segmentation model based on the encoding module, backbone network and decoding module, integrate multi-scale information and spatial attention mechanism, and extract the boundaries and morphology of the waterlogged area;
[0025] Waterlogging spatiotemporal distribution map module: converts waterlogging patches identified from a single viewpoint into world coordinates; spatially aligns and fuses waterlogging patches from multiple viewpoints to obtain a spatiotemporal distribution map of waterlogging within the city’s monitoring range.
[0026] The present invention has the following beneficial technical effects:
[0027] Real-time and high-frequency monitoring: Through the deployed urban monitoring probes, the present invention realizes real-time monitoring of urban waterlogging, overcoming the problems of low detection frequency and delayed feedback in traditional methods. The monitoring probes can work 24 hours a day, provide high-frequency data collection, ensure timely acquisition of the occurrence and changes of waterlogging events, and improve the emergency response capabilities of urban waterlogging.
[0028] High spatial coverage and representativeness: The wide application of monitoring probes covers every corner of the city, including the city center and marginal areas, solving the problem of insufficient spatial coverage of traditional manual inspections and drone monitoring. By reasonably setting monitoring points, the present invention realizes comprehensive monitoring of urban waterlogging and enhances the spatial representativeness and accuracy of data.
[0029] Reduce monitoring costs: Compared with traditional manual inspections and drone monitoring, the monitoring equipment of the present invention has relatively low installation and operation costs, avoiding the high equipment maintenance and labor cost problems in traditional waterlogging detection methods, and improving the economy and sustainability of the monitoring system.
[0030] Accurate waterlogged area extraction: This invention uses advanced denoising diffusion semantic segmentation algorithm to effectively remove background noise in the image, improve image clarity and water feature extraction accuracy. By extracting the boundaries and morphology of waterlogged areas with high precision, the impact of non-waterlogged water body noise in the image is reduced, ensuring the accuracy and reliability of waterlogging detection.
[0031] Perfect waterlogging spatiotemporal distribution map generation: The present invention uses the waterlogging spatiotemporal distribution map module to transform the coordinates of the waterlogging spots identified from a single viewpoint, and spatially aligns and merges the waterlogging spots from multiple viewpoints to generate a spatiotemporal distribution map of waterlogging within the city's monitoring range. This function provides a global perspective on waterlogging events, helps city managers fully understand the scope and trend of waterlogging, and supports scientific decision-making and effective management.
[0032] Ability to cope with complex environments: The waterlogging detection method of the present invention takes into account complex urban environments, such as the obstruction of water areas by buildings, trees, etc., and improves the detection capability of waterlogged areas through advanced algorithms and optimization techniques, ensuring that waterlogged areas can still be accurately identified and extracted in complex environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is an overall execution flow chart of the method of the present invention;
[0034] Figure 2 It is the denoised diffusion semantic segmentation map in the present invention;
[0035] Figure 3 Sample data for semantic segmentation model training and its segmentation mask example map;
[0036] Figure 4 This is the overall functional module diagram of the urban waterlogging detection device. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in each embodiment of the present invention described below can be combined with each other as long as they do not conflict with each other. To achieve the above-mentioned purpose, the present invention adopts the following technical scheme.
[0038] This paper proposes a waterlogging detection method based on a denoising diffusion model from the perspective of urban monitoring. Figure 1 , the method comprises the following steps:
[0039] Step (1) using a denoising diffusion model to suppress target noise in the waterlogged area of the surveillance video image, and reduce background noise interference, improve image clarity and quality, and enhance the color, contrast, and edge features of the water body in the waterlogged area;
[0040] Step (2) Based on the encoding module, backbone network and decoding module, multi-scale information and spatial attention mechanism are integrated to capture the characteristic information of waterlogging at different scales and improve the attention of the semantic segmentation model to the waterlogged area, build a semantic segmentation model for monitoring waterlogging, and extract the boundary and spatial distribution of the waterlogged area in the field of view;
[0041] Step (3) performs target positioning and geometric correction on the waterlogging spots identified by a single viewpoint, and converts its camera coordinates into world coordinates; spatially aligns and fuses the waterlogging spots obtained by multi-viewpoint synchronous detection to obtain a spatiotemporal distribution map of urban waterlogging within the monitoring range;
[0042] Step (4) provides an urban waterlogging detection device based on a denoising diffusion model from the perspective of urban monitoring. By using the deployed monitoring network in the city, the urban waterlogging detection is performed in real time in the area covered by the monitoring probes to obtain the waterlogging distribution data.
[0043] Further, the specific implementation steps of step (1) are as follows:
[0044] Step (1-1) sets the rainfall threshold according to weather forecast information and historical rainfall data, selects the start and end frames of effective rainfall events, and dynamically calculates the image acquisition frequency using formula (1):
[0045] (1)
[0046] in, is the frequency of waterlogging image acquisition, They are respectively the unified dimension normalized representation of precipitation amount, precipitation intensity and duration;
[0047] Step (1-2) inputs the waterlogged image into the denoising diffusion model, and through multiple iterations of optimization, suppresses the target noise of water surface ripples and waves in the waterlogged area of the monitoring video image, and reduces the background noise interference of buildings and tree textures, improves the image clarity and quality, and enhances the water color, contrast and water edge characteristics in the waterlogged area;
[0048] Step (1-2-1) uses the forward process of the denoising diffusion model to deduce the initial waterlogging video image , gradually add Gaussian noise to simulate the interference of rainfall, water waves, and light changes on the waterlogging monitoring image, and finally generate a noise image. The noise image conforms to the isotropic Gaussian distribution N(0, I). In each time step t of the forward process, according to the forward distribution process Add noise. The specific noise operation is defined as follows:
[0049] (2)
[0050] in,( ... ... ) represents a Markov chain with T time steps, noisy scheduling Control the variance of the noise added at each step;
[0051] Step (1-2-2) uses the reverse process of the denoising diffusion model, starting from the damaged video image, and gradually restores the original waterlogged video image through a series of denoising operations to ensure that the features of the waterlogged area are effectively preserved and enhanced. At each time step, the denoising model is used to Simulating reverse distribution :
[0052] (3)
[0053] in, is the predicted mean of the normal distribution of the reverse process; the parameter θ is obtained by minimizing the KL divergence between the forward and reverse distributions of all time steps; during the optimization process, Sampling, simulating the noise diffusion process, according to formula (4), by marginalizing the intermediate latent variables to derive the given of The marginal distribution of is:
[0054] (4)
[0055] in, It is before All time steps The cumulative product of the parameters, under the Markov assumption, uses formula (2) and formula (4) to obtain the posterior distribution:
[0056] (5)
[0057] Where μ is the mean of the posterior distribution, is the covariance of the posterior distribution:
[0058] (6)
[0059] (7)
[0060] Step (1-2-3) optimizes the parameters of the denoising diffusion model by minimizing the loss function to restore the water boundary, water surface texture, and color details of the waterlogging image; the optimization goal is to make the image generated by the model The difference between the noise image and the original image is minimized. enter The generation process of is shown in formula (8), and the optimized loss function is shown in formula (9):
[0061] (8)
[0062] (9)
[0063] in, , is a normally distributed random noise with a mean of zero and a covariance matrix equal to the identity matrix. Express and Perform the desired operation, is the image generated by the model With random noise term The square of the Euclidean norm between ;
[0064] Step (1-2-4) performs the reverse Markov inference process, from Gaussian noise First, according to formula (10), at each time step right Iterative denoising, we get :
[0065] (10)
[0066] Where z is Gaussian noise with mean 0 and variance I. The result is Figure 2 shown.
[0067] Further, the specific implementation steps of step (2) are as follows:
[0068] Step (2-1) performs denoising and contrast enhancement preprocessing on the time series waterlogging image processed by the denoising diffusion model to highlight the water body features of the image and enhance the visibility of the waterlogged area;
[0069] Step (2-2) uses a semantic segmentation model to perform semantic segmentation on the time series waterlogging image preprocessed in step (2-1), and extracts and marks the waterlogged area in the image;
[0070] Step (2-3) is to train and test the semantic segmentation model: the constructed urban flooding monitoring image dataset is trained with the semantic segmentation model and the optimal training result is saved, such as Figure 3 shown.
[0071] Further, the specific implementation steps of step (2-2) are as follows:
[0072] Step (2-2-1) uses the time series water accumulation image preprocessed in step (2-1) as input data of the semantic segmentation model;
[0073] Step (2-2-2) normalizes the image and unifies it to a size suitable for the semantic segmentation model, inputs the preprocessed time series waterlogging image into the semantic segmentation model encoding module, extracts the water wave texture, water body color, and water body boundary features of the waterlogged area, and finally generates a low-dimensional feature representation, retaining enough key information about waterlogging and reducing computational complexity;
[0074] Step (2-2-3) combines the backbone network to extract high-level features of waterlogging images, captures the global context features and semantic information of waterlogging images, identifies the background environments of buildings and trees around the waterlogged areas, and better understands the scope and form of waterlogging;
[0075] Step (2-2-4) combines global context features and semantic information, uses multiple dilated convolution branches to expand the receptive field of the convolution kernel, and each branch has a different sampling rate to capture feature information of different scales; fuses the information of each branch to form a comprehensive semantic representation, and improves the detection capability of waterlogged areas of different scales;
[0076] Step (2-2-5) uses the spatial attention mechanism to improve the perception of fine-grained and global contextual features of waterlogged micro-waves and reflective points, and enhance the correlation between the waterlogged area and its surrounding environment;
[0077] Step (2-2-6) uses the cross entropy loss function And Dice loss function The comprehensive loss function , optimize the semantic segmentation model's attention to waterlogged areas; combine the cross entropy and Dice loss functions to improve the semantic segmentation model's detection accuracy for waterlogged areas during training, and use the Adam optimizer to optimize the semantic segmentation model parameters. The update formulas of the cross entropy loss function, Dice loss function, and Adam optimizer are shown in formulas (11), (12), and (13), respectively:
[0078] (11)
[0079] (12)
[0080] (13)
[0081] in, is the number of samples, is the true label, is the predicted value, and is the weight coefficient used to balance the two loss functions. For the Wheel parameters, is the learning rate, and They are the first-order moment estimate and second-order moment estimate of the gradient after bias correction, Prevent division by zero for small constants;
[0082] In step (2-2-7), the decoding module concatenates the global context features processed by the spatial attention mechanism with the underlying high-resolution features obtained by the dilated convolution branch, restores the comprehensive semantic representation to the original resolution of the input image, and generates the final semantic segmentation result, ensuring that the decoding module accurately extracts the boundary and morphological details of the flooded area.
[0083] Furthermore, step (3) includes the following specific implementation steps:
[0084] Step (3-1) Select three or more obvious and fixed non-collinear reference points in the target area to assist camera positioning and calibration;
[0085] Step (3-2) uses camera calibration technology to obtain the internal parameters of each surveillance camera, including the focal length of the camera. , optical center parameters; obtain external parameters including the position, height, and orientation of the camera, and calculate the field of view angle using formulas (14) and (15) using the focal length of the camera and the size of the photosensitive element;
[0086] (14)
[0087] (15)
[0088] in, and are the horizontal and vertical field angles, and is the width and height of the photosensitive element, and are the focal lengths in the horizontal and vertical directions;
[0089] Step (3-3) takes the pixel coordinates of the temporal mask image processed by the semantic segmentation model in step (2-3) Convert to image coordinates , the conversion formula between pixel coordinates and image coordinates is as follows:
[0090] (16)
[0091] in, is the intersection of the camera optical axis and the imaging plane, and is the physical size of each pixel on the horizontal and vertical axes;
[0092] Step (3-4) converts the waterlogging image coordinates into camera coordinates , which belongs to the perspective projection relationship, is converted from 2D to 3D. The conversion relationship between image coordinates and camera coordinates is as follows:
[0093] (17)
[0094] Steps (3-5) use the external parameter matrix of the monitoring probe , convert the camera coordinates to world coordinates , where the external parameter matrix formula is shown in (18), and the transformation relationship between camera coordinates and world coordinates is shown in formula (19):
[0095] (18)
[0096] (19)
[0097] in, Represents the rotation matrix of the camera's coordinate system relative to the world coordinate system, Represents the translation matrix of the camera's coordinate system relative to the world coordinate system;
[0098] Steps (3-6) perform image mosaicking on the waterlogged area images from multiple monitoring perspectives, take the average value of the overlapping parts, where positive values represent waterlogged areas and zero values represent non-waterlogged areas, and finally generate a waterlogging distribution map of the monitoring area;
[0099] Step (3-7) subtracts the waterlogging distribution map of the monitoring area generated in step (3-6) from the normal water body layer of the same area to obtain a waterlogging layer of the monitoring area, where a positive value represents a waterlogged area and a zero value represents a non-waterlogged area;
[0100] Step (3-8) loops through step (3-2) to step (3-7), performs spatial processing on the time series images recorded by multiple surveillance cameras at different times, derives the boundaries and distribution of the waterlogged areas, and obtains a spatiotemporal distribution map of urban waterlogging within the monitoring range.
[0101] The present invention also proposes a waterlogging detection device based on a denoising diffusion model from the perspective of urban monitoring, see Figure 4 The device includes a monitoring video acquisition module, a time-series image acquisition module, a denoising diffusion module, a waterlogging segmentation module, and a waterlogging spatiotemporal distribution map module, wherein:
[0102] Surveillance video acquisition module: according to weather forecast information and historical rainfall data, set rainfall threshold, filter the start and end frames of effective rainfall events, and extract and collect urban surveillance videos of different time periods in real time;
[0103] Time-series image acquisition module: Use formulas to dynamically calculate the image acquisition frequency and extract complete time-series images;
[0104] De-noising diffusion module: reduces background noise interference of time series images and improves image clarity and water characteristics;
[0105] Waterlogging segmentation module: Build a waterlogging semantic segmentation model based on the encoding module, backbone network and decoding module, integrate multi-scale information and spatial attention mechanism, and extract the boundaries and morphology of the waterlogged area;
[0106] Waterlogging spatiotemporal distribution map module: converts waterlogging patches identified from a single viewpoint into world coordinates; spatially aligns and fuses waterlogging patches from multiple viewpoints to obtain a spatiotemporal distribution map of waterlogging within the city’s monitoring range.
Claims
1. A waterlogging detection method based on a denoising diffusion model from the perspective of urban monitoring, characterized in that: The method comprises the following steps: Step (1) using a denoising diffusion model to suppress target noise in the waterlogged area of the surveillance video image, and reduce background noise interference, improve image clarity and quality, and enhance the color, contrast, and edge features of the water body in the waterlogged area; Step (2) Based on the encoding module, backbone network and decoding module, multi-scale information and spatial attention mechanism are integrated to capture the characteristic information of waterlogging at different scales and improve the attention of the semantic segmentation model to the waterlogged area, build a semantic segmentation model for monitoring waterlogging, and extract the boundary and spatial distribution of the waterlogged area in the field of view; Step (3) performs target positioning and geometric correction on the waterlogging spots identified by a single viewpoint, and converts its camera coordinates into world coordinates; spatially aligns and fuses the waterlogging spots obtained by multi-viewpoint synchronous detection to obtain a spatiotemporal distribution map of urban waterlogging within the monitoring range; Step (4) provides an urban waterlogging detection device based on a denoising diffusion model from the perspective of urban monitoring, and uses the monitoring network deployed in the city to detect waterlogging in real time in the area covered by the monitoring probes to obtain waterlogging distribution data; The specific implementation steps of step (1) are as follows: Step (1-1) sets the rainfall threshold according to weather forecast information and historical rainfall data, selects the start and end frames of effective rainfall events, and dynamically calculates the image acquisition frequency using formula (1): (1) in, is the frequency of waterlogging image collection, They are respectively the unified dimension normalized representation of precipitation amount, precipitation intensity and duration; Step (1-2) inputs the waterlogged image into the denoising diffusion model, and through multiple iterations of optimization, suppresses the target noise of water surface ripples and waves in the waterlogged area of the monitoring video image, and reduces the background noise interference of buildings and tree textures, improves the image clarity and quality, and enhances the water color, contrast and water edge characteristics in the waterlogged area; Step (1-2-1) uses the forward process of the denoising diffusion model to deduce the initial waterlogging video image , gradually add Gaussian noise to simulate the interference of rainfall, water waves, and light changes on the waterlogging monitoring image, and finally generate a noise image. The noise image conforms to the isotropic Gaussian distribution N(0, I). In each time step t of the forward process, according to the forward distribution process Add noise. The specific noise operation is defined as follows: (2) in,( ... ... ) represents a Markov chain with T time steps, noisy scheduling Control the variance of the noise added at each step; Step (1-2-2) uses the reverse process of the denoising diffusion model, starting from the damaged video image, and gradually restores the original waterlogged video image through denoising operations to ensure that the features of the waterlogged area are effectively preserved and enhanced. At each time step, the denoising model is used to Simulating reverse distribution : (3) in, is the predicted mean of the normal distribution of the reverse process; the parameter θ is obtained by minimizing the KL divergence between the forward and reverse distributions of all time steps; in the optimization process, Sampling, simulating the noise diffusion process, according to formula (4), by marginalizing the intermediate latent variables to derive the given of The marginal distribution of is: (4) in, It is before All time steps The cumulative product of the parameters, under the Markov assumption, uses formula (2) and formula (4) to obtain the posterior distribution: (5) Where μ is the mean of the posterior distribution, is the covariance of the posterior distribution: (6) (7) Step (1-2-3) optimizes the parameters of the denoising diffusion model by minimizing the loss function to restore the water boundary, water surface texture, and color details of the waterlogging image; the optimization goal is to make the image generated by the model The difference between the noise image and the original image is minimized. enter The generation process of is shown in formula (8), and the optimized loss function is shown in formula (9): (8) (9) in, , is a normally distributed random noise with a mean of zero and a covariance matrix equal to the identity matrix. Express and Perform the desired operation, is the image generated by the model With random noise term The square of the Euclidean norm between ; Step (1-2-4) performs the reverse Markov inference process, from Gaussian noise First, according to formula (10), at each time step right Iterative denoising, we get : (10) Where z is Gaussian noise with mean 0 and variance I; The specific implementation steps of step (2) are as follows: Step (2-1) performs denoising and contrast enhancement preprocessing on the time series waterlogging image processed by the denoising diffusion model to highlight the water body features of the image and enhance the visibility of the waterlogged area; Step (2-2) uses a semantic segmentation model to perform semantic segmentation on the time series waterlogging image preprocessed in step (2-1), and extracts and marks the waterlogged area in the image; Step (2-3) performs training and testing of the semantic segmentation model: the constructed urban waterlogging monitoring image dataset is trained with the semantic segmentation model, and the optimal training result is saved; Step (3) includes the following specific implementation steps: Step (3-1) Select three or more non-collinear reference points in the target area to assist camera positioning and calibration; Step (3-2) uses camera calibration technology to obtain the internal parameters of each surveillance camera, including the focal length of the camera. , optical center parameters; obtain external parameters including the position, height, and orientation of the camera, and calculate the field of view angle using formulas (14) and (15) using the focal length of the camera and the size of the photosensitive element; (14) (15) in, and are the horizontal and vertical field angles, and is the width and height of the photosensitive element, and are the focal lengths in the horizontal and vertical directions; Step (3-3) takes the pixel coordinates of the temporal mask image processed by the semantic segmentation model in step (2-3) Convert to image coordinates , the conversion formula between pixel coordinates and image coordinates is as follows: (16) in, is the intersection of the camera optical axis and the imaging plane, and is the physical size of each pixel on the horizontal and vertical axes; Step (3-4) converts the waterlogging image coordinates into camera coordinates , which belongs to the perspective projection relationship, is converted from 2D to 3D. The conversion relationship between image coordinates and camera coordinates is as follows: (17) Steps (3-5) use the external parameter matrix of the monitoring probe , convert the camera coordinates to world coordinates , where the external parameter matrix formula is shown in (18), and the transformation relationship between camera coordinates and world coordinates is shown in formula (19): (18) (19) in, Represents the rotation matrix of the camera's coordinate system relative to the world coordinate system, Represents the translation matrix of the camera's coordinate system relative to the world coordinate system; Steps (3-6) perform image mosaicking on the waterlogged area images from multiple monitoring perspectives, take the average value of the overlapping parts, where positive values represent waterlogged areas and zero values represent non-waterlogged areas, and finally generate a waterlogging distribution map of the monitoring area; Step (3-7) subtracts the waterlogging distribution map of the monitoring area generated in step (3-6) from the normal water body layer of the same area to obtain a waterlogging layer of the monitoring area, where a positive value represents a waterlogged area and a zero value represents a non-waterlogged area; Step (3-8) loops through steps (3-2) to (3-7), performs spatial processing on the time series images recorded by multiple surveillance cameras at different times, derives the boundaries and distribution of the waterlogged areas, and obtains a spatiotemporal distribution map of urban waterlogging within the monitoring range.
2. According to the method of claim 1, the waterlogging detection method based on denoising diffusion model under the perspective of urban monitoring is characterized in that: The specific implementation steps of step (2-2) are as follows: Step (2-2-1) uses the time series water accumulation image preprocessed in step (2-1) as input data of the semantic segmentation model; Step (2-2-2) normalizes the image and unifies it to a size suitable for the semantic segmentation model, inputs the preprocessed time series waterlogging image into the semantic segmentation model encoding module, extracts the water wave texture, water body color, and water body boundary features of the waterlogged area, and finally generates a low-dimensional feature representation, retaining enough key information about waterlogging and reducing computational complexity; Step (2-2-3) combines the backbone network to extract high-level features of waterlogging images, captures the global context features and semantic information of waterlogging images, identifies the background environments of buildings and trees around the waterlogged areas, and better understands the scope and form of waterlogging; Step (2-2-4) combines global context features and semantic information, uses multiple dilated convolution branches to expand the receptive field of the convolution kernel, and each branch has a different sampling rate to capture feature information of different scales; fuses the information of each branch to form a comprehensive semantic representation, and improves the detection capability of waterlogged areas of different scales; Step (2-2-5) uses the spatial attention mechanism to improve the perception of fine-grained and global contextual features of waterlogged micro-waves and reflective points, and enhance the correlation between the waterlogged area and its surrounding environment; Step (2-2-6) uses the cross entropy loss function And Dice loss function The comprehensive loss function , optimize the semantic segmentation model's attention to the waterlogged area; this comprehensive loss function is used to balance the class imbalance problem, where the waterlogged area, as a minority class, will be affected by the majority class, the non-waterlogged area; combined with the cross entropy and Dice loss functions, the semantic segmentation model's detection accuracy for the waterlogged area during training is improved, and the Adam optimizer is used to optimize the semantic segmentation model parameters, where the update formulas of the cross entropy loss function, the Dice loss function, and the Adam optimizer are shown in formulas (11), (12), and (13), respectively: (11) (12) (13) in, is the number of samples, is the true label, is the predicted value, and is the weight coefficient used to balance the two loss functions. For the Wheel parameters, is the learning rate, and They are the first-order moment estimate and second-order moment estimate of the gradient after bias correction, Prevent division by zero for small constants; In step (2-2-7), the decoding module concatenates the global context features processed by the spatial attention mechanism with the underlying high-resolution features obtained by the dilated convolution branch, restores the comprehensive semantic representation to the original resolution of the input image, and generates the final semantic segmentation result, ensuring that the decoding module accurately extracts the boundary and morphological details of the flooded area.
3. A waterlogging detection device for implementing the waterlogging detection method based on a denoising diffusion model under the perspective of urban monitoring as described in any one of claims 1-2, characterized in that: The device includes a monitoring video acquisition module, a time-series image acquisition module, a denoising diffusion module, a waterlogging segmentation module, and a waterlogging spatiotemporal distribution map module, wherein: Surveillance video acquisition module: according to weather forecast information and historical rainfall data, set rainfall threshold, filter the start and end frames of effective rainfall events, and extract and collect urban surveillance videos of different time periods in real time; Time-series image acquisition module: Use formulas to dynamically calculate the image acquisition frequency and extract complete time-series images; De-noising diffusion module: reduces background noise interference of time series images and improves image clarity and water characteristics; Waterlogging segmentation module: Build a waterlogging semantic segmentation model based on the encoding module, backbone network and decoding module, integrate multi-scale information and spatial attention mechanism, and extract the boundaries and morphology of the waterlogged area; Waterlogging spatiotemporal distribution map module: converts waterlogging patches identified from a single viewpoint into world coordinates; spatially aligns and fuses waterlogging patches from multiple viewpoints to obtain a spatiotemporal distribution map of waterlogging within the city’s monitoring range.
