A weather prediction method, device, medium and electronic device
By using a quantum convolutional attention module-convolutional long short-term memory (QCBAM)-ConvLSTM network, the problem of information loss in existing weather forecasting networks is solved, achieving higher forecast accuracy.
Patent Information
- Application Number
- CN202310957060.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2043-07-28
AI Technical Summary
Existing weather forecasting networks use classical computers to compress radar echo images into fixed-size vectors, resulting in information loss, failure to fully consider important features, and inability to discard useless features in a timely manner, leading to low forecast accuracy.
The Quantum Convolutional Attention Module – Convolutional Long Short-Term Memory (QCBAM) – ConvLSTM network is adopted, which includes quantum-hole convolutional layers and quantum logic gates. Information processing is performed through quantum superposition and entanglement properties to improve the accuracy of feature extraction and prediction.
It significantly improves the accuracy of weather forecasts, leveraging the advantages of quantum computing to provide more powerful computing capabilities in feature extraction and prediction.
Smart Images

Figure CN117010518B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of quantum computing technology, and in particular to a weather forecasting method, device, medium and electronic device. Background Technology
[0002] A quantum computer is a physical device that performs high-speed mathematical and logical operations, stores and processes quantum information in accordance with the laws of quantum mechanics. When a device processes and calculates quantum information and runs quantum algorithms, it is a quantum computer. Because of its ability to process mathematical problems more efficiently than ordinary computers—for example, reducing the time to crack RSA keys from hundreds of years to hours—quantum computers have become a key technology under research.
[0003] Existing weather forecasting networks use classical computers to simply compress radar echo images into fixed-size vectors, and then decode these vectors to achieve predictions. This results in the loss of a large amount of information, failure to fully consider important features, failure to discard useless features in a timely manner, and an inability to provide reasonable weights for the decoding process, leading to low prediction accuracy.
[0004] Application content
[0005] The purpose of this application is to provide a weather forecasting method, apparatus, medium, and electronic device, aimed at improving the accuracy of weather forecasting.
[0006] One embodiment of this application provides a weather forecasting method, the method comprising:
[0007] The weather radar echo maps of multiple time points before the time point to be predicted are input into the quantum convolutional attention module-convolutional long short-term memory QCBAM-ConvLSTM network, and the QCBAM-ConvLSTM network is run to obtain the weather radar echo map of the time point to be predicted; the QCBAM network includes a quantum dilated convolutional layer, which is used to sample the input feature map at intervals to obtain multiple pixels, and to convolve the multiple pixels to obtain the output feature map;
[0008] The meteorological forecast result for the time node to be predicted is determined based on the meteorological radar echo map of the time node to be predicted.
[0009] Optionally, the quantum circuit corresponding to the quantum void convolutional layer includes an encoding circuit, a variational circuit, and an entanglement circuit. The encoding circuit is used to load the plurality of pixels onto the qubits, the variational circuit is used to perform variational quantum encoding on the loaded qubits, and the entanglement circuit is used to establish entanglement between the qubits after variational quantum encoding.
[0010] Optionally, the encoding circuit includes a first single quantum logic gate acting on each qubit, the variational circuit includes a first multi-quantum logic gate acting on multiple qubits and a second single quantum logic gate acting on each qubit, and the entanglement circuit includes a second multi-quantum logic gate acting on multiple qubits; the parameters of the first single quantum logic gate are determined based on the multiple pixels, and the parameters of the first multi-quantum logic gate and the second single quantum logic gate are determined based on training.
[0011] Optionally, the pixels include row pixels and column pixels. Every two adjacent row pixels are separated by n pixels on the input feature map, and every two adjacent column pixels are separated by m pixels on the input feature map.
[0012] Optionally, the QCBAM network includes a classical channel attention module and a quantum spatial attention module. The quantum spatial attention module includes a pooling layer, a quantum-hole convolutional layer, and an activation layer. The pooling layer is used to reduce the dimensionality of the channel attention map output by the classical channel attention module to obtain the input feature map. The activation layer is used to determine the spatial attention map based on the output feature map.
[0013] Optionally, the step of inputting meteorological radar echo images from multiple time points preceding the time point to be predicted into the QCBAM-ConvLSTM network and running the QCBAM-ConvLSTM network to obtain the meteorological radar echo image of the time point to be predicted includes:
[0014] The weather radar echo image and encoding status of the i-th time node are input into the QCBAM-ConvLSTM network and run to obtain the encoding status of the (i+1)-th time node. The initial value of i is 1, and the encoding status corresponding to the weather radar echo image of the 1-th time node is a preset value.
[0015] Let i = i + 1, and return to the step described above to input the weather radar echo map and encoding status of the i-th time node into the QCBAM-ConvLSTM network and run it;
[0016] When i = u, the weather radar echo map of the time node to be predicted is determined based on the encoding state of the (u+1)th time node, where u is the number of time nodes before the time node to be predicted.
[0017] Optionally, the ConvLSTM network is used to determine the coding state of the next time node based on the spatial attention map of the current time node. The step of inputting the meteorological radar echo map and coding state of the i-th time node into the QCBAM-ConvLSTM network and running it to obtain the coding state of the (i+1)-th time node includes:
[0018] The meteorological radar echo map and coding status of the i-th time node are input into the QCBAM network and run to obtain the first spatial attention map and the second spatial attention map of the i-th time node, wherein the coding status corresponding to the meteorological radar echo map of the 1-th time node is a preset value.
[0019] The first spatial attention map and the second spatial attention map at the i-th time node are input into the ConvLSTM network and run to obtain the encoding state at the (i+1)-th time node.
[0020] Optionally, the ConvLSTM network is used to determine the next decoding state based on the current spatial attention map, and the determination of the weather radar echo map of the time node to be predicted based on the encoding state of the (u+1)th time node includes:
[0021] The encoding state of the (u+1)th time node is taken as the first decoding state;
[0022] The j-th decoding state is input into the QCBAM network and run to obtain the j-th third space attention map, with the initial value of j being 1;
[0023] The j-th third spatial attention map is input into the ConvLSTM network and run to obtain the (j+1)-th decoding state;
[0024] Let j = j + 1, and return to the step of inputting the j-th decoding state into the QCBAM network and running it;
[0025] After executing the preset number of times, the (j+1)th decoding state obtained from the last execution is the meteorological radar echo map of the time node to be predicted.
[0026] Another embodiment of this application provides a weather forecasting device, the device comprising:
[0027] The execution module is used to input the meteorological radar echo maps of multiple time points before the time point to be predicted into the quantum convolutional attention module-convolutional long short-term memory QCBAM-ConvLSTM network, and run the QCBAM-ConvLSTM network to obtain the meteorological radar echo map of the time point to be predicted; the QCBAM network includes a quantum dilated convolutional layer, which is used to sample the input feature map at intervals to obtain multiple pixels, and to convolve the multiple pixels to obtain the output feature map;
[0028] The prediction module is used to determine the meteorological prediction result for the time node to be predicted based on the meteorological radar echo map of the time node to be predicted.
[0029] Another embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the preceding claims when running.
[0030] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method described in any of the preceding claims.
[0031] This invention utilizes a quantum convolutional attention module—a convolutional long short-term memory (QCBAM)-ConvLSTM network—for weather forecasting. The QCBAM network, comprising a classical channel attention module and a quantum spatial attention module, employs a dual-channel attention mechanism, assigning different weights along two independent dimensions to the decoding process. Quantum-dilated convolutional layers sample the input feature map at intervals to obtain multiple pixels, and an encoding circuit loads these pixels into qubits, resulting in a larger receiving field. Furthermore, this invention constructs the logic gates in the weather forecasting network based on a variable quantum algorithm. Benefiting from the quantum superposition and quantum entanglement properties of quantum states, it provides significantly stronger computational power compared to traditional methods, and utilizes quantum optimization techniques to optimize the network parameters. Compared to existing weather forecasting networks, the weather forecasting method provided by this invention significantly improves the accuracy of weather forecasts. Attached Figure Description
[0032] Figure 1 A hardware structure block diagram of a computer terminal for a weather forecasting method provided in an embodiment of this application;
[0033] Figure 2 A flowchart illustrating a weather forecasting method provided in this application embodiment;
[0034] Figure 3 A partial exemplary schematic diagram of an input feature map provided in an embodiment of this application;
[0035] Figure 4 An exemplary schematic diagram of a quantum void convolution circuit provided for the application embodiment.
[0036] Figure 5 An exemplary schematic diagram of a classic channel attention module provided in an embodiment of this application;
[0037] Figure 6 An exemplary schematic diagram of a quantum spatial attention module provided in an embodiment of this application;
[0038] Figure 7 An exemplary schematic diagram of a ConvLSTM network provided for an embodiment of this application;
[0039] Figure 8 A flowchart illustrating another weather forecasting method provided in this application embodiment;
[0040] Figure 9 This is a schematic diagram of the structure of a weather forecasting device provided in an embodiment of this application. Detailed Implementation
[0041] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0042] Figure 1 This is a network block diagram of a weather forecasting system provided in an embodiment of this application. The weather forecasting system may include a network 110, a server 120, a wireless device 130, a client 140, storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memory, a classical processor, a quantum processor, and other devices not shown.
[0043] Network 110 is a medium used to provide communication links between various devices and computers connected together within a weather forecasting system, including but not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The connection method can be wired, wireless communication links, or fiber optic cables.
[0044] Server 120, wireless device 130, and client 140 are conventional data processing systems that may contain data and application programs or software tools that perform conventional computational processes. Client 140 may be a personal computer or a network computer, so the data may also be provided by server 120. Wireless device 130 may be a smartphone, tablet, laptop, smart wearable device, etc. Storage unit 150 may include database 151, which can be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, and quantum programs.
[0045] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application program 163 (application program 173). The application program 163 (application program 173) may be used to implement the quantum algorithm compiled according to the weather forecasting method provided in the embodiments of this application.
[0046] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application executed therein can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0047] It should be noted that a true quantum computer has a hybrid structure, which includes at least... Figure 1 The system consists of two main parts: the classical computing unit 160, which is responsible for performing classical calculations and control; and the quantum computing unit 170, which is responsible for running quantum programs to achieve quantum computing.
[0048] The aforementioned classical computing unit 160 and quantum computing unit 170 can be integrated into a single device or distributed across two different devices. For example, a first device including the classical computing unit 160 runs a classical computer operating system, providing quantum application development tools and services, as well as the storage and network services required for quantum applications. Users develop quantum programs using the quantum application development tools and services on the second device, and send these quantum programs to a second device including the quantum computing unit 170 via the network services. The second device runs a quantum computer operating system, which parses and compiles the quantum program's code into instructions that the quantum processor 170 can recognize and execute. The quantum processor 170 then implements the quantum algorithm corresponding to the quantum program based on these instructions.
[0049] The computing units of the classic processor 161 within the classic computing unit 160 are based on CMOS transistors on a silicon chip. These computing units are not limited by time or coherence; that is, they are available at any time without time constraints. Furthermore, the number of such computing units in a silicon chip is sufficient; currently, a single classic processor 161 contains tens of thousands of computing units. Given this sufficient number and the fixed selectable computing logic of the CMOS transistors (e.g., AND logic), computational performance is achieved by combining a large number of CMOS transistors with a limited set of logic functions during operation.
[0050] In the quantum computing unit 170, the basic computing unit of the quantum processor 171 is the qubit. The input of a qubit is limited by coherence and coherence time; that is, a qubit is limited by its usage time and is not always available. Making full use of qubits within their available usage time is a key challenge in quantum computing. Furthermore, the number of qubits in a quantum computer is one of the representative indicators of its performance. Each qubit performs computational functions through on-demand configured logical functions. Given the limited number of qubits and the diverse logical functions available in quantum computing, such as Hadamard gates (H gates), Pauli-X gates (X gates), Pauli-Y gates (Y gates), Pauli-Z gates (Z gates), X gates, RY gates, RZ gates, CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc., quantum computing requires combining a limited number of qubits with diverse logical function combinations to achieve computational effects.
[0051] Based on these differences, the design of classical logic functions applied to CMOS transistors and the design of quantum logic functions applied to qubits are significantly and fundamentally different. The design of classical logic functions applied to CMOS transistors does not need to consider the individuality of CMOS transistors. For example, the representation of a CMOS transistor in a silicon chip is its individual identifier, location, and usable time of each CMOS transistor. Therefore, classical algorithms composed of classical logic functions only express the operational relationship of the algorithm, not the algorithm's dependence on individual CMOS transistors.
[0052] Quantum logic functions applied to qubits need to consider the individuality of each qubit, such as its position within the quantum chip, its relationship with surrounding qubits, and the duration of its usable time. Therefore, quantum algorithms composed of quantum logic functions not only express the computational relationships within the algorithm but also its dependence on the individual qubits.
[0053] For example:
[0054] Quantum Algorithm 1: H1, H2, CNOT(1,3), H3, CNOT(2,3);
[0055] Quantum Algorithm 2: H1, H2, CNOT(1,2), H3, CNOT(2,3);
[0056] Where 1 / 2 / 3 represent three sequentially connected qubits Q1, Q2, Q3 or interconnected qubits Q1, Q2, Q3, respectively;
[0057] An exemplary explanation of how quantum algorithms are affected by the coherence time of qubits is as follows:
[0058] Define the execution time of a single-qubit logic gate as t, and the execution time of two single-qubit logic gates operating on adjacent qubits as 2t; then:
[0059] When Q1, Q2, and Q3 are interconnected, the computation of Quantum Algorithm 1 requires 6t, which is divided into 4 time periods. The duration of each time period is t, 2t, t, and 2t, respectively. The operations performed in each time period are: H1, H2; CNOT(1,3); H3; CNOT(2,3);
[0060] The computation of Quantum Algorithm 1 requires 5t, which is divided into 3 time periods. The duration of each time period is t, 2t, and 2t respectively. The operations performed in each time period are: H1, H2, H3; CNOT(1,2); CNOT(2,3);
[0061] When Q1, Q2, and Q3 are connected sequentially, Quantum Algorithm 1 needs to be equivalent to: H1, H2; swap(1,2), CNOT(2,3), swap(1,2); H3; CNOT(2,3). The computation of the equivalent Quantum Algorithm 1 requires 10t, divided into 4 time periods, with each time period requiring durations of t, 6t, t, and 2t respectively. The operations performed in each time period are: H1, H2; swap(1,2), CNOT(2,3), swap(1,2); H3; CNOT(2,3).
[0062] Therefore, the application of quantum logic functions in the design of qubits (including the design of whether qubits are used and the design of the efficiency of each qubit) is key to improving the computational performance of quantum computers and requires special design. This is the unique characteristic of quantum algorithms implemented based on quantum logic functions, and is fundamentally and significantly different from classical algorithms implemented based on classical logic functions. The aforementioned design considerations for qubits are technical problems that ordinary computing devices do not need to consider or address. Based on this, this application proposes a weather forecasting method and related apparatus for implementing weather forecasting in quantum computing, aiming to improve the accuracy of weather forecasting.
[0063] See Figure 2 , Figure 2 A flowchart illustrating a weather forecasting method provided in this application embodiment may include the following steps:
[0064] S201, the meteorological radar echo maps of multiple time points before the time point to be predicted are input into the quantum convolutional attention module-convolutional long short-term memory QCBAM-ConvLSTM network, and the QCBAM-ConvLSTM network is run to obtain the meteorological radar echo map of the time point to be predicted; the QCBAM network includes a quantum dilated convolutional layer, which is used to sample the input feature map at intervals to obtain multiple pixels, and to convolve the multiple pixels to obtain the output feature map;
[0065] A weather radar echo map is an image that displays the electromagnetic waves reflected back from objects detected by radar. Radar emits pulsed electromagnetic waves. When these pulses encounter precipitation (raindrops, snowflakes, hail, etc.), most of the energy continues forward, while a small portion is reflected back—these reflected electromagnetic waves are called echoes. These waves are converted into signals and displayed as an image on a radar screen; this image is called a weather radar echo map. The weather radar echo map displays information such as the time, intensity, and azimuth of the electromagnetic waves reflected back from objects detected by the radar. Based on the weather radar echo map, corresponding weather conditions, such as precipitation, wind direction, and wind speed, can be obtained.
[0066] The Quantum Convolutional Attention Module-Convolutional Length Short-Term Memory (QCBAM-ConvLSTM) network includes a Quantum Convolutional Attention Module (QCBAM) network and a Convolutional Length Short-Term Memory (ConvLSTM) network, which will be described below.
[0067] Dilated convolution, as described above, is an operation in convolutional neural networks used to increase the receptive field, thereby improving the model's expressive and generalization abilities. In traditional convolutional neural networks, the size of the convolutional kernel is fixed, and therefore its receptive field size is also fixed. Dilated convolution can be implemented in various ways. For example, it can first sample the pixels in the input feature map at intervals and then load them into the qubits; or it can add a certain number of "0" elements to the convolutional kernel, and then sample the elements in the input feature map and load them into the qubits. By introducing dilated convolution, each convolutional kernel unit can receive input information at different distances, thereby expanding the range of the receptive field. The essence of both methods is to sample the pixels in the input feature map at intervals. In this embodiment, the method of first sampling the pixels in the input feature map at intervals and then loading them into the qubits is used.
[0068] The basic building block of a weather radar echo map is the pixel. In a weather radar echo map, each pixel represents a specific object or area that can reflect and receive the electromagnetic waves emitted by the radar. Each pixel has a unique identifier, such as coordinates.
[0069] In one embodiment of this application, before inputting the meteorological radar echo maps of multiple time nodes before the time node to be predicted into the quantum convolutional attention module-convolutional long short-term memory QCBAM-ConvLSTM network, it is necessary to preprocess the meteorological radar base data of multiple time nodes before the time node to be predicted, so as to obtain the meteorological radar echo maps of multiple time nodes before the time node to be predicted.
[0070] Weather radar baseline data refers to data acquired from weather radar equipment. This data contains crucial information such as echo range, intensity, and trends, and can be obtained from local meteorological bureaus and other organizations. Various methods can be used to preprocess weather radar baseline data to obtain weather radar echo maps. For example, quality control can be performed on the data, and it can be interpolated to Cartesian coordinates to create an electromagnetic wave propagation height correction map. This can be encapsulated as a Python object; after instantiating this class, the data stored in the baseline data can be retrieved by calling predefined attributes and methods. Finally, standard meshing is performed to obtain the weather radar echo map.
[0071] It should be noted that this application does not limit the preprocessing method for meteorological radar base data, and the method should be set according to the actual situation. The above-mentioned method provided in the embodiments of this application is only a preferred option.
[0072] The method for obtaining multiple pixels by sampling the input feature map at intervals, and the method for convolving the multiple pixels to obtain the output feature map, will be described below.
[0073] S202, determine the meteorological forecast result for the time node to be predicted based on the meteorological radar echo map of the time node to be predicted.
[0074] Useful information can be extracted from the weather radar echo map of the time point to be predicted, thus determining the weather forecast results for that time point. For example, when predicting precipitation, the gradual change from blue to purple represents an increase in echo intensity, and a gradual increase in rainfall intensity. Generally speaking, the area corresponding to the blue echo indicates that the local area will be covered by precipitation clouds, but there will be no rain; the area covered by the green echo indicates that there may be light rain; the area covered by the yellow to red echo may have moderate to heavy rain; and the area corresponding to the purple echo has the highest precipitation intensity, and this area may have heavy rain or torrential rain, possibly accompanied by severe weather such as thunderstorms, strong winds, or even hail.
[0075] This application does not restrict the method for determining the meteorological forecast result of the time node to be predicted based on the meteorological radar echo map of the time node to be predicted, and the method should be selected according to the actual situation.
[0076] In one embodiment of this application, the quantum circuit corresponding to the quantum void convolutional layer includes an encoding circuit, a variational circuit, and an entanglement circuit. The encoding circuit is used to load the plurality of pixels onto the qubits, the variational circuit is used to perform variational quantum encoding on the loaded qubits, and the entanglement circuit is used to establish entanglement between the qubits after variational quantum encoding.
[0077] The variable quantum coding refers to the use of variable quantum circuits to encode the quantum states of loaded qubits. A variable quantum circuit is a quantum circuit composed of parameterized quantum logic gates. When solving a problem, the solution space is represented by a variable quantum circuit, and the variables of the problem are represented by the parameters of the quantum logic gates. By adjusting the parameters of these quantum logic gates, a highly tunable quantum circuit is constructed, allowing the circuit to transform the input data in different ways, thus handling various different problems. Furthermore, unlike traditional quantum circuits, variable quantum circuits use variational optimization algorithms to find the optimal parameters that minimize the problem's loss, thereby obtaining an approximate solution to the problem and significantly improving computational efficiency.
[0078] In quantum computing, the states of qubits can be altered by applying specific quantum gate operations, thus establishing entanglement between multiple qubits. For example, multi-qubit control gates such as CNOT, SWAP, and Tofoli gates can be used to transform the quantum states of multiple qubits and establish entanglement between them.
[0079] For ease of explanation, the quantum circuit corresponding to the quantum void convolution layer in this application embodiment is referred to as a quantum void convolution circuit.
[0080] The quantum void convolution circuit shown, as well as the encoding circuit, variational circuit, and entanglement circuit within it, will be explained below.
[0081] In one embodiment of this application, the encoding circuit includes a first single quantum logic gate acting on each qubit, the variational circuit includes a first multi-quantum logic gate acting on multiple qubits and a second single quantum logic gate acting on each qubit, and the entanglement circuit includes a second multi-quantum logic gate acting on multiple qubits; the parameters of the first single quantum logic gate are determined based on the multiple pixels, and the parameters of the first multi-quantum logic gate and the second single quantum logic gate are determined based on training.
[0082] A single quantum logic gate is a quantum logic gate used in quantum circuits to operate a single quantum bit. It includes Hadamard gates, phase gates, single quantum rotation gates, etc. Single quantum logic gates can be used to realize the state transformation of a single quantum bit and to realize the basic operations and algorithms in quantum computing.
[0083] Multiple quantum logic gates are quantum logic gates used in quantum circuits to operate multiple qubits. They include CRX, CRY, CRZ, CNOT gates, SWAP gates, Tooffoli gates, etc. Multiple quantum logic gates can not only be used to realize the state transformation of a single qubit, but also to realize the control and interaction between multiple qubits.
[0084] The parameters of the first single quantum logic gate, the first multiple quantum logic gate, the second single quantum logic gate, the second multiple quantum logic gate, the first multiple quantum logic gate, and the second single quantum logic gate will be described below.
[0085] In one embodiment of this application, the pixels include row pixels and column pixels. Every two adjacent row pixels are separated by n pixels on the input feature map, and every two adjacent column pixels are separated by m pixels on the input feature map.
[0086] The row pixel refers to a pixel located in a certain row on the input feature map among multiple pixels obtained by sampling the input feature map at intervals.
[0087] The column pixel refers to a pixel located in a certain column on the input feature map among multiple pixels obtained by sampling the input feature map at intervals.
[0088] See Figure 3 , Figure 3 This is a partial exemplary schematic diagram of an input feature map provided in an embodiment of this application. Figure 3 The partial exemplary schematic diagram of an input feature map shown includes 25 raw pixels, including raw pixels located in 5 rows and raw pixels located in 5 columns. The raw pixels located in the 5 rows include the raw pixel X located in the 1st row. 11 X 12 X 13 X 14 X 15 The original row pixel X located in the second row 21 X 22 X 23 X 24 X 25 The original row pixel X located in the 3rd row 31 X 32 X 33 X 34 X 35The original row pixel X located in row 4 41 X 42 X 43 X 44 X 45 The original column pixel X located in row 5 51 X 52 X 53 X 54 X 55 The original column pixels located in column 5 include the original column pixels X located in column 1. 11 X 21 X 31 X 41 X 51 The original column pixel X located in column 2 12 X 22 X 32 X 42 X 52 The original column pixel X located in column 3 13 X 23 X 33 X 43 X 53 The original column pixel X located in column 4 14 X 24 X 34 X 44 X 54 The original column pixel X located in column 5 15 X 25 X 35 X 45 X 55 ;
[0089] right Figure 3 The partial exemplary schematic diagram of the input feature map shown is used for sampling. The original pixels obtained after sampling become pixels, including X. 22 X 24 X 42 X 44 Divided by row pixels and column pixels, it includes: row pixels X located in the second row of the local exemplary schematic diagram of the input feature map. 22 X 24 The row pixel X located in the 4th row 42 X 44 The column pixel X located in the second column 22 X 42 Column pixel X located in column 4 24 X 44 ;X 22 and X 24 For adjacent row pixels, X42 and X 44 Also for adjacent row pixels, X 22 and X 24 X is an input feature map spaced one pixel apart. 42 and X 44 The input feature map is also spaced one pixel apart, and n is 1; X 22 and X 42 For adjacent column pixels, X 24 and X 44 Also, for adjacent column pixels, X 22 and X 42 X is an input feature map spaced one pixel apart. 42 and X 44 The input feature map is also spaced 1 pixel apart, with m being 1.
[0090] For ease of explanation later, the pixel X will be... 22 Called pixel X1, pixel X 24 Called pixel X2, pixel X 42 Called pixel X3, pixel X 44 It is called pixel X4.
[0091] See Figure 4 , Figure 4 This is an exemplary schematic diagram of a quantum void convolution circuit provided in an embodiment of this application. Figure 4 The quantum void convolution circuit shown includes four qubits and consists of an encoding circuit, a variational circuit, an entanglement circuit, and a measurement layer connected in sequence.
[0092] The encoding circuit includes: a first single quantum logic gate H and a first single quantum logic gate RZ(θ1) operating on the first qubit, a first single quantum logic gate H and a first single quantum logic gate RZ(θ2) operating on the second qubit, a first single quantum logic gate H and a first single quantum logic gate RZ(θ3) operating on the third qubit, and a first single quantum logic gate H and a first single quantum logic gate RZ(θ4) operating on the fourth qubit.
[0093] The first single quantum logic gate is used to load multiple pixels onto a qubit, in order to Figure 3 Taking a partial exemplary schematic diagram of an input feature map as an example, the H gates acting on each qubit are used to convert the corresponding qubit from the ground state to the excited state. The first single quantum logic gate RZ(θ1) acting on the first qubit is used to load pixel X1 onto the first qubit in the excited state, and the first single quantum logic gate RZ(θ2) acting on the second qubit is used to load pixel X2 onto the second qubit in the excited state.
[0094] The first single quantum logic gate RZ(θ3) acting on the third qubit is used to load pixel X3 onto the third qubit in the excited state, and the first single quantum logic gate RZ(θ4) acting on the fourth qubit is used to load pixel X4 onto the fourth qubit in the excited state. The parameter θ1 of the first single quantum logic gate RZ(θ1) is determined based on pixel X1, the parameter θ1 of the first single quantum logic gate RZ(θ2) is determined based on pixel X2, the parameter θ3 of the first single quantum logic gate RZ(θ3) is determined based on pixel X3, and the parameter θ4 of the first single quantum logic gate RZ(θ4) is determined based on pixel X4.
[0095] The variational circuit includes: a first multi-quantum logic gate RZZ(α1) acting on the first and second qubits, a first multi-quantum logic gate RZZ(α2) acting on the first, second, and third qubits, a first multi-quantum logic gate RZZ(α3) acting on the first, second, third, and fourth qubits, a first multi-quantum logic gate RZZ(α4) acting on the second and third qubits, a first multi-quantum logic gate RZZ(α5) acting on the second, third, and fourth qubits, and a first multi-quantum logic gate RZZ(α6) acting on the third and fourth qubits.
[0096] The first multi-quantum logic gate is used to perform variable quantum encoding on the loaded qubits, in order to Figure 3 Taking a partial exemplary schematic diagram of an input feature map as an example, the first multi-quantum logic gate RZZ(α1) acting on the first and second qubits is used to perform variable quantum encoding on the first and second qubits, the first multi-quantum logic gate RZZ(α2) acting on the first, second, and third qubits is used to perform variable quantum encoding on the first, second, and third qubits, and the first multi-quantum logic gate RZZ(α3) acting on the first, second, third, and fourth qubits is used to perform variable quantum encoding on the first, second, third, and fourth qubits.
[0097] The first multi-quantum logic gate RZZ(α4), operating on the 2nd and 3rd qubits, is used for variable quantum encoding of the 2nd and 3rd qubits. The first multi-quantum logic gate RZZ(α5), operating on the 2nd, 3rd, and 4th qubits, is also used for variable quantum encoding of the 2nd, 3rd, and 4th qubits. The first multi-quantum logic gate RZZ(α5), operating on the 3rd and 4th qubits, is also used for variable quantum encoding of the 2nd, 3rd, and 4th qubits. Gate RZZ(α6) is used for variable quantum encoding of the 3rd and 4th qubits; the parameters α1 of the first multi-quantum logic gate RZZ(α1), α2 of the first multi-quantum logic gate RZZ(α2), α3 of the first multi-quantum logic gate RZZ(α3), α4 of the first multi-quantum logic gate RZZ(α4), α5 of the first multi-quantum logic gate RZZ(α5), and α6 of the first multi-quantum logic gate RZZ(α6) are all determined based on training.
[0098] The variational circuit also includes: a second single quantum logic gate RZ(β1) acting on the first qubit, a second single quantum logic gate RZ(β2) acting on the second qubit, a second single quantum logic gate RZ(β3) acting on the third qubit, and a second single quantum logic gate RZ(β4) acting on the fourth qubit.
[0099] The second single quantum logic gate is used to further perform variable quantum encoding on the qubits encoded by the first multi-quantum logic gate, so as to... Figure 3 Taking a partial exemplary schematic diagram of an input feature map as an example, the second single quantum logic gate RZ(β1) acting on the first qubit is used to perform variable quantum encoding on the first qubit, the second single quantum logic gate RZ(β2) acting on the second qubit is used to perform variable quantum encoding on the second qubit, the second single quantum logic gate RZ(β3) acting on the third qubit is used to perform variable quantum encoding on the third qubit, and the second single quantum logic gate RZ(β4) acting on the fourth qubit is used to perform variable quantum encoding on the fourth qubit; the parameters β1 of the second single quantum logic gate RZ(β1), β2 of the second single quantum logic gate RZ(β2), β3 of the second single quantum logic gate RZ(β3), and β4 of the second single quantum logic gate RZ(β4) are all determined based on training.
[0100] The entangled circuit includes: a second multiple quantum logic gate (CNOT) operating on the first and second qubits, wherein the second qubit is the control bit and the first qubit is the controlled bit; a second multiple quantum logic gate (CNOT) operating on the second and third qubits, wherein the third qubit is the control bit and the second qubit is the controlled bit; a second multiple quantum logic gate (CNOT) operating on the third and fourth qubits, wherein the fourth qubit is the control bit and the third qubit is the controlled bit; and a second multiple quantum logic gate (CNOT) operating on the first and fourth qubits, wherein the first qubit is the control bit and the fourth qubit is the controlled bit.
[0101] Entangled circuits are used to establish entanglement between qubits after variable quantum encoding, in order to Figure 3 Taking a partial exemplary schematic diagram of an input feature map as an example, the second multi-quantum logic gate CNOT gate acting on the first and second qubits is used to establish entanglement between the first and second qubits; the second multi-quantum logic gate CNOT gate acting on the second and third qubits is used to establish entanglement between the second and third qubits; the second multi-quantum logic gate CNOT gate acting on the third and fourth qubits is used to establish entanglement between the third and fourth qubits; and the second multi-quantum logic gate acting on the first and fourth qubits is used to establish entanglement between the first and fourth qubits.
[0102] The measurement layer applied to each qubit is used to measure the quantum state of the corresponding qubit and obtain the measurement result.
[0103] In one embodiment of this application, the input feature map includes N local input feature maps, the output feature map includes N local output feature maps, and the quantum-hole convolutional layer of the QCBAM network includes N quantum circuits corresponding to the quantum-hole convolutional layer. The N quantum circuits are used to sample the N local input feature maps to obtain N sets of pixels, and to convolve the N sets of pixels to obtain N local output feature maps; wherein, each quantum circuit is used to sample 1 local input feature map to obtain 1 set of pixels, and to convolve the 1 set of pixels to obtain 1 local output feature map.
[0104] It should be noted that the exemplary schematic diagram of a partial input feature map provided in this application represents only one partial input feature map, and the exemplary schematic diagram of a quantum-hole convolution circuit provided in this application only performs convolution on the pixels in that partial input feature map. In practical applications, the number and arrangement of pixels in the input feature map are related to the actual weather radar echo map, and the number of qubits and encoding method of the quantum-hole convolution circuit also vary. An appropriate number of quantum-hole convolution circuits should be selected according to the requirements and used to convolve the pixels in each partial input feature map, thereby completing the convolution of all pixels in the input feature map and obtaining the output feature map.
[0105] This application uses quantum-dilated convolutional layers to perform convolution operations on the input feature map. Multiple pixels are sampled at intervals in the input feature map, and these pixels are loaded onto multiple qubits. Convolution is then performed using quantum circuits to obtain the output feature map. By introducing interval sampling during the convolution process, the receptive field of the convolution kernel can be expanded, enabling the neural network to acquire broader temporal information, thereby better capturing features at different scales and improving prediction accuracy. Quantum-dilated convolution increases the receptive field without changing the spatial dimensions of the input and output, maintaining excellent spatial resolution, thus better capturing fine-grained meteorological information and improving the granularity of predictions.
[0106] In addition, this application uses a quantum void convolution circuit to implement the convolution operation, which can utilize the entanglement and superposition properties of quantum states to improve the accuracy of circuit operations. The variable quantum logic gates in the quantum void convolution circuit include variational parameters. By iteratively optimizing the variational parameters through training, the performance of the quantum circuit can be effectively improved. For these and other reasons, the quantum void convolution layer and the corresponding quantum void convolution circuit provided in this application embodiment greatly improve the accuracy of weather forecasting.
[0107] In one embodiment of this application, the QCBAM network includes a classical channel attention module and a quantum spatial attention module. The quantum spatial attention module includes a pooling layer, a quantum-hole convolutional layer, and an activation layer. The pooling layer is used to reduce the dimensionality of the channel attention map output by the classical channel attention module to obtain the input feature map. The activation layer is used to determine the spatial attention map based on the output feature map.
[0108] The pooling layer, a layer in a convolutional neural network, is used for dimensionality reduction of images. Its main function is to transform high-dimensional spatial information into two-dimensional image information, thereby reducing computational cost and the number of parameters, and improving the training speed and generalization ability of the model. Dimensionality reduction in the pooling layer compresses the input attention map into a fixed-size region, and selects a statistical measure such as the maximum, mean, or median within this region as the output, thus obtaining the input feature map. This effectively reduces redundant information in the feature map, preserves important spatial features, and also prevents overfitting.
[0109] The activation layer, also a layer in a convolutional neural network, is used to introduce non-linear characteristics, enabling the model to learn more complex features. The activation layer includes one or more activation functions, such as ReLU, Sigmoid, and Tanh functions. This embodiment uses the Sigmoid function as the activation function for the activation layer; however, in practice, the appropriate function should be selected based on the specific circumstances.
[0110] A channel attention map is a feature map representing the importance of different pixels in a weather radar echo image or its encoded / decoded state, after a series of weighted processing steps by the classic channel attention module. In this embodiment, the channel attention map can be viewed as a weighted representation of different pixels in a weather radar echo image or its encoded / decoded state, where the weight of each part reflects its importance to the weather forecasting task.
[0111] The spatial attention map is a feature map representing the importance of different pixels in the channel attention map after the quantum spatial attention module performs a series of weighted processing on the spatial attention map. In the embodiments of this application, the spatial attention map can be regarded as a weighted representation of different pixels in the channel attention map, where the weight of each part reflects the importance of that part to the weather forecasting task.
[0112] See Figure 5 , Figure 5 This is an exemplary schematic diagram of a classic channel attention module provided in an embodiment of this application. Figure 5 The classic channel attention module shown includes a first max pooling layer, a first average pooling layer, a fully connected layer, an addition operation, and a first activation layer.
[0113] See Figure 6 , Figure 6 This is an exemplary schematic diagram of a quantum spatial attention module provided in an embodiment of this application. Figure 6 The quantum spatial attention module shown includes a second maximum pooling layer, a second average pooling layer, a quantum void convolutional layer, and a second activation layer.
[0114] Max pooling is a pooling operation that improves model performance and generalization ability by reducing and enhancing the dimensionality of the feature map. It divides the input feature map into several fixed-size regions and extracts the maximum or average value within each region, thereby reducing dimensionality while retaining important information. In max pooling, selecting the maximum value of each region as the output feature effectively reduces the size of the feature map while preserving the most important feature information.
[0115] Average pooling is another pooling operation that performs average pooling on the input feature map. Unlike max pooling, average pooling sums the pixel values within each small region and then divides by the number of pixels in that region to obtain the average value for each small region. In average pooling, the average value of each small region is selected as the output feature.
[0116] This application provides a Quantum Convolutional Attention Module (QCBAM) network, which can perform attention calculations on the input weather radar echo map and the encoding and decoding states to obtain a spatial attention map. The QCBAM network includes a classical channel attention module and a quantum spatial attention module. Through the classical channel attention module, the QCBAM network can automatically adjust the weights of each channel in the feature map, enabling the network to focus more on features that significantly contribute to prediction accuracy, thus enhancing the network's extraction and utilization of key features from radar echo data.
[0117] Through the quantum spatial attention module, the quantum convolutional attention module can adaptively adjust the weight of each spatial location in the feature map, enabling the network to better perceive the importance of different regions. In weather forecasting, data from different regions often have varying degrees of importance; the quantum spatial attention module helps the network better focus on the most important regions. In addition, the quantum spatial attention module includes quantum dilated convolutional layers, which process information at different scales through multi-layer quantum dilated convolutional circuits. In radar echo-based weather forecasting, echo data at different scales contain different weather phenomena and characteristics. The QCBAM network can extract information at these scales through multi-layer convolution and incorporate and utilize this information in the model, improving prediction accuracy. For these reasons, the quantum convolutional attention module QCBAM network provided in this application embodiment can significantly improve the accuracy of weather forecasting.
[0118] The operation of the classical channel attention module and the quantum space attention module will be described below.
[0119] In one embodiment of this application, the step of inputting meteorological radar echo images of multiple time points preceding the time point to be predicted into a QCBAM-ConvLSTM network and running the QCBAM-ConvLSTM network to obtain the meteorological radar echo image of the time point to be predicted includes:
[0120] The weather radar echo image and encoding status of the i-th time node are input into the QCBAM-ConvLSTM network and run to obtain the encoding status of the (i+1)-th time node. The initial value of i is 1, and the encoding status corresponding to the weather radar echo image of the 1-th time node is a preset value.
[0121] Let i = i + 1, and return to the step described above to input the weather radar echo map and encoding status of the i-th time node into the QCBAM-ConvLSTM network and run it;
[0122] When i = u, the weather radar echo map of the time node to be predicted is determined based on the encoding state of the (u+1)th time node, where u is the number of time nodes before the time node to be predicted.
[0123] The encoding state refers to the input of the QCBAM-ConvLSTM encoder at each time node, and the output generated at each time node that can be used as input for subsequent time nodes. It contains the input of the current time node and the information of previous time nodes, and carries the modeling of the temporal dependencies in the sequence data by QCBAM-ConvLSTM. The encoder will be described below.
[0124] In one embodiment of this application, the ConvLSTM network is used to determine the coding state of the next time node based on the spatial attention map of the current time node. The step of inputting the weather radar echo map and coding state of the i-th time node into the QCBAM-ConvLSTM network and running it to obtain the coding state of the (i+1)-th time node includes:
[0125] The meteorological radar echo map and coding status of the i-th time node are input into the QCBAM network and run to obtain the first spatial attention map and the second spatial attention map of the i-th time node, wherein the coding status corresponding to the meteorological radar echo map of the 1-th time node is a preset value.
[0126] The first spatial attention map and the second spatial attention map at the i-th time node are input into the ConvLSTM network and run to obtain the encoding state at the (i+1)-th time node.
[0127] The first spatial attention map is the result of the QCBAM network performing attention calculations on the weather radar echo image. It is an attention feature map used to represent the degree of correlation between different pixels in the weather radar echo image. It is obtained by calculating the similarity between the query vector and the key vector, and is used to measure the relevance of each pixel in the input weather radar echo image to the target.
[0128] The second spatial attention map is the result of the QCBAM network performing attention calculations on the encoded state. It is an attention feature map used to represent the degree of correlation between different pixels in the encoded state. It is obtained by calculating the similarity between the query vector and the key vector, and is used to measure the relevance of each pixel in the input encoded state to the target.
[0129] The following section details the method of inputting meteorological radar echo maps from multiple time points preceding the time point to be predicted into a QDCBAM-ConvLSTM network and running the QDCBAM-ConvLSTM network to obtain the meteorological radar echo map of the time point to be predicted.
[0130] The weather radar echo map at the i-th time node is input into the first average pooling layer and the first maximum pooling layer in the classic channel attention module, respectively. The first average pooling layer is run to obtain the first average pooling map at the i-th time node, and the first maximum pooling layer is run to obtain the first maximum pooling map at the i-th time node.
[0131] The encoding state of the i-th time node is input into the first average pooling layer and the first maximum pooling layer in the classic channel attention module, respectively. The first average pooling layer is run to obtain the second average pooling map of the i-th time node, and the first maximum pooling layer is run to obtain the second maximum pooling map of the i-th time node.
[0132] The first average pooling map and the first maximum pooling map at the i-th time node are respectively input into the fully connected layer and run to obtain the first average attention map and the first maximum attention map at the i-th time node.
[0133] The second average pooling map and the second maximum pooling map at the i-th time node are then input into the fully connected layer and run to obtain the second average attention map and the second maximum attention map at the i-th time node.
[0134] The first average attention map and the first maximum attention map at the i-th time node are summed, and the summed result is activated by the sigmoid function of the first activation layer to obtain the first channel attention map at the i-th time node.
[0135] The second average attention map and the second maximum attention map at the i-th time node are summed, and the summed result is activated by the sigmoid function of the first activation layer to obtain the second channel attention map at the i-th time node.
[0136] The first channel attention map at the i-th time node is input into the second maximum pooling layer in the quantum space attention module and run to obtain the third maximum pooling map at the i-th time node.
[0137] The second channel attention map at the i-th time node is input into the second maximum pooling layer in the quantum space attention module and run to obtain the fourth maximum pooling map at the i-th time node.
[0138] The third maximum pooling graph at the i-th time node is input into the second average pooling layer in the quantum space attention module and run to obtain the third average pooling graph at the i-th time node.
[0139] The fourth maximum pooling graph at the i-th time node is then input into the second average pooling layer in the quantum space attention module and run to obtain the fourth average pooling graph at the i-th time node.
[0140] The third average pooling map at the i-th time node is used as the input feature map of the quantum void convolutional layer. Multiple pixels are sampled at intervals on the map. The multiple pixels are input into the quantum void convolutional layer and run to obtain the output feature map at the i-th time node. The output feature map at the i-th time node is activated by the sigmoid function of the second activation layer to obtain the first spatial attention map at the i-th time node.
[0141] The fourth average pooling map at the i-th time node is used as the input feature map of the quantum void convolutional layer. Multiple pixels are sampled at intervals on the map. The multiple pixels are input into the quantum void convolutional layer and run to obtain the output feature map at the i-th time node. The output feature map at the i-th time node is activated by the sigmoid function of the second activation layer to obtain the second spatial attention map at the i-th time node.
[0142] The first spatial attention map and the second spatial attention map at the i-th time node are input into the ConvLSTM network and run to obtain the encoding state at the (i+1)-th time node.
[0143] Let i = i+1, and return to the execution step of inputting the weather radar echo map of the i-th time node into the first average pooling layer and the first maximum pooling layer in the classic channel attention module respectively, and determine the weather radar echo map of the time node to be predicted based on the encoding state of the (u+1)-th time node, where u is the number of time nodes before the time node to be predicted.
[0144] The method for determining the weather radar echo map of the time node to be predicted based on the coding state of the (u+1)th time node will be described below.
[0145] In one embodiment of this application, both the encoding state and the decoding state include a hidden state and a unit state.
[0146] Hidden states are an encoded representation of past information in neural networks such as recurrent neural networks (RNNs) and long short-term memory (LSTM) networks when processing sequential data. They contain the model's memory of past input data and a summary of the processing results.
[0147] A cell state is an internal state in a ConvLSTM network used to store and transmit information. It is a key component of the ConvLSTM network, used to address long-term dependencies and control the flow of information. The cell state is updated at each time point and cyclically passed to the next. The definition and update process of the cell state is controlled by the gating mechanism of ConvLSTM to determine which information needs to be forgotten or retained, and to selectively introduce new information from the input. This process of defining and updating the cell state enables the LSTM network to more effectively capture and remember long-term dependencies.
[0148] In one embodiment of this application, the encoding state includes a first hidden state and a first unit state.
[0149] In one embodiment of this application, the ConvLSTM network includes a forget gate, an input gate, an output gate, a sigmoid function, and a tanh function.
[0150] The sigmoid function is an activation function used to map input values to a continuous output between 0 and 1. Its mathematical definition is:
[0151] σ(r)=1 / (1+e^(-r))
[0152] Where r is the input value and e is the base of the natural logarithm.
[0153] The tanh function (Hyperbolic Tangent Function), also known as the hyperbolic tangent function, is another activation function used to map input values to a continuous output between -1 and 1. Its mathematical definition is:
[0154] tanh(r)=(e^r-e^(-r)) / (e^r+e^(-r))
[0155] Where r is the input value and e is the base of the natural logarithm.
[0156] Both the Sigmoid and tanh functions are nonlinear functions that can perform nonlinear transformations on the outputs of gating units in a network, mapping them to a specific range. They also have the property of being continuously differentiable, which facilitates model training and optimization.
[0157] See Figure 7 , Figure 7 This is an exemplary schematic diagram of a ConvLSTM network provided in an embodiment of this application. Figure 7 The ConvLSTM network shown also includes a BN layer and an addition operation. Product operation
[0158] BN (Batch Normalization) layer refers to a normalization layer. By performing a normalization operation on each feature dimension, the mean of the input samples is adjusted to 0 and the variance is adjusted to 1, so that the data distribution of each feature dimension is more stable.
[0159] When the input is a first spatial attention map and a second spatial attention map, in Figure 7 middle, y t Z represents the first spatial attention graph at time point t. t H represents the second spatial attention graph at time point t. t+1 S represents the first hidden state at time point t+1. t S represents the state of the first unit at time point t. t+1 This represents the state of the first unit at time node t+1.
[0160] Figure 7 The ConvLSTM network shown can process the first spatial attention graph y at time t according to the following formula. t The second spatial attention graph Z at time point t t The state S of the first unit at time t t And obtain the first hidden state h at the (t+1)th time node. t+1 and the first unit state S t+1 :
[0161] i t =σ(W yi *y t +W hi *z t +b i )
[0162] f t =σ(W yf *y t +W zf *z t +b f )
[0163] o t =σ(W yo *y t +W zo *z t +b0)
[0164]
[0165]
[0166]
[0167] Where σ represents the sigmoid function, and tanh represents the tanh function; i t f represents the output of the input gate. t This represents the output of the forget gate, o t This indicates the output result of the output gate. This indicates the calculation of the first unit state S at time node t+1. t+1 The median value of W; yi W represents the weight of the input gate with respect to the first spatial attention map. zi b represents the weight of the input gate with respect to the second-space attention map. i W represents the bias term of the input gate. yf W represents the weight of the forget gate with respect to the first-space attention graph. zf b represents the weight of the forget gate with respect to the second-space attention map. i The bias term representing the forget gate; W yo W represents the weight of the output gate with respect to the first spatial attention map. zo b represents the weight of the output gate with respect to the second-space attention map. i W represents the bias term of the output gate. ys This represents the calculation of the first hidden state S at time point t+1. t+1 The median value of the weights of the first spatial attention map, W zsThis represents the calculation of the first hidden state S at time point t+1. t+1 The median value of the weights with respect to the second spatial attention map, b s This represents the calculation of the first hidden state S at time point t+1. t+1 The bias term of the intermediate value;
[0168] It should be noted that, Figure 7 In the ConvLSTM network shown, 'i' in the above formula refers to the input gate, which has a different meaning from the 'i' used in other embodiments of this application.
[0169] In one embodiment of this application, the ConvLSTM network is used to determine the next decoding state based on the current spatial attention map, and the step of determining the weather radar echo map of the time node to be predicted based on the encoding state of the (u+1)th time node includes:
[0170] The encoding state of the (u+1)th time node is taken as the first decoding state;
[0171] The j-th decoding state is input into the QCBAM network and run to obtain the j-th third space attention map, with the initial value of j being 1;
[0172] The j-th third spatial attention map is input into the ConvLSTM network and run to obtain the (j+1)-th decoding state;
[0173] Let j = j + 1, and return to the step of inputting the j-th decoding state into the QCBAM network and running it;
[0174] After executing the preset number of times, the (j+1)th decoding state obtained from the last execution is the meteorological radar echo map of the time node to be predicted.
[0175] The concepts of decoding state and encoding state are basically the same. The difference is that decoding state refers to the input and output of the decoder of the QCBAM-ConvLSTM network at each time node.
[0176] The encoder and decoder are two components in a QELSTM network. The encoder encodes the input sequence into an encoded state, while the decoder decodes this encoded state into a decoded state, which is then used as the input for the encoder's next iteration. It should be noted that the encoder and decoder are both based on a ConvLSTM network as described in this application embodiment; the only difference is that their inputs and outputs are different.
[0177] The third spatial attention map, the result of the QCBAM network performing attention calculations on the decoding state, is an attention feature map used to represent the degree of correlation between different pixels in the decoding state. It is obtained by calculating the similarity between the query vector and the key vector, and is used to measure the relevance of each pixel in the input decoding state to the target.
[0178] In one embodiment of this application, the decoding state includes a second hidden state and a second unit state.
[0179] See Figure 7 When the input is a third-space attention map, the ConvLSTM network has the same characteristics as... Figure 7 The structure shown is the same as that of a ConvLSTM network, and Z t Let y represent the third-space attention graph at time point t. t It is a null value; and in the above formula, h t+1 S represents the (t+1)th second hidden state. t S represents the t-th state of the second unit. t+1 This represents the (t+1)th state of the second unit. This indicates the calculation of the (t+1)th second hidden state S. t+1 The median value of W; zi W represents the weight of the input gate with respect to the third-space attention map. zf W represents the weight of the forget gate with respect to the third-space attention graph. zo W represents the weight of the output gate with respect to the third-space attention map. zs This indicates the calculation of the (t+1)th second hidden state S. t+1 The median value is the weight of the third-space attention map.
[0180] The following section provides a detailed explanation of the method for determining the meteorological radar echo map of the time node to be predicted based on the coding state of the (u+1)th time node.
[0181] The encoding state at the (u+1)th time node is taken as the first decoding state;
[0182] The j-th decoding state is input into the first average pooling layer and the first maximum pooling layer in the classic channel attention module, respectively. The first average pooling layer is run to obtain the j-th fifth average pooling graph, and the first maximum pooling layer is run to obtain the j-th fifth maximum pooling graph. The initial value of j is 1.
[0183] The j-th fifth average pooling graph and the j-th fifth maximum pooling graph are input into the fully connected layer and run to obtain the i-th third average attention graph and the j-th third maximum attention graph.
[0184] The j-th third average attention map and the j-th third maximum attention map are summed, and the summed result is activated by the sigmoid function of the first activation layer to obtain the j-th third channel attention map.
[0185] The j-th third channel attention map is input into the second maximum pooling layer in the quantum space attention module and run to obtain the j-th fifth maximum pooling map;
[0186] The j-th fifth maximum pooling graph is input into the second average pooling layer in the quantum space attention module and run to obtain the j-th fifth average pooling graph;
[0187] The j-th fifth average pooling map is used as the input feature map of the quantum void convolutional layer. Multiple pixels are sampled at intervals on the map. The multiple pixels are input into the quantum void convolutional layer and run to obtain the j-th output feature map. The j-th output feature map is activated by the sigmoid function of the second activation layer to obtain the j-th third spatial attention map.
[0188] Input the j-th third-space attention map into the ConvLSTM network and run it to obtain the (j+1)-th decoding state;
[0189] Let j = i+1, return to the execution step of inputting the j-th decoding state into the first average pooling layer and the first maximum pooling layer in the classic channel attention module respectively, and execute for a preset number of times. The j+1-th decoding state obtained in the last execution is the weather radar echo map of the time node to be predicted.
[0190] This application provides a Convolutional Long Short-Term Memory (ConvLSTM) network capable of processing the spatial attention map output by a CBAM network to obtain the encoding or decoding state of the next time node corresponding to the spatial attention map. The ConvLSTM network can process weather radar echo data with spatiotemporal structure, considering both temporal and spatial correlations. In weather forecasting, the evolution of weather systems typically exhibits distinct spatiotemporal characteristics, which the ConvLSTM network can better capture.
[0191] In radar echo-based weather forecasting, past echo data has a significant impact on future weather changes. Traditional weather forecasting networks are prone to gradient vanishing and gradient exploding problems, making it difficult to capture long-term dependencies. However, in ConvLSTM networks, the input gate, forget gate, and output gate can adaptively determine which information to input, forget, or output, and control the flow of information and memory updates at each time point. For these reasons, the ConvLSTM network provided in this application significantly improves the accuracy of weather forecasting.
[0192] See Figure 8 , Figure 8 This is a flowchart illustrating a weather forecasting method provided in an embodiment of this application. The following is an example... Figure 8 For example, the flow of a weather forecasting method provided in this application embodiment will be described as follows:
[0193] The meteorological radar echo map and encoding state of the k-th time node before the time node to be predicted are input into the classical channel attention module of the quantum convolutional attention module QCBAM network and run to obtain the fourth channel attention map and the fifth channel attention map of the k-th time node, where the encoding state of the first time node is a preset value.
[0194] The fourth and fifth channel attention maps at the k-th time node are input into the quantum spatial attention module of the QCBAM network and run to obtain the fourth and fifth spatial attention maps at the k-th time node.
[0195] The fourth spatial attention map and the fifth spatial attention map of the kth time node are input into the encoder of the ConvLSTM network to obtain the encoding state of the (k+1)th node.
[0196] Let k = k + 1, and return to execute the classic channel attention module of the QCBAM network, which inputs the weather radar echo map and encoding state of the kth time node before the time node to be predicted into the QCBAM network and runs it. When v = k, the encoding state of the (v+1)th time node is used as the first decoding state, where v is the number of time nodes.
[0197] The g-th decoding state is input into the classic channel attention module of the QCBAM network and run to obtain the g-th sixth channel attention map, with the initial value of g being 1;
[0198] The g-th sixth-channel attention map is input into the quantum space attention module of the QCBAM network and run to obtain the g-th sixth-space attention map;
[0199] The g-th sixth-space attention map is input into the decoder of the ConvLSTM network to obtain the g+1-th decoding state;
[0200] Let g = g + 1, and return to execute the classic channel attention module that inputs the g-th decoding state into the QCBAM network and run it;
[0201] After executing the preset number of times, the g+1th decoding state obtained from the last execution is the weather radar echo map of the time node to be predicted;
[0202] Meteorological radar echo maps of the time points to be predicted determine the meteorological forecast results for the time points to be predicted.
[0203] See Figure 9 , Figure 9 This is a schematic diagram of the structure of a weather forecasting device provided in an embodiment of this application, and... Figure 2 Corresponding to the process shown, the apparatus includes:
[0204] The execution module 901 is used to input the meteorological radar echo maps of multiple time points before the time point to be predicted into the quantum convolutional attention module-convolutional long short-term memory QCBAM-ConvLSTM network, and run the QCBAM-ConvLSTM network to obtain the meteorological radar echo map of the time point to be predicted; the QCBAM network includes a quantum dilated convolutional layer, which is used to sample the input feature map at intervals to obtain multiple pixels, and to convolve the multiple pixels to obtain the output feature map;
[0205] The prediction module 902 is used to determine the meteorological prediction result for the time node to be predicted based on the meteorological radar echo map of the time node to be predicted.
[0206] Optionally, the quantum circuit corresponding to the quantum void convolutional layer includes an encoding circuit, a variational circuit, and an entanglement circuit. The encoding circuit is used to load the plurality of pixels onto the qubits, the variational circuit is used to perform variational quantum encoding on the loaded qubits, and the entanglement circuit is used to establish entanglement between the qubits after variational quantum encoding.
[0207] Optionally, the encoding circuit includes a first single quantum logic gate acting on each qubit, the variational circuit includes a first multi-quantum logic gate acting on multiple qubits and a second single quantum logic gate acting on each qubit, and the entanglement circuit includes a second multi-quantum logic gate acting on multiple qubits; the parameters of the first single quantum logic gate are determined based on the multiple pixels, and the parameters of the first multi-quantum logic gate and the second single quantum logic gate are determined based on training.
[0208] Optionally, the pixels include row pixels and column pixels. Every two adjacent row pixels are separated by n pixels on the input feature map, and every two adjacent column pixels are separated by m pixels on the input feature map.
[0209] Optionally, the QCBAM network includes a classical channel attention module and a quantum spatial attention module. The quantum spatial attention module includes a pooling layer, a quantum-hole convolutional layer, and an activation layer. The pooling layer is used to reduce the dimensionality of the channel attention map output by the classical channel attention module to obtain the input feature map. The activation layer is used to determine the spatial attention map based on the output feature map.
[0210] Optionally, the step of inputting meteorological radar echo images from multiple time points preceding the time point to be predicted into the QCBAM-ConvLSTM network and running the QCBAM-ConvLSTM network to obtain the meteorological radar echo image of the time point to be predicted includes:
[0211] The weather radar echo image and encoding status of the i-th time node are input into the QCBAM-ConvLSTM network and run to obtain the encoding status of the (i+1)-th time node. The initial value of i is 1, and the encoding status corresponding to the weather radar echo image of the 1-th time node is a preset value.
[0212] Let i = i + 1, and return to the step described above to input the weather radar echo map and encoding status of the i-th time node into the QCBAM-ConvLSTM network and run it;
[0213] When i = u, the weather radar echo map of the time node to be predicted is determined based on the encoding state of the (u+1)th time node, where u is the number of time nodes before the time node to be predicted.
[0214] Optionally, the ConvLSTM network is used to determine the coding state of the next time node based on the spatial attention map of the current time node. The step of inputting the meteorological radar echo map and coding state of the i-th time node into the QCBAM-ConvLSTM network and running it to obtain the coding state of the (i+1)-th time node includes:
[0215] The meteorological radar echo map and coding status of the i-th time node are input into the QCBAM network and run to obtain the first spatial attention map and the second spatial attention map of the i-th time node, wherein the coding status corresponding to the meteorological radar echo map of the 1-th time node is a preset value.
[0216] The first spatial attention map and the second spatial attention map at the i-th time node are input into the ConvLSTM network and run to obtain the encoding state at the (i+1)-th time node.
[0217] Optionally, the ConvLSTM network is used to determine the next decoding state based on the current spatial attention map, and the determination of the weather radar echo map of the time node to be predicted based on the encoding state of the (u+1)th time node includes:
[0218] The encoding state of the (u+1)th time node is taken as the first decoding state;
[0219] The j-th decoding state is input into the QCBAM network and run to obtain the j-th third space attention map, with the initial value of j being 1;
[0220] The j-th third spatial attention map is input into the ConvLSTM network and run to obtain the (j+1)-th decoding state;
[0221] Let j = j + 1, and return to the step of inputting the j-th decoding state into the QCBAM network and running it;
[0222] After executing the preset number of times, the (j+1)th decoding state obtained from the last execution is the meteorological radar echo map of the time node to be predicted.
[0223] This application also provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0224] Specifically, in this embodiment, the storage medium may include, but is not limited to, USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks, and other media capable of storing computer programs.
[0225] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the method embodiments described above.
[0226] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.
[0227] Specifically, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0228] S1, input the weather radar echo maps of multiple time points before the time point to be predicted into the quantum convolutional attention module-convolutional long short-term memory QCBAM-ConvLSTM network, and run the QCBAM-ConvLSTM network to obtain the weather radar echo map of the time point to be predicted; the QCBAM network includes a quantum dilated convolutional layer, which is used to sample the input feature map at intervals to obtain multiple pixels, and to convolve the multiple pixels to obtain the output feature map;
[0229] S2, determine the meteorological forecast result for the time node to be predicted based on the meteorological radar echo map of the time node to be predicted.
[0230] Specifically, the specific examples in this embodiment can be referred to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0231] The above description, based on the embodiments shown in the drawings, details the structure, features, and effects of this application. The above description is only a preferred embodiment of this application, but this application does not limit the scope of implementation to what is shown in the drawings. Any changes made in accordance with the concept of this application, or modifications to equivalent embodiments, that do not exceed the spirit covered by the specification and drawings, should be within the protection scope of this application.
Claims
1. A weather forecasting method, characterized in that, The method includes: The weather radar echo maps of multiple time points preceding the time point to be predicted are input into a quantum convolutional attention module—a convolutional long short-term memory (QCBAM)-ConvLSTM network, and the QCBAM-ConvLSTM network is run to obtain the weather radar echo map of the time point to be predicted. The QCBAM-ConvLSTM network includes a QCBAM network and a ConvLSTM network. The QCBAM network includes a classical channel attention module and a quantum spatial attention module. The quantum spatial attention module includes a pooling layer, a quantum dilated convolutional layer, and an activation layer. The pooling layer is used to reduce the dimensionality of the channel attention map output by the classical channel attention module to obtain an input feature map. The quantum dilated convolutional layer is used to sample the input feature map at intervals to obtain multiple pixels, and to convolve multiple pixels to obtain an output feature map. The activation layer is used to determine the spatial attention map based on the output feature map. The ConvLSTM network is used to determine the weather radar echo map of the time point to be predicted based on the spatial attention map of the current time point. The meteorological forecast result for the time node to be predicted is determined based on the meteorological radar echo map of the time node to be predicted.
2. The method as described in claim 1, characterized in that, The quantum circuit corresponding to the quantum void convolutional layer includes an encoding circuit, a variational circuit, and an entanglement circuit. The encoding circuit is used to load the plurality of pixels onto the qubits. The variational circuit is used to perform variational quantum encoding on the loaded qubits. The entanglement circuit is used to establish entanglement between the qubits after variational quantum encoding.
3. The method as described in claim 2, characterized in that, The encoding circuit includes a first single quantum logic gate acting on each qubit; the variational circuit includes a first multi-quantum logic gate acting on multiple qubits and a second single quantum logic gate acting on each qubit; the entanglement circuit includes a second multi-quantum logic gate acting on multiple qubits; the parameters of the first single quantum logic gate are determined based on the multiple pixels; and the parameters of the first multi-quantum logic gate and the second single quantum logic gate are determined based on training.
4. The method as described in claim 1, characterized in that, Pixels include row pixels and column pixels. Every two adjacent row pixels are separated by n pixels on the input feature map, and every two adjacent column pixels are separated by m pixels on the input feature map.
5. The method as described in claim 4, characterized in that, The process of inputting meteorological radar echo maps from multiple time points preceding the time point to be predicted into the QCBAM-ConvLSTM network and running the QCBAM-ConvLSTM network to obtain the meteorological radar echo map of the time point to be predicted includes: The weather radar echo image and encoding status of the i-th time node are input into the QCBAM-ConvLSTM network and run to obtain the encoding status of the (i+1)-th time node. The initial value of i is 1, and the encoding status corresponding to the weather radar echo image of the 1-th time node is a preset value. Let i = i + 1, and return to the step described above to input the weather radar echo map and encoding status of the i-th time node into the QCBAM-ConvLSTM network and run it; When i = u, the weather radar echo map of the time node to be predicted is determined based on the encoding state of the (u+1)th time node, where u is the number of time nodes before the time node to be predicted.
6. The method as described in claim 5, characterized in that, The ConvLSTM network is used to determine the coding state of the next time node based on the spatial attention map of the current time node. The step of inputting the meteorological radar echo map and coding state of the i-th time node into the QCBAM-ConvLSTM network and running it to obtain the coding state of the (i+1)-th time node includes: The meteorological radar echo map and coding status of the i-th time node are input into the QCBAM network and run to obtain the first spatial attention map and the second spatial attention map of the i-th time node, wherein the coding status corresponding to the meteorological radar echo map of the 1-th time node is a preset value. The first spatial attention map and the second spatial attention map at the i-th time node are input into the ConvLSTM network and run to obtain the encoding state at the (i+1)-th time node.
7. The method as described in claim 5, characterized in that, The ConvLSTM network is used to determine the next decoding state based on the current spatial attention map. The determination of the weather radar echo map for the predicted time node based on the encoding state at the (u+1)th time node includes: The encoding state of the (u+1)th time node is taken as the first decoding state; The j-th decoding state is input into the QCBAM network and run to obtain the j-th third space attention map, with the initial value of j being 1; The j-th third spatial attention map is input into the ConvLSTM network and run to obtain the (j+1)-th decoding state; Let j = j + 1, and return to the step of inputting the j-th decoding state into the QCBAM network and running it; After executing the preset number of times, the (j+1)th decoding state obtained from the last execution is the meteorological radar echo map of the time node to be predicted.
8. A weather forecasting device, characterized in that, The device includes: The execution module is used to input meteorological radar echo maps from multiple time points prior to the time point to be predicted into a quantum convolutional attention module—a convolutional long short-term memory (QCBAM)-ConvLSTM network—and run the QCBAM-ConvLSTM network to obtain the meteorological radar echo map for the time point to be predicted. The QCBAM-ConvLSTM network includes a QCBAM network and a ConvLSTM network. The QCBAM network includes a classical channel attention module and a quantum spatial attention module. The quantum spatial attention module includes a pooling layer, a quantum dilated convolutional layer, and an activation layer. The pooling layer is used to reduce the dimensionality of the channel attention map output by the classical channel attention module to obtain an input feature map. The quantum dilated convolutional layer is used to sample the input feature map at intervals to obtain multiple pixels and convolve these pixels to obtain an output feature map. The activation layer is used to determine a spatial attention map based on the output feature map. The prediction module is used to determine the meteorological prediction result for the time node to be predicted based on the meteorological radar echo map of the time node to be predicted.
9. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 7 when it is run.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Ozone concentration distribution prediction method and system based on space-time deep learning
CN108108836A
Meteorological data prediction method and device, storage medium and electronic device
CN116400430A