An oil well production prediction method, device, storage medium and electronic equipment

By combining time-frequency Transformer and Bi-LSTM, the problems of training sample scarcity and production fluctuation in oil well production prediction are solved, achieving accurate prediction of target oil well production and improving the prediction accuracy and stability of the model.

CN120744874BActive Publication Date: 2025-11-07CNPC XIBU DRILLING ENG +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511249198.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-03
Publication Date
2025-11-07
Estimated Expiration
2045-09-03

AI Technical Summary

Technical Problem

Existing technologies cannot accurately predict the oil production of target oil wells, and face challenges such as the scarcity of training samples, significant fluctuations in production, and complexity of sample labeling, which affect the model's prediction performance and data processing efficiency.

Method used

By employing a joint time-frequency Transformer and Bi-LSTM approach, and by fusing time-domain and frequency-domain information, combined with forward and backward LSTM networks, we can capture long-term dependencies in time-series data and improve the modeling capability of the model.

Benefits of technology

It achieves accurate prediction of oil production from target oil wells, improves the model's generalization ability and prediction accuracy, and can better capture patterns and long-range dependencies in complex time series data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120744874B_ABST
    Figure CN120744874B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of artificial intelligence selection in oil exploitation, and provides a method and device for predicting the yield of an oil well, a storage medium and an electronic device, the method comprising: sequentially inputting training set data in a training set into a bidirectional long short-term memory network branch and a time-frequency transformer branch for processing, and outputting a first prediction value and a second prediction value; calculating a Q matrix based on the first prediction value, and calculating a K matrix and a V matrix based on the second prediction value; performing fusion processing on the Q matrix, the K matrix and the V matrix through a multi-head attention mechanism to obtain a fused result; after converting the fused result through a linear layer, obtaining an optimal parameter model through iterative training; and predicting the oil yield of a target oil well through the optimal parameter model to predict the oil yield of the target oil well. Through the prediction method, the oil yield of the target oil well can be accurately predicted.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of artificial intelligence selection in oil exploitation, and particularly relates to an oil well yield prediction method and device, a storage medium and an electronic device. BACKGROUND

[0002] The oil and gas resources in the Junggar Basin are extremely rich, with a total oil resource of 8.6 billion tons and a natural gas resource of 210 billion cubic meters. At present, the proven rate of oil is only 21.4%, and the proven rate of natural gas is less than 3.64%, showing a broad exploration prospect and great development potential. The source of the study area is mainly derived from the northwest, and the thickness gradually thins from northeast to southwest. The oil layer porosity of the region is 16.5%, and the oil layer permeability is 7.5 mD, showing strong heterogeneity and relatively poor physical properties, and the pore structure is also relatively complex.

[0003] In recent years, artificial intelligence has been widely applied in the oil and gas industry. Many researchers use artificial intelligence technology to predict production based on dynamic data of oilfield development. Rerrent Neural Network (RNN), Long Short-Term Memory Network (LSTM), and Transformer network structures can effectively process time series data, which is crucial for analyzing the periodic changes and production trends of oil. Chen et al. designed a model based on BP neural network to achieve efficient prediction of low-permeability oilfield dynamic development. Su et al. applied LSTM network to learn the production capacity trend for two years to accurately predict the production capacity for the next four months. Liang et al. proposed a BiLSTM-RF-MPA model to handle the complex nonlinear and non-stationary characteristics in shale gas production time series, which can effectively capture the internal correlation in the data and reduce the uncertainty of the model. Zha et al. designed a hybrid model combining Convolutional Neural Network (CNN) and LSTM, which has complementary advantages in feature extraction and sequence dependency learning, enabling the CNN-LSTM model to accurately describe the change trend in the production process. Wang et al. developed a production prediction method based on the Transformer architecture using simplified static formation data and dynamic data collected during daily production, considering possible human interference factors such as shut-in during production. These studies show that combining advanced deep learning techniques can significantly improve the accuracy and reliability of oilfield production prediction.

[0004] The key to building a production prediction model is to make full use of the historical production data of the oilfield to establish an accurate prediction mechanism. However, in practical application, a series of challenges are faced, such as the scarcity of training samples, the significance of production fluctuations, the complexity of sample labeling, etc. These factors not only affect the prediction effect of the model, but also make the data processing work time-consuming and laborious. Therefore, in view of these problems, the present application first designs an effective data processing strategy, and then proposes an oil well production prediction method combining time-frequency Transformer and Bi-LSTM. On the one hand, by fusing the information of time domain (self-attention path) and frequency domain (Fourier path), the model can capture global context information and extract and utilize periodic characteristics; on the other hand, by using forward LSTM and backward LSTM to capture the long-term dependence of time series data, the modeling ability for complex time series data is improved.

[0005] Therefore, how to provide a prediction method capable of accurately predicting the oil production of a target oil well is a technical problem to be solved. SUMMARY

[0006] Therefore, it is necessary to provide an oil well production prediction method, device, storage medium and electronic equipment to solve the problem that the prior art cannot accurately predict the oil production of a target oil well.

[0007] In a first aspect, an embodiment of the present application provides an oil well production prediction method, which comprises:

[0008] obtaining a training set and a test set;

[0009] sequentially inputting training set data in the training set into a bidirectional long short-term memory network branch and a time-frequency transformer branch for processing, outputting a first prediction value and a second prediction value, and the training set data comprising multivariate time series data of historical oil production of a target oil well;

[0010] calculating a Q matrix based on the first prediction value, and calculating a K matrix and a V matrix based on the second prediction value;

[0011] fusing the Q matrix, the K matrix and the V matrix through a multi-head attention mechanism to obtain a fused result;

[0012] after converting the fused result through a linear layer, obtaining an optimal parameter model through iterative training;

[0013] predicting the oil production of the target oil well through the optimal parameter model to predict the oil production of the target oil well.

[0014] Optionally, after obtaining the optimal parameter model, the method further comprises:

[0015] inputting test set data in the test set into the optimal parameter model, evaluating model performance of the optimal parameter model, and obtaining an evaluation result.

[0016] Optionally, the inputting training set data in the training set into the bidirectional long short-term memory network branch and the time-frequency transformer branch for processing includes:

[0017] inputting training set data in the training set into the bidirectional long short-term memory network branch, processing the training set data by a forward long short-term memory network and a backward long short-term memory network in the bidirectional long short-term memory network branch to capture long-term dependence of time series data, and obtaining an output state; and

[0018] inputting training set data in the training set into the time-frequency transformer branch, and processing the training set data by combining self-attention and Fourier transform to capture time domain features of sequence data and frequency domain features of sequence data.

[0019] Optionally, the inputting training set data in the training set into the bidirectional long short-term memory network branch, processing the training set data by a forward long short-term memory network and a backward long short-term memory network in the bidirectional long short-term memory network branch to capture long-term dependence of time series data, and obtaining an output state includes:

[0020] processing the training set data from front to back to obtain a forward hidden state;

[0021] processing the training set data from back to front to obtain a backward hidden state;

[0022] concatenating the forward hidden state and the backward hidden state to capture the long-term dependence of the time series data, and obtaining the output state.

[0023] Optionally, the processing the training set data from front to back to obtain a forward hidden state includes:

[0024] calculating an input gate based on an input, a weight matrix of the input gate, a first bias term, and a first activation function;

[0025] calculating a forget gate based on the input, a weight matrix of the forget gate, a second bias term, and the first activation function;

[0026] calculating a first memory cell based on a weight matrix of a candidate memory cell, the input, a third bias term, and a second activation function;

[0027] An output gate is calculated based on a weight matrix of the output gate, the input, the first activation function and a fourth bias term;

[0028] The forward hidden state is calculated based on the output gate, the first memory cell and a second activation function.

[0029] Optionally, the processing of the training set data from back to front to obtain a reverse hidden state comprises:

[0030] The reverse hidden state is calculated based on an output gate corresponding to the processing of the data from back to front, a memory cell corresponding to the processing of the data from back to front and a third activation function.

[0031] Optionally, the input of the training set data in the training set into the time-frequency transformer branch, the combination of the self-attention and the Fourier transform for processing to capture the time domain feature of the sequence data and the frequency domain feature of the sequence data comprises:

[0032] The training set data is obtained, and the training set data is preprocessed time series data;

[0033] The correlation weight of each time step in the input sequence is calculated through the self-attention mechanism for the preprocessed time series data, and a time sequence context representation is generated;

[0034] The frequency domain feature of the input is obtained through the fast Fourier transform for the preprocessed time series data;

[0035] The first k frequency components with the largest amplitudes are extracted from the frequency domain feature, so that the first k frequency components with the largest amplitudes represent the period of the input sequence;

[0036] The period feature is extracted and the time-frequency information of the input is enhanced through the continuous convolution operation using different convolution kernel sizes for each period result;

[0037] The amplitude mean of each period is used as a weight, and the weighted sum processing is performed on all period results to aggregate the period feature;

[0038] The time domain output and the frequency domain output are weighted and fused based on the weight parameter to obtain a comprehensive feature;

[0039] The fusion result and the input sequence are added through the residual connection to obtain an addition result, and the addition result is layer normalized to obtain a normalized output;

[0040] The normalized output is sequentially processed by a feedforward neural network, a residual connection process and a layer normalization process to capture the time domain features of the sequence data and the frequency domain features of the sequence data.

[0041] Optionally, the calculation of the Q matrix based on the first prediction value, the calculation of the K matrix based on the second prediction value, and the calculation of the V matrix based on the second prediction value include:

[0042] The Q matrix is calculated based on the first prediction value, a linear transformation weight matrix of the query and a fifth bias term.

[0043] The K matrix is calculated based on a linear transformation weight matrix of the key, the second prediction value and a sixth bias term.

[0044] The V matrix is calculated based on a linear transformation weight matrix of the value, the second prediction value and a seventh bias term.

[0045] Optionally, the fusion processing of the Q matrix, the K matrix and the V matrix by the multi-head attention mechanism includes:

[0046] The fusion processing of the Q matrix, the K matrix, the V matrix, the dimension of the key vector and the transpose operation on K by the multi-head attention mechanism obtains the fused result.

[0047] Optionally, before the obtaining of the training set and the test set, the method further includes:

[0048] Obtaining a target data set, the data in the target data set being oil production data of a target oil well in a preset time period;

[0049] Preprocessing each data in the target data set to obtain preprocessed data, so as to form a preprocessed data set based on the preprocessed data.

[0050] According to a preset ratio, the data in the preprocessed data set is divided to obtain a training set and a test set.

[0051] Optionally, the obtaining of the optimal parameter model by iterative training includes:

[0052] Defining an optimization target;

[0053] Using a smooth L1 loss as a loss function and Adam as an optimizer, the optimal parameter model is obtained by iterative training.

[0054] In a second aspect, an embodiment of the present application provides an oil well production prediction device, the device comprising:

[0055] The acquisition module is configured to acquire a training set and a test set.

[0056] The processing module is configured to sequentially input training set data in the training set into the bidirectional long short-term memory network branch and the time-frequency transformer branch for processing, output a first prediction value and a second prediction value, and the training set data includes multivariate time series data of historical oil production of a target oil well.

[0057] The calculation module is configured to calculate a Q matrix based on the first prediction value, and calculate a K matrix and a V matrix based on the second prediction value.

[0058] The fusion module is configured to perform fusion processing on the Q matrix, the K matrix and the V matrix through a multi-head attention mechanism to obtain a fused result.

[0059] The iterative training module is configured to obtain an optimal parameter model through iterative training after the fused result is converted through a linear layer.

[0060] The prediction module is configured to predict oil production of the target oil well through the optimal parameter model.

[0061] In a third aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. When the computer program is executed in a computer, the computer program causes the computer to execute the method in the first aspect.

[0062] In a fourth aspect, an electronic device is provided, and the electronic device includes a memory and a processor. The memory stores executable code, and the processor executes the executable code to implement the method in the first aspect.

[0063] In the embodiments of the present application, a training set and a test set are acquired; training set data in the training set is sequentially input into a bidirectional long short-term memory network branch and a time-frequency transformer branch for processing, a first prediction value and a second prediction value are output, and the training set data includes multivariate time series data of historical oil production of a target oil well; a Q matrix is calculated based on the first prediction value, and a K matrix and a V matrix are calculated based on the second prediction value; fusion processing is performed on the Q matrix, the K matrix and the V matrix through a multi-head attention mechanism to obtain a fused result; an optimal parameter model is obtained through iterative training after the fused result is converted through a linear layer; and oil production of the target oil well is predicted through the optimal parameter model. The prediction method provided in the embodiments of the present application can accurately predict oil production of the target oil well. BRIEF DESCRIPTION OF DRAWINGS

[0064] The exemplary embodiments of this application will be better understood with a reference to the accompanying drawings; however, the drawings clearly represent the typical exemplary embodiment of the application, and therefore are not to be considered limiting of its scope. In the drawings:

[0065] Figure 1 Flow chart of the prediction method of oil well production according to an exemplary embodiment of the application;

[0066] Figure 2 Network model diagram for a specific application scenario;

[0067] Figure 3 Fitting result diagram of the training set used by the prediction method according to an exemplary embodiment of the application;

[0068] Figure 4 Fitting result diagram of the test set used by the prediction method according to an exemplary embodiment of the application;

[0069] Figure 5 Flow chart of the prediction method of oil well production for a specific application scenario;

[0070] Figure 6 Structure schematic diagram of the prediction device of oil well production according to an exemplary embodiment of the application. DETAILED DESCRIPTION

[0071] The exemplary embodiments of this application will be better understood with a reference to the accompanying drawings; however, the drawings clearly represent the typical exemplary embodiment of the application, and therefore are not to be considered limiting of its scope. In the drawings:

[0072] It should be noted that the technical terms or scientific terms used in the present application should be understood as the common meanings understood by the skilled in the art, unless otherwise specified.

[0073] In addition, the terms "first" and "second" and the like are used to distinguish different objects, and are not intended to describe a particular order. Furthermore, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product, or apparatus that includes a list of steps or units is not limited to the listed steps or units, but can optionally include additional steps or units not listed or can optionally include other steps or units inherent to such processes, methods, products, or apparatus.

[0074] The embodiment of the present application provides a kind of oil well production prediction method and device, computer readable medium and electronic equipment, described below with reference to the drawings.

[0075] Please refer to Figure 1 It shows the flow chart of the oil well production prediction method provided by some embodiments of the present application, as shown in Figure 1 The oil well production prediction method can include the following steps:

[0076] Step S101: obtaining training set and test set.

[0077] In one example, before obtaining the training set and the test set, the oil well production prediction method provided by the embodiment of the present application can further include the following steps:

[0078] Obtain the target data set, and the data in the target data set is the oil production data of the target oil well in a preset time period;

[0079] Preprocess each data in the target data set to obtain preprocessed data, and form a preprocessed data set based on the preprocessed data;

[0080] According to a preset ratio, the data in the preprocessed data set is divided to obtain the training set and the test set.

[0081] In actual application scenarios, the oil production data of the target oil well in the past few years in the oil field is collected, and three basic parameters in the oil well development process, i.e., oil pressure, casing pressure, and back pressure, are selected to be used to construct the basic data set of the neural network.

[0082] The oil production data set in the above step includes oil pressure, casing pressure, back pressure and historical monthly average oil production, wherein the oil pressure is the tubing pressure, the unit is MPa; the casing pressure is the casing pressure (oil-casing annulus pressure), the unit is MPa; and the back pressure is the pressure in the ground oil pipeline, the unit is MPa.

[0083] In actual application scenarios, the data in the data set is preprocessed, and piecewise cubic Hermite interpolation polynomial is used for interpolation and filling to solve the zero value problem in the data. In addition, in order to reduce the noise in the original production data, a three-point moving average filter is introduced to smooth the data and improve its quality. Furthermore, the method of z-score standardization is adopted to convert the data into a distribution with a mean of 0 and a standard deviation of 1, thereby effectively reducing the non-stationarity of the input data.

[0084] In an actual application scenario, the data set is divided, and a sliding window technique is used to reorganize the data. Specifically, the data of the previous m days (m is the length of the sliding window) is selected from the historical production data to predict the production value of the next time step, and the actual production value of the time step is used as a label for training. At the same time, the production sequence data is divided into a training set and a test set in a ratio of 8:2.

[0085] It should be noted that a suitable sliding window length m is selected, for example, if m = 7, it means that the data of the previous 7 days is used to predict the production value of the 8th day.

[0086] In the prediction method provided by the embodiments of the present application, the prediction ratio is not specifically limited, and can be adjusted according to the needs of different application scenarios, which will not be described here.

[0087] Step S102: sequentially input the training set data in the training set into the bidirectional long short-term memory network branch and the time-frequency transformer branch for processing, output first prediction value and second prediction value, the training set data includes the multivariate time series data of the historical oil production of the target oil well.

[0088] As shown in Figure 2 , it is a network model diagram in a specific application scenario. As shown in Figure 2 , first, the data is preprocessed and divided to obtain a training set and a test set, and the training set is input into a time-frequency Transformer module and a Bi-LSTM, respectively. The time-frequency Transformer combines self-attention and Fourier transform to simultaneously capture the time domain and frequency domain features of the sequence data, enhancing the modeling capability of the time series data. Then, the outputs of the two branches are fused using a multi-head attention mechanism to achieve adaptive allocation of attention weights. After training, the optimal parameter model is obtained, and the test set is used for oil production prediction.

[0089]

[0090] Table 1 shows the oil production prediction results of the prediction method provided by the embodiments of the present application

[0091] As can be seen from Table 1, the prediction method provided by the embodiments of the present application performs well in the three error indicators of MAE, RMSE and MAPE. Compared with the SVM, LSTM and Transformer models, the prediction result is closer to the true value, and the generalization ability of the model is significantly enhanced. The value reaches 0.95, which is much higher than other methods, indicating that the model has stronger explanation ability and higher prediction accuracy. As can be seen, the effective application of time-frequency Transformer and Bi-LSTM enables the model to accurately capture complex patterns and long-range dependencies in time series, improving the accuracy of prediction.

[0092] In an example, the training set data in the training set is sequentially input into the bidirectional long short-term memory network branch and the time-frequency transformer branch for processing, including the following steps:

[0093] The training set data in the training set is input into the bidirectional long short-term memory network branch, and is processed by the forward long short-term memory network and the reverse long short-term memory network in the bidirectional long short-term memory network branch to capture the long-term dependence relationship of the time series data, to obtain an output state; and

[0094] The training set data in the training set is input into the time-frequency transformer branch, and is processed by combining the self-attention and the Fourier transform to capture the time domain features of the sequence data and the frequency domain features of the sequence data.

[0095] In an example, the training set data in the training set is input into the bidirectional long short-term memory network branch, and is processed by the forward long short-term memory network and the reverse long short-term memory network in the bidirectional long short-term memory network branch to capture the long-term dependence relationship of the time series data, to obtain an output state, including the following steps:

[0096] The training set data is processed from front to back to obtain a forward hidden state;

[0097] The training set data is processed from back to front to obtain a reverse hidden state;

[0098] The forward hidden state and the reverse hidden state are spliced to capture the long-term dependence relationship of the time series data, to obtain an output state.

[0099] In an example, the training set data is processed from front to back to obtain a forward hidden state, including the following steps:

[0100] The input, the weight matrix of the input gate, the first bias term and the first activation function are calculated to obtain an input gate;

[0101] The weight matrix of the forgetting gate, the input, the second bias term and the first activation function are calculated to obtain a forgetting gate;

[0102] The weight matrix of the candidate memory unit, the input, the third bias term and the second activation function are calculated to obtain a first memory unit;

[0103] The weight matrix of the output gate, the input, the first activation function and the fourth bias term are calculated to obtain an output gate;

[0104] The output gate, the first memory unit and the second activation function are calculated to obtain a forward hidden state.

[0105] In the above steps, the first activation function is a sigmoid activation function, and the second activation function is a hyperbolic tangent activation function.

[0106] It should be noted that the data is processed from front to back to obtain the forward hidden state The specific process is as follows:

[0107] Assuming the input is First, calculate the input gate :

[0108] Equation (1);

[0109] Wherein, The input gate weight matrix is represented by The first bias term is represented by The first activation function is represented by, the first activation function is a sigmoid activation function, The previous hidden state is represented by

[0110] Next, calculate the forget gate :

[0111] Equation (2);

[0112] Wherein, The forget gate weight matrix is represented by The second bias term is represented by The sigmoid activation function is represented by

[0113] Next, calculate the first memory cell

[0114] Equation (3);

[0115] Equation (4);

[0116] Wherein, The forget gate is represented by The weight matrix of the candidate memory cell is represented by The third bias term is represented by The hyperbolic tangent activation function is represented by The element-wise multiplication is represented by

[0117] Next, calculate the output gate

[0118] Equation (5);

[0119] Wherein, The output gate weight matrix is represented by represents a fourth bias term; represents a sigmoid activation function.

[0120] Finally, the hidden state is calculated to obtain the forward hidden state.

[0121] Equation (6);

[0122] wherein, is an output gate, represents an element-wise multiplication, is a hidden state, is a second activation function, and the second activation function is a hyperbolic tangent activation function.

[0123] In an example, the training set data is processed from back to front to obtain the reverse hidden state, including the following steps:

[0124] Based on the output gate corresponding to the data processed from back to front, the memory cell corresponding to the data processed from back to front, and the third activation function, the reverse hidden state is calculated.

[0125] In a specific application scenario, the training set data is processed from back to front to obtain the reverse hidden state , which is specifically described as follows:

[0126] Equation (7);

[0127] The same as the calculation steps of processing data forwardly, represents the output gate in the data processed from back to front; represents a memory cell, and tanh is a second activation function, which is a hyperbolic tangent activation function, represents an element-wise multiplication.

[0128] In an actual application scenario, after obtaining the above forward hidden state and reverse hidden state, the forward hidden state and the reverse hidden state are merged to obtain an output state

[0129] Equation (8);

[0130] wherein, is an output state, is a forward hidden state, is a reverse hidden state, represents that the forward hidden state and the reverse hidden state are spliced along the last dimension.

[0131] In an example, the training set data in the training set is input into a time-frequency transformer branch, and the time domain features of the sequence data and the frequency domain features of the sequence data are captured by combining and processing self-attention and Fourier transform, including the following steps:

[0132] The training set data is obtained, and the training set data is preprocessed time series data;

[0133] For the preprocessed time series data, the correlation weight of each time step in the input sequence is calculated by the self-attention mechanism, and the time sequence context representation is generated;

[0134] For the preprocessed time series data, the frequency domain features of the input are obtained by fast Fourier transform;

[0135] The first k largest amplitude frequency components are extracted from the frequency domain features to represent the first k largest amplitude frequency components of the input sequence;

[0136] For each period result, the period feature is extracted by using a continuous convolution operation with different convolution kernel sizes, and the input time-frequency information is enhanced;

[0137] The amplitude mean of each period is used as a weight to perform weighted summation processing on all period results to aggregate the period features;

[0138] Based on the weight parameter, the time domain output and the frequency domain output are weighted and fused to obtain the comprehensive features;

[0139] The fusion result and the input sequence are added by residual connection to obtain an addition result, and the addition result is layer normalized to obtain the normalized output;

[0140] The normalized output is sequentially processed by a feedforward neural network, residual connection and layer normalization to capture the time domain features of the sequence data and the frequency domain features of the sequence data.

[0141] In a specific application scenario, the training set data in the training set is input into a time-frequency transformer branch, and the time domain features of the sequence data and the frequency domain features of the sequence data are captured by combining and processing self-attention and Fourier transform, as follows:

[0142] Step a1: For the preprocessed time series data, the correlation weight of each time step in the input sequence is calculated by the self-attention mechanism, and the time sequence context representation is generated, and the calculation formula is:

[0143] Equation (9);

[0144] wherein, Query, Key and Value, respectively, denotes the dimension of the Key vector, used for scaling, denotes the transpose operation on .

[0145] Step a2: Similarly, for the preprocessed time series data, the frequency domain features of the input are calculated by fast Fourier transform, and the calculation formula is

[0146] Equation (10);

[0147] wherein, denotes the number of features.

[0148] Step a3: Extract the first k frequency components with the largest amplitude from the frequency domain features to represent the main period of the input sequence, and the calculation formula is:

[0149] Equation (11);

[0150] wherein, denotes the time step, denotes the amplitude sequence of the frequency, denotes the period.

[0151] Step a4: Use a continuous convolution operation with different kernel sizes on each period result to extract period features and enhance the time-frequency information of the input.

[0152] Step a5: Weighted sum all period results with the amplitude mean of each period as the weight to realize the aggregation of period features.

[0153] Step a6: Weighted fusion of time domain output and frequency domain output according to weight parameter to form comprehensive features, and the calculation formula is

[0154] Equation (12);

[0155] wherein, denotes the fusion result, denotes the frequency domain output, denotes the time domain output, denotes the frequency domain weighting coefficient.

[0156] Step a7: The fusion result and the input sequence are added through a residual connection, and then layer normalization is performed.

[0157] Step a8: The normalized output is passed through a feedforward neural network, and again through a residual connection and layer normalization to ensure the stability and performance of the network.

[0158] As shown in Figure 3 , it is a fitting result diagram of the training set used by the prediction method provided by the embodiment of the application. In the diagram, the solid line represents the predicted value, and the dashed line represents the actual value. As can be seen from Figure 3 , the model can well track the average daily oil production change trend in the entire time period, especially in the initial and middle stages, and can well capture the peak, valley and trend change in the data, proving its effective application in long-term oil production prediction.

[0159] Step S103: calculating the Q matrix based on the first predicted value, and calculating the K matrix and the V matrix based on the second predicted value.

[0160] In an example, calculating the Q matrix based on the first predicted value, and calculating the K matrix and the V matrix based on the second predicted value, includes the following steps:

[0161] calculating based on the first predicted value, the linear transformation weight matrix of the query, and the fifth bias term to obtain the Q matrix;

[0162] calculating based on the linear transformation weight matrix of the key, the second predicted value, and the sixth bias term to obtain the K matrix;

[0163] calculating based on the linear transformation weight matrix of the value, the second predicted value, and the seventh bias term to obtain the V matrix.

[0164] In a specific application scenario, calculating the Q matrix based on the first predicted value, and calculating the K matrix and the V matrix based on the second predicted value, specifically includes the following steps:

[0165] Step b1: using the first predicted value output by the Bi-LSTM branch to calculate the Q matrix:

[0166] Equation (13);

[0167] wherein, represents the linear transformation weight matrix of the query; represents the fifth bias term.

[0168] Step b2: using the second predicted value output by the time-frequency Transformer branch to calculate the K matrix and the V matrix:

[0169] Equation (14);

[0170] Equation (15);

[0171] wherein, a linear transformation weight matrix representing the key; a linear transformation weight matrix representing the value; a sixth bias term and a seventh bias term.

[0172] Step b3: calculate the attention score and normalize, and perform weighted summation: Equation (16);

[0173] Step S104: fuse the Q matrix, the K matrix and the V matrix through the multi-head attention mechanism to obtain a fused result.

[0174] In an example, the Q matrix, the K matrix and the V matrix are fused through the multi-head attention mechanism to obtain a fused result, including the following steps:

[0175] The Q matrix, the K matrix, the V matrix, the dimension of the key vector and the transposition operation on the K are fused through the multi-head attention mechanism to obtain a fused result.

[0176] Step S105: after the fused result is converted through the linear layer, an optimal parameter model is obtained through iterative training.

[0177] In an example, the optimal parameter model is obtained through iterative training, including the following steps:

[0178] Define an optimization objective;

[0179] Use the smooth L1 loss as the loss function, and the Adam as the optimizer, and obtain the optimal parameter model through iterative training.

[0180] Specifically, the optimal parameter model is obtained through iterative training, including the following steps:

[0181] Define an optimization objective;

[0182] Use the smooth L1 loss as the loss function, and the Adam as the optimizer, and obtain the optimal parameter model through iterative training, and use the early stopping method as a regularization strategy to prevent overfitting. Specifically, when the loss function converges and the validation set accuracy no longer rises and lasts for a certain number of rounds, the training is stopped, and the optimal parameter model is obtained. The optimal parameters refer to the set of network weights and biases that perform the strongest generalization ability on the independent validation set at this time. These parameters can make the network prediction MAE (Mean Absolute Error, Mean Absolute Error) and RMSE (Root Mean Squared Error, Root Mean Squared Error) optimal.

[0183] In a specific application scenario, the calculation formula of the smooth L1 loss function is

[0184] Equation (17) is obtained.

[0185] wherein, represents the error between the predicted value and the true value.

[0186] Step S106: predicting the oil production of the target oil well by the optimal parameter model.

[0187] In an example, after obtaining the optimal parameter model, the method for predicting the oil production of the oil well provided by the embodiment of the present application can further include the following steps:

[0188] The test set data in the test set is input into the optimal parameter model, the model performance of the optimal parameter model is evaluated, and an evaluation result is obtained.

[0189] As shown in FIG. 6, it is a fitting result diagram of the test set used by the prediction method provided by the embodiment of the present application. As can be seen from FIG. 6, in the first few months (0-5 months), there is a certain deviation between the predicted value and the actual value. However, as the month increases, the predicted value gradually approaches the actual value, and basically remains consistent after 10 months. Overall, the model can well capture the average daily oil production change trend of the certain well in Karamay Oilfield, showing good stability and prediction ability. Figure 4 Figure 4 In actual application scenarios, the scheme recommended by the machine is submitted to experts for review to verify the accuracy of the model, and the model is continuously adjusted and optimized according to the actual application effect.

[0190] As shown in FIG. 7, it is a flowchart of the method for predicting the oil production of the oil well in a specific application scenario. As shown in FIG. 8, the method for predicting the oil production of the oil well can include the following steps:

[0191] As shown in FIG. 7, it is a flowchart of the method for predicting the oil production of the oil well in a specific application scenario. As shown in FIG. 8, the method for predicting the oil production of the oil well can include the following steps: Figure 5 Figure 5 Step S501: collecting historical oil production data of a target oil well.

[0192] Step S502: pre-processing the data and dividing the data set.

[0193] Step S502: pre-processing the data and dividing the data set.

[0194] In actual application scenarios, the method for pre-processing the data specifically includes: using a piecewise cubic Hermite interpolation polynomial for interpolation and padding to solve the zero value problem in the data, introducing a three-point moving average filter to reduce the noise in the original production data, and using z-score standardization to enhance the stationarity of the data.

[0195] ​​Step S503: inputting the training set data in the training set into the joint time-frequency Transformer branch and the Bi-LSTM network branch for processing.

[0196] In this step S503, the training set is input into the network, wherein the adaptive fusion network of the joint time-frequency Transformer and the BI-LSTM is designed, the time-frequency Transformer captures the time domain and frequency domain features of the sequence data by combining the self-attention and the Fourier transform, enhances the modeling ability of the time series data, and the Bi-LSTM captures the long-term dependence of the time series data through the forward LSTM and the backward LSTM.

[0197] Step S504: the output features of the two branches are fused through the multi-head attention mechanism to obtain the fused result.

[0198] Step S505: after the fused result is converted through the linear layer, the optimal parameter model is obtained through iterative training.

[0199] Step S506: the performance of the optimal parameter model is evaluated using the test set data in the test set. The accuracy performance and the fitting curve in the experiment show that the model can better capture the average daily oil production change trend of the target well in the target oilfield, and has good stability and prediction ability, and is better than other comparison methods.

[0200] The prediction method provided by the embodiment of the present application can accurately predict the oil production of the target oil well. The prediction method provided by the embodiment of the present application can perform long-term dynamic prediction on the production of the target oil well in the target oilfield, can provide decision basis for the reservoir engineer, and assist in realizing oilfield production optimization and improving quality and efficiency. Furthermore, the prediction method provided by the embodiment of the present application not only fuses the information of the time domain (self-attention path) and the frequency domain (Fourier path), but also captures the global context information and extracts and utilizes the periodic characteristics; and can capture the long-term dependence of the time series data through the forward LSTM and the backward LSTM, and improve the modeling ability of the complex time series data.

[0201] In the above embodiment, a prediction method of oil well production is provided, and a prediction device of oil well production is also provided. The prediction device of oil well production provided by the embodiment of the present application can implement the prediction method of oil well production. The prediction device of oil well production can be realized by software, hardware or a combination of software and hardware. For example, the prediction device of oil well production can include integrated or separated functional modules or units to perform corresponding steps in the above methods.

[0202] Please refer to Figure 6FIG. 1 shows a schematic diagram of an oil well production prediction device according to some embodiments of the present application. Since the device embodiments are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device embodiments described below are only illustrative.

[0203] As shown in FIG. 1, the oil well production prediction device can include: Figure 6

[0204] An acquisition module 601 is configured to acquire a training set and a test set.

[0205] A processing module 602 is configured to sequentially input training set data in the training set into the bidirectional long short-term memory network branch and the time-frequency transformer branch for processing, output a first prediction value and a second prediction value, and the training set data includes multivariate time series data of historical oil production of a target oil well.

[0206] A calculation module 603 is configured to calculate a Q matrix based on the first prediction value, and calculate a K matrix and a V matrix based on the second prediction value.

[0207] A fusion module 604 is configured to perform fusion processing on the Q matrix, the K matrix and the V matrix through a multi-head attention mechanism to obtain a fused result.

[0208] An iterative training module 605 is configured to, after converting the fused result through a linear layer, obtain an optimal parameter model through iterative training.

[0209] A prediction module 606 is configured to predict the oil production of the target oil well through the optimal parameter model to predict the oil production of the target oil well.

[0210] In some embodiments of the present application, the oil well production prediction device can include:

[0211] An evaluation module (not shown in FIG. 1) is configured to, after obtaining the optimal parameter model, input test set data in the test set into the optimal parameter model, evaluate the model performance of the optimal parameter model, and obtain an evaluation result. Figure 6 In some embodiments of the present application, the processing module 602 is specifically configured to:

[0212] input the training set data in the training set into the bidirectional long short-term memory network branch, process the training set data through a forward long short-term memory network and a reverse long short-term memory network in the bidirectional long short-term memory network branch to capture long-term dependence of the time series data, and obtain an output state; and

[0213]

[0214] ​​The training set data in the training set is input into the time-frequency transformer branch, and the time domain features of the sequence data and the frequency domain features of the sequence data are captured by combining and processing self-attention and Fourier transform.

[0215] In some embodiments of the embodiments of the application, the processing module 602 is specifically configured to:

[0216] The training set data is processed from front to back to obtain a forward hidden state;

[0217] The training set data is processed from back to front to obtain a reverse hidden state;

[0218] The forward hidden state and the reverse hidden state are spliced to capture the long-term dependence of the time series data, and an output state is obtained.

[0219] In some embodiments of the embodiments of the application, the processing module 602 is specifically configured to:

[0220] The input, the weight matrix of the input gate, the first bias term and the first activation function are calculated to obtain the input gate;

[0221] The weight matrix of the forgetting gate, the input, the second bias term and the first activation function are calculated to obtain the forgetting gate;

[0222] The weight matrix of the candidate memory unit, the input, the third bias term and the second activation function are calculated to obtain the first memory unit;

[0223] The weight matrix of the output gate, the input, the first activation function and the fourth bias term are calculated to obtain the output gate;

[0224] The output gate, the first memory unit and the second activation function are calculated to obtain the forward hidden state.

[0225] In some embodiments of the embodiments of the application, the processing module 602 is specifically configured to:

[0226] The output gate corresponding to the data processed from back to front, the memory unit corresponding to the data processed from back to front and the third activation function are calculated to obtain the reverse hidden state.

[0227] In some embodiments of the embodiments of the application, the processing module 602 is specifically configured to:

[0228] Obtain the training set data, and the training set data is preprocessed time series data;

[0229] For the preprocessed time series data, the correlation weight of each time step in the input sequence is calculated by the self-attention mechanism to generate a time sequence context representation;

[0230] For the preprocessed time series data, the input frequency domain features are obtained by fast Fourier transform calculation;

[0231] The first k largest amplitude frequency components are extracted from the frequency domain features to represent the input sequence cycle with the first k largest amplitude frequency components;

[0232] For each cycle result, the cycle feature is extracted by using a continuous convolution operation with different kernel sizes, and the input time-frequency information is enhanced;

[0233] The amplitude mean of each cycle is used as a weight to perform weighted summation processing on all cycle results to aggregate the cycle features;

[0234] Based on the weight parameter, the time domain output and the frequency domain output are weighted and fused to obtain the comprehensive features;

[0235] The fusion result and the input sequence are added through residual connection to obtain an addition result, and the addition result is subjected to layer normalization processing to obtain a normalized output;

[0236] The normalized output is sequentially processed through a feedforward neural network, residual connection and layer normalization to capture the time domain features of the sequence data and the frequency domain features of the sequence data.

[0237] In some embodiments of the present application, the calculation module 603 is specifically configured to:

[0238] Based on the first prediction value, the linear transformation weight matrix of the query and the fifth bias term, the Q matrix is calculated;

[0239] Based on the linear transformation weight matrix of the key, the second prediction value and the sixth bias term, the K matrix is calculated;

[0240] Based on the linear transformation weight matrix of the value, the second prediction value and the seventh bias term, the V matrix is calculated.

[0241] In some embodiments of the present application, the fusion module 604 is specifically configured to:

[0242] Through the multi-head attention mechanism, the Q matrix, the K matrix, the V matrix, the dimension of the key vector and the transpose operation on K are fused to obtain the fused result.

[0243] In some embodiments of the present application,

[0244] The acquisition module 601 can also be configured to acquire a target data set before acquiring the training set and the test set, the data in the target data set being oil production data of the target oil well in a preset time period;

[0245] The oil well production prediction device can further include:

[0246] A preprocessing module (not shown in the figures) is configured to preprocess each data in the target data set to obtain preprocessed data, and to construct a preprocessed data set based on the preprocessed data. Figure 6

[0247] A division module (not shown in the figures) is configured to divide the data in the preprocessed data set according to a preset ratio to obtain the training set and the test set. Figure 6 In some embodiments of the present application, the iterative training module 605 is specifically configured to:

[0248] define an optimization target;

[0249] use a smooth L1 loss as a loss function, use Adam as an optimizer, and obtain an optimal parameter model through iterative training.

[0250] In some embodiments of the present application, the oil well production prediction device provided by the present application has the same beneficial effects as the oil well production prediction method provided by the aforementioned embodiments of the present application.

[0251] According to another aspect of the embodiments, a computer readable storage medium having stored thereon a computer program is also provided, which, when executed in a computer, causes the computer to perform the method described in conjunction with

[0252] the figures. Figure 1

[0253] According to still another aspect of the embodiments, an electronic device is also provided, which includes a memory and a processor, the memory having stored thereon executable code, and the processor executing the executable code to implement the method described in conjunction with Figure 1 the figures.

[0254] Those skilled in the art should be aware that the functions described in the above one or more examples can be realized by hardware, software, firmware or any combination thereof. When realized by software, these functions can be stored in a computer readable medium or transmitted as one or more instructions or codes on a computer readable medium.

[0255] ​​The above detailed description of the specific embodiments of the present application has been given to illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application shall be included in the protection scope of the present application.

Claims

1. A method of predicting the production of an oil well, characterized in that, The method comprises: obtaining a training set and a test set; sequentially inputting training set data in the training set into a bidirectional long short-term memory network branch and a time-frequency transformer branch for processing, outputting a first prediction value and a second prediction value, and the training set data comprising multivariate time series data of historical oil production of a target oil well; calculating a Q matrix based on the first prediction value, and calculating a K matrix and a V matrix based on the second prediction value; fusing the Q matrix, the K matrix and the V matrix through a multi-head attention mechanism to obtain a fused result; after converting the fused result through a linear layer, obtaining an optimal parameter model through iterative training; predicting the oil production of the target oil well through the optimal parameter model to predict the oil production of the target oil well.

2. The prediction method of claim 1, wherein, After the optimal parameter model is obtained, the method further comprises: inputting test set data in the test set into the optimal parameter model to evaluate the model performance of the optimal parameter model and obtain an evaluation result.

3. The prediction method of claim 1, wherein, The sequentially inputting training set data in the training set into a bidirectional long short-term memory network branch and a time-frequency transformer branch for processing comprises: inputting the training set data in the training set into the bidirectional long short-term memory network branch, processing through a forward long short-term memory network and a reverse long short-term memory network in the bidirectional long short-term memory network branch to capture the long-term dependence relationship of time series data, and obtaining an output state; and inputting the training set data in the training set into the time-frequency transformer branch, combining self-attention and Fourier transform for processing to capture the time domain characteristics of sequence data and the frequency domain characteristics of sequence data.

4. The prediction method of claim 3, wherein, The inputting the training set data in the training set into the bidirectional long short-term memory network branch, processing through a forward long short-term memory network and a reverse long short-term memory network in the bidirectional long short-term memory network branch to capture the long-term dependence relationship of time series data, and obtaining an output state, comprises: processing the training set data from front to back to obtain a forward hidden state; processing the training set data from back to front to obtain a reverse hidden state; splicing the forward hidden state and the reverse hidden state to capture the long-term dependence relationship of the time series data to obtain the output state.

5. The prediction method of claim 4, wherein, The processing the training set data from front to back to obtain a forward hidden state comprises: calculating based on an input, a weight matrix of an input gate, a first bias term and a first activation function to obtain an input gate; calculating based on a weight matrix of a forgetting gate, the input, a second bias term and the first activation function to obtain a forgetting gate; calculating based on a weight matrix of a candidate memory unit, the input, a third bias term and a second activation function to obtain a first memory unit; calculating based on a weight matrix of an output gate, the input, the first activation function and a fourth bias term to obtain an output gate; and The forward hidden state is calculated based on the output gate, the first memory cell, and a second activation function.

6. The prediction method of claim 4, wherein, The processing of the training set data from back to front to obtain a reverse hidden state comprises: The reverse hidden state is calculated based on an output gate corresponding to the processing of the data from back to front, a memory cell corresponding to the processing of the data from back to front, and a third activation function.

7. The prediction method of claim 3, wherein, The training set data in the training set is input into the time-frequency transformer branch, and the time domain features of the sequence data and the frequency domain features of the sequence data are captured by combining and processing the self-attention and the Fourier transform, comprising: The training set data is obtained, and the training set data is preprocessed time series data; For the preprocessed time series data, the correlation weight of each time step in the input sequence is calculated by the self-attention mechanism to generate a time sequence context representation; For the preprocessed time series data, the frequency domain features of the input are calculated by the fast Fourier transform; The first k largest amplitude frequency components are extracted from the frequency domain features to represent the input sequence with the first k largest amplitude frequency components; For each period result, the period feature is extracted by using a continuous convolution operation with different convolution kernel sizes, and the time-frequency information of the input is enhanced; The amplitude mean of each period is used as a weight to perform weighted summation processing on all period results to aggregate the period features; The time domain output and the frequency domain output are weighted and fused based on the weight parameter to obtain comprehensive features; The fusion result and the input sequence are added by a residual connection to obtain an addition result, and the addition result is layer normalized to obtain a normalized output; The normalized output is sequentially processed by a feedforward neural network, a residual connection, and layer normalization to capture the time domain features of the sequence data and the frequency domain features of the sequence data.

8. The prediction method of claim 1, wherein, The Q matrix is calculated based on the first prediction value, and the K matrix and the V matrix are calculated based on the second prediction value, comprising: The Q matrix is calculated based on the first prediction value, the linear transformation weight matrix of the query, and the fifth bias term; The K matrix is calculated based on the linear transformation weight matrix of the key, the second prediction value, and the sixth bias term; The V matrix is calculated based on the linear transformation weight matrix of the value, the second prediction value, and the seventh bias term.

9. The prediction method of claim 1, wherein, The Q matrix, the K matrix, and the V matrix are fused by the multi-head attention mechanism to obtain a fused result, comprising: The Q matrix, the K matrix, the V matrix, the dimension of the key vector, and the transpose operation on K are fused by the multi-head attention mechanism to obtain the fused result.

10. The prediction method of claim 1, wherein, Before the training set and the test set are obtained, the method further comprises: A target data set is obtained, and the data in the target data set is the oil production data of a target oil well in a preset time period; Preprocess each data in the target data set to obtain preprocessed data, so as to form a preprocessed data set based on the preprocessed data; According to a preset proportion, the data in the preprocessed data set is divided to obtain a training set and a test set.

11. The prediction method of claim 1, wherein, The optimal parameter model is obtained by iterative training, including: Defining an optimization target; Using smooth L1 loss as a loss function and Adam as an optimizer, the optimal parameter model is obtained by iterative training.

12. An apparatus for predicting the production of an oil well, characterized by The device includes: An acquisition module for acquiring a training set and a test set; A processing module for sequentially inputting training set data in the training set into a bidirectional long short-term memory network branch and a time-frequency transformer branch for processing, outputting a first prediction value and a second prediction value, and the training set data including multivariate time series data of historical oil production of a target oil well; A calculation module for calculating a Q matrix based on the first prediction value and a K matrix and a V matrix based on the second prediction value; A fusion module for performing fusion processing on the Q matrix, the K matrix, and the V matrix through a multi-head attention mechanism to obtain a fused result; An iterative training module for obtaining an optimal parameter model by iterative training after converting the fused result through a linear layer; A prediction module for predicting the oil production of a target oil well through the optimal parameter model.

13. A computer-readable storage medium, characterized in that, A computer program is stored thereon, which, when executed in a computer, causes the computer to execute the method of any one of claims 1 to 11.

14. An electronic device, comprising: A memory and a processor are included, and executable code is stored in the memory, and the processor executes the executable code to implement the method of any one of claims 1 to 11.

Citation Information

Patent Citations

  • Industrial internet prediction method and system based on frequency domain and long and short term feature fusion

    CN115907154A

  • Radar echo space-time sequence depth prediction method based on Fourier neural operator

    CN119047511A