HailRU-based hail forecast model determination method, application method, device, medium and product
By constructing the HailRU deep learning model and combining multi-source data with refined preprocessing, the timeliness and accuracy of hail forecasts were solved, realizing the scientific and efficient construction of hail forecast models and improving the accuracy and reliability of hail warnings.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INST OF ATMOSPHERIC PHYSICS CHINESE ACADEMY SCI
- Filing Date
- 2026-05-14
- Publication Date
- 2026-06-12
AI Technical Summary
Traditional numerical models are insufficient in terms of hail forecast timeliness, resolution, and accuracy. The relationship between hail formation and observation parameters is unclear, and the rarity of hail events makes the models prone to falling into the trap of predicting all zeros.
A hail forecasting model based on HailRU was constructed. By fusing radar data, numerical weather prediction data and hail observation data, a U-Net architecture was adopted and modules such as multi-scale convolutional residual, convolutional attention, and lossless upsampling were integrated. Spatial physical constraints and regional weighted loss functions were designed, and multi-source data preprocessing and model training were carried out.
It significantly improves the accuracy, timeliness, and reliability of hail forecasts, better meeting the needs of meteorological disaster early warning. The model has high forecast accuracy and stability.
Smart Images

Figure CN122197647A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of weather forecasting technology, and in particular to a method, application method, equipment, medium and product for determining a hail forecasting model based on HailRU. Background Technology
[0002] Hailstorms are characterized by their sudden onset, significant locality, and short lifespan, posing significant limitations to traditional numerical models and data extrapolation methods in terms of forecast timeliness, resolution, and accuracy. In recent years, artificial intelligence (AI) technology has demonstrated remarkable potential in short-term weather forecasting, particularly in its ability to effectively integrate key information closely related to hail development, such as vertical wind shear, liquid water content, and particle phase evolution, from radar observations. By further incorporating information on convective development, thermodynamic environment, and structural conditions provided by numerical models, AI can offer new breakthroughs in short-term hail forecasting.
[0003] Compared to the application of deep learning in forecasting other meteorological elements, the construction of hail forecasting models faces two major challenges: First, the physical relationship between hail formation and various observation parameters is not yet fully clear, and how to automatically select and make full use of effective forecasting factors from multidimensional data is a major challenge; Second, the scarcity of hail events leads to a serious imbalance between positive and negative samples (hail occurred and did not occur), and the model is prone to falling into the "all-zero prediction" trap. Summary of the Invention
[0004] The purpose of this application is to provide a method, application method, equipment, medium and product for determining hail forecasting models based on HailRU, which can improve the automation level of short-term hail forecasting.
[0005] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a method for determining a hail forecasting model based on HailRU, the method comprising: Construct a sample set; the sample set includes: radar data, numerical weather prediction data, and hail observation data.
[0006] The sample set is preprocessed to obtain preprocessed data. The preprocessed data includes: radar data from the past several hours, numerical weather forecast data for the current time and the next several hours, hail data from the past several hours, a time encoding matrix, a spatial encoding matrix, and corresponding hail tags. The time encoding matrix is a single-value matrix generated by encoding the date and time. The spatial encoding matrix is a matrix obtained by mapping the latitude and longitude of the observation station to a spatial matrix and performing Gaussian diffusion.
[0007] A HailRU deep learning model is constructed. The HailRU deep learning model adopts the U-Net architecture and adds a multi-scale convolutional residual module, a convolutional attention module, a lossless upsampling module, a learnable input weight mechanism module, a temporal coding module, and a spatial physical constraint module.
[0008] The HailRU deep learning model is trained based on the preprocessed data to obtain a HailRU-based hail forecasting model.
[0009] Optionally, the preprocessing includes: missing value handling, normalization, hail label cleaning, hail label mapping & Gaussian diffusion, spatial encoding, temporal encoding, numerical weather forecast data interpolation and pruning, and data stacking.
[0010] Optionally, the HailRU deep learning model includes: The input layer is used to input preprocessed data and the time encoding matrix.
[0011] The learnable input weight module is used to perform weighted fusion of the preprocessed data and the time encoding matrix to obtain weighted input features.
[0012] The encoder module consists of an input convolutional layer, a first multi-scale convolutional residual module, and a pixel-unshuffle module stacked sequentially.
[0013] The input convolutional layer, consisting of a convolutional layer, batch regularization, and Leaky ReLU activation function, is used to transform the weighted input features to obtain the transformed first feature map.
[0014] The first multi-scale convolutional residual module uses multi-scale convolutional kernels connected to residuals and integrates a convolutional attention module to enhance the ability to extract the temporal variation features of multi-scale cloud clusters and hail clouds while keeping the number of parameters controllable.
[0015] The Pixel-UnShuffle module is the inverse process of Pixel-Shuffle. It is used to achieve lossless downsampling through channel rearrangement, gradually compressing the spatial size of the transformed first feature map and expanding the number of channels.
[0016] The decoder module consists of a pixel-shuffle module, a second multi-scale convolutional residual module, and a merged convolutional layer stacked sequentially.
[0017] The Pixel-Shuffle module, which is a lossless upsampling module, is used to achieve lossless upsampling by rearranging channels, thereby expanding the spatial size of the downsampled feature map and compressing the number of channels.
[0018] The merged convolutional layer is used to fuse the feature map of the corresponding layer of the encoder with the upsampled feature map of the decoder, and then integrate the features through convolution operation.
[0019] The second multi-scale convolutional residual module is used to further refine the fused features and maintain the same feature extraction capability as the encoder.
[0020] The output convolutional layer, consisting of convolutional layers, batch regularization, and the Leaky ReLU activation function, is used to transform the feature map output by the decoder to obtain the transformed second feature map.
[0021] The time-coding module is used to learn the annual and daily cycle patterns of hail.
[0022] The spatial physical constraint module is used to multiply the spatial encoding matrix element by element with the transformed second feature map to constrain the hail forecast range.
[0023] Optionally, the convolutional attention module includes: The input feature layer is used to input feature maps.
[0024] The channel attention module is used to perform global average pooling and global max pooling on the feature map respectively, compressing the spatial information into channel attention features. After being fused by a shared multilayer perceptron, channel weights are generated by Sigmoid and multiplied with the feature map channel by channel to obtain refined features.
[0025] The spatial attention module is used to concatenate the refined features along the channel dimension using global average pooling and global max pooling, then compress them into single-channel spatial attention features through convolution, and finally multiply them element-wise with the refined features using a sigmoid function to obtain the enhanced features.
[0026] An output feature layer is used to output the enhanced features.
[0027] Optionally, the HailRU deep learning model is trained based on the preprocessed data to obtain a HailRU-based hail forecasting model, specifically including: The radar data from the past few hours, the numerical weather forecast data for the current time and the next few hours, the hail data from the past few hours, the time encoding matrix, and the spatial encoding matrix are input into the HailRU deep learning model to obtain the output of the HailRU deep learning model.
[0028] The loss value is determined based on the output of the HailRU deep learning model, the corresponding hail label, and the determined loss function.
[0029] The network parameters of the HailRU deep learning model are optimized based on the loss value to obtain a HailRU-based hail forecasting model.
[0030] Optionally, the expression for the loss function is: ; in, SFloss For spatial concentration loss function; y pred This is the forecast value; y true The actual value; α and β These are adjustable parameters.
[0031] Secondly, this application provides a method for applying a hail forecasting model based on HailRU, the method comprising: Acquire the data to be forecasted; the data to be forecasted includes: radar data, numerical weather forecast data for the current time and several hours to come, and the latitude and longitude of all hail observation stations within the radar observation range; The data to be forecasted is preprocessed to obtain preprocessed data. The preprocessed data includes: radar data from the past several hours, numerical weather forecast data for the current time and the next several hours, hail data from the past several hours, a time encoding matrix, and a spatial encoding matrix. The time encoding matrix is a single-value matrix generated by encoding the date and time. The spatial encoding matrix is a matrix obtained by mapping the latitude and longitude of the observation station to a spatial matrix and performing Gaussian spread. The preprocessed data is input into a HailRU-based hail forecasting model to obtain future hail forecast results; the HailRU-based hail forecasting model is a model trained based on the HailRU-based hail forecasting model determination method described in any of the first aspects.
[0032] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for determining a hail forecast model based on HailRU as described in any one of the first aspects or the method for applying a hail forecast model based on HailRU as described in the second aspect.
[0033] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for determining a hail forecast model based on HailRU as described in the first aspect or the method for applying a hail forecast model based on HailRU as described in the second aspect.
[0034] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method for determining a hail forecast model based on HailRU as described in the first aspect or the method for applying a hail forecast model based on HailRU as described in the second aspect.
[0035] According to the specific embodiments provided in this application, this application has the following technical effects: This application provides a method, application method, device, medium, and product for determining a hail forecasting model based on HailRU. The determination method constructs a sample set by fusing radar data, numerical weather prediction data, and hail observation data, which can provide comprehensive and multi-source basic data support for hail forecasting model training, ensuring the richness and completeness of model learning information. Preprocessing operations on the sample set, including multi-time series data, time coding matrices, and spatial coding matrices, can effectively standardize data formats, mine spatiotemporal feature information, and remove invalid interference, improving data quality and model input adaptability. A HailRU deep learning model is constructed using a U-Net architecture and integrating multiple dedicated modules such as multi-scale convolutional residuals, convolutional attention, and lossless upsampling, which can significantly enhance the model's ability to extract hail meteorological features, its spatiotemporal correlation modeling ability, and its forecast accuracy and stability. Training the HailRU deep learning model using the preprocessed high-quality data can quickly converge to obtain a dedicated hail forecasting model with strong generalization ability and high forecast accuracy, providing reliable support for actual hail warning operations. This application achieves the scientific and efficient construction of a hail forecasting model through multi-source data construction, refined preprocessing, dedicated deep learning model building and targeted training. It effectively improves the accuracy, timeliness and reliability of hail forecasts, and can better meet the practical application needs of meteorological disaster early warning. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is an application environment diagram of a hail forecasting model determination method based on HailRU in one embodiment of this application; Figure 2 A flowchart illustrating a method for determining a hail forecasting model based on HailRU, provided in an embodiment of this application; Figure 3 This is a schematic diagram of Gaussian diffusion processing provided in an embodiment of this application; Figure 4 This is a schematic diagram of the HailRU deep learning model structure provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a multi-scale convolutional residual module provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a convolutional attention module provided in an embodiment of this application; Figure 7 This is a schematic diagram of a lossless upsampling module structure provided in an embodiment of this application; Figure 8 A flowchart illustrating an application method for a hail forecasting model based on HailRU, provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0038] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0039] This application employs deep learning technology to construct an end-to-end short-term hail forecast model. By automatically learning the complex nonlinear relationships between multidimensional features, it achieves a direct mapping from data to forecast results.
[0040] To address the aforementioned issues, this application integrates multiple attention mechanisms in its model design, enabling the model to adaptively focus on key observation parameters and enhance feature utilization efficiency. Simultaneously, by transforming single-point hail forecasts into regional probability forecasts and combining them with a specially designed regional weighted loss function, the training bias caused by sample imbalance is effectively mitigated, allowing the model to escape the "all-zero prediction" dilemma.
[0041] The design and implementation of this deep learning model significantly improves the automation level of short-term hail forecasts, and demonstrates excellent forecast performance and stability in testing.
[0042] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0043] The hail forecasting model determination method based on HailRU provided in this application can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be set up independently, integrated into server 104, or placed in the cloud or on another server. Terminal 102 can send a sample set to server 104. The sample set includes radar data, numerical weather prediction data, and hail observation data. After receiving the sample set, server 104 preprocesses the sample set to obtain preprocessed data. The preprocessed data includes radar data from the past few hours, numerical weather prediction data for the current time and the next few hours, hail data from the past few hours, a time encoding matrix, a spatial encoding matrix, and corresponding hail labels. The time encoding matrix is a single-valued matrix generated by encoding the date and time. The spatial encoding matrix is a matrix obtained by mapping the latitude and longitude of the observation station to a spatial matrix and performing Gaussian diffusion. A HailRU deep learning model is constructed. The HailRU deep learning model adopts the U-Net architecture and adds a multi-scale convolutional residual module, a convolutional attention module, a lossless upsampling module, a learnable input weight mechanism module, a time encoding module, and a spatial physical constraint module. The HailRU deep learning model is trained based on the preprocessed data to obtain a HailRU-based hail forecasting model. Server 104 can feed back the obtained HailRU-based hail forecast model to terminal 102. Furthermore, in some embodiments, the method for determining the HailRU-based hail forecast model can also be implemented separately by server 104 or terminal 102. For example, terminal 102 can directly determine the HailRU-based hail forecast model for a sample set, or server 104 can obtain the sample set from the data storage system and determine the HailRU-based hail forecast model for that sample set.
[0044] The terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster composed of multiple servers, or it can be a cloud server.
[0045] In one exemplary embodiment, such as Figure 2 As shown, a method for determining a hail forecast model based on HailRU is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is applied to... Figure 1Taking server 104 as an example, the explanation includes the following steps S1 to S4. Wherein: S1: Construct a sample set; the sample set includes: radar data, numerical weather prediction data, and hail observation data.
[0046] S2: Preprocess the sample set to obtain preprocessed data; the preprocessed data includes: radar data from the past several hours, numerical weather forecast data for the current time and the next several hours, hail data from the past several hours, time encoding matrix, spatial encoding matrix, and corresponding hail tags; the time encoding matrix is a single-value matrix generated by encoding the date and time; the spatial encoding matrix is a matrix obtained by mapping the latitude and longitude of the observation station to a spatial matrix and performing Gaussian diffusion.
[0047] S3: Construct the HailRU deep learning model. The HailRU deep learning model adopts the U-Net architecture and adds a multi-scale convolutional residual module, a convolutional attention module, a lossless upsampling module, a learnable input weight mechanism module, a temporal coding module, and a spatial physical constraint module.
[0048] S4: Train the HailRU deep learning model based on the preprocessed data to obtain a HailRU-based hail forecasting model.
[0049] By implementing steps S1 to S4 above, this application constructs a sample set using multi-source data, which can fully integrate radar, numerical forecast, and actual observation information, providing a comprehensive and reliable data foundation for hail forecasting modeling. Through refined preprocessing, including spatiotemporal coding, the spatiotemporal patterns of hail occurrence can be effectively mined, data noise removed, and data format standardized, significantly improving the effectiveness and standardization of model input data. The improved U-Net architecture, integrating multi-scale residuals, attention mechanisms, lossless upsampling, and spatiotemporal physical constraints, is used to construct the HailRU model, significantly enhancing the model's ability to extract complex meteorological features, fit the hail evolution process, and improve forecast refinement, while also considering physical rationality. Using the high-quality preprocessed data for model training allows the model to converge quickly and possess stronger generalization ability and predictive stability. The resulting hail forecasting model has higher accuracy, better spatiotemporal resolution, and stronger early warning reliability. Overall, the entire process of hail forecasting, from data input to model output, is optimized, effectively improving the accuracy and timeliness of hail disaster early warnings and better meeting the practical application needs of meteorological disaster prevention and mitigation.
[0050] Specifically, in step S1, the observation data used for constructing the sample set includes: (1) Radar data: 8 parameters (combined reflectivity, vertical liquid water content, 20 / 30 / 45dBZ echo top height, 20 / 30 / 45dBZ echo bottom height), spatial resolution 1km×1km, grid size 401×401, time granularity 6 minutes.
[0051] (2) Numerical weather forecast (NWP) data: 4 parameters (temperature 0 / -10 / -20℃ layer height, wet bulb temperature 0℃ layer height), spatial resolution 3km×3km (corresponding to a 501×501km area), grid size 167×167, time granularity 1 hour, completely covering the radar observation range.
[0052] (3) Hail observation data: Provide the latitude and longitude of all hail observation stations within the radar observation range, and indicate whether hail has occurred. "1" indicates that hail has occurred, and "0" indicates that it has not occurred. The time granularity is 6 minutes.
[0053] Samples are generated using a sliding window on all continuous observation data. The input consists of 10 frames (past 1 hour), and the output consists of 20 frames (future 2 hours), with a step size of 1 frame, to obtain the sample set.
[0054] Specifically, in step S2, the preprocessing of the sample set includes: Missing value handling: The locations of no observations in radar and NWP data are mapped to 0, and missing observations are filled by interpolation of the maximum value.
[0055] Normalization: Perform maximum and minimum value normalization on radar and NWP data. The formula is as follows: x'=(x-min(x all )) / (max(x all )-min(x all )); Where x' is the processed data, x is the original data, and x all This represents all data from a single sample.
[0056] Hailstone label cleaning: If the maximum radar echo intensity (CR) within a 5×5km radius around a point where a hailstone is labeled as 1 is less than 30dBZ, then the label will be changed to 0.
[0057] Hailstone Label Mapping & Gaussian Diffusion: First, hailstone labels are mapped onto a 401×401 matrix with the same spatial resolution as the radar. Hailstone grid points are labeled as 1, and all others as 0 (including locations without national stations). Then, the matrix is subjected to Gaussian diffusion, mapping the discrete hailstone labels to a two-dimensional Gaussian probability distribution map. This approach better reflects physical laws (if hailstones are observed at a current point, hailstones are highly likely to occur at surrounding points, with the probability decreasing gradually with distance according to a Gaussian distribution), while effectively mitigating the problem of extreme sample imbalance (typically, there is only one positive sample in a 401×401 grid). The Gaussian diffusion process is as follows: Figure 3 As shown.
[0058] Spatial encoding: The latitude and longitude of the observation stations are mapped to a spatial matrix and Gaussian diffused, which is then used as one of the model inputs.
[0059] Time encoding: Dates and times are encoded to generate a single-value matrix, which is then concatenated with the input to allow the model to learn the periodicity of hail occurrences. The encoding formula is as follows: sin time =sin(2π·t / T),cos time =cos(2π·t / T); For date encoding, T=366; for minute encoding, T=1440.
[0060] NWP data interpolation and clipping: Since the spatial range of NWP data does not overlap with that of radar data, this embodiment linearly interpolates the NWP data to 1km×1km to obtain a 501×501 matrix. Then, based on the latitude and longitude range of the data, a 401×401 matrix with overlapping regions is clipped according to the latitude and longitude range of the radar.
[0061] Data stacking: Radar (past 1 hour), NWP (hourly frames of the forecast time and 2-hour frames of the future), hail observations (past 1 hour), and temporal coding matrix are directly stacked as model input, while spatial coding matrix is input into the model separately.
[0062] As an optional implementation, in step S3, the HailRU deep learning model includes: The input layer is used to input preprocessed data and the time encoding matrix.
[0063] The learnable input weight module is used to perform weighted fusion of the preprocessed data and the time encoding matrix to obtain weighted input features.
[0064] The encoder module consists of an input convolutional layer, a first multi-scale convolutional residual module, and a pixel-unshuffle module stacked sequentially.
[0065] The input convolutional layer, consisting of a convolutional layer, batch regularization, and Leaky ReLU activation function, is used to transform the weighted input features to obtain the transformed first feature map.
[0066] The first multi-scale convolutional residual module uses multi-scale convolutional kernels connected to residuals and integrates a convolutional attention module to enhance the ability to extract the temporal variation features of multi-scale cloud clusters and hail clouds while keeping the number of parameters controllable.
[0067] The Pixel-UnShuffle module is the inverse process of Pixel-Shuffle. It is used to achieve lossless downsampling through channel rearrangement, gradually compressing the spatial size of the transformed first feature map and expanding the number of channels.
[0068] The decoder module consists of a pixel-shuffle module, a second multi-scale convolutional residual module, and a merged convolutional layer stacked sequentially.
[0069] The Pixel-Shuffle module, which is a lossless upsampling module, is used to achieve lossless upsampling by rearranging channels, thereby expanding the spatial size of the downsampled feature map and compressing the number of channels.
[0070] The merged convolutional layer is used to fuse the feature map of the corresponding layer of the encoder with the upsampled feature map of the decoder, and then integrate the features through convolution operation.
[0071] The second multi-scale convolutional residual module is used to further refine the fused features and maintain the same feature extraction capability as the encoder.
[0072] The output convolutional layer, consisting of convolutional layers, batch regularization, and the Leaky ReLU activation function, is used to transform the feature map output by the decoder to obtain the transformed second feature map.
[0073] The time-coding module is used to learn the annual and daily cycle patterns of hail.
[0074] The spatial physical constraint module is used to multiply the spatial encoding matrix element by element with the transformed second feature map to constrain the hail forecast range.
[0075] As an optional implementation, the convolutional attention module includes: The input feature layer is used to input feature maps.
[0076] The channel attention module is used to perform global average pooling and global max pooling on the feature map respectively, compressing the spatial information into channel attention features. After being fused by a shared multilayer perceptron, channel weights are generated by Sigmoid and multiplied with the feature map channel by channel to obtain refined features.
[0077] The spatial attention module is used to concatenate the refined features along the channel dimension using global average pooling and global max pooling, then compress them into single-channel spatial attention features through convolution, and finally multiply them element-wise with the refined features using a sigmoid function to obtain the enhanced features.
[0078] An output feature layer is used to output the enhanced features.
[0079] Specifically, the structure of the HailRU deep learning model is as follows: Figure 4 As shown, the InRes module represents the multi-scale convolutional residual (InceptionRes) module, the Pixel-Shuffle module represents the lossless upsampling module, and the Pixel-UnShuffle module is the inverse process of the Pixel-Shuffle module.
[0080] The HailRU deep learning model adopts the U-Net architecture and, specifically designed for the characteristics of hail forecasting tasks, has added the following modules: Multi-scale convolutional residual (InceptionRes) modules replace standard convolutional layers (structures such as...) Figure 5 (As shown). In this module, residual connections are introduced to significantly accelerate the model training convergence speed. Multi-scale convolutional kernels are used to further improve the model's ability to learn multi-scale cloud features with almost no increase in the number of parameters. An integrated convolutional attention module (CBAM, structure as shown) is also included. Figure 6 As shown in the figure, by adding a small number of parameters, a temporal and spatial attention mechanism is introduced, which greatly enhances the model's ability to extract temporal variation features of hail clouds.
[0081] Convolutional Attention Module (CBAM, structure as follows) Figure 6As shown, by introducing a temporal and spatial attention mechanism at the cost of a small increase in parameters, the model's ability to extract temporal variation features of hail clouds is significantly enhanced. CBAM is a lightweight and general attention mechanism designed to adaptively calibrate the weights of convolutional feature maps through the concatenation of two sub-modules: channel attention and spatial attention, thereby enhancing the network's ability to focus on key information. Its core process is as follows: First, the feature map is fed into the channel attention module, which compresses spatial information into channel attention features by performing global average pooling and global max pooling on the feature map. After fusion by a shared multilayer perceptron (MLP), channel weights are generated by Sigmoid and multiplied channel-wise with the original feature map to obtain the refined feature F'. Then, F' enters the spatial attention module, where global average pooling and global max pooling are performed along the channel dimension and concatenated. After being compressed into a single-channel spatial attention feature Ms(F') by a 7×7 convolution, it is multiplied element-wise with the refined feature F' by Sigmoid and finally outputs the enhanced feature.
[0082] Lossless upsampling (PixelShuffle) module (algorithm flow as follows) Figure 7 The algorithm shown is an efficient algorithm for upsampling. Its core idea is to "rearrange" the information in the channel dimension to the spatial dimension. The specific process is as follows: Assume the input feature map size is H×W×(C·r). 2 ), where r is the upsampling factor (2 here). The algorithm first expands the number of feature map channels to C·r through a convolutional layer. 2 Then each r 2 The channels are rearranged according to a fixed rule to form a high-resolution output with dimensions (rH)×(rW)×C. This method effectively solves the information loss problem of traditional upsampling and downsampling, and significantly improves the spatial accuracy of forecasts in high-resolution forecasting tasks such as hail forecasting. In this embodiment, the PixelShuffle module is used in the HailRU deep learning model to replace the traditional upsampling and downsampling operators of U-Net.
[0083] Learnable input weight modules (e.g.) Figure 4 (As shown in "Learnable Weights") Before the input enters the model, learnable weights are assigned to each variable channel. This allows the model to automatically evaluate the importance of the input parameters during training. Furthermore, in subsequent importance analysis, the input weight values of the trained model can be directly used; their magnitude represents the importance of each channel parameter. Since the input channels contain both different parameters and different time points, these weights simultaneously incorporate the importance information of both different parameters and different time points.
[0084] Time encoding module: Since hail has annual and daily cycles, this embodiment uses time encoding to input time information into the model, allowing the model to learn the cycle information.
[0085] Space physical constraint module (e.g.) Figure 4 (As shown in the "Mask" section): Spatial physical constraints were applied to the output, forcing the model to focus only on hail occurrence in the station and its surrounding 5km area. Specifically, the station's Gaussian coding matrix (described earlier) was multiplied by the model's final output to form a spatial mask. The output for non-critical areas was then forced to zero, thus compelling the model to focus on the forecast performance of the 5km area surrounding the station. The mask can be optionally removed; after removal, the model no longer focuses solely on the area around the station but rather on the hail probability forecast across the entire radar observation space.
[0086] As an optional implementation, in step S4, the HailRU deep learning model is trained based on the preprocessed data to obtain a HailRU-based hail forecasting model, specifically including: S41: Input the radar data of the past few hours, the numerical weather forecast data of the current time and the next few hours, the hail data of the past few hours, the time encoding matrix and the spatial encoding matrix into the HailRU deep learning model to obtain the output of the HailRU deep learning model.
[0087] S42: Determine the loss value based on the output of the HailRU deep learning model and the corresponding hail label, as well as the determined loss function.
[0088] S43: Optimize the network parameters of the HailRU deep learning model based on the loss value to obtain a HailRU-based hail forecasting model.
[0089] In this embodiment, the loss function used is the spatial concentration loss function.
[0090] Due to the extreme sparseness of hail events and the severe imbalance in the dataset, models trained on this dataset often output all-zero forecasts. This is a problem that must be addressed before using deep learning models to forecast hail. In this embodiment, data augmentation methods were attempted, using a dataset where all samples contain hail for training. Even so, the trained model still only outputs all-zero forecasts. Analysis of the hail-labeled samples in this embodiment revealed that in most samples containing hail, only one grid point was labeled 1, with the rest being 0, a ratio of 1:160000. Therefore, even if the model gives an all-zero forecast, the error is almost zero, far less than the penalty for false positives. As mentioned earlier, Gaussian diffusion was used to process the hail-labeled samples, increasing the ratio of non-zero grid points to 81:160000. However, experiments show that Gaussian diffusion alone still cannot solve the problem of all-zero forecasts. This embodiment attempts to address this issue by modifying the loss function. However, currently, no non-binary classification loss function exists that can balance the imbalance between positive and negative samples within a single sample. Therefore, this embodiment designs a spatial concentration loss function, assigning higher weights to hail-prone areas when calculating the loss. This significantly increases the loss when the model predicts all zeros, forcing the model to accurately predict hail-prone areas. The formula for the spatial concentration loss function is shown below: ; in, SFloss For spatial concentration loss function; y pred This is the forecast value; y true The actual value; α and β These are adjustable parameters.
[0091] The training details are as follows: Code environment: PyTorch + PyTorch Lightning.
[0092] Model parameter count: approximately 13.9 million parameters.
[0093] Data loading: Due to the huge amount of data in a single sample (126) 401 (401 floats) The GPU memory is insufficient to load all training data at once, so a mini-batch is used to load the training data in batches, and the batch size is set to 8 to load data in small batches, so as to reserve GPU memory for increasing the number of model parameters.
[0094] Mixed precision training: Data is loaded with float32 precision, and model parameters are loaded with a mixed precision of float16 + float32 to balance data precision and GPU memory usage, further reserving GPU memory to increase the number of model parameters.
[0095] Distributed strategy: Use the ddp_notebook strategy in PyTorch Lightning to train the model in parallel across multiple GPUs, so as to fully utilize the GPU memory and computational performance.
[0096] Training-validation split: In the training set provided by the organizer, a validation set is split in an 8:2 ratio. Training and validation losses are monitored during training to prevent model overfitting.
[0097] Early stopping mechanism: If the validation loss does not decrease for 5 consecutive epochs, training is terminated; during training, the top 5 models with the lowest validation loss are saved for testing at any time.
[0098] Optimizer: Adam, learning rate 0.0001.
[0099] Loss function: SFloss .
[0100] In summary, addressing the issues of the incompletely defined relationship between hail and observational parameters, and the severe imbalance in the sample due to the low probability of hail occurrence, this application establishes a HailRU deep learning model for hail forecasting. The main innovations of the model are as follows: The HailRU deep learning model incorporates multi-scale convolution, spatiotemporal attention mechanisms, and learnable input weights. It accurately identifies hail-affected areas and captures their movement trends, handling complex multi-regional hail situations and accurately predicting the formation and dissipation times and areas of hail. The model automatically learns and outputs parameter importance, thus exhibiting good interpretability.
[0101] Gaussian diffusion and SFloss It effectively solves the problem of model failure caused by severe sample imbalance in hail observations.
[0102] Spatial coding: A spatial mask physical constraint structure that can be added or removed was designed. After adding it, the model can predict the probability of hail occurrence only at the site, and after removing it, the model can predict the probability of hail occurrence in the entire radar observation area.
[0103] In another exemplary embodiment of this application, such as Figure 8 As shown, a method for applying a hail forecasting model based on HailRU is provided, the method including: A1: Obtain the data to be forecasted; the data to be forecasted includes: radar data, numerical weather forecast data for the current time and the next few hours, and the latitude and longitude of all hail observation stations within the radar observation range.
[0104] A2: The data to be forecasted is preprocessed to obtain preprocessed data; the preprocessed data includes: radar data from the past several hours, numerical weather forecast data for the current time and the next several hours, hail data from the past several hours, a time encoding matrix, and a spatial encoding matrix; the time encoding matrix is a single-value matrix generated by encoding the date and time; the spatial encoding matrix is a matrix obtained by mapping the latitude and longitude of the observation station to a spatial matrix and performing Gaussian diffusion.
[0105] A3: Input the preprocessed data into the HailRU-based hail forecasting model to obtain future hail forecast results; the HailRU-based hail forecasting model is a model trained based on the HailRU-based hail forecasting model determination method described above.
[0106] Specifically, after completing model building and training, the model can be used for real-time hail forecasting. First, a Python + PyTorch + PyTorch Lightning code environment needs to be configured on a computer equipped with at least one RTX 4090 graphics card. The model parameters need to be loaded and set to validation mode. Regarding data, data needs to be prepared and processed according to step A1. Finally, the data is input into the HailRU-based hail forecasting model, which will output hail forecasts every 6 minutes for the next 0-2 hours.
[0107] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 9As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database is used for a sample set. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a Hail RU-based hail forecasting model determination method or a Hail RU-based hail forecasting model application method.
[0108] Those skilled in the art will understand that Figure 9 The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0109] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0110] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0111] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of the relevant data are carried out in compliance with the relevant data protection laws and policies of the country where the location is located, and with the authorization granted by the owner of the corresponding device.
[0112] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0113] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0114] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0115] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for determining a hail forecasting model based on HailRU, characterized in that, The determination method includes: Construct a sample set; the sample set includes: radar data, numerical weather prediction data, and hail observation data; The sample set is preprocessed to obtain preprocessed data. The preprocessed data includes: radar data from the past several hours, numerical weather forecast data for the current time and the next several hours, hail data from the past several hours, a time encoding matrix, a spatial encoding matrix, and corresponding hail tags. The time encoding matrix is a single-value matrix generated by encoding the date and time. The spatial encoding matrix is a matrix obtained by mapping the latitude and longitude of the observation station to a spatial matrix and then performing Gaussian spread. A HailRU deep learning model is constructed. The HailRU deep learning model adopts the U-Net architecture and adds a multi-scale convolutional residual module, a convolutional attention module, a lossless upsampling module, a learnable input weight mechanism module, a temporal coding module, and a spatial physical constraint module. The HailRU deep learning model is trained based on the preprocessed data to obtain a HailRU-based hail forecasting model.
2. The method for determining a hail forecasting model based on HailRU according to claim 1, characterized in that, The preprocessing includes: missing value handling, normalization, hail label cleaning, hail label mapping & Gaussian diffusion, spatial encoding, temporal encoding, numerical weather forecast data interpolation and pruning, and data stacking.
3. The method for determining a hail forecasting model based on HailRU according to claim 1, characterized in that, The HailRU deep learning model includes: The input layer is used to input preprocessed data and the time encoding matrix; A learnable input weight module is used to perform weighted fusion of the preprocessed data and the time encoding matrix to obtain weighted input features; The encoder module consists of an input convolutional layer, a first multi-scale convolutional residual module, and a pixel-unshuffle module stacked sequentially. The input convolutional layer, consisting of a convolutional layer, batch regularization, and Leaky ReLU activation function, is used to transform the weighted input features to obtain the transformed first feature map. The first multi-scale convolutional residual module uses multi-scale convolutional kernels connected to residuals and integrates a convolutional attention module to enhance the ability to extract the temporal variation features of multi-scale cloud clusters and hail clouds while keeping the number of parameters controllable. The Pixel-UnShuffle module is the inverse process of Pixel-Shuffle, used to achieve lossless downsampling through channel rearrangement, gradually compressing the spatial size of the transformed first feature map and expanding the number of channels; The decoder module consists of a pixel-shuffle module, a second multi-scale convolutional residual module, and a merged convolutional layer stacked sequentially. The Pixel-Shuffle module, which is a lossless upsampling module, is used to achieve lossless upsampling by rearranging channels, thereby expanding the spatial size of the downsampled feature map and compressing the number of channels. The merged convolutional layer is used to fuse the feature map of the corresponding layer of the encoder with the upsampled feature map of the decoder, and then integrate the features through a convolution operation. The second multi-scale convolutional residual module is used to further refine the fused features and maintain the same feature extraction capability as the encoder. The output convolutional layer, consisting of convolutional layers, batch regularization, and the Leaky ReLU activation function, is used to transform the feature map output by the decoder to obtain the transformed second feature map. The time-coding module is used to learn the annual and daily cycle patterns of hail. The spatial physical constraint module is used to multiply the spatial encoding matrix element by element with the transformed second feature map to constrain the hail forecast range.
4. The method for determining a hail forecasting model based on HailRU according to claim 3, characterized in that, The convolutional attention module includes: The input feature layer is used to input feature maps; The channel attention module is used to perform global average pooling and global max pooling on the feature map respectively, compressing the spatial information into channel attention features. After being fused by a shared multilayer perceptron, channel weights are generated by Sigmoid and multiplied with the feature map channel by channel to obtain refined features. The spatial attention module is used to perform global average pooling and global max pooling on the refined features along the channel dimension, then convolve and compress them into single-channel spatial attention features, which are then multiplied element-wise with the refined features after passing through the Sigmoid function to obtain the enhanced features. An output feature layer is used to output the enhanced features.
5. The method for determining a hail forecasting model based on HailRU according to claim 1, characterized in that, The HailRU deep learning model is trained based on the preprocessed data to obtain a HailRU-based hail forecasting model, specifically including: The radar data from the past few hours, the numerical weather forecast data for the current time and the next few hours, the hail data from the past few hours, the time encoding matrix, and the spatial encoding matrix are input into the HailRU deep learning model to obtain the output of the HailRU deep learning model. The loss value is determined based on the output of the HailRU deep learning model, the corresponding hail label, and the determined loss function. The network parameters of the HailRU deep learning model are optimized based on the loss value to obtain a HailRU-based hail forecasting model.
6. The method for determining a hail forecasting model based on HailRU according to claim 5, characterized in that, The expression for the loss function is: ; in, SFloss For spatial concentration loss function; y pred This is the forecast value; y true The actual value; α and β These are adjustable parameters.
7. A method for applying a hail forecasting model based on HailRU, characterized in that, The application method includes: Acquire the data to be forecasted; the data to be forecasted includes: radar data, numerical weather forecast data for the current time and several hours to come, and the latitude and longitude of all hail observation stations within the radar observation range; The data to be forecasted is preprocessed to obtain preprocessed data. The preprocessed data includes: radar data from the past several hours, numerical weather forecast data for the current time and the next several hours, hail data from the past several hours, a time encoding matrix, and a spatial encoding matrix. The time encoding matrix is a single-value matrix generated by encoding the date and time. The spatial encoding matrix is a matrix obtained by mapping the latitude and longitude of the observation station to a spatial matrix and performing Gaussian spread. The preprocessed data is input into a HailRU-based hail forecasting model to obtain future hail forecast results; the HailRU-based hail forecasting model is a model trained based on the HailRU-based hail forecasting model determination method according to any one of claims 1-6.
8. 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 the processor executes the computer program to implement the method for determining a hail forecast model based on HailRU as described in any one of claims 1-6 or the method for applying a hail forecast model based on HailRU as described in claim 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method for determining a hail forecast model based on HailRU as described in any one of claims 1-6 or the method for applying a hail forecast model based on HailRU as described in claim 7.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the method for determining a hail forecast model based on HailRU as described in any one of claims 1-6 or the method for applying a hail forecast model based on HailRU as described in claim 7.