Method and device for constructing flow rate prediction model based on improved gated circulation unit
By introducing residual structures in the spatiotemporal attention module and the bidirectional gated cycle module into the flow rate prediction model, the problem of data noise interference and slow calculation speed of fixed-point (horizontal) acoustic Doppler flowmeter is solved, and more efficient and accurate flow rate prediction is achieved.
Patent Information
- Application Number
- CN202411943251.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-27
AI Technical Summary
The flow velocity data measured by fixed-point (horizontal) acoustic Doppler flowmeter has noise interference, which makes it difficult for the prediction model to accurately capture the trend of flow velocity changes. In addition, traditional algorithms are slow to calculate when processing large-scale and long-term time series data, which cannot meet the real-time requirements.
A flow rate prediction model based on improved gated circulation unit is constructed, and the spatiotemporal attention module is used to make full use of the spatiotemporal dynamic relationship between flow rate data at different depths at different moments, and two residual structures are used in the bidirectional gated circulation module to process the output of the BiGRU layer, improving the prediction speed and accuracy of the model.
The prediction accuracy and efficiency of the flow rate prediction model are improved, and the relationship between flow rate data at different depths can be captured more accurately, and application scenarios that meet real-time requirements.
Smart Images

Figure CN119378407B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method and device for constructing a flow rate prediction model based on an improved gated circulation unit. Background Art
[0002] In many fields such as water conservancy projects, marine scientific research and environmental monitoring, flow velocity measurement is a vital task. Fixed-point (horizontal) acoustic Doppler flowmeter, as a commonly used flow velocity measurement instrument, plays a key role in practical applications.
[0003] Since the fixed-point (horizontal) acoustic Doppler current meter measures multi-layer flow velocity data, and each layer of flow velocity data has different degrees of noise interference, when using the fixed-point (horizontal) acoustic Doppler current meter to measure multi-layer flow velocity data for prediction, the noise will cover up the real characteristics and laws in the data, making it difficult for the prediction model to accurately capture the trend of flow velocity changes. When predicting flow velocity, some existing prediction models often cannot fully explore the measurement relationship between flow velocities at adjacent depths. For example, in the marine environment, the water flow velocity at different depths may be affected by different factors and produce different noises. For example, surface water flow is greatly affected by wind force, and deep water flow is affected by seabed topography and other factors. Traditional methods ignore the relationship between these depths and cannot fully extract the characteristics of flow velocity data, which in turn affects the accuracy of prediction.
[0004] In addition, velocity data is a long time series feature. Traditional algorithms used to process time series velocity data, such as recurrent neural networks, mostly use serial calculations during the calculation process. When processing large-scale, long-time series velocity data, the calculation speed is slow and it is difficult to meet the real-time requirements of scenarios such as flood warning and marine disaster monitoring. When a flood comes, it is necessary to predict the velocity change in a timely and accurate manner in order to take effective flood prevention measures. However, the low efficiency of traditional algorithms may result in the inability to provide accurate prediction information in a timely manner.
[0005] In summary, in view of the problems of noise interference and slow prediction speed in the flow velocity measurement data of fixed-point (horizontal) acoustic Doppler current meters, there is an urgent need for a more effective flow velocity prediction method to improve the prediction accuracy and efficiency of flow velocity measurement data and meet the needs of various fields for accurate flow velocity data. Summary of the invention
[0006] The embodiment of the present application provides a method and device for constructing a flow rate prediction model based on an improved gated recurrent unit. By constructing a spatiotemporal attention module, the spatiotemporal dynamic relationship between flow rate data at different depths at different times is fully utilized, and two residual structures are used in the bidirectional gated recurrent module to process the outputs of the two BiGRU layers, which not only speeds up the prediction speed of the model, but also further increases the accuracy of flow rate prediction at different depths.
[0007] In a first aspect, an embodiment of the present application provides a method for constructing a flow rate prediction model based on an improved gated circulation unit, the method comprising:
[0008] Acquire a multi-layer historical flow velocity data sequence represented by a sequence at a target location, and perform sliding window segmentation processing on the multi-layer historical flow velocity data sequence to obtain a sequence to be predicted;
[0009] Constructing a spatiotemporal attention module, wherein the spatiotemporal attention module is trained to perform temporal attention calculation and spatial attention calculation on the sequence to be predicted, respectively, and then weightedly integrating the temporal attention calculation result and the spatial attention calculation result to obtain an attention weighted feature;
[0010] Constructing a first encoding module, wherein the first encoding module is trained to extract the attention-weighted features through a multi-head self-attention mechanism to obtain a first encoding feature;
[0011] Constructing a bidirectional gated recurrent module, the bidirectional gated recurrent module is trained to process the first coding feature through two serially connected BiGRU layers to obtain a prediction feature, and input the prediction feature into a pre-trained fully connected layer to obtain a flow rate prediction result, wherein the output of the first BiGRU layer is residually connected to the first coding feature to obtain a first result, the first result is input to the second BiGRU layer, and the output result of the second BiGRU layer is residually connected to the first result to obtain a prediction feature;
[0012] The flow rate prediction model consists of a spatiotemporal attention module, a first encoding module, a bidirectional gated recurrent module and a fully connected layer.
[0013] In a second aspect, an embodiment of the present application provides a device for constructing a flow rate prediction model based on an improved gated circulation unit, comprising:
[0014] A sliding window module is used to obtain a multi-layer historical flow velocity data sequence represented by a sequence at a target location, and obtain a sequence to be predicted after performing a sliding window segmentation process on the multi-layer historical flow velocity data sequence;
[0015] The spatiotemporal attention module is trained to perform temporal attention calculation and spatial attention calculation on the predicted sequence respectively, and then weightedly integrate the temporal attention calculation results with the spatial attention calculation results to obtain the attention weighted features;
[0016] A first encoding module is trained to extract the attention-weighted features through a multi-head self-attention mechanism to obtain a first encoding feature;
[0017] The bidirectional gated recurrent module is trained to process the first coding feature through two series-connected BiGRU layers to obtain a prediction feature, and input the prediction feature into a pre-trained fully connected layer to obtain a flow rate prediction result, wherein the output of the first BiGRU layer is residually connected to the first coding feature to obtain a first result, the first result is input into the second BiGRU layer, and the output result of the second BiGRU layer is residually connected to the first result to obtain a prediction feature. The flow rate prediction model is composed of a spatiotemporal attention module, a first coding module, a bidirectional gated recurrent module and a fully connected layer.
[0018] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute a method for constructing a flow rate prediction model based on an improved gated circulation unit.
[0019] In a fourth aspect, an embodiment of the present application provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute a process, and the process includes a method for constructing a flow rate prediction model based on an improved gated circulation unit.
[0020] The main contributions and innovations of the present invention are as follows:
[0021] When performing the segmentation processing of the sliding window, the embodiment of the present application discards the useless data in the initial part to avoid data pollution caused by this part of the data, thereby increasing the prediction accuracy of the flow velocity prediction model. In addition, since some useless data is discarded, the reduction in the amount of data will also improve the prediction speed of the flow velocity prediction model; this solution uses a spatiotemporal attention module to fully utilize the spatiotemporal dynamic relationship between flow velocity measurement data at different depths at different times, thereby making the prediction result more accurate; this solution uses two residual connections in the bidirectional gated loop module, which reduces the loss and loss of information transmission, and the prediction features obtained after the residual connection are also convenient for the full connection layer to quickly understand, thereby improving the prediction speed of the flow velocity prediction model.
[0022] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0024] Figure 1 is a schematic diagram of the overall structure of a flow velocity prediction model according to an embodiment of the present application;
[0025] Figure 2 is a schematic diagram of sliding window segmentation according to an embodiment of the present application;
[0026] Figure 3 is a structural diagram of a spatiotemporal attention module according to an embodiment of the present application;
[0027] Figure 4 is a structural schematic diagram of a bidirectional gated circulation module according to an embodiment of the present application;
[0028] Figure 5 It is a schematic diagram of the result of predicting the flow velocity of layers with different depths using a flow velocity prediction model according to an embodiment of the present application;
[0029] Figure 6 It is a structural block diagram of a device for constructing a flow rate prediction model based on an improved gated circulation unit according to an embodiment of the present application;
[0030] Figure 7 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0032] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0033] Embodiment 1
[0034] The embodiment of the present application provides a method for constructing a flow rate prediction model based on an improved gated recurrent unit, which fully utilizes the spatiotemporal dynamic relationship between flow rate data at different depths at different times by constructing a spatiotemporal attention module, and also uses two residual structures in the bidirectional gated recurrent module to process the outputs of the two BiGRU layers, which can not only speed up the prediction speed of the model, but also further increase the accuracy of the prediction of flow rates at different depths. Specifically, refer to Figure 1 , the method comprising:
[0035] Acquire a multi-layer historical flow velocity data sequence represented by a sequence at a target location, and perform sliding window segmentation processing on the multi-layer historical flow velocity data sequence to obtain a sequence to be predicted;
[0036] Constructing a spatiotemporal attention module, wherein the spatiotemporal attention module is trained to perform temporal attention calculation and spatial attention calculation on the sequence to be predicted, respectively, and then weightedly integrating the temporal attention calculation result and the spatial attention calculation result to obtain an attention weighted feature;
[0037] Constructing a first encoding module, wherein the first encoding module is trained to extract the attention-weighted features through a multi-head self-attention mechanism to obtain a first encoding feature;
[0038] Constructing a bidirectional gated recurrent module, the bidirectional gated recurrent module is trained to process the first coding feature through two serially connected BiGRU layers to obtain a prediction feature, and input the prediction feature into a pre-trained fully connected layer to obtain a flow rate prediction result, wherein the output of the first BiGRU layer is residually connected to the first coding feature to obtain a first result, the first result is input to the second BiGRU layer, and the output result of the second BiGRU layer is residually connected to the first result to obtain a prediction feature;
[0039] The flow rate prediction model consists of a spatiotemporal attention module, a first encoding module, a bidirectional gated recurrent module and a fully connected layer.
[0040] In some specific embodiments, the multi-layer historical flow velocity data sequence is a set of data measured by a fixed-point (horizontal) acoustic Doppler current meter, and the multi-layer historical flow velocity data sequence records the flow velocity data of the 1st to Nth layers of the water area at the target location within a certain period of time.
[0041] In this solution, the sliding window size is set, and the multi-layer historical flow rate data sequence is subjected to sliding window segmentation according to the sliding window size to obtain multiple groups of sequences to be predicted, and the multiple groups of sequences to be predicted are sequentially input into the spatiotemporal attention module.
[0042] Further, during the sliding window segmentation process, data with a time scale less than the sliding window size in the multi-layer historical flow velocity data sequence is discarded.
[0043] Specifically, the schematic diagram of the sliding window segmentation is as Figure 2 shown. For example, the total duration of the multi-layer historical flow velocity data sequence is 100s, and a flow velocity data is recorded every second. The sliding window size sequence_length is 10s. Then, when the time scale i in the multi-layer historical flow velocity data sequence is less than sequence_length, the flow velocity measurement data at this time, that is, the data of the first 9s, is discarded. When i >= sequence_length, [i, i + sequence_length) is taken, that is, the data from 10s to 19s is used as a group of sequences to be predicted, and so on to obtain multiple groups of sequences to be predicted.
[0044] Specifically, since the multi-layer historical flow velocity data sequence obtained in this solution is randomly obtained, that is, the starting part of this data may include parts that cannot be used to infer the sequence law, so this solution uses the judgment of the sliding window to discard these parts that cannot be used for model inference, enhancing the prediction accuracy. And because some useless data is discarded, the prediction speed of the flow velocity prediction model is further improved.
[0045] In some specific embodiments, this solution trains each module in a batch processing manner during the training process. That is, during the training process, multiple groups of sequences to be predicted are input into the flow velocity prediction model in batches. Among them, the data dimension of each batch of data is (BatchSize, sequence_length, measurement_dim), BatchSize is the batch size, sequence_length is the sliding window size, and measurement_dim is the data dimension.
[0046] In this solution, the structure of the spatio-temporal attention module is as Figure 3 shown. The spatio-temporal attention module includes a time dimension attention calculation branch and a space dimension attention calculation branch. Adjacent first features and second features are obtained in the sequence to be predicted. In the time dimension attention calculation branch, the first feature and the second feature are subjected to attention calculation in the time dimension to obtain a time attention calculation result. In the space dimension attention calculation branch, the first feature and the second feature are subjected to attention calculation in the space dimension to obtain a space attention calculation result.
[0047] Furthermore, attention calculation in the time dimension refers to the calculation of flow velocity data at different time nodes on the same layer, and attention calculation in the spatial dimension refers to the calculation of flow velocity data of different layers at the same time node.
[0048] Furthermore, when performing attention calculation on the first feature and the second feature in the time dimension, the first feature is processed using a time fully connected layer to obtain a first time fully connected result, and then the first time fully connected result and the second feature are input into the time attention layer for time attention calculation and then output by the activation layer.
[0049] Specifically, the size of the two-dimensional tensor of the first feature input to the temporal fully connected layer is the same as the size of the data dimension measurement_dim, the size of the two-dimensional tensor of the first temporal fully connected result output by the temporal fully connected layer is also the same as the size of the data dimension measurement_dim, the activation function of the temporal attention layer is softmax, and the activation function of the activation layer is relu.
[0050] Furthermore, when performing attention calculation on the first feature and the second feature in the spatial dimension, the spatial fully connected layer is used to process the first feature to obtain a first spatial fully connected result, and then the first spatial fully connected result and the second feature are input into the spatial attention layer for spatial attention calculation and then output by the activation layer.
[0051] Specifically, the size of the two-dimensional tensor of the first feature of the input to the spatial fully connected layer is the same as the size of the sliding window sequence_length, the size of the two-dimensional tensor of the first spatial fully connected result output by the spatial fully connected layer is also the same as the size of the sliding window sequence_length, the activation function of the spatial attention layer is softmax, and the activation function of the activation layer is relu.
[0052] In some specific embodiments, the time attention calculation result and the spatial attention calculation result are weighted and integrated to obtain the attention weighted feature formula as follows:
[0053]
[0054] Among them, α and β are weight coefficients in the interval [0, 1] and satisfy α+β=1, elu() represents the relu activation function, and softmax() represents the softmax activation function. represent the first and second characteristics respectively, represents the time dimension attention weighted matrix, represents the spatial dimension attention weighted matrix, represents the attention weighted feature.
[0055] Specifically, the spatiotemporal attention module in this scheme can make full use of the spatiotemporal dynamic relationship between the flow velocity measurement data at different depths at different times, thereby making the prediction results more accurate.
[0056] In some specific embodiments, multiple self-attention layers are run in parallel in the first encoding module to construct multi-head self-attention, and the results of each self-attention layer are combined to obtain the first encoding feature.
[0057] Specifically, the number of self-attention layers is set manually or adjusted in real time during model training. In this scheme, the number of self-attention layers is 10, the dropout ratio is 0.1, and the number of encoding layers in the encoder is 3.
[0058] Specifically, each self-attention layer is responsible for performing parallel calculation of self-attention on any value in the attention-weighted feature, so it can simultaneously capture the information of the values in the attention-weighted feature in different mapping subspaces, thereby increasing the expressiveness of the feature.
[0059] In this scheme, the structural diagram of the bidirectional gated loop module is as follows Figure 4 As shown in the figure, BiGRU is a bidirectional gating unit that can process data from both the forward and reverse directions of the sequence at the same time. This scheme uses two BiGRU layers in series to better improve the fitting ability of flow rate data and improve the accuracy of flow rate prediction.
[0060] In some specific embodiments, the output of the first BiGRU layer in this scheme is residually connected with the first coding feature to obtain a first result, and the first coding feature is fused with the output of the first BiGRU layer by linear superposition through the residual connection, thereby avoiding the loss and loss of information transmission and improving the understanding speed of the second BiGRU layer. The second residual connection is the same, which also reduces the loss and loss of information transmission. Moreover, the predicted features obtained after the residual connection are also convenient for the full connection layer to quickly understand, thereby improving the prediction speed of the flow rate prediction model.
[0061] In addition, this scheme uses two residual connections to effectively solve the network degradation and gradient vanishing problems when the residual is small, making the modified network more sensitive to small perturbations of output changes.
[0062] In some specific embodiments, the output feature dimension of each BiGRU layer in the bidirectional gated recurrent module is 256, and the number of GRU layers is 5.
[0063] In some embodiments, the pre-trained fully connected layer is a conventional fully connected layer structure, which will not be introduced in detail in this solution.
[0064] In this scheme, the velocity prediction model is trained using multiple segments and multiple layers of historical velocity data sequences within any historical time, and then the velocity prediction results are compared with the actual measured flow velocity, so as to update the parameters of each module in the velocity prediction model to complete the training.
[0065] For example, the velocity prediction model trained in this solution predicts the velocity of different depth layers as follows: Figure 5 As shown by Figure 5 It can be seen that the deep neural network model proposed by this method can accurately predict the flow velocity data at multiple depths at the same time.
[0066] Embodiment 2
[0067] Based on the same idea, refer to Figure 6 The present application also proposes a construction device for a flow rate prediction model based on an improved gated circulation unit, comprising:
[0068] A sliding window module is used to obtain a multi-layer historical flow velocity data sequence represented by a sequence at a target location, and obtain a sequence to be predicted after performing a sliding window segmentation process on the multi-layer historical flow velocity data sequence;
[0069] The spatiotemporal attention module is trained to perform temporal attention calculation and spatial attention calculation on the predicted sequence respectively, and then weightedly integrate the temporal attention calculation results with the spatial attention calculation results to obtain the attention weighted features;
[0070] A first encoding module is trained to extract the attention-weighted features through a multi-head self-attention mechanism to obtain a first encoding feature;
[0071] The bidirectional gated recurrent module is trained to process the first coding feature through two series-connected BiGRU layers to obtain a prediction feature, and input the prediction feature into a pre-trained fully connected layer to obtain a flow rate prediction result, wherein the output of the first BiGRU layer is residually connected to the first coding feature to obtain a first result, the first result is input into the second BiGRU layer, and the output result of the second BiGRU layer is residually connected to the first result to obtain a prediction feature. The flow rate prediction model is composed of a spatiotemporal attention module, a first coding module, a bidirectional gated recurrent module and a fully connected layer.
[0072] Embodiment 3
[0073] This embodiment also provides an electronic device, referring to Figure 7 , comprises a memory 404 and a processor 402, wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to execute the steps in any of the above method embodiments.
[0074] Specifically, the processor 402 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0075] Among them, the memory 404 may include a large capacity memory 404 for data or instructions. For example, but not limitation, the memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In appropriate cases, the memory 404 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 404 may be inside or outside the data processing device. In a specific embodiment, the memory 404 is a non-volatile memory. In a specific embodiment, the memory 404 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable Programmable Read-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable Programmable Read-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. In appropriate circumstances, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM may be a fast page mode dynamic random access memory 404 (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0076] The memory 404 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 402 .
[0077] The processor 402 reads and executes the computer program instructions stored in the memory 404 to implement any one of the methods for constructing a flow rate prediction model based on an improved gated circulation unit in the above embodiments.
[0078] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408 , wherein the transmission device 406 is connected to the processor 402 , and the input / output device 408 is connected to the processor 402 .
[0079] The transmission device 406 can be used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired or wireless network provided by a communication provider of the electronic device. In one example, the transmission device 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 406 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0080] The input and output device 408 is used to input or output information. In this embodiment, the input information may be a multi-layer historical flow rate data sequence, attention weighted features, etc., and the output information may be a flow rate prediction result, etc.
[0081] Optionally, in this embodiment, the processor 402 may be configured to perform the following steps through a computer program:
[0082] Acquire a multi-layer historical flow velocity data sequence represented by a sequence at a target location, and perform sliding window segmentation processing on the multi-layer historical flow velocity data sequence to obtain a sequence to be predicted;
[0083] Constructing a spatiotemporal attention module, wherein the spatiotemporal attention module is trained to perform temporal attention calculation and spatial attention calculation on the sequence to be predicted, respectively, and then weightedly integrating the temporal attention calculation result and the spatial attention calculation result to obtain an attention weighted feature;
[0084] Constructing a first encoding module, wherein the first encoding module is trained to extract the attention-weighted features through a multi-head self-attention mechanism to obtain a first encoding feature;
[0085] Constructing a bidirectional gated recurrent module, the bidirectional gated recurrent module is trained to process the first coding feature through two serially connected BiGRU layers to obtain a prediction feature, and input the prediction feature into a pre-trained fully connected layer to obtain a flow rate prediction result, wherein the output of the first BiGRU layer is residually connected to the first coding feature to obtain a first result, the first result is input to the second BiGRU layer, and the output result of the second BiGRU layer is residually connected to the first result to obtain a prediction feature;
[0086] The flow rate prediction model consists of a spatiotemporal attention module, a first encoding module, a bidirectional gated recurrent module and a fully connected layer.
[0087] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0088] In general, various embodiments may be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that, as non-limiting examples, the boxes, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.
[0089] Embodiments of the present invention may be implemented by computer software that is executable by a data processor of a mobile device, such as in a processor entity, or by hardware, or by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets and / or macros may be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. A computer program product may include one or more computer executable components configured to perform an embodiment when the program is run. One or more computer executable components may be at least one software code or a portion thereof. In addition, at this point, it should be noted that, for example, Figure 7 Any block of the logic flow in the program may represent program steps, or interconnected logic circuits, blocks and functions, or a combination of program steps and logic circuits, blocks and functions. The software may be stored on physical media such as memory chips or storage blocks implemented within a processor, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and data variants thereof, CDs, etc. Physical media are non-transitory media.
[0090] Those skilled in the art should understand that the technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0091] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for constructing a flow rate prediction model based on an improved gated circulation unit, characterized in that: The following steps are involved: A multi-layer historical velocity data sequence represented by a sequence is obtained at a target location, wherein the multi-layer historical velocity data sequence records the velocity data of the 1st to Nth layers of the water area at the target location within a certain period of time, and the multi-layer historical velocity data sequence is subjected to sliding window segmentation processing to obtain a sequence to be predicted, wherein a sliding window size is set, and the multi-layer historical velocity data sequence is subjected to sliding window segmentation processing according to the sliding window size to obtain multiple groups of sequences to be predicted; Constructing a spatiotemporal attention module, wherein the spatiotemporal attention module is trained to perform temporal attention calculation and spatial attention calculation on the sequence to be predicted, respectively, and then weightedly integrating the temporal attention calculation result and the spatial attention calculation result to obtain an attention weighted feature; The spatiotemporal attention module includes a time dimension attention calculation branch and a space dimension attention calculation branch, wherein adjacent first features and second features are obtained in the sequence to be predicted, and attention calculation in the time dimension is performed on the first feature and the second feature in the time dimension attention calculation branch to obtain a time attention calculation result, and attention calculation in the space dimension is performed on the first feature and the second feature in the space dimension attention calculation branch to obtain a space attention calculation result, wherein the attention calculation in the time dimension refers to the calculation of flow velocity data at different time nodes of the same layer, and the attention calculation in the space dimension refers to the calculation of flow velocity data at different layers at the same time node; Constructing a first encoding module, wherein the first encoding module is trained to extract the attention-weighted features through a multi-head self-attention mechanism to obtain a first encoding feature; Constructing a bidirectional gated recurrent module, the bidirectional gated recurrent module is trained to process the first coding feature through two serially connected BiGRU layers to obtain a prediction feature, and input the prediction feature into a pre-trained fully connected layer to obtain a flow rate prediction result, wherein the output of the first BiGRU layer is residually connected to the first coding feature to obtain a first result, the first result is input to the second BiGRU layer, and the output result of the second BiGRU layer is residually connected to the first result to obtain a prediction feature; The flow rate prediction model consists of a spatiotemporal attention module, a first encoding module, a bidirectional gated recurrent module and a fully connected layer.
2. The method for constructing a flow rate prediction model based on an improved gated circulation unit according to claim 1, characterized in that: In the sliding window segmentation process, data with a time scale smaller than the sliding window size in the multi-layer historical flow rate data series are discarded.
3. The method for constructing a flow rate prediction model based on an improved gated circulation unit according to claim 1, characterized in that: When performing attention calculation on the first feature and the second feature in the time dimension, the first feature is processed using the time fully connected layer to obtain a first time fully connected result, and then the first time fully connected result and the second feature are input into the time attention layer for time attention calculation and then output by the activation layer.
4. The method for constructing a flow rate prediction model based on an improved gated circulation unit according to claim 1, characterized in that: When performing attention calculation on the first feature and the second feature in the spatial dimension, the spatial fully connected layer is used to process the first feature to obtain a first spatial fully connected result, and then the first spatial fully connected result and the second feature are input into the spatial attention layer for spatial attention calculation and then output by the activation layer.
5. The method for constructing a flow rate prediction model based on an improved gated circulation unit according to claim 1, characterized in that: In the first encoding module, multiple self-attention layers are run in parallel to construct multi-head self-attention, and the results of each self-attention layer are combined to obtain the first encoding feature.
6. A device for constructing a flow rate prediction model based on an improved gated circulation unit, characterized in that: include: A sliding window module is used to obtain a multi-layer historical flow velocity data sequence represented by a sequence at a target location, wherein the multi-layer historical flow velocity data sequence records the flow velocity data of the 1st to Nth layers of the water area at the target location within a certain period of time, and the multi-layer historical flow velocity data sequence is subjected to sliding window segmentation processing to obtain a sequence to be predicted, wherein a sliding window size is set, and the multi-layer historical flow velocity data sequence is subjected to sliding window segmentation according to the sliding window size to obtain multiple groups of sequences to be predicted; The spatiotemporal attention module is trained to perform temporal attention calculation and spatial attention calculation on the predicted sequence respectively, and then weightedly integrate the temporal attention calculation results with the spatial attention calculation results to obtain the attention weighted features; The spatiotemporal attention module includes a time dimension attention calculation branch and a space dimension attention calculation branch, wherein adjacent first features and second features are obtained in the sequence to be predicted, and attention calculation in the time dimension is performed on the first feature and the second feature in the time dimension attention calculation branch to obtain a time attention calculation result, and attention calculation in the space dimension is performed on the first feature and the second feature in the space dimension attention calculation branch to obtain a space attention calculation result, wherein the attention calculation in the time dimension refers to the calculation of flow velocity data at different time nodes of the same layer, and the attention calculation in the space dimension refers to the calculation of flow velocity data at different layers at the same time node; A first encoding module is trained to extract the attention-weighted features through a multi-head self-attention mechanism to obtain a first encoding feature; The bidirectional gated recurrent module is trained to process the first coding feature through two series-connected BiGRU layers to obtain a prediction feature, and input the prediction feature into a pre-trained fully connected layer to obtain a flow rate prediction result, wherein the output of the first BiGRU layer is residually connected to the first coding feature to obtain a first result, the first result is input into the second BiGRU layer, and the output result of the second BiGRU layer is residually connected to the first result to obtain a prediction feature. The flow rate prediction model is composed of a spatiotemporal attention module, a first coding module, a bidirectional gated recurrent module and a fully connected layer.
7. 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 execute the method for constructing a flow rate prediction model based on an improved gated circulation unit according to any one of claims 1 to 5.
8. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which includes a program code for controlling a process to execute a process, wherein the process includes a method for constructing a flow rate prediction model based on an improved gated circulation unit according to any one of claims 1-5.