Meteorological forecasting method and device, storage medium and electronic device
By combining linear neural networks and convolutional neural networks to decode meteorological data, the problem that meteorological forecasting in the prior art cannot capture local details and spatial continuity at the same time is solved, and more accurate meteorological forecasting results are achieved.
Patent Information
- Application Number
- CN202411310298.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-17
AI Technical Summary
Existing meteorological forecasting methods cannot accurately predict meteorological changes in local scope and continuous changes in space at the same time, and lack the accuracy and spatial continuity of local details.
The linear neural network decoder and convolutional neural network decoder are used to decode historical meteorological data, capture local details and spatial continuity respectively, and the two are weighted and fused to generate meteorological forecast results.
The meteorological forecast results of the target area are achieved to more accurately predict local details and spatial correlation, and the accuracy and continuity of meteorological forecasts are improved.
Smart Images

Figure CN119148256A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of weather forecasting, and more specifically, to a weather forecasting method and device, a storage medium, an electronic device, and a computer program product. Background Art
[0002] With the development of social economy, people's requirements for the accuracy and timeliness of weather forecasts are constantly increasing, especially short-term forecasts, which can help people prevent meteorological disasters and reduce economic losses. Accurate weather forecasts require meteorological data with high temporal and spatial resolution. High-resolution weather forecasts can provide more detailed meteorological information, such as terrain, temperature, wind speed and direction, which helps to better understand complex weather systems and weather phenomena. Therefore, high-resolution weather forecasts have important practical significance.
[0003] In the related art, an existing large meteorological model is usually used for weather forecasting, and an output layer is added to the structure of the large meteorological model to output the weather forecast results.
[0004] However, the weather forecast results in the related art cannot have both the accuracy of local details and spatial continuity, that is, it is impossible to accurately predict the changes in the local weather and the continuous changes in the weather in space at the same time. Summary of the invention
[0005] Embodiments of the present application provide a weather forecasting method and device, a storage medium, an electronic device, and a computer program product.
[0006] According to one aspect of an embodiment of the present application, a weather forecasting method is provided, the method comprising: acquiring historical meteorological data of a target area; using a preset feature detection model to perform feature extraction on the historical meteorological data to obtain meteorological feature data; respectively using a first decoder and a second decoder to decode the meteorological feature data to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder; weighted fusion of the first prediction result and the second prediction result to obtain a weather forecast result for the target area.
[0007] In an exemplary embodiment, the first decoder is used to decode the meteorological feature data to obtain a first prediction result, including: performing layer normalization, average pooling, and dimensionality conversion on the meteorological feature data in sequence to obtain a first meteorological feature vector; using a linear fully connected layer to decode the first meteorological feature vector to obtain a first decoded feature vector; performing dimensionality conversion on the first decoded feature vector to obtain a first meteorological feature matrix as the first prediction result, wherein the dimension of the first meteorological feature matrix is the same as the dimension of the meteorological feature data.
[0008] In an exemplary embodiment, the second decoder is used to decode the meteorological characteristic data to obtain a second prediction result, including: performing at least one convolution decoding process on the meteorological characteristic data to obtain the second prediction result, wherein the convolution decoding process includes deconvolution layer processing, batch normalization processing, activation function processing, convolution layer processing, batch normalization processing, and activation function processing in sequence.
[0009] In an exemplary embodiment, the method of extracting features from the historical meteorological data using a preset feature detection model to obtain meteorological feature data includes: segmenting the image of the historical meteorological data to obtain a plurality of image blocks of the historical meteorological data; encoding the plurality of image blocks to obtain high-dimensional feature vectors of the plurality of image blocks; and sequentially inputting the high-dimensional feature vectors of the plurality of image blocks into a multi-layer sliding window transformer model for feature extraction processing to obtain the meteorological feature data.
[0010] In an exemplary embodiment, the high-dimensional feature vectors of the multiple image blocks are sequentially input into a multi-layer sliding window transformer model for feature extraction processing to obtain the meteorological feature data, including: inputting the high-dimensional feature vectors of the multiple image blocks into a first-layer sliding window transformer model to obtain multiple first meteorological feature image blocks; merging the multiple first meteorological feature image blocks and then inputting them into a second-layer sliding window transformer model to obtain a meteorological feature matrix as the meteorological feature data.
[0011] In an exemplary embodiment, the weighted fusion of the first prediction result and the second prediction result to obtain the weather forecast result of the target area includes: obtaining a first weight of the first prediction result and a second weight of the second prediction result, wherein the sum of the first weight and the second weight is 1; adding the result of multiplying the first prediction result by the first weight and the result of multiplying the second prediction result by the second weight to obtain the weather forecast result of the target area.
[0012] According to another aspect of the embodiment of the present application, a weather forecasting device is also provided, the device comprising:
[0013] A data acquisition module is used to obtain historical meteorological data of the target area;
[0014] A feature extraction module is used to extract features from the historical meteorological data using a preset feature detection model to obtain meteorological feature data;
[0015] A decoding module, configured to respectively decode the meteorological characteristic data using a first decoder and a second decoder to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder;
[0016] The data fusion module is used to weightedly fuse the first prediction result and the second prediction result to obtain the weather forecast result of the target area.
[0017] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned weather forecasting method when running.
[0018] According to another aspect of the embodiments of the present application, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the weather forecasting method through the computer program.
[0019] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.
[0020] The above-mentioned weather forecasting method first obtains the historical weather data of the target area, and then uses a preset feature detection model to extract features from the historical weather data to obtain weather feature data. After obtaining the weather feature data, the weather feature data is decoded and processed by the first decoder and the second decoder respectively to obtain the first prediction result output by the first decoder and the second prediction result output by the second decoder. The first decoder is a linear neural network decoder. Since the linear neural network decoder can accurately capture local details when used as the output layer, the first prediction result output by the first decoder can more accurately predict the weather conditions within the local range. The second decoder is a convolutional neural network decoder. Since the convolutional neural network decoder can better learn the spatial continuity of adjacent grid points when used as the output layer, the second prediction result output by the second decoder can reflect the correlation of the weather conditions in the adjacent spaces. The first prediction result and the second prediction result are weighted and fused to obtain the weather forecast result of the target area, which can accurately predict the weather conditions within the local range of the target area on the one hand, and reflect the correlation of the weather conditions in different spaces of the target area on the other hand. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0023] Figure 1 It is a hardware structure block diagram of the weather forecasting method of the embodiment of the present application;
[0024] Figure 2 is a flow chart of a weather forecasting method according to an embodiment of the present application;
[0025] Figure 3 is a schematic diagram of a model architecture according to an embodiment of the present application;
[0026] Figure 4 is a flowchart of a processing method of a first decoder according to an embodiment of the present application;
[0027] Figure 5 is a flow chart of a method for obtaining meteorological characteristic data according to an embodiment of the present application;
[0028] Figure 6This is a second flow chart of a method for obtaining meteorological characteristic data according to an embodiment of the present application;
[0029] Figure 7 is a flow chart of a method for obtaining a weather forecast result according to an embodiment of the present application;
[0030] Figure 8 It is a structural block diagram of a weather forecasting device according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0033] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of the weather forecasting method of the embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 The computer terminal includes a processor 102 (only one is shown in the figure) (the processor 102 may include but is not limited to a microprocessor (Microprocessor Unit, MPU for short) or a programmable logic device (PLD for short)) and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 A different configuration with more features is shown.
[0034] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the weather forecasting method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0035] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0036] In view of the above problems, a weather forecasting method is provided in this embodiment. Figure 2 This is a flow chart of an optional weather forecasting method according to an embodiment of the present application, and the process includes the following steps S200-S230:
[0037] Step S200, obtaining historical meteorological data of the target area.
[0038] Among them, multiple three-dimensional meteorological characteristic maps of the target area can be obtained as historical meteorological data. Historical meteorological data include historical high-precision terrain data, historical meteorological data site real-time observation data, historical meteorological data grid reanalysis data, and historical model forecast data. The collected historical model forecast data include but are not limited to the China Meteorological Administration Wind and Solar Medium-Term Model Forecast (CMA-WSP), the European Center for Medium-Term Weather Forecasts Numerical Model Forecast (ECMWF), the China Meteorological Administration Mesoscale Numerical Forecast (CMA-MESO), the U.S. National Center for Environmental Prediction Model Forecast (NCEP), etc. The meteorological elements obtained include but are not limited to wind speed, wind direction, temperature, relative humidity, air pressure, etc.
[0039] Step S210, using a preset feature detection model to extract features from historical meteorological data to obtain meteorological feature data.
[0040] Among them, the preset feature detection model can be a neural network model based on the Transformer architecture, which serves as the backbone neural network model.
[0041] For example, the input of the feature detection model is the three-dimensional meteorological feature map InWea∈R at time T0 height ×lon×lat , the output is the three-dimensional meteorological characteristic map OutWea∈R at time T1 height×lon×lat .
[0042] Exemplarily, the process of feature extraction processing of historical meteorological data through the Transformer feature extraction network is as follows: through the Transformer feature extraction networks of different dimensions, the historical high-precision terrain features corresponding to the historical high-precision terrain data, the historical site actual observation features corresponding to the historical meteorological data site actual observation data, the historical grid point reanalysis actual features corresponding to the historical meteorological data grid reanalysis data, and the historical pattern forecast features corresponding to the historical pattern forecast data are respectively extracted. In an embodiment of the present invention, Transformer feature extraction networks of different dimensions are constructed for the historical meteorological data site actual observation data, historical high-precision terrain data, historical meteorological data grid reanalysis data, and different historical pattern forecast data. The feature extraction network based on Transformer can efficiently process long-term spatiotemporal dependencies, effectively extract the nonlinear relationship between wind speed and multiple meteorological elements such as temperature, humidity, air pressure, wind direction, and the interactive influence between adjacent position points in space.
[0043] Step S220, respectively use the first decoder and the second decoder to decode the meteorological characteristic data to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder.
[0044] Among them, the first decoder is a linear neural network decoder, and the second decoder is a convolutional neural network decoder.
[0045] When linear neural network structures are fitted as output layers in weather forecasting, they can capture local details, but they have certain limitations in dealing with spatial continuity. This is mainly due to some characteristics of linear neural networks and the way they deal with spatial data. Since linear neural networks usually use linear activation functions, such as the identity function. This means that the output of the network is a linear combination of the input and cannot capture nonlinear relationships. In weather forecasting, many phenomena (such as precipitation, temperature, etc.) have complex nonlinear relationships with spatial locations. Therefore, linear neural networks may not be able to fully capture these relationships, resulting in the inability to reflect the spatial continuity of adjacent grid points. Linear neural networks usually do not have an explicit spatial structure, which means that they cannot directly capture the spatial relationship between adjacent grid points. However, linear neural networks can fit more refined local details and provide meteorological information for smaller areas, such as different areas of a city or different plots of a piece of farmland, rather than just providing average conditions over a large area. They can identify and predict local meteorological features, such as changes in cloud cover, slight differences in wind speed, or differences in the distribution of rainfall in a small area. They can more accurately reflect the actual observed meteorological data, reduce errors, and improve the accuracy of predictions. It can adapt to and reflect the particularities of different geographical locations, such as the impact of terrain, ocean, urbanization characteristics, etc. on meteorological conditions.
[0046] Convolutional neural network structures can better learn the spatial continuity of adjacent grid points, which means that meteorological models can consider the correlation of meteorological data between geographically adjacent locations when making predictions, thereby more accurately simulating the continuous changes in space of meteorological phenomena. In weather forecasting, the meteorological conditions of an area are often closely related to its surrounding areas. For example, if an area is experiencing precipitation, it is likely that its neighboring areas will also experience precipitation in a short period of time. Convolutional neural networks (CNNs) can better understand spatial continuity by using convolutional layers to capture local correlations in image or spatial data. The convolutional layer locally processes the input data through a sliding window (filter), allowing the model to learn the relationship between adjacent pixels or grid points. This mechanism makes convolutional neural networks perform well in processing data with obvious spatial structure (such as images or maps).
[0047] Step S230: weighted fusion of the first prediction result and the second prediction result to obtain a weather forecast result for the target area.
[0048] Specifically, the first prediction result and the second prediction result are weighted and fused. Since the first prediction result can more accurately predict local details and the second prediction result can reflect spatial continuity, the fused weather forecast result can accurately predict the weather conditions in the local area of the target area and reflect the correlation of the weather conditions in different spaces of the target area.
[0049] For example, the framework diagram of the weather forecasting method is as follows: Figure 3 As shown in the figure, the Transformer architecture is used as the feature detection model of the backbone neural network of the model, and the historical meteorological data is input into the feature detection model. Then the first decoder and the second decoder are designed as the output layer, and the calculation is performed in a two-line parallel manner. The output results obtained are weighted and fused respectively, and finally the meteorological forecast results are output.
[0050] In this embodiment, the historical meteorological data of the target area is first obtained, and then the preset feature detection model is used to extract the features of the historical meteorological data to obtain the meteorological feature data. After obtaining the meteorological feature data, the meteorological feature data is decoded by the first decoder and the second decoder to obtain the first prediction result output by the first decoder and the second prediction result output by the second decoder. The first decoder is a linear neural network decoder. Since the linear neural network decoder can accurately capture local details when used as the output layer, the first prediction result output by the first decoder can more accurately predict the meteorological conditions within the local range. The second decoder is a convolutional neural network decoder. Since the convolutional neural network decoder can better learn the spatial continuity of adjacent grid points when used as the output layer, the second prediction result output by the second decoder can reflect the correlation of the meteorological conditions of adjacent spaces. The first prediction result and the second prediction result are weighted and fused to obtain the meteorological forecast result of the target area, which can accurately predict the meteorological conditions within the local range of the target area on the one hand, and reflect the correlation of the meteorological conditions of different spaces in the target area on the other hand.
[0051] In one embodiment, Figure 4 As shown, in step S210, a first decoder is used to decode the meteorological characteristic data to obtain a first prediction result, including steps S400-420.
[0052] Step S400, performing layer normalization processing, average pooling processing, and dimension conversion processing on the meteorological feature data in sequence to obtain a first meteorological feature vector.
[0053] The first decoder is a linear multilayer fully connected neural network decoder. First, the first decoder receives meteorological feature data, which can be represented as a three-dimensional meteorological feature matrix R c×h×w , where c is the number of channels, h represents the height, and w represents the width. Then the input meteorological feature matrix is layer normalized to reduce the internal covariate shift and help the model learn better. Through the average pooling operation, the feature map of each channel is averaged along the height and width directions to obtain the global features of each channel. Then the dimension conversion process is performed to convert the feature map into a one-dimensional vector to obtain the first meteorological feature vector.
[0054] For example, this process can be expressed by the following formula:
[0055]
[0056] Among them, FWea is the meteorological characteristic data, and its dimension is R c×h×w , LayerNorm is the layer normalization process, AveragePool is the average pooling process, and Reshape is the dimension conversion process. Finally, the first meteorological feature vector FWea is obtained. 1 , whose dimension is R hw .
[0057] Step S410: Use a linear fully connected layer to decode the first meteorological feature vector to obtain a first decoded feature vector.
[0058] Among them, a linear fully connected layer is used to decode the first meteorological feature vector, and this process includes transforming the first meteorological feature vector through a weight matrix to obtain a first decoded feature vector. Specifically, it can be: first, define a weight matrix W, whose dimension matches the dimension of the first meteorological feature. Then define a bias vector b, whose dimension is the same as the number of channels of the output first decoded feature vector. Then perform a matrix multiplication operation on the first meteorological feature and the weight matrix W, add the result to the bias vector b, and then perform feature transformation through an activation function to obtain the first decoded feature vector.
[0059] Step S420: Perform dimension conversion processing on the first decoded feature vector to obtain a first meteorological feature matrix as a first prediction result.
[0060] The dimension of the first meteorological feature matrix is the same as the dimension of the meteorological feature data.
[0061] For example, this process can be expressed by the following formula:
[0062]
[0063] Among them, ReLU is the activation function, W 1 is the weight matrix, b 1 is the bias term, FWea 1 is the first meteorological feature vector, Reshape represents the dimension conversion process, LF is the first prediction result, and its dimension is R height×lon×lat .
[0064] In this embodiment, the decoding of meteorological characteristic data is implemented by a linear multi-layer fully connected neural network decoder, which can capture local details in the input data, and finally the output first prediction result can be converted back to the dimension of the meteorological characteristic map with the same dimension as the input meteorological characteristic data, so as to perform subsequent meteorological forecasts.
[0065] In one embodiment, in step S210, the meteorological characteristic data is decoded by a second decoder to obtain a second prediction result, including:
[0066] The meteorological characteristic data is subjected to at least one convolution decoding process to obtain a second prediction result, wherein the convolution decoding process includes sequentially performing deconvolution layer processing, batch normalization processing, activation function processing, convolution layer processing, batch normalization processing, and activation function processing.
[0067] Specifically, the convolution decoding process includes: taking the meteorological feature data as the input of the deconvolution layer (TransposedConv), and performing a deconvolution operation on the meteorological feature data, which usually involves performing a transposed convolution on the feature map to increase the dimension and spatial resolution. The data is then batch normalized (BatchNorm), and normalization helps to improve the stability and convergence speed of model training. Then adding the activation function ReLU to perform a nonlinear transformation on the batch-normalized output data can increase the nonlinear expression ability of the network. The data output after the activation function is then input into the convolution layer (Conv) for a convolution operation. The convolution layer is used to extract local features on the feature map. The output of the convolution layer is then batch normalized again, and the ReLU activation function is applied again to perform a nonlinear transformation on the batch-normalized output.
[0068] Specifically, the above-mentioned convolution decoding process can be repeated multiple times on the meteorological characteristic data to finally obtain the second prediction result output. The second prediction result can be expressed as RF∈R height×lon×latEach repetition may use a different convolution kernel size or number to adapt to different levels of feature extraction. Here, height, l on, and l at represent the height, longitude, and latitude of the output feature map, respectively. This process gradually increases the spatial dimension of the feature map through a deep convolution structure while maintaining the depth of feature extraction, ultimately obtaining high-resolution weather forecast results.
[0069] The advantages of convolutional neural networks (CNNs) in weather forecasting are mainly reflected in the following aspects, which enable CNNs to better learn the spatial continuity of adjacent grid points:
[0070] 1. Local connection: CNNs use local connections so that each neuron is only connected to a local area of the input data. This design mimics the processing method of the biological visual cortex and can capture local features, which is particularly important for learning the spatial continuity of meteorological data.
[0071] 2. Weight sharing: In the convolutional layer, the weights of the same convolution kernel are shared across the entire input data. This means that the network can capture patterns in the input data by learning fewer parameters, which helps to identify and learn spatial continuity in meteorological data.
[0072] 3. Translation invariance: Due to weight sharing, CNNs are translation invariant, meaning the network is able to recognize the same patterns that appear in different locations. This is very useful for identifying weather patterns (such as clouds, rain bands, etc.) in weather forecasting, as these patterns may appear in different locations.
[0073] 4. Multi-layer structure: CNNs usually contain multiple convolutional layers and pooling layers. This multi-layer structure enables the network to gradually abstract high-level features from low-level features. In weather forecasting, this means that more and more complex weather patterns can be extracted from raw weather data.
[0074] 5. Automatic feature extraction: Compared with traditional weather forecast models, CNNs do not require manual design of feature extractors. The network can automatically learn the most useful features from the data, which is particularly important for processing complex meteorological data.
[0075] 6. Good adaptability: CNNs can automatically adjust their parameters through training data to adapt to different meteorological conditions and forecasting tasks. This adaptability enables CNNs to make forecasts more flexibly when facing changing meteorological conditions.
[0076] 7. Parallel processing capability: The convolution operations of CNNs can be performed in parallel, which makes them computationally efficient when processing large-scale meteorological data.
[0077] 8. Support from deep learning frameworks: Modern deep learning frameworks (such as TensorFlow, PyTorch, etc.) provide strong support for CNNs, allowing researchers to more easily implement and optimize complex network structures to meet the needs of weather forecasting.
[0078] In summary, convolutional neural networks, through their unique structure and learning mechanism, can effectively capture and learn the spatial continuity in meteorological data, thus playing an important role in weather forecasting.
[0079] In this embodiment, the decoding of meteorological characteristic data is achieved through a convolutional neural network decoder, which can effectively capture and learn the spatial continuity in the meteorological data to obtain more accurate meteorological forecast results.
[0080] In one embodiment, Figure 5 As shown, step S210 uses a preset feature detection model to extract features from historical meteorological data to obtain meteorological feature data, including steps S500-520.
[0081] Step S500, segmenting the image of historical meteorological data to obtain a plurality of image blocks of historical meteorological data.
[0082] Among them, the patch layer (Patch Partition) is used to divide the input image of historical meteorological data into multiple image blocks, so that the image can be gridded and decomposed to facilitate subsequent processing.
[0083] Step S510: encode multiple image blocks to obtain high-dimensional feature vectors of the multiple image blocks.
[0084] Among them, multiple image blocks can be encoded and represented through a linear fully connected layer (L i near Embedding ing) and mapped to a high-dimensional space for more complex feature representation.
[0085] Step S520, the high-dimensional feature vectors of the multiple image blocks are sequentially input into a multi-layer sliding window transformer model for feature extraction processing to obtain meteorological feature data.
[0086] The sliding window transformer model may be a Swin-Transformer module, and a two-layer sliding window transformer model may be designed. Each layer of the sliding window transformer model may include multiple Swin-Transformer modules, for example, two. The high-dimensional feature vectors of multiple image blocks may be input into two consecutive Swin-Transformer modules for representation learning to generate hierarchical feature representations, and the feature dimension and resolution remain unchanged. The two-layer sliding window transformer model has four Swin-Transformer modules.
[0087] In this embodiment, a preset feature detection model can be used as a backbone neural network to extract features from historical meteorological data to obtain meteorological feature data, which facilitates subsequent analysis and prediction of the meteorological feature data.
[0088] In one embodiment, Figure 6 As shown, in step S520, high-dimensional feature vectors of multiple image blocks are sequentially input into a multi-layer sliding window transformer model for feature extraction processing to obtain meteorological feature data. The method includes steps S600-S610.
[0089] Step S600: input high-dimensional feature vectors of multiple image blocks into a first-layer sliding window transformer model to obtain multiple first meteorological feature image blocks.
[0090] Among them, the sliding window transformer model includes the following parts:
[0091] Layer Normalization: Layer Normalization is performed to help the model training become more stable. Then Windowed Multi-Head Self-Attention (W-MSA) is applied, which is a variation of the self-attention mechanism to handle local features. Next, Residual Connections are added, which helps to avoid the vanishing gradient problem in deep network training. Then Layer Normalization (LaverNorm) is performed again. The next step is to use a Multi-Layer Perceptron (MLP) to further extract features. Then Residual Connections are added again. Sliding Window Multi-Head Self-Attention (SW-MSA) is used to handle a wider range of features. Residual Connections are added again. Layer Normalization (LaverNorm) is performed again. The MLP is used again.
[0092] Step S610, after merging the plurality of first meteorological characteristic image blocks, the merged image blocks are input into the second layer sliding window transformer model to obtain a meteorological characteristic matrix as meteorological characteristic data.
[0093] Specifically, after being processed by the first layer of Swin Transformer, multiple first meteorological feature image blocks are merged through the Patch Merging layer to reduce the spatial dimension of the feature map and increase the dimension of the feature. The merged meteorological feature map is input into the second layer of Swin Transformer module and the above process is repeated. The final output meteorological feature matrix FWea∈R c×h×w , whose dimension is R c×h×w , where c is the number of channels and h and w are the height and width respectively.
[0094] In this embodiment, a multi-layer sliding window transformer model is set as the backbone neural network to extract features from historical meteorological data, thereby obtaining more accurate meteorological feature data, which is beneficial for subsequent meteorological forecasting.
[0095] In one embodiment, Figure 7 As shown, step S230, weighted fusion of the first prediction result and the second prediction result is performed to obtain the weather forecast result of the target area. The method includes steps S700-S710.
[0096] Step S700, obtaining a first weight of a first prediction result and a second weight of a second prediction result.
[0097] The sum of the first weight and the second weight is 1, and both the first weight and the second weight are greater than or equal to 0.
[0098] Step S710, adding the result of multiplying the first prediction result by the first weight and the result of multiplying the second prediction result by the second weight to obtain the weather forecast result of the target area.
[0099] Among them, weights can be set for the first prediction result and the second prediction result respectively, and the weather forecast result is determined by the following formula:
[0100] OutWea=A×LF+B×RF,OutWea∈R height×lon×lat .
[0101] Among them, OutWea is the weather forecast result, LF is the first prediction result, A is the first weight, RF is the second prediction result, and B is the second weight.
[0102] Specifically, the specific values of weights A and B can be determined based on the following considerations: Through experiments and verification, it can be determined which decoder performs better in specific situations (such as forecast accuracy, computational complexity, etc.). The setting of weights can reflect this performance, so that the model tends to use decoders with better performance. Linear multi-layer fully connected layers tend to capture local details, while convolutional neural networks have advantages in learning and representing spatial continuity. The setting of weights can balance these two characteristics to achieve better forecasting results. Data-driven methods can be used to adjust weights, such as cross-validation to evaluate the performance of the model under different weight settings and select the optimal weight combination. The weights can be initially set based on prior knowledge in the field of meteorological forecasting, and then further adjusted through experiments. The specific values of weights are obtained through experiments and adjustments, which involve hyperparameter tuning during model training. In practical applications, the selection of weights is an iterative and optimized process, which needs to be continuously adjusted according to the performance of the model on the validation set until the best weight combination is found to achieve the most accurate forecast results.
[0103] In this embodiment, by designing weights, the first prediction result and the second prediction result are weighted and fused to obtain a weather forecast result, thereby obtaining a weather forecast result that accurately predicts the weather conditions within the local range of the target area and can reflect the correlation between the weather conditions in different spaces of the target area.
[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0105] In this embodiment, a weather forecasting device is also provided, and the weather forecasting device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0106] Figure 8 is a structural block diagram of an optional weather forecasting device according to an embodiment of the present application. Figure 8 As shown, including:
[0107] The data acquisition module 801 is used to acquire the historical meteorological data of the target area.
[0108] The feature extraction module 802 is used to extract features from historical meteorological data using a preset feature detection model to obtain meteorological feature data.
[0109] The decoding module 803 is used to decode the meteorological characteristic data using the first decoder and the second decoder respectively to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder.
[0110] The data fusion module 804 is used to perform weighted fusion of the first prediction result and the second prediction result to obtain a weather forecast result for the target area.
[0111] Through the above device, the historical meteorological data of the target area is first obtained, and then the preset feature detection model is used to extract the features of the historical meteorological data to obtain the meteorological feature data. After obtaining the meteorological feature data, the meteorological feature data is decoded by the first decoder and the second decoder to obtain the first prediction result output by the first decoder and the second prediction result output by the second decoder. The first decoder is a linear neural network decoder. Since the linear neural network decoder can accurately capture local details when used as the output layer, the first prediction result output by the first decoder can more accurately predict the meteorological conditions within the local range. The second decoder is a convolutional neural network decoder. Since the convolutional neural network decoder can better learn the spatial continuity of adjacent grid points when used as the output layer, the second prediction result output by the second decoder can reflect the correlation of the meteorological conditions of adjacent spaces. The first prediction result and the second prediction result are weighted and fused to obtain the meteorological forecast result of the target area, which can accurately predict the meteorological conditions within the local range of the target area on the one hand, and reflect the correlation of the meteorological conditions of different spaces in the target area on the other hand.
[0112] In an exemplary embodiment, the decoding module 803 further includes:
[0113] The first processing unit is used to perform layer normalization processing, average pooling processing, and dimension conversion processing on the meteorological feature data in sequence to obtain a first meteorological feature vector.
[0114] The second processing unit is used to decode the first meteorological feature vector using a linear fully connected layer to obtain a first decoded feature vector.
[0115] The third processing unit is used to perform dimension conversion processing on the first decoded feature vector to obtain a first meteorological feature matrix as a first prediction result, wherein the dimension of the first meteorological feature matrix is the same as the dimension of the meteorological feature data.
[0116] In an exemplary embodiment, the above-mentioned decoding module 803 is also used to perform at least one convolution decoding process on the meteorological feature data to obtain a second prediction result, wherein the convolution decoding process includes deconvolution layer processing, batch normalization processing, activation function processing, convolution layer processing, batch normalization processing, and activation function processing in sequence.
[0117] In an exemplary embodiment, the feature extraction module 802 includes:
[0118] The segmentation unit is used to segment the image of the historical meteorological data to obtain a plurality of image blocks of the historical meteorological data.
[0119] The encoding unit is used to encode the multiple image blocks to obtain high-dimensional feature vectors of the multiple image blocks.
[0120] The feature extraction unit is used to sequentially input the high-dimensional feature vectors of multiple image blocks into the multi-layer sliding window transformer model for feature extraction processing to obtain meteorological feature data.
[0121] In an exemplary embodiment, the feature extraction unit includes:
[0122] The first extraction unit is used to input the high-dimensional feature vectors of multiple image blocks into the first-layer sliding window transformer model to obtain multiple first meteorological feature image blocks.
[0123] The second extraction unit is used to merge the multiple first meteorological feature image blocks and then input them into the second layer sliding window transformer model to obtain a meteorological feature matrix as meteorological feature data.
[0124] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0125] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0126] S1, obtain historical meteorological data of the target area.
[0127] S2, using a preset feature detection model to extract features from historical meteorological data to obtain meteorological feature data.
[0128] S3, respectively using a first decoder and a second decoder to decode the meteorological characteristic data to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder.
[0129] S4, weighted fusion of the first prediction result and the second prediction result to obtain a weather forecast result for the target area.
[0130] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0131] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0132] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0133] S1, obtain historical meteorological data of the target area.
[0134] S2, using a preset feature detection model to extract features from historical meteorological data to obtain meteorological feature data.
[0135] S3, respectively using a first decoder and a second decoder to decode the meteorological characteristic data to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder.
[0136] S4, weighted fusion of the first prediction result and the second prediction result to obtain a weather forecast result for the target area.
[0137] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0138] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores the computer program product, and when the computer program is executed by a processor, the steps of the method in each embodiment of the present application are implemented.
[0139] Optionally, in this embodiment, the above computer program may be configured to implement the following steps when executed by a processor:
[0140] S1, obtain historical meteorological data of the target area.
[0141] S2, using a preset feature detection model to extract features from historical meteorological data to obtain meteorological feature data.
[0142] S3, respectively using a first decoder and a second decoder to decode the meteorological characteristic data to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder.
[0143] S4, weighted fusion of the first prediction result and the second prediction result to obtain a weather forecast result for the target area.
[0144] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0145] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0146] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A weather forecasting method, It is characterized in that The method comprises: Obtain historical meteorological data for the target area; Using a preset feature detection model to extract features from the historical meteorological data to obtain meteorological feature data; The meteorological characteristic data are decoded by a first decoder and a second decoder respectively to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder; The first prediction result and the second prediction result are weighted and fused to obtain a weather forecast result for the target area.
2. The weather forecasting method according to claim 1, It is characterized in that The first decoder is used to decode the meteorological characteristic data to obtain a first prediction result, including: The meteorological feature data is sequentially subjected to layer normalization processing, average pooling processing, and dimension conversion processing to obtain a first meteorological feature vector; Using a linear fully connected layer to decode the first meteorological feature vector to obtain a first decoded feature vector; The first decoded feature vector is subjected to dimension conversion processing to obtain a first meteorological feature matrix as the first prediction result, wherein the dimension of the first meteorological feature matrix is the same as the dimension of the meteorological feature data.
3. The weather forecasting method according to claim 1, It is characterized in that The second decoder is used to decode the meteorological characteristic data to obtain a second prediction result, including: The meteorological characteristic data is subjected to at least one convolution decoding process to obtain the second prediction result, wherein the convolution decoding process includes sequentially performing deconvolution layer processing, batch normalization processing, activation function processing, convolution layer processing, batch normalization processing, and activation function processing.
4. The weather forecasting method according to claim 1, It is characterized in that The method of extracting features from the historical meteorological data using a preset feature detection model to obtain meteorological feature data includes: Segmenting the image of the historical meteorological data to obtain a plurality of image blocks of the historical meteorological data; Encoding the plurality of image blocks to obtain high-dimensional feature vectors of the plurality of image blocks; The high-dimensional feature vectors of the plurality of image blocks are sequentially input into a multi-layer sliding window transformer model for feature extraction processing to obtain the meteorological feature data.
5. The weather forecasting method according to claim 4, It is characterized in that The step of sequentially inputting the high-dimensional feature vectors of the plurality of image blocks into a multi-layer sliding window transformer model for feature extraction processing to obtain the meteorological feature data comprises: Inputting the high-dimensional feature vectors of the plurality of image blocks into a first-layer sliding window transformer model to obtain a plurality of first meteorological feature image blocks; After the plurality of first meteorological characteristic image blocks are merged, they are input into the second-layer sliding window transformer model to obtain a meteorological characteristic matrix as the meteorological characteristic data.
6. The weather forecasting method according to claim 1, It is characterized in that The step of weighting and fusing the first prediction result and the second prediction result to obtain the weather forecast result for the target area includes: Obtaining a first weight of the first prediction result and a second weight of the second prediction result, wherein the sum of the first weight and the second weight is 1; A result of multiplying the first prediction result by the first weight and a result of multiplying the second prediction result by the second weight are added together to obtain a weather forecast result for the target area.
7. A weather forecasting device, It is characterized in that The device comprises: A data acquisition module is used to obtain historical meteorological data of the target area; A feature extraction module is used to extract features from the historical meteorological data using a preset feature detection model to obtain meteorological feature data; A decoding module, configured to respectively decode the meteorological characteristic data using a first decoder and a second decoder to obtain a first prediction result output by the first decoder and a second prediction result output by the second decoder, wherein the first decoder is a linear neural network decoder and the second decoder is a convolutional neural network decoder; The data fusion module is used to weightedly fuse the first prediction result and the second prediction result to obtain the weather forecast result of the target area.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 6 when executed.
9. An electronic device comprising a memory and a processor, It is characterized in that A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 through the computer program.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Marine weather forecast data processing method and system and electronic equipment
CN119939171A
Method, System and Electronic Device for Processing Maritime Meteorological Forecast Data
CN119939171B
