A weather system classification method, device, equipment and storage medium
By constructing a spatiotemporal feature fusion module to connect the encoding layer and decoding layer of the weather system classification model, the problem that the existing model fails to effectively learn the spatiotemporal correlation of meteorological data is solved, and more accurate weather system classification is achieved.
Patent Information
- Application Number
- CN202411731105.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-11-29
AI Technical Summary
Existing weather system classification models fail to effectively consider the spatiotemporal correlation of meteorological data, resulting in low accuracy of classification results.
A spatiotemporal feature fusion module is constructed to connect the encoding layer and decoding layer of the weather system classification model. The query vector, key vector and value vector are extracted through the spatiotemporal feature fusion module, and time delay rolling and Fourier transform are performed. The autocorrelation matrix is calculated to achieve feature fusion and reshaping, thereby improving the model's learning of the spatiotemporal correlation of meteorological data.
It has improved the accuracy of weather system classification, and can more effectively identify and classify cyclone systems, frontal systems, etc., and optimize disaster warning and climate change monitoring.
Smart Images

Figure CN119669852B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of meteorological analysis, and in particular to a weather system classification method, device, equipment and computer-readable storage medium. Background Art
[0002] Weather systems refer to various systems in the atmosphere formed by differences in temperature, humidity, pressure, and other factors, which affect weather changes in a given area. Classifying weather systems is crucial, as different weather systems are often accompanied by different weather phenomena, such as cyclones, anticyclones, and fronts. Weather classification helps meteorologists predict the weather changes that a particular weather system may bring. Existing methods for weather system classification typically use artificial intelligence models to learn the characteristics of meteorological data and then classify weather systems based on the trained AI models. However, existing models fail to consider the temporal and spatial correlations of these characteristics when learning meteorological data features, resulting in low accuracy in the classification output. Summary of the Invention
[0003] The purpose of the present invention is to provide a weather system classification method, device, equipment and storage medium, which are applied to the field of meteorological analysis. The method connects the encoding layer and decoding layer of the weather system classification model of the model by constructing a spatiotemporal feature fusion module for extracting feature spatiotemporal correlation, so that the model can more effectively learn the spatiotemporal correlation of meteorological data and improve the accuracy of weather system classification.
[0004] To solve the above technical problems, the present invention provides a weather system classification method, comprising:
[0005] Acquire spatiotemporal weather data including a plurality of meteorological elements, and construct four-dimensional meteorological data including time, meteorological elements, longitude, and latitude based on the spatiotemporal weather data;
[0006] Constructing a weather system classification model based on a spatiotemporal feature fusion module; the spatiotemporal feature fusion module connects the encoding layer and the decoding layer of the weather system classification model;
[0007] Training the weather system classification model based on the four-dimensional meteorological data to obtain the trained weather system classification model;
[0008] Inputting the four-dimensional meteorological data to be detected into the trained weather system classification model to obtain an output weather system classification result;
[0009] The spatiotemporal feature fusion module is configured to extract a query vector, a key vector, and a value vector from the output features of the coding layer, perform time-delay rolling on the value vector to obtain a time-delay rolling value matrix, and perform Fourier transform on the query vector and the key vector to obtain Fourier transform data.
[0010] Performing autocorrelation calculation based on the Fourier transform data to obtain a frequency domain autocorrelation matrix, performing inverse Fourier transform on the frequency domain autocorrelation matrix to obtain a time domain autocorrelation matrix, inputting the time domain autocorrelation matrix into an activation function to obtain an autocorrelation weight matrix, and copying and splicing the autocorrelation weight matrix in the time dimension to obtain a spliced autocorrelation weight matrix;
[0011] A weighted matrix is obtained by weighted summation based on the spliced autocorrelation weight matrix and the time delay rolling value matrix at each time delay step, the weighted matrix is input into an activation function to obtain weighted features, and the weighted features are fused and reshaped with the input features to obtain the input features of the decoding layer.
[0012] Optionally, the weather system classification model is based on a Unet++ model, and the encoding layer of the weather system classification model is a densely connected architecture.
[0013] Optionally, the expression of the feature map in the encoding layer is:
[0014]
[0015] Among them, (m,n) is the feature map sign, is the feature map in the coding layer, h is the step size, is the channel splicing operation, Γ(α) is the gamma function operation of the fractional-order differential operator α, F() is the downsampling operation, X (m,n) is the corrected feature map, X (j,n) It is the corrected feature map when m is j.
[0016] Optionally, the expression of the corrected feature map in the coding layer is:
[0017]
[0018] Among them, X (m,n) | n≠0 is the corrected feature map in the coding layer, is the feature map in the coding layer, F() is the downsampling operation, a u,v is the correction coefficient for discretization of fractional-order differential equations, u and v are the first and second parameters of the correction coefficient respectively, X (j,n) is the corrected feature map when m takes j, This is the channel splicing operation.
[0019] Optionally, the expression of the feature map in the decoding layer is:
[0020]
[0021] Among them, (m,n) is the feature map sign, is the feature map in the decoding layer, X (m,n) is the corrected feature map, X (m,j) is the corrected feature map when n is j, X (m+1,0) is the corrected feature map when the feature map mark is (m+1,0), X (m+1,n-1) is the corrected feature map when the feature map is marked as (m+1, n-1), k is the number of layers of the Unet++ model, h is the step size, Γ(α) is the gamma function operation of the fractional-order differential operator α, T() is the upsampling operation, S() is the same convolution operation, Tac(X m+1,0 ) is the input feature of the decoding layer.
[0022] Optionally, the expression of the corrected feature map in the coding layer is:
[0023]
[0024] in, is the feature map in the decoding layer, X (m,n) | n≠0 is the rectified feature map in the decoding layer, X (m,j) is the corrected feature map when n is j, X (m+1,0) is the corrected feature map when the feature map mark is (m+1,0), X (m+1,n-1) is the corrected feature map when the feature map mark is (m+1,n-1), k is the number of layers of the Unet++ model, a u,v is the correction coefficient for discretization of fractional-order differential equations, u and v are the first and second parameters of the correction coefficient respectively, T() is the upsampling operation, S() is the convolution operation, Tac(X m+1,0 ) is the input feature of the decoding layer.
[0025] Optionally, extracting the query vector, the key vector, and the value vector from the output features of the encoding layer includes:
[0026] Constructing a feature extraction unit; the feature extraction unit includes a depth convolution layer, a depth void convolution layer, a group normalization layer, a 1×1 convolution layer, a Flatten layer and a stacked fully connected layer connected in sequence;
[0027] Extracting features from the output features based on the feature extraction unit to obtain preprocessing features;
[0028] extracting the query vector, the key vector, and the value vector from the preprocessed features;
[0029] Accordingly, the step of fusing and reshaping the weighted features with the input features to obtain the input features of the decoding layer includes:
[0030] The weighted features are weightedly fused with the preprocessed features to obtain fused features, and the fused features are reshaped to obtain input features with the same dimension as the output features.
[0031] In order to solve the above technical problems, the present invention provides a weather system classification device, comprising:
[0032] The first module is used to obtain spatiotemporal weather data containing multiple meteorological elements, and construct four-dimensional meteorological data containing time, meteorological elements, longitude and latitude based on the spatiotemporal weather data;
[0033] The second module is used to build a weather system classification model based on the spatiotemporal feature fusion module; the spatiotemporal feature fusion module connects the encoding layer and the decoding layer of the weather system classification model;
[0034] A third module is configured to train the weather system classification model based on the four-dimensional meteorological data to obtain the trained weather system classification model;
[0035] The fourth module is used to input the four-dimensional meteorological data to be detected into the trained weather system classification model to obtain an output weather system classification result;
[0036] The spatiotemporal feature fusion module is configured to extract a query vector, a key vector, and a value vector from the output features of the coding layer, perform time-delay rolling on the value vector to obtain a time-delay rolling value matrix, and perform Fourier transform on the query vector and the key vector to obtain Fourier transform data.
[0037] Performing autocorrelation calculation based on the Fourier transform data to obtain a frequency domain autocorrelation matrix, performing inverse Fourier transform on the frequency domain autocorrelation matrix to obtain a time domain autocorrelation matrix, inputting the time domain autocorrelation matrix into an activation function to obtain an autocorrelation weight matrix, and copying and splicing the autocorrelation weight matrix in the time dimension to obtain a spliced autocorrelation weight matrix;
[0038] A weighted matrix is obtained by weighted summation based on the spliced autocorrelation weight matrix and the time delay rolling value matrix at each time delay step, the weighted matrix is input into an activation function to obtain weighted features, and the weighted features are fused and reshaped with the input features to obtain the input features of the decoding layer.
[0039] To solve the above technical problems, the present invention provides an electronic device, comprising:
[0040] Memory for storing computer programs;
[0041] A processor is used to implement the above-mentioned weather system classification method when executing the computer program.
[0042] In order to solve the above technical problems, the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the above-mentioned weather system classification method is implemented.
[0043] As can be seen, the method of the present invention obtains spatiotemporal weather data containing multiple meteorological elements, constructs four-dimensional meteorological data containing time, meteorological elements, longitude, and latitude based on the spatiotemporal weather data; constructs a weather system classification model based on a spatiotemporal feature fusion module; the spatiotemporal feature fusion module connects the encoding layer and decoding layer of the weather system classification model; trains the weather system classification model based on the four-dimensional meteorological data to obtain a trained weather system classification model; and inputs the four-dimensional meteorological data to be tested into the trained weather system classification model to obtain an output weather system classification result. By constructing a spatiotemporal feature fusion module for extracting feature spatiotemporal correlations and connecting the encoding layer and decoding layer of the weather system classification model of the model, the model can more effectively learn the spatiotemporal correlations of meteorological data, thereby improving the accuracy of weather system classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0045] Figure 1 A flow chart of a weather system classification method provided by an embodiment of the present invention;
[0046] Figure 2 This is a structural example diagram of a Unet++ model provided by an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of the structure of a spatiotemporal feature fusion module provided by an embodiment of the present invention;
[0048] Figure 4 This is a structural block diagram of a weather system classification device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0050] At present, there are many classification models in the field of multimedia video classification, but their characteristics are that they are classified according to the subject objects with strong correlation, and the channels are only RGB (Red Green Blue). The distribution of data has a strong correlation and there is human experience in distinguishing the occurrence of events in related regions. However, for meteorological data of a continuous period of time, multiple meteorological elements are used as channels, and their correlation is not obvious. There is also a large difference in data distribution, and there is a lack of human experience in distinguishing. Since the classification of weather systems in a region for continuous time has important practical guiding significance in real life production, in view of this, this patent proposes an innovative model for the classification of weather systems for continuous time. Through deep learning technology to process and analyze spatiotemporal data containing different weather elements, time, longitude and latitude information, the model identifies and classifies weather systems (such as cyclonic systems, frontal systems, convective systems, monsoon systems, wind shear systems, etc.), and classifies and monitors the changes in the frequency and intensity of extreme weather events in climate change to improve weather forecast accuracy and optimize disaster warning and management.
[0051] The following combination Figure 1 , Figure 1 This is a flow chart of a weather system classification method provided by an embodiment of the present invention. The method may include:
[0052] S101: Acquire spatiotemporal weather data including multiple meteorological elements, and construct four-dimensional meteorological data including time, meteorological elements, longitude, and latitude based on the spatiotemporal weather data.
[0053] This embodiment can obtain spatiotemporal weather data of multiple meteorological elements, which include temperature, humidity, air pressure, wind speed, precipitation and other meteorological elements at different times, longitudes and latitudes.
[0054] This embodiment does not limit the data source of spatiotemporal weather data, and generally includes ERA5 reanalysis data, CLDAS (CMA Land Data Assimilation System, China Meteorological Administration Land Data Assimilation System) real-time product data set, and the International Best Tracking Tropical Cyclone Database. ERA5 is the fifth-generation global climate atmospheric reanalysis data set of the European Centre for Medium-Range Weather Forecasts.
[0055] This embodiment can process the acquired spatiotemporal weather data to fill missing data and remove abnormal data. This embodiment does not limit the specific method of filling missing data. Generally, missing data can be filled by linear interpolation method, such as using trilinear interpolation method to fill missing data. Trilinear interpolation method includes time interpolation, longitude interpolation and latitude interpolation. This embodiment does not limit the specific method of removing abnormal data. Generally, abnormal data can be removed by Z-score method. Z-score method is a commonly used standardization method. The Z value of the data is determined by the mean and standard deviation of the data, and abnormal data is removed based on the Z value, such as identifying and removing abnormal values with |Z|>3 in spatiotemporal weather data.
[0056] This embodiment does not limit the order of filling missing data and clearing abnormal data, and can be set based on actual applications. Generally, missing data can be filled first, and then abnormal data can be cleared, and missing data can be filled again after the abnormal data is cleared; or abnormal data can be cleared first, and then missing data can be filled again after the abnormal data is cleared.
[0057] Since the temporal resolution and spatial resolution of data from different data sources may differ, this embodiment can perform data normalization to unify the data resolution. This embodiment does not limit the specific method of performing data normalization. Generally, the highest temporal resolution in the spatiotemporal weather data can be determined as the target temporal resolution, and the highest spatial resolution in the spatiotemporal weather data can be determined as the target spatial resolution. The data resolution can be unified to the target temporal resolution and target spatial resolution through interpolation.
[0058] Furthermore, this embodiment can also perform data normalization processing using an artificial intelligence model. Specifically, this embodiment can determine the resolution ratio between the target resolution and the resolution of the data to be converted, downsample the data at the target resolution based on the resolution ratio to obtain downsampled data, and use the data at the target resolution as pseudo-labels for model training to obtain a normalization model for resolution conversion. By inputting data at the resolution of the data to be converted into the normalization model, data converted to the target resolution can be obtained. This embodiment does not limit the specific model type of the normalization model, and it can be set based on actual applications.
[0059] This embodiment can construct four-dimensional meteorological data including time, meteorological elements, longitude and latitude based on the spatiotemporal weather data after data processing. The four-dimensional meteorological data can be in the form of: [T, C, H, W], where T is the time dimension, C is the meteorological element dimension, H is the longitude dimension, and W is the latitude dimension.
[0060] S102: Constructing a weather system classification model based on the spatiotemporal feature fusion module; the spatiotemporal feature fusion module connects the encoding layer and the decoding layer of the weather system classification model.
[0061] This embodiment can construct a weather system classification model based on the spatiotemporal feature fusion module. The spatiotemporal feature fusion module connects the encoding layer and the decoding layer of the weather system classification model. The spatiotemporal feature fusion module in this embodiment can generally be set at the last layer of the encoding layer. Its main function is to perform temporal correlation calculation on the rich spatial information obtained by encoding, so as to find the relative relationship between data at different time steps, and then restore it to the features of the output dimension of the encoder for decoding, so as to obtain spatiotemporal fusion features with rich information in space and time.
[0062] This embodiment does not limit the specific type of weather system classification model; it can generally be a conventional image segmentation model, such as the Unet model and its variants. In this embodiment, the Unet++ model can be selected as the basic architecture of the weather system classification model, that is, the weather system classification model uses the Unet++ model as its foundation. In this embodiment, to better extract features, the encoding layer of the weather system classification model adopts a densely connected architecture. That is, each encoding layer receives the output of all previous layers as input, promoting feature reuse.
[0063] This embodiment does not limit the specific number of layers of the Unet++ model used in the weather system classification model. Generally, the L4 (Layer 4) Unet++ model can be selected as the basic architecture of the weather system classification model. The spatiotemporal feature fusion module is set at the last layer of the encoding layer of the L4 Unet++ model to connect the decoding layer, such as Figure 2 As shown, this embodiment can use X (m,n) Represent the feature map in the Unet++ model and set (m,n) as the feature map number. The values of m and n are the same as the number of layers of the Unet++ model. When the number of layers of the Unet++ model is L4, the maximum value of m and n is 4.
[0064] Figure 2 In, X (0,0) is the initial feature map of the input encoding layer. In the dense connection architecture of the encoding layer, X (0,0) Downsampling as input can get X (1,0) , X (0,0) and X (1,0) Downsampling as input can get X (2,0) , X (0,0) 、X (1,0) and X (2,0) Downsampling as input can get X (3,0) , X (0,0) 、X(1,0) 、X (2,0) and X (3,0) Downsampling as input can get X (4,0) .X (4,0) That is the output feature of the encoding layer, X (4,0) The input spatiotemporal feature fusion module is used to learn the spatiotemporal feature correlation and obtain the input features of the encoding layer output by the spatiotemporal feature fusion module.
[0065] This embodiment does not limit the specific parameters of the upsampling, downsampling, and same-convolution operations of the Unet++ model in the model. This embodiment can adjust the size of the feature map through upsampling and downsampling to achieve feature fusion between feature maps of different levels. Therefore, this embodiment can adjust the parameters in the upsampling and downsampling processes based on the differences in feature maps, and the specific settings can be based on actual applications. Same convolution is a special convolution operation whose purpose is to ensure that the output size after convolution is the same as the input size. This embodiment does not limit the parameters of the same convolution during the jump connection process, and can be set based on actual applications.
[0066] Moreover, this embodiment does not limit the specific method of feature fusion. Generally, in the coding layer, the feature fusion of downsampling in the dense connection process can adopt the channel splicing operation. In the coding layer, the feature fusion in the skip layer connection and upsampling process can adopt the channel numerical addition operation to perform feature fusion.
[0067] This embodiment does not limit the specific architecture of the spatiotemporal feature fusion module. Generally, the spatiotemporal feature fusion module is used to extract the query vector, key vector and value vector from the output features of the coding layer, perform time-delay rolling on the value vector to obtain a time-delay rolling value matrix, perform Fourier transform on the query vector and the key vector to obtain Fourier transform data; perform autocorrelation calculation based on the Fourier transform data to obtain a frequency domain autocorrelation matrix, perform inverse Fourier transform on the frequency domain autocorrelation matrix to obtain a time domain autocorrelation matrix, input the time domain autocorrelation matrix into the activation function to obtain an autocorrelation weight matrix, copy and splice the autocorrelation weight matrix in the time dimension to obtain a spliced autocorrelation weight matrix; perform weighted summation on the spliced autocorrelation weight matrix and the time delay rolling value matrix at each time delay step to obtain a weighted matrix, input the weighted matrix into the activation function to obtain weighted features, and perform feature fusion and feature reshaping on the weighted features and input features to obtain input features of the decoding layer.
[0068] This embodiment does not limit the input form of the input features. Generally, the input can be directly in the four-dimensional form of [T, C, H, W]. Alternatively, T and C can be merged into a new channel dimension T*C to represent time step related features.
[0069] Furthermore, this embodiment is not limited to extracting the query vector (Q), key vector (K) and value vector (V) from the output features of the encoding layer. Generally, a feature extraction unit can be constructed, which includes a depth convolution layer, a depth void convolution layer, a group normalization layer, a 1×1 convolution layer (1×1Conv), a Flatten layer and a stacked fully connected layer (FCStack, Fully Connected Stack) connected in sequence; based on the feature extraction unit, feature extraction is performed on the output features to obtain preprocessing features; and the query vector, key vector and value vector are extracted from the preprocessing features.
[0070] Correspondingly, the weighted features are fused and reshaped with the input features to obtain the input features of the decoding layer. Specifically, the weighted features are fused with the preprocessing features to obtain the fused features, and the fused features are reshaped to obtain the input features with the same dimension as the output features.
[0071] In this embodiment, deep convolution is used to extract local features; deep void convolution is used to expand the receptive field and capture long-distance correlation; the group normalization layer is used for feature normalization; the 1x1 convolution layer is used for feature dimensionality reduction and channel number adjustment; the Flatten layer is used to flatten the four-dimensional spatiotemporal data into a two-dimensional form. For example, when the feature input form is [T, C, H, W], C, H and W can be merged and converted into a two-dimensional form of [T, C*H*W]. When the feature input form is [T*C, H, W], H and W can be merged and converted into a two-dimensional form of [T*C, H*W]. The stacked fully connected layer is used for feature conversion to output preprocessing features.
[0072] This embodiment does not limit the specific method of extracting the query vector, key vector and value vector from the preprocessing features. Generally, the preprocessing features can be input into three 1×1 convolutions respectively to obtain the output query vector, key vector and value vector.
[0073] In this embodiment, the value vector may be time-delayed rolled to obtain a time-delayed rolling matrix. The time-delayed rolling operation is used to offset the data in the time series by a specified number of time steps, thereby introducing a delay in the time dimension to help the model capture the dependencies between different time steps.
[0074] In this embodiment, a time delay rolling (TDR) network may be used to uniformly roll the value vector over all time steps. A rolled time delay rolling value matrix exists at each time delay step, as shown in the following formula:
[0075] Roll(V,τi)=V[t-τi];
[0076] Where, Roll(V, τ i ) is the delay τ i The matrix of rolling values of the time delay after the time step, τ i is the delayed time step, V is the value vector, and t is the current time step.
[0077] Autocorrelation is a crucial concept in signal processing, used to quantify the similarity between a signal and its delayed version. In this example, autocorrelation is used to quantify the similarity between features Q (query vector) and K (key vector) at different time steps. By combining Fourier transforms and autocorrelation, the model can identify significant patterns in the frequency domain, thereby better capturing the temporal characteristics of time series data.
[0078] Specifically, in this embodiment, the query vector and the key vector can be Fourier transformed to obtain the query vector Fourier transform data (Q FFT ) and key vector Fourier transform data (K FFT ), this embodiment does not limit the specific method of Fourier transform, which can generally be a fast Fourier transform (FFT). The query vector Fourier transform data and the key vector Fourier transform data are autocorrelated to obtain a frequency domain autocorrelation matrix, which represents the autocorrelation of Q and K in the frequency domain, as shown in the following formula:
[0079] Auto-Correlation FFT =Q FFT ×K FFT * :
[0080] Where, Auto-Correlation FFT is the frequency domain autocorrelation matrix, Q FFT To query the vector Fourier transform data, K FFT is the key vector Fourier transform data, K FFT * is the complex conjugate of the Fourier transform data of the key vector.
[0081] In order to return to the time domain, we perform an inverse Fourier transform on the autocorrelation result in the frequency domain. Correspondingly, the inverse Fourier transform can be an inverse fast Fourier transform (IFFT), as shown in the following formula:
[0082] Auto-Correlation=IFFT(Auto-Correlation FFT );
[0083] Where, Auto-Corrleation is the time domain autocorrelation matrix, IFFT is the inverse fast Fourier transform, Auto-Correlation FFT is the frequency domain autocorrelation matrix.
[0084] Furthermore, this embodiment can process the time domain autocorrelation matrix through an activation function to obtain an autocorrelation weight matrix. This embodiment does not limit the specific type of activation function, which can generally be a Softmax activation function. The autocorrelation weight matrix is copied and spliced (Repmat) in the time dimension to obtain a spliced autocorrelation weight matrix so that the autocorrelation weight is the same size as the time delay rolling value matrix.
[0085] In a specific embodiment, the TopK algorithm can be used to select the largest K numbers from the time domain autocorrelation matrix, that is, only the first K time delay steps with the highest correlation with the current time step are used. The TopK algorithm is a common statistical algorithm, which finds the first K largest elements or smallest elements in the data combination.
[0086] In this embodiment, a Hadamard product operation is performed on the spliced autocorrelation weight matrix and the time delay rolling value matrix to obtain a fusion matrix, and each element in the fusion matrix is summed at each time delay step to obtain a weighted matrix, as shown in the following formula:
[0087]
[0088] Where Timeout is the weighted matrix, Roll(V, τ i ) is the time delay rolling value matrix, ⊙ is the Hadamard product, R Q,K is the concatenated autocorrelation weight matrix, Roll(V, τ i )⊙R Q,K is the fusion matrix, τ i is the delay time step, and l is the total number of time delay steps.
[0089] In this embodiment, the weighted matrix can be processed by an activation function to obtain weighted features. This embodiment does not limit the specific type of activation function, and it can generally be a Softmax activation function. Furthermore, the weighted features can be fused with the preprocessing features output by the stacked fully connected layer to obtain fused features. This embodiment does not limit the specific method of feature fusion, and it can generally be fused by channel splicing. The fused features after fusion are reshaped to obtain input features input to the decoding layer. The feature reshaping operation in this embodiment is mainly to achieve dimensional restoration of the features.
[0090] The integration of fractional-order control systems with neural networks is a new direction. It offers strong interpretability, clear control strategies, and the ability to optimize model parameters and improve performance. Analyzing the temporal evolution of weather systems can be used to describe the temporal changes in characteristic graphs.
[0091] In this embodiment, the idea of fractional-order differential equations can be used in the encoding layer and decoder to realize the transmission and fusion of feature maps between different levels through specific weights. These weights reflect the relationship between feature maps at different levels, which are similar to the weight terms in fractional-order differential equations.
[0092] Furthermore, in this embodiment, a correction unit can be introduced into the encoding layer and the decoding layer to implement correction of the feature map through the correction unit.
[0093] Specifically, after introducing fractional-order differential equations in the encoding layer and the decoding layer, the expression of the feature map in the encoding layer can be:
[0094]
[0095] Among them, (m,n) is the feature map sign, is the feature map in the coding layer, h is the step size, is the channel splicing operation, Γ(α) is the gamma function operation of the fractional-order differential operator α, F() is the downsampling operation, X (m,n) is the corrected feature map, X (j,n) It is the corrected feature map when m takes j.
[0096] Furthermore, the expression of the corrected feature map in the encoding layer is:
[0097]
[0098] Among them, X (m,n) | n=0 is the corrected feature map in the encoding layer, is the feature map in the encoding layer, F() is the downsampling operation, a u,v is the correction coefficient of the discretization of the fractional-order differential equation, u and v are the first and second parameters of the correction coefficient respectively, X (j,n) is the corrected feature map when m takes j, This is the channel splicing operation.
[0099] Correspondingly, the expression of the feature map in the decoding layer is:
[0100]
[0101] Among them, (m,n) is the feature map sign, is the feature map in the decoding layer, X (m,n)is the corrected feature map, X (m,j) is the corrected feature map when n is j, X (m+1,0) is the corrected feature map when the feature map mark is (m+1,0), X (m+1,n-1) is the corrected feature map when the feature map is marked as (m+1,n-1), k is the number of layers of the Unet++ model, h is the step size, Γ(α) is the gamma function operation of the fractional-order differential operator α, T() is the upsampling operation, S() is the same convolution operation, Tac(X m+1,0 ) is the input feature of the decoding layer.
[0102] Optionally, the expression of the rectified feature map in the encoding layer is:
[0103]
[0104] in, is the feature map in the decoding layer, X (m,n) | n≠0 is the rectified feature map in the decoding layer, X (m,j) is the corrected feature map when n is j, X (m+1,0) is the corrected feature map when the feature map mark is (m+1,0), X (m+1,n-1) is the corrected feature map when the feature map is marked as (m+1,n-1), k is the number of layers of the Unet++ model, and a u,v is the correction coefficient for discretization of fractional-order differential equations, u and v are the first and second parameters of the correction coefficient, T() is the upsampling operation, S() is the convolution operation, Tac(X m+1,0 ) is the input feature of the decoding layer.
[0105] In this embodiment, whether n is 0 can be used to distinguish whether the feature map is a feature in the encoding layer or a feature in the decoding layer. For example, when n is 0, X (m,0) is the feature map in the coding layer. When n is not 0, X (m,n) is the feature map in the decoding layer. In this embodiment, the values of m and n are related to the number of layers of the Unet++ model, that is, the maximum value of m and n is the number of layers of the Unet++ model. When m is k-1 and n is 1, X (k-1,1) is the first feature map in the decoding layer, then X (k,0) It is the last feature map in the encoding layer, that is, the output feature of the encoding layer.
[0106] In this embodiment, X (k,0) After being processed by the spatiotemporal feature fusion module, the input feature Tac(X (k,0) ), Tac(X (m+1,0) ) is used as the input feature of the encoding layer and is upsampled with the convolutional layer X (k-1,0)Adding the values on the channels gives X (k-1,1) .
[0107] In this embodiment, α is the fractional order, which controls the influence range of feature transfer. It is the basic weight of feature transfer, similar to the fractional derivative part in the fractional differential equation, which controls the transfer ratio of features between different levels. α -(mj-1) α ] and [(nj) α -(nj-1) α ] is the difference between features at different levels, which controls the specific transmission relationship between features at different levels. By adjusting α, the change pattern of feature maps at different levels can be controlled.
[0108] In this embodiment, a u,v is the correction coefficient for discretization of fractional differential equations, u and v are the first and second parameters of the correction coefficient respectively. This embodiment does not limit a u,v The specific form of the expression can generally be:
[0109]
[0110] Where a u,v is the correction coefficient for discretization of the fractional-order differential equation, u and v are the first and second parameters of the correction coefficient respectively, h is the step size, and Γ(α+2) is the gamma function operation after the fractional-order differential operator α is added with 2.
[0111] Furthermore, this embodiment can set a channel attention mechanism layer and a classifier connected in sequence after the decoder of the weather system splitting model, and output the probability distribution of the final weather system type through the classifier.
[0112] The channel attention mechanism layer in this embodiment mainly obtains two 1×1×C feature maps through global maximum pooling (MaxPool) and global average pooling (AvgPool) in the two dimensions of H and W; then, the two 1×1×C feature maps are sent to a two-layer neural network with shared weights to learn the inter-channel dependencies and obtain the weights of each feature channel; each feature channel is assigned a weight, and the corresponding channel feature values are weighted multiplied; and after the channel attention layer, a 1×1 convolution is used to reduce the number of channels to the target channel and align them with the prediction elements.
[0113] The classifier in this embodiment may include a Flatten layer, a first fully connected layer, a Dropout layer, a second fully connected layer and an activation function connected in sequence; wherein, the Flatten layer is used to perform feature flattening, flattening the four-dimensional input data into a two-dimensional first feature for processing by the fully connected layer; the first fully connected layer is used to perform a nonlinear transformation on the flattened first feature to obtain a second feature; the Dropout layer is a regularization technique commonly used in training deep neural networks to prevent model overfitting, and the second feature is processed by the Dropout layer to output a third feature; the second fully connected layer is used to perform a nonlinear change on the third feature to obtain a fourth feature; the activation function is used to calculate the fourth feature to determine the probability distribution of the final weather system type.
[0114] S103: Training a weather system classification model based on the four-dimensional meteorological data to obtain a trained weather system classification model.
[0115] S104: Inputting the four-dimensional meteorological data to be detected into the trained weather system classification model to obtain an output weather system classification result.
[0116] This embodiment can train a weather system classification model based on four-dimensional meteorological data to obtain a trained weather system classification model. Specifically, this embodiment can set a weather system classification label for the four-dimensional meteorological data at each time step based on the type of the weather system, input the four-dimensional meteorological data with the weather system classification label into the weather system classification model for model training, obtain the probability distribution of the weather system type to which the four-dimensional meteorological data at each time step output by the model belongs, determine the loss value of the four-dimensional meteorological data at each time step based on the probability distribution, and update the model parameters based on the loss value until the model parameters converge, thereby completing the training of the weather system classification model.
[0117] After the weather system classification model training is completed, this embodiment can classify the weather system based on the weather system classification model. Specifically, this embodiment can collect meteorological data to be detected, and convert the meteorological data to be detected into four-dimensional meteorological data to be detected, and finally input the four-dimensional meteorological data to be detected into the trained weather system classification model to obtain the output weather system classification result.
[0118] Based on the above embodiments, the method of the present invention constructs a spatiotemporal feature fusion module for extracting the spatiotemporal correlation of features, and connects the encoding layer and decoding layer of the weather system classification model of the model through the spatiotemporal feature fusion module, so that the model can more effectively learn the spatiotemporal correlation of meteorological data and improve the accuracy of weather system classification.
[0119] The following combination Figure 4 , Figure 4This is a structural block diagram of a weather system classification device provided by an embodiment of the present invention. The device may include:
[0120] The first module 100 is used to obtain spatiotemporal weather data including multiple meteorological elements, and construct four-dimensional meteorological data including time, meteorological elements, longitude and latitude based on the spatiotemporal weather data;
[0121] The second module 200 is used to build a weather system classification model based on the spatiotemporal feature fusion module; the spatiotemporal feature fusion module connects the encoding layer and the decoding layer of the weather system classification model;
[0122] The third module 300 is configured to train the weather system classification model based on the four-dimensional meteorological data to obtain the trained weather system classification model;
[0123] The fourth module 400 is configured to input the four-dimensional meteorological data to be detected into the trained weather system classification model to obtain an output weather system classification result;
[0124] The spatiotemporal feature fusion module is configured to extract a query vector, a key vector, and a value vector from the output features of the coding layer, perform time-delay rolling on the value vector to obtain a time-delay rolling value matrix, and perform Fourier transform on the query vector and the key vector to obtain Fourier transform data.
[0125] Performing autocorrelation calculation based on the Fourier transform data to obtain a frequency domain autocorrelation matrix, performing inverse Fourier transform on the frequency domain autocorrelation matrix to obtain a time domain autocorrelation matrix, inputting the time domain autocorrelation matrix into an activation function to obtain an autocorrelation weight matrix, and copying and splicing the autocorrelation weight matrix in the time dimension to obtain a spliced autocorrelation weight matrix;
[0126] A weighted matrix is obtained by weighted summation based on the spliced autocorrelation weight matrix and the time delay rolling value matrix at each time delay step, the weighted matrix is input into an activation function to obtain weighted features, and the weighted features are fused and reshaped with the input features to obtain the input features of the decoding layer.
[0127] Based on the above embodiments, the method of the present invention constructs a spatiotemporal feature fusion module for extracting the spatiotemporal correlation of features, and connects the encoding layer and decoding layer of the weather system classification model of the model through the spatiotemporal feature fusion module, so that the model can more effectively learn the spatiotemporal correlation of meteorological data and improve the accuracy of weather system classification.
[0128] Based on the above embodiment, the weather system classification model is based on the Unet++ model, and the encoding layer of the weather system classification model is a densely connected architecture.
[0129] Based on the above embodiments, the expression of the feature map in the coding layer is:
[0130]
[0131] Among them, (m,n) is the feature map sign, is the feature map in the coding layer, h is the step size, is the channel splicing operation, Γ(α) is the gamma function operation of the fractional-order differential operator α, F() is the downsampling operation, X (m,n) is the corrected feature map, X (j,n) It is the corrected feature map when m is j.
[0132] Based on the above embodiments, the expression of the corrected feature map in the coding layer is:
[0133]
[0134] Among them, X (m,n) |n=0 is the corrected feature map in the coding layer, is the feature map in the coding layer, F() is the downsampling operation, a u,v is the correction coefficient for discretization of fractional-order differential equations, u and v are the first and second parameters of the correction coefficient respectively, X (j,n) is the corrected feature map when m takes j, This is the channel splicing operation.
[0135] Based on the above embodiments, the expression of the feature map in the decoding layer is:
[0136]
[0137] Among them, (m,n) is the feature map sign, is the feature map in the decoding layer, X (m,n) is the corrected feature map, X (m,j) is the corrected feature map when n is j, X (m+1,0) is the corrected feature map when the feature map mark is (m+1,0), X (m+1,n-1) is the corrected feature map when the feature map is marked as (m+1, n-1), k is the number of layers of the Unet++ model, h is the step size, Γ(α) is the gamma function operation of the fractional-order differential operator α, T() is the upsampling operation, S() is the same convolution operation, Tac(X m+1,0 ) is the input feature of the decoding layer.
[0138] Based on the above embodiments, the expression of the corrected feature map in the coding layer is:
[0139]
[0140] in, is the feature map in the decoding layer, X (m,n) | n≠0 is the rectified feature map in the decoding layer, X (m,j) is the corrected feature map when n is j, X (m+1,0) is the corrected feature map when the feature map mark is (m+1,0), X (m+1,n-1) is the corrected feature map when the feature map mark is (m+1,n-1), k is the number of layers of the Unet++ model, a u,v is the correction coefficient for discretization of fractional-order differential equations, u and v are the first and second parameters of the correction coefficient respectively, T() is the upsampling operation, S() is the convolution operation, Tac(X m+1,0 ) is the input feature of the decoding layer.
[0141] Based on the above embodiments, extracting the query vector, key vector, and value vector from the output features of the encoding layer may include:
[0142] Constructing a feature extraction unit; the feature extraction unit may include a depth convolution layer, a depth void convolution layer, a group normalization layer, a 1×1 convolution layer, a Flatten layer and a stacked fully connected layer connected in sequence;
[0143] Extracting features from the output features based on the feature extraction unit to obtain preprocessing features;
[0144] extracting the query vector, the key vector, and the value vector from the preprocessed features;
[0145] Accordingly, the step of fusing and reshaping the weighted features with the input features to obtain the input features of the decoding layer may include:
[0146] The weighted features are weightedly fused with the preprocessed features to obtain fused features, and the fused features are reshaped to obtain input features with the same dimension as the output features.
[0147] Based on the above embodiments, the present invention further provides an electronic device, which may include a memory and a processor. The memory stores a computer program, and the processor, when invoking the computer program in the memory, can implement the steps provided in the above embodiments. Of course, the device may also include various necessary network interfaces, a power supply, and other components.
[0148] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an execution terminal or a processor, can implement the method provided in an embodiment of the present invention; the storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program codes.
[0149] In this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
Claims
1. A weather system classification method, characterized in that: include: Acquire spatiotemporal weather data including a plurality of meteorological elements, and construct four-dimensional meteorological data including time, meteorological elements, longitude, and latitude based on the spatiotemporal weather data; Constructing a weather system classification model based on a spatiotemporal feature fusion module; the spatiotemporal feature fusion module connects the encoding layer and the decoding layer of the weather system classification model; Training the weather system classification model based on the four-dimensional meteorological data to obtain the trained weather system classification model; Inputting the four-dimensional meteorological data to be detected into the trained weather system classification model to obtain an output weather system classification result; Among them, the spatiotemporal feature fusion module is used to extract the query vector, key vector and value vector from the output features of the coding layer, perform time delay rolling on the value vector to obtain a time delay rolling value matrix, and perform Fourier transform on the query vector and the key vector to obtain Fourier transform data; based on the feature extraction unit, feature extraction is performed on the output features of the coding layer to obtain preprocessing features; the query vector, the key vector and the value vector are extracted from the preprocessing features; the feature extraction unit includes a depth convolution layer, a depth void convolution layer, a group normalization layer, a 1×1 convolution layer, a Flatten layer and a stacked fully connected layer connected in sequence; Performing autocorrelation calculation based on the Fourier transform data to obtain a frequency domain autocorrelation matrix, performing inverse Fourier transform on the frequency domain autocorrelation matrix to obtain a time domain autocorrelation matrix, inputting the time domain autocorrelation matrix into an activation function to obtain an autocorrelation weight matrix, and copying and splicing the autocorrelation weight matrix in the time dimension to obtain a spliced autocorrelation weight matrix; A weighted matrix is obtained by weighted summation based on the spliced autocorrelation weight matrix and the time delay rolling value matrix at each time delay step, the weighted matrix is input into the activation function to obtain weighted features, and the weighted features are fused and reshaped with the preprocessing features output by the stacked fully connected layer to obtain the input features of the decoding layer.
2. The weather system classification method according to claim 1, characterized in that: The weather system classification model is based on the Unet++ model, and the encoding layer of the weather system classification model is a densely connected architecture; correction units and fractional-order differential equations are introduced in the encoding layer and the decoding layer, and feature maps are transferred and fused between different levels based on the fractional-order differential equations, and feature maps are corrected based on the correction unit.
3. The weather system classification method according to claim 2, characterized in that: The expression of the feature map in the encoding layer is: ; Among them, (m,n) is the feature map sign, is the feature map in the coding layer, h is the step size, For channel splicing operation, is the fractional differential operator Gamma function operation, F() is the downsampling operation, It is the corrected feature map when m takes j.
4. The weather system classification method according to claim 3, characterized in that: The expression of the corrected feature map in the coding layer is: ; in, is the corrected feature map in the coding layer, is the feature map in the coding layer, F() is the downsampling operation, is the correction coefficient for discretization of fractional-order differential equations, u and v are the first and second parameters of the correction coefficient respectively, is the corrected feature map when m takes j, This is the channel splicing operation.
5. The weather system classification method according to claim 2, characterized in that: The expression of the feature map in the decoding layer is: ; Among them, (m,n) is the feature map sign, is the feature map in the decoding layer, is the corrected feature map when n takes j, is the corrected feature map when the feature map mark is (m+1,0), is the corrected feature map when the feature map is marked as (m+1,n-1), k is the number of layers of the Unet++ model, h is the step size, is the fractional differential operator Gamma function operation, T() is the upsampling operation, S() is the same convolution operation, is the input feature of the decoding layer.
6. The weather system classification method according to claim 5, characterized in that: The expression of the corrected feature map in the coding layer is: ; in, is the feature map in the decoding layer, is the corrected feature map in the decoding layer, is the corrected feature map when n takes j, is the corrected feature map when the feature map mark is (m+1,0), is the corrected feature map when the feature map is marked as (m+1,n-1), k is the number of layers of the Unet++ model, is the correction coefficient for discretization of fractional-order differential equations, u and v are the first and second parameters of the correction coefficient respectively, T() is the upsampling operation, S() is the convolution operation, is the input feature of the decoding layer.
7. The weather system classification method according to claim 1, characterized in that: The extracting the query vector, the key vector, and the value vector from the output features of the encoding layer includes: Constructing a feature extraction unit; the feature extraction unit includes a depth convolution layer, a depth void convolution layer, a group normalization layer, a 1×1 convolution layer, a Flatten layer and a stacked fully connected layer connected in sequence; Extracting features from the output features based on the feature extraction unit to obtain preprocessing features; extracting the query vector, the key vector, and the value vector from the preprocessed features; Accordingly, the step of fusing and reshaping the weighted features with the input features to obtain the input features of the decoding layer includes: The weighted features are weightedly fused with the preprocessed features to obtain fused features, and the fused features are reshaped to obtain input features with the same dimension as the output features.
8. A weather system classification device, characterized in that: include: The first module is used to obtain spatiotemporal weather data containing multiple meteorological elements, and construct four-dimensional meteorological data containing time, meteorological elements, longitude and latitude based on the spatiotemporal weather data; The second module is used to build a weather system classification model based on the spatiotemporal feature fusion module; the spatiotemporal feature fusion module connects the encoding layer and the decoding layer of the weather system classification model; A third module is configured to train the weather system classification model based on the four-dimensional meteorological data to obtain the trained weather system classification model; The fourth module is used to input the four-dimensional meteorological data to be detected into the trained weather system classification model to obtain an output weather system classification result; Among them, the spatiotemporal feature fusion module is used to extract the query vector, key vector and value vector from the output features of the coding layer, perform time delay rolling on the value vector to obtain a time delay rolling value matrix, and perform Fourier transform on the query vector and the key vector to obtain Fourier transform data; based on the feature extraction unit, feature extraction is performed on the output features of the coding layer to obtain preprocessing features; the query vector, the key vector and the value vector are extracted from the preprocessing features; the feature extraction unit includes a depth convolution layer, a depth void convolution layer, a group normalization layer, a 1×1 convolution layer, a Flatten layer and a stacked fully connected layer connected in sequence; Performing autocorrelation calculation based on the Fourier transform data to obtain a frequency domain autocorrelation matrix, performing inverse Fourier transform on the frequency domain autocorrelation matrix to obtain a time domain autocorrelation matrix, inputting the time domain autocorrelation matrix into an activation function to obtain an autocorrelation weight matrix, and copying and splicing the autocorrelation weight matrix in the time dimension to obtain a spliced autocorrelation weight matrix; A weighted matrix is obtained by weighted summation based on the spliced autocorrelation weight matrix and the time delay rolling value matrix at each time delay step, the weighted matrix is input into the activation function to obtain weighted features, and the weighted features are fused and reshaped with the preprocessing features output by the stacked fully connected layer to obtain the input features of the decoding layer.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the weather system classification method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the weather system classification method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Long-term and short-term public traffic flow prediction method
CN115440032A
Multivariate space-time prediction method and system for weather forecast
CN118226551A