An urban waterlogging prediction method based on a multi-condition guided diffusion model
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING UNIV
- Filing Date
- 2025-11-20
- Publication Date
- 2026-07-21
Smart Images

Figure CN121502224B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to an urban flooding forecasting method based on a multi-condition guided diffusion model, belonging to the field of data processing technology. Background Technology
[0002] Urban flooding is a significant challenge facing urban development. With the increasing severity of global climate change and the frequent occurrence of extreme precipitation events, urban flooding is on the rise. Developing accurate and efficient urban flooding forecasting models has become a research hotspot in the field of hydrological forecasting. Traditional physical process models and hydrodynamic models such as HEC-RAS and Mike's models are complex in structure and require solving two-dimensional shallow water equations, resulting in high computational resource requirements and long computation periods, often requiring hours or even days. This severely limits their practical flooding forecasting potential.
[0003] With the continuous evolution of deep learning frameworks in recent years, end-to-end network models have emerged in large numbers. Traditional data-driven models usually adopt an Encode-Decode framework, such as LSTM or RNN. However, this data-driven approach is essentially a mapping relationship between the learning objective and the training input conditions. Therefore, it has a low probability prediction capability for extreme events. Furthermore, due to the limitations of the end-to-end prediction framework, the flood forecast results are prone to discontinuity and ambiguity, making it difficult to meet the current needs of refined and efficient urban flood forecasting in urban areas.
[0004] Precipitation, as a direct driver of urban flooding, has a profound impact on the inundation process of the underlying surface. However, due to varying levels of development across the world, detailed precipitation data is scarce in underdeveloped urban areas, limiting the application potential of traditional deep learning models and hydrodynamic models in these regions. Faced with the increasing risk of flooding, these areas urgently need efficient and accurate urban flooding prediction solutions. Therefore, adopting urban flooding forecasting models that are not dependent on precipitation data is of paramount practical significance for underdeveloped regions. Summary of the Invention
[0005] Purpose of the invention: To address the problems and shortcomings of existing technologies, this invention provides an urban flooding forecasting method based on a multi-condition guided diffusion model, and constructs an intelligent flooding forecasting model based on the multi-condition guided diffusion model. This aims to solve the problem of the strong dependence of traditional data-driven methods on precipitation data and generate a more realistic and accurate flooding forecast field.
[0006] Technical solution: A method for urban flooding forecasting based on a multi-condition guided diffusion model, comprising the following steps: Step 1: Construct an urban flooding dataset: Collect and simulate individual flooding cases to obtain images of the maximum inundation depth corresponding to each case, empirical precipitation forecast text during flooding, and images of urban spatial topographic attributes; Step 2: Crop the maximum inundation depth image and spatial topography image corresponding to the urban administrative region into regular patch images and normalize them. Preprocess the precipitation experience forecast text of the corresponding inundation cases and convert the text into a vector representation of the diffusion model. Step 3: Forward noise addition process: Input the flooded patch image, and gradually add Gaussian noise information through a Markov chain to gradually transform the original flooded patch into pure random Gaussian noise; Step 4: Reverse denoising process: Randomly extract an image at a certain moment in the noise-adding stage, and input the noise-adding image, along with the corresponding text vector and spatial terrain image, into the U-Net noise prediction module to predict the noise added to the current image; Step 5: Compare the error between the noise predicted by U-Net and the noise added to the image, and train and optimize the U-Net model. Step 6: Repeat steps 3-5 until the U-Net model training is converged. Then, perform a diffusion prediction test by comparing the images generated by the multi-condition guided model with the labeled samples. The test process fully examines the model's generalization ability and the text condition guidance effect.
[0007] Preferably, in step 1, the empirical forecast text for precipitation during the flooding period includes: a description of the temporal variation of precipitation, the spatial location of the maximum precipitation intensity, and a description of the spatial location of the cumulative maximum precipitation. The text does not contain any numbers. The urban spatial topographic image includes: upstream catchment area distribution, digital elevation distribution, slope distribution, building height distribution, longitude relative position code, latitude relative position code, and land cover type distribution.
[0008] The longitude-relative position encoding and latitude-relative position encoding encode the longitude and latitude information of the pixels in each patch into a relative position encoding relative to the longitude and latitude range of the entire urban area, that is, encode the longitude and latitude information into the [0-1] interval, so that the input normalization operation is consistent with the other spatial information.
[0009] Preferably, in step 2, the cropping is a regular patch image, specifically: using a square mask of a specified size, a sliding cropping is performed on the image of the maximum flooding depth of the administrative region or the spatial topographic image, and the patch is required to cover an area with at least 20% non-permanent water bodies.
[0010] Preferably, the step of converting text into a vector representation of a diffusion model specifically involves: using a word segmenter of a multimodal model pre-trained with Contrastive Language-Image Pre-training (CLIP) to split natural language text into word unit structures, and then assigning these structures to the Text Encoder of the CLIP model to ultimately generate a vector representation of the text.
[0011] Preferably, in step 3, the forward noise addition process is simulated by using a Markov chain to represent the gradual accumulation of noise, i.e., at the previous time step, the noise in the graph x... t-1 Based on this, the image x at the current time is obtained. t ; At time step t, based on the image at time t-1, the conditional probability distribution of the image at time t is obtained, which follows a Gaussian distribution with a mean of . Its variance is ,satisfy: in, It belongs to a given noise figure, and it increases with the increase of the time step, while This represents the identity matrix. This represents the conditional probability distribution of the diffusion process from time t-1 to time t, the function. This means that the process follows a Gaussian distribution.
[0012] Preferably, in step 3, the noise-adding forward process involves progressively adding Gaussian noise to the input original image, ultimately representing the image's distribution at time t as follows: + , in, This represents the random noise added at time t-1, while and The intermediate state variable, as defined, can be obtained through the derivation process. =1- , Ultimately, the derivation process yields the following result. New expression: + Preferably, in step 4, the noise prediction model U-Net model is used, which employs a multi-layer cross-modal attention mechanism for text information injection and a convolutional module.
[0013] Preferably, the step of inputting the spatial terrain image into the U-Net noise prediction module specifically involves: concatenating the regular patch image cropped from the spatial terrain image with the noise image along the channel dimension, and inputting them together into the U-Net denoising prediction network. In the first convolutional layer of the network, all channels are linearly mixed into features. These features are then processed through residual blocks, normalized modulation, skip connections, and multi-scale upsampling and downsampling, finally outputting a projection. The same shape noise prediction map.
[0014] In summary, the input to the denoising U-Net network includes: text vector embeddings generated by the CLIP tokenizer and text encoder, time-step embeddings generated by sine coding and fully connected mapping, and noise-added graphics. The image information includes spatial field information. Text embedding, temporal step embedding, and the noisy image are coordinated through a cross-attention module. The noisy image is set as the query vector Q, and key-value pairs (K / V) are generated using text embedding. K represents the matrix of key projections of the text embedding vectors, and V represents the projection of the values of the text embedding vectors. Finally, a multi-head attention mechanism is used to calculate feature weights, which are then output to a softmax layer for normalization, thereby matching information from different modalities. The formula used for normalization in the softmax layer is shown below: in It is the dimension of K, and its purpose is to reduce the variance of the dot product so that the gradient of the training is updated stably.
[0015] The aforementioned text embedding, temporal step embedding, noisy image, and regular patch image cropped from spatial terrain image will be injected into the U-Net network. After multiple block layers such as upsampling and downsampling, the difference between predicted noise and actual noise will be continuously reduced through the mean squared error loss function.
[0016] Preferably, in step 5, the predicted flooding depth image is compared with the labeled flooding depth image, and the error value between the predicted noise and the actual noise is calculated. The formula uses the mean squared error: in, This represents the noise added at the corresponding moment during the noise-adding process, while This represents the noise at the current moment, and N represents the total number of samples participating in the entire process. represents the noisy image of the i-th sample at time step t. cond represents the input conditions: the corresponding flooded spatial terrain patch, the flooded event text embedding, and the noisy flooded image. These three are effectively integrated into the guiding conditions in the network model architecture.
[0017] Preferably, during the training of the denoising network model, a certain conditional dropout rate is set, that is, the model's unconditional guidance and conditional guidance capabilities are trained simultaneously. In the denoising prediction stage, the tendency and diversity of the generated images can be controlled by parameters. When the control parameters tend to be unconditionally guided, more uncertain results are easily generated, while when the control parameters tend to be conditionally guided, the generated results are more fixed and conditionally biased.
[0018] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the urban flooding forecasting method based on a multi-condition guided diffusion model as described above.
[0019] A computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implements the steps of the urban flooding forecasting method based on a multi-condition guided diffusion model as described above.
[0020] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: (1) It can achieve high-precision forecasting of urban flooding without the need to use precipitation data, thus reducing the strong dependence on precipitation data; (2) The invention effectively integrates human experience forecasting information into model prediction, which will be of great benefit to the prevention and control of urban flooding in southern cities around the world. Attached Figure Description
[0021] Figure 1 This is a flowchart of a method according to an embodiment of the present invention; Figure 2 This is a CSI scoring effect diagram of a specific case in Nanchang city implemented according to the present invention; Figure 3 This is a diagram illustrating the RMSE scoring effect of a specific case in Nanchang city, based on the implementation of this invention. Figure 4 This is a schematic diagram illustrating the effect of an embodiment of the present invention in a specific case in Nanchang city. Detailed Implementation
[0022] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. After reading the present invention, any modifications of the present invention in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.
[0023] like Figure 1As shown, a method for predicting urban flooding based on a multi-condition guided diffusion generation model includes the following steps: Step 1: Simulate the flood process of 67 cities using a hydrodynamic model to obtain the maximum inundation depth for each case, and obtain the spatial distribution description and temporal variation description of precipitation during each case. These are then standardized into a fixed-format text description. Finally, using high-resolution topography, soil, and urban building data, extract the topography, slope, urban building height, upstream catchment area, and land cover type of the urban area, and standardize them to [0-1]. The latitude and longitude information is then encoded for relative position.
[0024] Step 2: The maximum flooding depth image of the urban administrative area and the urban terrain spatial graphics are cropped to a uniform patch size. During the cropping process, a sliding window is used with a sliding interval of 3 pixels and the patch size is set to 32*32. The pre-trained CLIP multimodal model's word segmenter and text encoder are used to encode the text description corresponding to the flooding event into a vector representation that the model can accept. Step 3, forward noise addition process: Input the flooding depth image, and gradually add Gaussian noise to the original flooding depth image in the form of a Markov chain. This step consists of 1000 steps in total.
[0025] Step 4, reverse denoising process: randomly extract the time image of the noise addition process, inject the corresponding conditional text and terrain spatial graphic conditions into the trained U-Net model, and predict the noise in the currently added image.
[0026] Step 5: Calculate the mean square error between the noise predicted by the U-Net network model and the noise actually added to the image, and use this as the loss function for convergence training.
[0027] Step 6: Repeat steps 3, 4, and 5 until 100 epochs have elapsed or the model has reached convergence and stability. All submerged cases will be divided into training data and validation data, and a 5-fold crossover experiment will be conducted to test the model's generalization ability and stability.
[0028] Specifically, in this embodiment, the flooding simulation data used in step 1 was obtained using the LISFLOOD hydrodynamic model, encompassing 67 high-impact flooding cases in Nanchang city between 2020 and 2024. Topographic and building data were selected from open-source and validated datasets with resolutions between 10 and 25 meters. All spatial data were uniformly projected to the same coordinate system and resolution. Before being input into the model, all spatial information underwent normalization and standardization processing.
[0029] In this embodiment, the text description used is in English, specifically: "Multiple short-duration heavy rainfall events occurred, spaced one day to a few hours apart. The main rainfall centers were concentrated in the southeastern area, with rainfall decreasing from southeast to northwest." This type of text information contains the temporal changes and spatial distribution characteristics of precipitation. The text does not contain any numerical information and completely simulates the forecast scenario predicted by forecasters in real-world situations.
[0030] In this embodiment, the text-to-vector conversion tool used is the word segmenter and text encoder of the CLIP multimodal model, which maps the text into a 768-dimensional vector. The vectors converted from different texts have large differences in the vector space, and the multimodal CLIP model represents the pairing unity of text and image. Therefore, this difference ensures that the differences in information represented by the text description can reflect the differences in image information, thereby completing the conditional guidance of the model vector prediction process.
[0031] Furthermore, in step 3, the forward noise addition process involves image noise reduction, which simulates a Markov chain process. In this embodiment, at time step t, based on the image at time t-1, the conditional probability distribution of the current image at time t is obtained, which satisfies a Gaussian distribution with a mean of . Its variance is ,satisfy: in, It belongs to a given noise figure, and it increases with the increase of the time step, while This represents the identity matrix. This represents the conditional probability distribution of the diffusion process from time t-1 to time t, the function. This means that the process follows a Gaussian distribution.
[0032] In step 3, the noisy forward pass is a process of progressively adding Gaussian noise to the input original image, ultimately representing the image's distribution at time t as follows: + , in, This represents the random noise added at time t-1, while and The intermediate state variable, as defined, can be obtained through the derivation process. =1- , Finally, the derivation process can be used to obtain... New expression: + In step 4, the noise prediction model U-Net is used. This model employs a Down, mid, Up structure and a skip-connection structure for stitching local and global scale information. It also utilizes a multi-layer cross-modal attention mechanism for text information injection and a convolutional module. The spatial terrain image is input into the U-Net noise prediction module.
[0033] Specifically, the spatial image patch and the noisy image are concatenated along the channel dimension and then fed together into the U-Net denoising prediction network. In the first convolutional layer of the network, all channels are linearly mixed into features. These features are then processed through residual blocks, normalized modulation, skip connections, and multi-scale upsampling and downsampling, finally outputting a projection. The same shape noise prediction map.
[0034] The input to the denoising U-Net network includes: text vector embeddings generated by CLIP tokenizer and text encoder, time-step embeddings generated by sine coding and fully connected mapping, and noise-added graphics. The image information includes the spatial field after channel-dimensional stitching. Text embedding, temporal step embedding, and the noisy image are coordinated through a cross-attention module. The noisy image is set as the query vector Q, and key-value pairs (K / V) are generated using text embedding. K represents the matrix of key projections of the text embedding vector, and V represents the projection of the values of the text embedding vector. Finally, a multi-head attention mechanism is used to calculate feature weights, which are then output to a softmax layer for normalization, thereby matching information from different modalities. The formula used is shown below: in It is the dimension of K, and its purpose is to reduce the variance of the dot product so that the gradient of the training is updated stably.
[0035] The aforementioned text injection features, temporal coding features, noisy images, and image guidance features will be injected into the U-Net network. After passing through multiple block layers such as upsampling and downsampling, the difference between predicted noise and actual noise will be continuously reduced through the mean squared error loss function.
[0036] In specific step 5, the predicted flooding depth image is compared with the labeled flooding depth image to calculate the error value between the predicted noise and the actual noise. The formula uses the mean squared error: in, This represents the noise added at the corresponding moment during the noise-adding process, while represents the noise at the current moment, and N represents the total number of samples participating in the entire process. cond represents the input conditions: corresponding to the flooded spatial terrain patch, the flooded event text embedding, and the noisy flooded image. These three are effectively integrated into the guiding conditions in the network model architecture.
[0037] Preferably, during the training of the denoising network model, a certain conditional dropout rate is set, that is, the model's unconditional guidance and conditional guidance capabilities are trained simultaneously. In the denoising prediction stage, the tendency and diversity of the generated images can be controlled by parameters. When the control parameters tend to be unconditionally guided, more uncertain results are easily generated, while when the control parameters tend to be conditionally guided, the generated results are more fixed and conditionally biased.
[0038] Specifically, in step 6, the training process repeats steps 3, 4, and 5 until 100 epochs or convergence is achieved. All flooded cases are divided into training and validation data, and a 5-fold crossover experiment is conducted to test the model's generalization ability and stability. We also conducted text ablation comparison experiments, revealing the crucial role of precipitation forecast information in the text. Simultaneously, we input some erroneous information into the text, and the results showed a certain decline in the model's simulation performance, demonstrating the forecasting potential of our text-guided urban flooding model in following changes in the forecast text.
[0039] The flooding forecast score under the method in this embodiment is as follows: Figure 2-3 As shown, the flood forecast performance in Xihu District, Nanchang, is illustrated under different thresholds. It can be seen that the best performance is achieved under full-condition guidance (highest CSI and lowest RMSE). However, the forecast performance drops significantly after removing text guidance, demonstrating the substantial effect of precipitation text forecasts in flood forecasting. Introducing some erroneous information also leads to a decrease in the predicted inundation effect, reflecting the ability of the diffusion forecast model to accurately follow changes in text-based forecast information. The worst flood forecast performance occurs after removing topographic spatial information, showcasing the guiding role of urban spatial topography in flood forecasting. Figure 4 The diagram shows the effect of urban flooding simulation under full-condition guidance. It can be seen that the flooding simulation reproduces the range and depth of the true value very well. The yellow areas (false alarms) and red areas (missed alarms) are very few, and the urban flooding forecast model demonstrates a strong ability to capture details under text guidance.
[0040] Obviously, those skilled in the art should understand that the steps of the urban flooding forecasting method based on a multi-condition guided diffusion generation model in the above embodiments of the present invention can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by the computing device. Furthermore, in some cases, the steps shown or described can be performed in a different order than presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of the present invention are not limited to any particular hardware and software combination.
Claims
1. A method for predicting urban flooding based on a multi-condition guided diffusion model, characterized in that, Includes the following steps: Step 1: Construct an urban flooding dataset: Collect and simulate individual flooding cases to obtain images of the maximum inundation depth corresponding to each case, empirical precipitation forecast text during flooding, and urban spatial topography images; Step 2: Crop the maximum inundation depth image and spatial topography image corresponding to the urban administrative region into regular patch images and normalize them. Preprocess the precipitation experience forecast text of the corresponding inundation cases and convert the text into a vector representation of the diffusion model. Step 3: Forward noise addition process: Input the patch image of the image with the maximum flooding depth, and gradually add Gaussian noise information through a Markov chain to gradually transform the original patch image into an image with pure random Gaussian noise added; Step 4: Reverse denoising process: Randomly extract an image at a certain moment in the noise-adding stage, and input the noise-adding image, along with the corresponding text vector and spatial terrain image, into the U-Net noise prediction module to predict the noise added to the current image; Step 5: Compare the error between the noise predicted by U-Net and the noise added to the image, and train and optimize the U-Net model. Step 6: Repeat steps 3-5 until the U-Net model training is converged. Then, perform a diffusion prediction test by comparing the images generated by the multi-condition guided model with the labeled samples. The test process fully examines the model's generalization ability and the text condition guidance effect. In step 3, the forward noise addition process uses a Markov chain to simulate the gradual accumulation of noise, that is, in the previous time step, the graph x... t-1 Based on this, the image x at the current time is obtained. t ; At time step t, based on the image at time t-1, the conditional probability distribution of the image at time t is obtained, which follows a Gaussian distribution with a mean of . Its variance is ,satisfy: in, It belongs to a given noise figure, which increases with the increase of the time step, while This represents the identity matrix. This represents the conditional probability distribution of the diffusion process from time t-1 to time t, the function. This means that the process follows a Gaussian distribution; In step 3, the noisy forward pass is a process of progressively adding Gaussian noise to the input original image, ultimately representing the image's distribution at time t as follows: + , in, This represents the random noise added at time t-1, while and The intermediate state variable is defined and obtained from the derivation process. =1- , Ultimately, the derivation process yields... New expression: + 。 2. The urban flooding forecasting method based on a multi-condition guided diffusion model according to claim 1, characterized in that, In step 1, the empirical forecast text for precipitation during the flooding period includes: a description of the temporal variation of precipitation, the spatial location of the maximum precipitation intensity, and a description of the spatial location of the cumulative maximum precipitation. The text does not contain any numbers. The urban spatial topographic image includes: upstream catchment area distribution, digital elevation distribution, slope distribution, building height distribution, longitude relative position code, latitude relative position code, and land cover type distribution.
3. The urban flooding forecasting method based on a multi-condition guided diffusion model according to claim 1, characterized in that, In step 2, the cropping is a regular patch image, specifically: using a square mask of a specified size, a sliding cropping is performed on the image of the maximum flooding depth of the administrative region or the spatial topographic image. The patch is required to cover an area with at least 20% non-permanent water bodies.
4. The urban flooding forecasting method based on a multi-condition guided diffusion model according to claim 1, characterized in that, The process of converting text into a vector representation of a diffusion model involves: using a CLIP-pretrained multimodal model's word segmenter to split natural language text into word unit structures, and then assigning these structures to the CLIP model's Text Encoder to ultimately generate a vector representation of the text.
5. The urban flooding forecasting method based on a multi-condition guided diffusion model according to claim 1, characterized in that, In step 4, the noise prediction model U-Net is used, which employs a multi-layer cross-modal attention mechanism for text information injection and a convolutional module. The spatial terrain image and the noisy image are input together into the U-Net noise prediction module. Specifically, the patch image of the spatial terrain image and the noisy image are concatenated along the channel dimension and input together into the U-Net denoising prediction network. In the first convolutional layer of the network, all channels are linearly mixed into features. These features are then processed through residual blocks, normalized modulation, skip connections, and multi-scale upsampling and downsampling, finally outputting a projection. The same shape noise prediction map; The input to the denoising U-Net network includes: text vector embeddings generated by CLIP tokenizer and text encoder, time-step embeddings generated by sine coding and fully connected mapping, and noise-added graphics. The text vector embedding and temporal step embedding are coordinated with the noisy image through a cross-attention module. The noisy image is set as the query vector Q, and key-value pairs K / V are generated using text embedding, where K represents the matrix of key projections of the text embedding vectors, and V represents the projection of the values of the text embedding vectors. Finally, a multi-head attention mechanism is used to calculate feature weights, which are then output to a softmax layer for normalization, thereby matching information from different modalities. The formula used is shown below: in It is the latitude of K.
6. The urban flooding forecasting method based on a multi-condition guided diffusion model according to claim 1, characterized in that, In step 5, the noise predicted based on U-Net is compared with the noise added to the image to calculate the error between the predicted noise and the actual noise. The formula uses the mean squared error: in, This represents the noise added at the corresponding moment during the noise-adding process. represents the noise at the current moment, N represents the total number of samples participating in the entire process; cond represents the input conditions: the patch image corresponding to the flooded spatial terrain, the text vector embedding of the flooding event, and the noisy flooded image. These three are integrated into the guiding conditions in the network model architecture. During the training of the denoising network model, a conditional dropout rate is set, which means that the model's unconditional guidance and conditional guidance capabilities are trained simultaneously. In the denoising prediction stage, the tendency and diversity of generated images are controlled by parameters. When the control parameters tend to be unconditional guidance, more uncertain results are easily generated, while when the control parameters tend to be conditional guidance, the generated results are more fixed and conditionally biased.
7. A computer device, characterized in that: The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the urban flooding forecasting method based on the multi-condition guided diffusion model as described in any one of claims 1-6.
8. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that: When the computer program / instruction is executed by the processor, it implements the steps of the urban flooding forecasting method based on the multi-condition guided diffusion model as described in any one of claims 1-6.