A two-stage nowcasting method based on EOF-Kmeans clustering and LDM
Through the two-stage method of EOF-Kmeans clustering and potential diffusion model, the problems of waste of computing resources and uneven prediction in large-scale meteorological data processing are solved, efficient rainfall space-time prediction is achieved, and the accuracy and stability of prediction are enhanced. .
Patent Information
- Application Number
- CN202410924548.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-07-11
AI Technical Summary
The prior art wastes serious computing resources when processing large-scale meteorological data, making it difficult to accurately predict precipitation location and intensity on small time and spatial scales, especially in cases where locality such as convective precipitation is strong.
Using a two-stage proximity precipitation forecast method combining EOF-Kmeans clustering and potential diffusion model (LDM), the precipitation area is identified through dimensionality reduction processing and clustering, and the frame-by-frame variational automatic encoder and time diffusion model are trained, and combined with SR3 architecture reconstruction High-resolution radar precipitation images to achieve time and space prediction of rainfall.
It improves computing efficiency, reduces waste of computing resources, enhances the spatial dimension integrity of prediction, solves the performance imbalance between time and spatial modeling, and improves the accuracy and stability of rainfall prediction.
Smart Images

Figure CN118465876B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a two-stage nowcasting method based on EOF-Kmeans clustering and LDM, belonging to the technical field of short-term precipitation forecasting. Background Art
[0002] Nowcasting of precipitation plays a key role in responding to natural disasters such as floods and landslides, ensuring infrastructure safety, as well as agricultural production and hydropower generation. Although numerical weather prediction models can provide predictions of precipitation probability and intensity over a wider geographical range, predictions at small temporal and spatial scales are still challenging. This is mainly because these models require a large amount of observational data and take some time to absorb this data, especially in the case of strong localization such as convective precipitation. It is difficult for the model to accurately predict the specific location and intensity of precipitation.
[0003] Over the past decade, with the increasing amount of spatiotemporal observation data on the Earth, data-driven prediction models using deep learning techniques have become possible. Deep neural networks combined with generative networks can learn the complex characteristics of precipitation distribution, thereby generating more realistic and accurate rainfall scenarios. Although these models can provide accurate predictions, their training costs are often high, especially in adversarial training, and they also consume a lot of computing resources. Rainfall prediction has significant similarities with video prediction, both of which require models to capture spatiotemporal information to achieve accurate predictions. One of the biggest challenges in processing and generating high-resolution long videos is the lack of computing resources, which means that it is necessary to find efficient algorithms and optimization methods to process these large-scale data and ensure the accuracy and reliability of the predictions. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM, which can maintain good computing efficiency when processing large-scale meteorological data, reduce the waste of computing resources, and solve the performance imbalance problem between time and space modeling.
[0005] The present invention adopts the following technical solutions to solve the above technical problems:
[0006] A two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM includes the following steps:
[0007] Step 1, collecting radar precipitation image data sets, and preprocessing them to obtain preprocessed image data sets;
[0008] Step 2: Use the empirical orthogonal function analysis method to reduce the dimension of each radar image in the preprocessed image data set, and use the Kmeans clustering method to cluster the reduced-dimensional radar images to identify precipitation and non-precipitation areas in the images;
[0009] Step 3, using the preprocessed image dataset to train a frame-by-frame variational autoencoder to encode the input image from pixel space to latent space and decode it back to pixel space;
[0010] Step 4, using the clustering results of step 2 to train a time diffusion model for predicting future precipitation conditions at low resolution based on known radar precipitation images, and obtaining a low-resolution radar precipitation image;
[0011] Step 5: Based on the frame-by-frame variational autoencoder trained in step 3, the clustering result of step 2 is used to train a combination of a latent diffusion model and an SR3 architecture, namely a spatial diffusion model, which is used to reconstruct the low-resolution radar precipitation image into a high-resolution radar precipitation image.
[0012] Step 6: Use the trained time diffusion model and space diffusion model to perform precipitation forecasting.
[0013] As a preferred solution of the present invention, in step 1, the collected radar precipitation data set is preprocessed by logarithmic transformation, and the formula is as follows:
[0014] ,
[0015] in, represents the precipitation intensity, represents the result of logarithmic transformation.
[0016] As a preferred solution of the present invention, in step 2, the dimensionality reduction process is performed on each radar image in the preprocessed image data set using the empirical orthogonal function analysis method, specifically:
[0017] First, the image data matrix corresponding to the preprocessed radar image Convert to a normalized matrix :
[0018] ,
[0019] In the formula, and denote the mean and standard deviation respectively;
[0020] Next, according to the standardized matrix Calculate the covariance matrix :
[0021] ,
[0022] In the formula, is the number of samples of radar image, for The transposed matrix of
[0023] Finally, the covariance matrix Perform eigendecomposition to obtain several eigenvalues and corresponding eigenvectors, sort the eigenvalues from large to small, start from the largest eigenvalue, and select the first The eigenvectors corresponding to the eigenvalues form a new eigenspace, and the standardized matrix Project to the new feature space to obtain the reduced-dimensional image data matrix :
[0024] ,
[0025] In the formula, For selected The new feature space is composed of the eigenvectors corresponding to the eigenvalues.
[0026] As a preferred solution of the present invention, in step 2, the Kmeans clustering method is used to cluster the radar image after dimensionality reduction to identify precipitation and non-precipitation areas in the image, specifically:
[0027] Randomly select a pixel as the first centroid, calculate the distance between the remaining pixels and the first centroid, select the second centroid using weighted probability distribution, calculate the distance between the remaining pixels and the nearest centroid among all the selected centroids, select the third centroid using weighted probability distribution, and so on, until the centroid;
[0028] Assign each pixel point to the centroid closest to each pixel point to form a cluster, calculate the new centroid of the cluster, and determine whether the new centroid is the same as the original centroid of the corresponding cluster. If they are the same, keep the centroids different. If they are different, replace the original centroid with the new centroid. Repeat the process of calculating the new centroid and determining whether it is the same as the original centroid until the preset number of iterations is reached and clustering is completed.
[0029] As a preferred solution of the present invention, in step 3, the frame-by-frame variational autoencoder includes an encoder and a decoder, the encoder includes a two-dimensional convolutional neural network, a residual module, a downsampling layer and a self-attention module connected in sequence, and the decoder includes a two-dimensional convolutional neural network, a self-attention module, a residual module and an upsampling layer connected in sequence;
[0030] The loss function used to train the frame-by-frame variational autoencoder is the sum of the pixel-level loss function and the KL regularization loss function, that is:
[0031] ,
[0032] In the formula, represents the pixel-level loss function, is the total number of pixels, Respectively The predicted and true values of pixels. represents the KL regularization loss function, Indicates The variance of pixels, Indicates the The mean value of pixels, Represents latent variables The prior probability distribution of Indicates that given data Latent variables The approximate distribution of .
[0033] As a preferred solution of the present invention, in step 4, by using the known first to fourth frames of low-resolution radar precipitation images, a time diffusion model is trained to predict the fifth to twentieth frames of low-resolution radar precipitation images;
[0034] During the training process, noise is added to the fifth to twentieth frames of low-resolution radar precipitation images to be predicted, and the first to fourth frames of radar precipitation images are merged with the fifth to twentieth frames of low-resolution radar precipitation images after adding noise as conditional dependencies, and input into U-net. Time steps are embedded in each residual layer of U-net, and the noise added to the image is predicted by U-net, and finally a trained time diffusion model is obtained.
[0035] As a preferred solution of the present invention, in step 5, the high-resolution radar precipitation image is encoded into the latent space using the encoder in the trained Frame-wise VAE to obtain the latent code, noise is added to the latent code, the low-resolution radar precipitation image is combined with the latent code with the added noise as a conditional dependency, and the image is input into the U-net, and the time step is embedded in each residual layer of the U-net. The noise added in the latent code is predicted by the U-net, and finally the trained spatial diffusion model is obtained.
[0036] As a preferred solution of the present invention, in step 6, the first to fourth frames of radar precipitation images are combined as conditional dependencies with random Gaussian noise, and used as input of the trained time diffusion model, and the fifth to twentieth frames of low-resolution radar precipitation images with noise are output, and the predicted fifth to twentieth frames of low-resolution radar precipitation images are obtained by denoising;
[0037] The fifth to twentieth frames of low-resolution radar precipitation images are combined with random Gaussian noise as conditional dependencies and used as the input of the trained latent diffusion model. The noisy latent code is output and the latent code is obtained by denoising. The latent code is decoded by the decoder in the trained Frame-wise VAE to obtain the fifth to twentieth frames of high-resolution radar precipitation images.
[0038] A computer device comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, the steps of the two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM are implemented.
[0039] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM are implemented.
[0040] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:
[0041] 1. The present invention utilizes the EOF-Kmeans clustering algorithm to help extract features representing different weather conditions from radar images and classify them into specific weather types, such as storms, precipitation areas, or clear skies, thereby reflecting the latest weather conditions.
[0042] 2. The present invention applies the latent diffusion model (LDM) to short-term forecasting, which can maintain high computing efficiency, reduce computing costs, and reduce waste of computing resources when processing large-scale meteorological data.
[0043] 3. The present invention decomposes the spatiotemporal rainfall prediction task into a time model and a space model, retaining spatial information while capturing robust time information, enhancing the spatial dimension integrity of the prediction, and being able to more accurately predict the time of future rainfall, thus solving the performance imbalance problem between time and space modeling.
[0044] 4. The present invention integrates the SR3 architecture to combine the low-definition image as a conditional dependency and the latent code after adding noise, and then inputs it into the U-net to predict the noise, which greatly improves the stability of the model and reduces the mode collapse phenomenon during training. The autoregressive property means that the output of each step directly depends on the result of the previous step, which makes the entire generation process more efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1It is a flow chart of the two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM of the present invention;
[0046] Figure 2 It is a schematic diagram of the EOF-Kmeans clustering algorithm of the present invention;
[0047] Figure 3 It is a schematic diagram of the Frame-wise VAE model training process of the present invention;
[0048] Figure 4 It is the time-space prediction task decomposition diagram of the present invention;
[0049] Figure 5 It is the U-net prediction noise map of the present invention;
[0050] Figure 6 It is a schematic diagram of the time diffusion model of the present invention;
[0051] Figure 7 It is a schematic diagram of the spatial diffusion model of the present invention. DETAILED DESCRIPTION
[0052] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.
[0053] like Figure 1 As shown, the present invention proposes a two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM, and the specific steps are as follows:
[0054] S1 collects radar precipitation forecast data sets and performs preprocessing.
[0055] The dataset is divided into training, validation and test sets, and all data for each date are completely assigned to only one of these three sets. This is done to reduce the temporal proximity of the dataset and thus reduce correlation. About 10% of the data is assigned to the validation set and about 10% to the test set. The final evaluation uses samples from each test set. Each image in the dataset is divided into The pixel blocks are sampled and the 99th percentile Rm of the rainfall rate is calculated for each small block (representing a soft maximum that is less sensitive to outliers). When generating training, validation, and test samples, instead of uniformly sampling the dataset, pixel blocks are sampled so that the model sees rainfall from different precipitation intensities. R Each block is assigned to 11 different bins according to the value of Rm, where the first bin is , the last bin is , and the rest in The bins are spaced logarithmically. Sample from these bins with equal probability to generate training samples. Before the samples are input into the model, they are preprocessed with logarithmic transformation, as follows:
[0056] ,
[0057] exist The discontinuity at helps the model distinguish more clearly between raindrops and non-raindrops, but it can produce artifacts in the generated model. To mitigate this and other artifacts in the input data, anti-aliasing is performed on the samples with a Gaussian filter with a standard deviation of 0.5 pixels.
[0058] S2 Figure 2 As shown, clustering is performed using the EOF-Kmeans clustering algorithm to identify common weather patterns.
[0059] s21 inputs the preprocessed radar image into EOF for dimensionality reduction, aiming to reduce the complexity of the data while retaining the most important information. For the preprocessed radar image, the dimensionality reduction process of the empirical orthogonal function analysis method (EOF) starts from converting the image data matrix We start by converting the dataset into a normalized dataset where each original image pixel is considered a feature. This step involves calculating the mean of each feature. and standard deviation , and use these values to transform the data matrix to ensure that all features have zero mean and unit variance:
[0060] ,
[0061] Standardized data To calculate the covariance matrix . Covariance matrix It is a square matrix representing the linear relationship between features, which can be obtained by the following formula:
[0062] ,
[0063] in, is the number of radar image samples, yes The transposed matrix of . Then the covariance matrix Perform eigendecomposition to obtain a series of eigenvalues and corresponding eigenvectors , the eigenvalues are sorted from large to small, and the eigenvectors are arranged according to the corresponding eigenvalues. These eigenvectors define the direction of the data in the new coordinate system, and the eigenvalues represent the variance in each direction. Select the largest The eigenvectors corresponding to the eigenvalues form a new feature space, which represents the most important features of the original data. Project the standardized data onto this feature vectors, forming a reduced-dimensional dataset , the formula is as follows:
[0064] ,
[0065] in, Contains the selection The matrix of eigenvectors, is the transformed data matrix.
[0066] S22 randomly selects a cluster centroid among the data points , for each data point that has not yet been selected ,calculate ,Right now The distance between the nearest centroid already selected. Use the weighted probability distribution to randomly select a new data point as the new center and repeat the above steps until a new centroid is selected. Centers .
[0067] S23 In each iteration of EOF-Kmeans, if a data point For a certain centroid than its distance to another centroid If the distance is far, then it can be ignored. arrive If ,So . is the distance between the two centroids, which is a constant for all data points in an iteration and can be pre-calculated and stored. is less than twice ,Right now , we can directly derive .
[0068] S24 assigns data points to the nearest cluster centroids to form clusters. Then the new cluster centroids are calculated. ,like , then update the centroid to , otherwise keep the centroid unchanged. Repeat the above steps until the iteration reaches the maximum value, and output the clustering result after convergence.
[0069] S3 Figure 3As shown, a frame-wise variational autoencoder (Frame-wise VAE) is trained to encode samples from pixel space to a continuous latent space and then decode them back to pixel space. The encoder and decoder parts of the Frame-wise VAE are constructed as three-dimensional convolutional networks, where each layer consists of a resnet-type residual block and a downsampling (encoder) or upsampling (decoder) convolution layer. Between the encoder and decoder stages, regularizing the Frame-wiseVAE latent space with the Kullback-Leibler (KL) divergence between the latent variables and the multivariate standard normal distribution variables can encode the data into a low-dimensional latent space. Use pixel-level loss and KL divergence to train a Frame-wise VAE. The formula is as follows:
[0070] ,
[0071] in, is the total number of pixels, The model predicts The value of pixels, It is The pixel-level loss function can be used to train the image reconstruction model to generate output images similar to the input images. Specifically, the encoder is trained A data frame Encoded as a latent representation .Decoder Learning to reconstruct the data frame from the encoded latent data .Will Expressed as , which means encoding the frame sequence in pixel space into a potential spatiotemporal sequence. Represents decoding a potential spatiotemporal sequence.
[0072] The encoder of Frame-wise VAE takes an input frame Encoded as a potential The decoder of Frame-wise VAE converts a latent Decode back to a frame in pixel space . Is has The kernel is a two-dimensional convolutional layer. GroupNorm32 is a group normalization (GN) layer with 32 groups. SiLU is a sigmoid linear unit activation layer with the function Then the self-attention layer is used to first map the input to the queries Q, keys K and values V of the three linear layers, and then perform the self-attention operation. The formula is: .
[0073] S4 decomposes the rainfall spatiotemporal prediction task into a time diffusion model and a space diffusion model. The present invention captures the key spatiotemporal information in the input sequence and uses the input of four conditional frames (20 minutes) to accurately predict the rainfall scenario for the next 16 frames (80 minutes). Figure 4 As shown in the figure, the first model focuses on capturing and analyzing temporal features based on the diffusion model (DM) framework to accurately predict the timing of future rainfall at low resolution. In order to enhance the spatial dimension integrity of the prediction, the second model combines the latent diffusion model (LDM) and the SR3 architecture to reconstruct low-resolution radar images into high-resolution radar images.
[0074] In the prediction stage, S41 constructs a temporal diffusion model based on the diffusion model (DM) to accurately capture the input temporal information and predict future rainfall scenarios with low resolution while retaining a certain degree of spatial information.
[0075] like Figure 6 As shown, a specific low-resolution time diffusion model is used to predict future precipitation conditions based on N ( ) frame, predict the next M ( ) frame. The prediction diffusion model (denoted as ) is a 3D convolutional neural network that aims to generate 16 frames Low-resolution radar imagery. The input involves a sequence of four radar frames , add noise to the 16 frames to be predicted, The frame radar image is used as a conditional dependency and M after adding noise ( ) frame low resolution rainfall result Make a merge and then use U-net to predict the noise (expressed as ). Using L1 loss for training, loss The calculation formula is as follows:
[0076] ,
[0077] The U-net network structure is as follows Figure 6As shown in the figure, by inputting a noisy radar image, the noise added to each image is predicted. The left half is the downsampling process, that is, the encoding process, which includes multiple consecutive downsampling steps, and the spatial resolution gradually decreases with depth. The right half is the upsampling process, that is, the decoding process, and the spatial resolution gradually increases. The residual connection retains the high-resolution information extracted during the downsampling process and passes it to the corresponding upsampling layer to avoid the problem of pixel distortion during upsampling. Between the downsampling and upsampling of U-net, an intermediate layer Mid is added to ensure that information is effectively transmitted during the encoding and decoding process. The role of Timestep Embedding is to embed the information into the image at each time step. The encoding method is embedded into each residual layer. By introducing the time step Simulate a disturbance that gradually increases over time. Each time step represents a perturbation process that gradually changes the distribution of the image by applying noise multiple times, starting from the initial state. represents a weaker noise disturbance, while a larger Represents a stronger noise disturbance.
[0078] S42 Constructing conditional diffusion in latent space
[0079] In the latent diffusion model, the forward diffusion process starts from an initial latent state and gradually adds noise until a random state with a Gaussian distribution is reached. , the formula is as follows:
[0080] ,
[0081] At every step , potential state Transformed into a new latent state by adding noise . Defined as The process of adding Gaussian noise can be specifically expressed as:
[0082] ,
[0083] in, is a predetermined noise level parameter that increases gradually over time to ensure Gradually approaching Gaussian noise distribution, is the noise sampled from a standard normal distribution.
[0084] By training the conditional LDM, predictions are generated in the obtained latent space, transforming the high-definition radar image Input to Frame-wise VAE encoder , encoded into the learned latent space The formula as conditional dependency is as follows:
[0085] ,
[0086] Potential predictive factors The conditional distribution of Decompose and parameterize, the formula is as follows:
[0087] ,
[0088] in, , by equivalent parameterization, the latent diffusion model learns to match the time steps The transition noise .
[0089] exist and Under the given conditions, are the sampled radar image sequence and target sequence data pairs.
[0090] In the reconstruction phase, S43 builds a spatial diffusion model based on the latent diffusion model (LDM) and SR3 architecture to reconstruct low-resolution images into high-resolution images, improving image quality and details.
[0091] like Figure 7 As shown in the figure, a super-resolution network is established using the spatial diffusion model. The network is combined with the SR3 structure in two stages. First, the Frame-wise VAE is trained (the encoder and decoder are represented as and ) will be a high-resolution image ( ) is encoded into a latent space (the size of the latent space is ).
[0092] During the training process, The input consists of low-resolution images , by using Encoding low-resolution images realizes the implicit coding of the potential outside of low-resolution images , use VIT-base to extract low-resolution image features , obtain the embedded representation of the image, add noise after high-resolution encoding The diffusion step obtained and The network training uses L1 loss, the formula is as follows:
[0093] ,
[0094] Input low-resolution image for , before feeding it into the network, it needs to be upgraded to a high-resolution state using an interpolation algorithm. Then, it is concatenated with the noise image in the channel and fed into the network together. Before performing the diffusion step, it needs to be used The image is compressed from pixel space to latent space, and then diffusion inference is performed. After the diffusion process, the image is used Decoding restores the latent space to pixel space.
[0095] S44 trains the model in latent space and uses the AdamW optimizer to train the two networks until the model error converges.
[0096] S441 Calculate the objective function with respect to the parameters Gradient .
[0097] S442 updates the first-order and second-order moment estimates:
[0098] ,
[0099] in, and are the first-order (mean) and second-order (unbiased variance) moment estimates of the gradient, and is the attenuation factor.
[0100] S443 calculates the bias-corrected moment estimate to ensure that the estimate does not deviate too far from the actual value in the early stages of training:
[0101] ;
[0102] S444 Update Parameters:
[0103] ,
[0104] in, is the learning rate, is the weight decay coefficient, is a small constant added to increase numerical stability. The learning rate is used to monitor the validation loss after each checkpoint, once every 100 training batches; if the validation loss does not decrease for 3 consecutive checkpoints, the learning rate is reduced. By using Early Stopping, training is terminated after 6 checkpoints without improvement in validation loss.
[0105] S5 inputs the radar image data of the test set into the model to generate the processed short-term forecast image.
[0106] Based on the same inventive concept, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the aforementioned two-stage nowcasting forecasting method based on EOF-Kmeans clustering and LDM are implemented.
[0107] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the aforementioned two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM are implemented.
[0108] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0109] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0110] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0112] The above embodiments are only for illustrating the technical idea of the present invention, and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the present invention.
Claims
1. A two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM, characterized in that: The steps include: Step 1, collecting radar precipitation image data sets, and preprocessing them to obtain preprocessed image data sets; In step 1, logarithmic transformation is used to preprocess the collected radar precipitation data set, and the formula is as follows: Among them, R represents the precipitation intensity, and f(R) represents the result obtained by logarithmic transformation; Step 2: Use the empirical orthogonal function analysis method to reduce the dimension of each radar image in the preprocessed image data set, and use the Kmeans clustering method to cluster the reduced-dimensional radar images to identify precipitation and non-precipitation areas in the images; In step 2, the Kmeans clustering method is used to cluster the radar image after dimensionality reduction to identify precipitation and non-precipitation areas in the image, specifically: Randomly select a pixel as the first centroid, calculate the distance between the remaining pixels and the first centroid, select the second centroid using weighted probability distribution, calculate the distance between the remaining pixels and the nearest centroid among all the selected centroids, select the third centroid using weighted probability distribution, and so on, until k′ centroids are selected; Assign each pixel point to the centroid closest to each pixel point to form a cluster, calculate the new centroid of the cluster, and determine whether the new centroid is the same as the original centroid of the corresponding cluster. If they are the same, keep the centroids different. If they are different, replace the original centroid with the new centroid. Repeat the process of calculating the new centroid and determining whether it is the same as the original centroid until the preset number of iterations is reached and clustering is completed; Step 3, using the preprocessed image dataset to train a frame-by-frame variational autoencoder to encode the input image from pixel space to latent space and decode it back to pixel space; Step 4, using the clustering results of step 2 to train a time diffusion model for predicting future precipitation conditions at low resolution based on known radar precipitation images, and obtaining a low-resolution radar precipitation image; In step 4, by using the known first to fourth frames of low-resolution radar precipitation images, a time diffusion model is trained to predict the fifth to twentieth frames of low-resolution radar precipitation images; During the training process, noise is added to the fifth to twentieth frames of low-resolution radar precipitation images to be predicted, and the first to fourth frames of radar precipitation images are combined with the fifth to twentieth frames of low-resolution radar precipitation images after adding noise as conditional dependencies, and then input into U-net. Time steps are embedded in each residual layer of U-net, and the noise added in the image is predicted by U-net, and finally a trained time diffusion model is obtained; Step 5: Based on the frame-by-frame variational autoencoder trained in step 3, the clustering result of step 2 is used to train a combination of a latent diffusion model and an SR3 architecture, namely a spatial diffusion model, which is used to reconstruct the low-resolution radar precipitation image into a high-resolution radar precipitation image. In the step 5, the high-resolution radar precipitation image is encoded into the latent space using the encoder in the trained Frame-wise VAE to obtain the latent code, noise is added to the latent code, the low-resolution radar precipitation image is combined with the latent code with the added noise as a conditional dependency, and the image is input into the U-net, and the time step is embedded in each residual layer of the U-net. The noise added in the latent code is predicted by the U-net, and finally the trained spatial diffusion model is obtained; Step 6: Use the trained time diffusion model and space diffusion model to perform precipitation forecasting.
2. The two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM according to claim 1, characterized in that: In step 2, the dimensionality reduction process is performed on each radar image in the preprocessed image data set using the empirical orthogonal function analysis method, specifically: First, the image data matrix X corresponding to the preprocessed radar image is converted into a standardized matrix X std : In the formula, μ and σ represent the mean and standard deviation respectively; Next, according to the standardized matrix X std Compute the covariance matrix ∑: Where n is the number of radar image samples, For X std The transposed matrix of Finally, the covariance matrix ∑ is subjected to eigendecomposition to obtain several eigenvalues and corresponding eigenvectors. The eigenvalues are sorted from large to small, starting from the largest eigenvalue, and the eigenvectors corresponding to the first k eigenvalues are selected to form a new feature space. std Projecting to the new feature space, we get the reduced-dimensional image data matrix T: T=X std V k Where V k A new feature space composed of the eigenvectors corresponding to the selected k eigenvalues.
3. The two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM according to claim 1, characterized in that: In the step 3, the frame-by-frame variational autoencoder includes an encoder and a decoder, the encoder includes a two-dimensional convolutional neural network, a residual module, a downsampling layer and a self-attention module connected in sequence, and the decoder includes a two-dimensional convolutional neural network, a self-attention module, a residual module and an upsampling layer connected in sequence; The loss function used to train the frame-by-frame variational autoencoder is the sum of the pixel-level loss function and the KL regularization loss function, that is: Where, L L2 represents the pixel-level loss function, N is the total number of pixels, are the predicted value and true value of the i-th pixel, respectively, D KL (q φ (z|x)∥p(z)) represents the KL regularization loss function, v i represents the variance of the i-th pixel, μ i represents the mean value of the i-th pixel, q φ (z|x) represents the prior probability distribution of the latent variable z, and p(z) represents the approximate distribution of the latent variable z given the data x.
4. The two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM according to claim 1, characterized in that: In step 6, the first to fourth frames of radar precipitation images are combined as conditional dependencies with random Gaussian noise as inputs of the trained time diffusion model, and the fifth to twentieth frames of low-resolution radar precipitation images with noise are output, and the predicted fifth to twentieth frames of low-resolution radar precipitation images are obtained by denoising; The fifth to twentieth frames of low-resolution radar precipitation images are combined with random Gaussian noise as conditional dependencies and used as the input of the trained latent diffusion model. The noisy latent code is output and the latent code is obtained by denoising. The latent code is decoded by the decoder in the trained Frame-wise VAE to obtain the fifth to twentieth frames of high-resolution radar precipitation images.
5. A computer device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: When the processor executes the computer program, the steps of the two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM are implemented as described in any one of claims 1 to 4.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the two-stage precipitation forecasting method based on EOF-Kmeans clustering and LDM are implemented as described in any one of claims 1 to 4.
