Classification and prediction method of liquid loading in gas wells based on frequency channel conversion and self-supervision

Through frequency channel conversion and self-supervised learning, the problem of limited label data in the classification and prediction of gas well liquid accumulation is solved, the generalization ability and adaptability of the model are improved, and efficient classification and prediction of gas well liquid accumulation are achieved.

CN118378135BActive Publication Date: 2024-09-24SOUTHWEST PETROLEUM UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410823205.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-24
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

The existing technology has problems in the classification and prediction of gas well liquid accumulation, such as limited label data, insufficient model generalization capabilities, and insufficient understanding of complex liquid accumulation patterns. In particular, the utilization ability and adaptability of unlabeled data are insufficient.

Method used

A method based on frequency channel conversion and self-supervision is adopted to obtain gas well day-level production data, construct labeled and unlabeled data sets, and use frequency channel conversion and mask processing to generate multiple mask time series, combining time-frequency consistency and Neighbor weighted aggregation is used to construct a pre-trained model and fine-tuned in downstream tasks to improve the model's generalization ability and adaptability.

Benefits of technology

It effectively reduces the dependence on expensive annotated data, improves the adaptability and generalization ability of the model on different well data, significantly improves the accuracy and efficiency of gas well liquid classification and prediction, and adapts to the dynamic changes of different gas wells.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118378135B
    Figure CN118378135B
Patent Text Reader

Abstract

The present invention provides a gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision, belonging to the technical field of gas well liquid accumulation classification and prediction. The method includes analyzing feature selection and preprocessing the acquired gas well daily production data, and constructing a labeled data set and an unlabeled data set respectively; performing frequency channel conversion and mask processing on the analysis feature data, and using time-frequency consistency and neighbor weighted aggregation to restore the mask time point, constructing a pre-trained model, and training the pre-trained model using an unlabeled data set; constructing a fine-tuning model in the downstream liquid accumulation task, and adjusting the parameters of the fine-tuning model using a labeled data set; and using the fine-tuning model after parameter adjustment to output classification results and prediction results. The present invention effectively solves the problem of limited labeled data in gas well liquid accumulation classification and prediction, and improves model accuracy and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of gas well liquid accumulation classification and prediction, and in particular relates to a gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision. Background Art

[0002] Liquid accumulation in gas wells is one of the main problems that lead to a decline in gas well production. As gas reservoir development proceeds, reservoir pressure gradually decreases, causing the gas flow rate in the gas well to decrease. When the flow rate drops below the critical value, the gas cannot discharge all the liquid from the wellhead, causing some of the liquid to fall back and accumulate in the wellbore to form liquid accumulation. As the energy of the gas reservoir continues to decrease and the amount of liquid accumulation in the wellbore increases, when the liquid in the wellbore completely crushes the gas well, the gas well will stop production due to flooding.

[0003] There are currently three main ways to determine whether a gas well is experiencing liquid accumulation. One is to determine whether the wellbore is experiencing liquid accumulation by determining whether the gas flow rate in the wellbore is lower than the critical liquid-carrying flow rate of the gas. If the gas flow rate in the wellbore is lower than the critical liquid-carrying flow rate, it indicates that liquid is present in the wellbore. The limitation of this type of method is that it only determines liquid accumulation in the wellbore by the critical liquid-carrying flow rate, and the flow law of the gas-liquid two-phase flow in the wellbore is unclear, and the law of when the gas well accumulates liquid and when the flow stops is unclear. One type is based on statistical methods, such as the liquid accumulation prediction method based on production data analysis, which uses dynamic production data to analyze the gas-liquid state at the bottom of the well to determine whether there is liquid accumulation. The problem with this type of method is that the performance law of the gas well in the dynamic production data at different stages of liquid accumulation is unclear, and there is insufficient understanding of the feature analysis that is highly correlated with the performance of liquid accumulation. The traditional method based on statistical features is not applicable enough to describe the complex laws of liquid accumulation. The other type is the effusion judgment method based on machine learning, which uses production data to construct a multi-dimensional feature vector and uses machine learning algorithms such as clustering and random forest to predict effusion. The disadvantage of this type of method is that it relies on a large amount of labeled data and cannot use unlabeled data. It is also easily affected by the bias in the training data, resulting in insufficient model generalization ability. Summary of the invention

[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides a gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision, which effectively solves the problem of limited label data in gas well liquid accumulation classification and prediction, and improves the model accuracy and efficiency.

[0005] In order to achieve the above objectives, the technical solution adopted by the present invention is: a gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision, comprising the following steps:

[0006] S1. Obtain daily production data of gas wells, perform feature selection and preprocessing on the acquired daily production data of gas wells, and construct labeled data sets and unlabeled data sets respectively;

[0007] S2, performing frequency channel conversion and masking processing on the subsequence data of the unlabeled data set, and using time-frequency consistency and neighbor weighted aggregation to restore the mask time point, construct a pre-training model, and train the pre-training model using the unlabeled data set;

[0008] S3. Use the trained pre-trained model to build a fine-tuning model in the downstream effusion task, and use the labeled dataset to adjust the parameters of the fine-tuning model;

[0009] S4. Use the fine-tuned model after parameter adjustment to output classification results and prediction results.

[0010] The beneficial effects of the present invention are as follows: the present invention uses frequency channel conversion technology and neighbor weighted aggregation mask reconstruction self-supervised learning to train unlabeled data using frequency information and time information of time series data, reducing the reliance on expensive and time-consuming labeled data, and reducing the cost and time of data preparation; compared with traditional machine learning methods, the present invention can learn universal feature representations from unlabeled data, thereby improving the generalization ability of the model on different well data. The present invention has strong adaptability, and gas well data is usually complex data with multiple sequences and multiple variables; since self-supervised learning depends on the structure of the data itself, the present invention can adapt to the dynamic changes of different gas wells and has strong adaptability and flexibility.

[0011] Furthermore, the S1 comprises the following steps:

[0012] S101, obtaining average oil pressure, average casing pressure, daily gas production, daily water production and production time dynamic data from daily production data of gas wells;

[0013] S102, constructing a casing-oil pressure difference characteristic through the average oil pressure and the average casing pressure, and constructing a water-gas ratio characteristic through the daily gas production and the daily water production;

[0014] S103, using the data acquired in S101 and the features constructed in S102 as analysis features;

[0015] S104, using cyclic segmentation detection to eliminate analysis feature data with missing values;

[0016] S105, using the K nearest neighbor missing value filling method to fill the analysis feature data after removing the missing values;

[0017] S106, using a local box plot method to process abnormal values ​​in the analysis feature data;

[0018] S107, performing normalization processing on each analysis feature data;

[0019] S108, splicing the static characteristics of the gas well into the data processed by S105-S107, completing the preprocessing of the daily production data of the gas well;

[0020] S109, in the pre-processed gas well daily production data, manually annotate the labeled data, and record the data other than the labeled data as unlabeled data, wherein the labeled data includes classified data and predicted data, the classified data is annotated with the liquid accumulation time period and the non-liquid accumulation time period, and the predicted data sets the labels far from the liquid accumulation time point as the first threshold value, and sets the labels close to the liquid accumulation time point as the second threshold value;

[0021] S1010, performing sliding window processing on the labeled data and the unlabeled data respectively, extracting a number of subsequences, and constructing a labeled data set and an unlabeled data set respectively according to the subsequence combinations.

[0022] The beneficial effect of the above further scheme is that the present invention uses cyclic segmented detection to remove missing values. Considering that when there are too many missing data, it is easy to have an adverse effect on the effect of the model after filling. In this way, the data part with less missing data can be retained, and the data with serious missing data can be removed, thereby optimizing the effect of data processing. The K nearest neighbor missing value filling method is a complex technology among many methods for processing missing data. This technology examines the information of multiple neighboring samples around the sample containing the missing value, and uses this as a basis to complete the missing data. The local box plot method does not rely on the global data distribution, but determines the outliers based on the local data characteristics, which enables it to adapt to the changing trend of the data. The analysis feature data are normalized separately, and each analysis feature data is scaled to a distribution with zero mean and unit standard deviation, so that the scaling of each analysis feature data is based on its own distribution characteristics, rather than based on the uniform distribution of all features, which helps to maintain the differences between different features. The order in the time series data contains potential information related to time. By using the Sliding Window sliding window technology, these time-related features can be retained instead of just analyzing the data at a single time point.

[0023] Furthermore, the missing values ​​of the analysis feature data after the missing values ​​are removed are filled using the K nearest neighbor missing value filling method, which is specifically as follows:

[0024] Through distance measurement, k samples with similar space in the feature data are identified and analyzed, and the missing values ​​are estimated and filled using k samples. The missing value of each sample is interpolated using the average value of the k neighborhood obtained by analyzing the feature data: ; ;in, represents missing values, Indicates The weight of the daily data of the gas well, Indicates the surrounding The value of the gas well day-level data, represents the total number of gas well day-level data near the missing value, Indicates The Euclidean distance between the day-level data of the gas well and the missing values.

[0025] Furthermore, the S2 comprises the following steps:

[0026] S201, using the data enhancement layer Aug, performing frequency channel conversion processing on the subsequence data of the unlabeled data set;

[0027] S202, using the data enhancement layer Aug, masking the subsequence data of the unlabeled data set to generate multiple masked time series representing different visual signals of the original time series: ;in, represents the masked time series, represents the original time series, j Indicates j masked time series, M Indicates the number of masked time series generated, Represents a mask operation, represents the mask matrix, r Indicates the mask ratio;

[0028] S203: Based on the frequency channel conversion processing result and the generated multiple mask time series, the mask time points are restored by using time-frequency consistency and neighbor weighted aggregation to reconstruct the original time series. , complete the construction of the pre-training model;

[0029] S204, using the unlabeled data set, iteratively train the pre-trained model, save the encoder parameters and projection layer parameters of the pre-trained model finally obtained, and complete the training of the pre-trained model.

[0030] The beneficial effects of the above further scheme are: the frequency channel conversion technology can highlight the effective frequency components in the time series signal while suppressing noise and interference. The original time series can be effectively reconstructed by using the time-frequency consistency and neighbor weighted aggregation mask mechanism to guide the training of the self-supervised pre-trained model. By constructing data enhancement layers, encoders, mapping layers, and decoders, the pre-trained model can learn and express the characteristics of time series data at multiple levels, which helps to capture more complex data patterns and relationships. By pre-training on unlabeled data and saving the obtained parameters for subsequent model fine-tuning, the adaptability and performance of the pre-trained model on new tasks can be improved.

[0031] Furthermore, the S201 includes the following steps:

[0032] S2011, using the data enhancement layer Aug, the analysis feature data is divided into C separate channel variables along the channel dimension using the following formula: ; ; ; ;in, and All represent channel variables. Indicates the batch size of feature data to be analyzed, Indicates the number of channels, Indicates the time length of the input analysis feature data, Indicates the subscript index of the channel variable, express A three-dimensional real tensor of size , Represents the analysis feature data, represents the partition operation, express A three-dimensional real tensor of size;

[0033] S2012, use the following formula to convert each channel variable With all discrete cosine transform DCT components sorted from low frequency to high frequency Multiply element by element to convert each channel variable from time series information to frequency domain information: ;in, Represents the channel variable that is converted from time series information to frequency domain information, represents discrete cosine transform, Represents discrete cosine transform DCT components sorted from low frequency to high frequency index;

[0034] S2013, transform the converted frequency domain information into the original shape by stacking , and use the KAN deep learning network to learn frequency channel attention , where the original shape For the original time series Same shape: ; ;in, represents a deep learning network based on the Kolmogorov-Arnold representation theorem. Indicates stacking operation, Indicates the first order of transformation from time series information to frequency domain information channel variables, Represents the 0th channel variable converted from time series information to frequency domain information, Represents the first channel variable converted from time series information to frequency domain information;

[0035] S2014, input analysis feature data Attention to frequency channels The tensors are multiplied element by element to obtain a weighted representation, and the fully connected layer is used to project the obtained weighted representation to obtain the sequence after frequency channel conversion , complete the frequency channel conversion processing of the analysis feature data: ;in, Represents a fully connected layer operation.

[0036] The beneficial effect of the above further scheme is: the present invention utilizes the above splitting operation to avoid the frequency information from each channel being distorted by the information from other channels when extracting frequency domain information from the entire sequence; the input is multiplied element by element with the frequency channel attention tensor to obtain a weighted representation, so that the output of the network layer can adapt to the frequency domain characteristics of the input data, avoiding the computational overhead caused by the inverse transformation.

[0037] Furthermore, the S203 includes the following steps:

[0038] S2031. The original time series , the sequence after frequency channel conversion and masked time series A collection of stitching Input into the pre-trained model, and pass through the feature extraction backbone network Encoder and the point-to-sequence mapping layer Projector in the pre-trained model to obtain a point-level representation set and sequence-level representation collection : ; ; ;in, , , Represent the original time series , the sequence after frequency channel conversion and masked time series A set of point-level representations, , , Represent the original time series , the sequence after frequency channel conversion and masked time series A collection of sequence-level representations, j Indicates j masked time series, M Indicates the number of masked time series generated, represents the feature extraction backbone network, represents the mapping network from point to sequence, Represents the original time series , the sequence after frequency channel conversion and masked time series The assembled collection;

[0039] S2032, using cosine similarity calculation, by calculating the original time series , the sequence after frequency channel conversion and masked time series The sequence-level representation similarity of different sequences is obtained : ; ; ;in, Represents similarity calculation, express A two-dimensional real tensor of size , Representing sequence-level representation The similarity between Both represent sequence-level representations. represents the transpose operation, Represents the original time series , the sequence after frequency channel conversion and masked time series The batch size of the concatenated collection, M Indicates the number of masked time series generated, Indicates the batch size of feature data to be analyzed;

[0040] S2033, based on sequence level similarity matrix , using the following formula, the point-level representation set Aggregate information to obtain : ; ;in, Represents similarity based on sequence-level representation Point-level representation The result after information aggregation is represents the reconstructed point-level representation, Represents the corresponding time series in a batch The index of express The similarity between express The similarity between Represents the corresponding time series The sequence representation of and Both represent non-time series The corresponding sequence representation is, express The corresponding point-level representation;

[0041] S2034, will Input to the decoder for processing, and use the following formula to reconstruct the original time series , complete the construction of the pre-trained model: ;in, Represents a decoding operation.

[0042] The beneficial effect of the above further scheme is that the present invention generates multiple time series that can represent different visual characteristics of the original time series by combining time-frequency consistency and performing random multiple masking operations on the original time series. This method utilizes the synergy between the frequency domain information of the time series and multiple mask sequences to achieve efficient reconstruction of the original time series, significantly alleviating the reconstruction difficulties caused by the damage of key time series change information, thereby ensuring the integrity and accuracy of the time series data. The method shows low sensitivity to the ratio of the mask, and shows higher stability and adaptability in the reconstruction process, which is more in line with the actual needs of the field of time series analysis.

[0043] Furthermore, the loss function of the pre-trained model is expressed as follows: ; ; ;in, represents the loss function of the pre-trained model, Indicates taking a small value. represents the reconstruction loss function, represents the constraint loss function, represents the loss weight of the constraint task, s represents the sequence-level representation, represents a positive sample, represents the set of positive samples, Represents a collection of sequence-level representations Sequence-level representation Every state outside represents the temperature parameter, and Respectively represent The true value of the sample and the predicted The reconstructed value of samples, represents the L2 norm.

[0044] Furthermore, the sequence-level representation set The structure of is adjusted by defining positive sample pairs and negative sample pairs, where the structural expressions of positive sample pairs and negative sample pairs are as follows: Positive sample pairs: ; Negative sample pairs: );in, and Respectively indicate distance Near and far elements, The elements include time series The corresponding frequency channel converted sequence level representation set and masked sequence-level representation collection The intersection of The elements include non-time series The corresponding sequence-level representation set , sequence-level representation set after frequency channel conversion and masked sequence-level representation collection The intersection of Represents the corresponding time series in a batch The index of Indicates that the corresponding time series in a batch is not The index of .

[0045] The beneficial effects of the above further scheme are: the reconstruction process directly depends on the similarity of the sequence. In the sequence representation space, if there is a lack of clear constraints, it is difficult for the model to accurately capture the similarity; in order to prevent the result from showing trivial aggregation, the sequence-level representation set is adjusted by defining positive sample pairs and negative sample pairs The structure can prevent the results from showing trivial aggregation and help the pre-trained model capture similarities more accurately. The learned sequence representation can be optimized by constraining the loss function. The sequence-level representation distance between positive and negative examples can be adjusted in a contrastive manner, and the aggregation weights between multiple mask sequences can be controlled based on the similarity between the original time series and its own mask sequence and the sequence after frequency channel conversion, thus realizing a learnable neighbor weight aggregation process.

[0046] Furthermore, the S3 comprises the following steps:

[0047] S301, using the encoder and projection layer of the trained pre-trained model as an initialization feature extractor of the fine-tuning model, wherein the encoder of the pre-trained model is a feature extraction backbone network Encoder in the pre-trained model;

[0048] S302, by constructing a multilayer perceptron including an input layer, two hidden layers each using a rectified linear unit as an activation function and including a discard layer, and an output layer for outputting classification results and prediction results, and combining the feature extractor in S301, a fine-tuning model for classification and prediction of downstream effusion tasks is constructed, wherein the loss function of the classifier is expressed as follows: ;in, represents the loss function of the classifier, represents the number of samples, Indicates the index number of the sample, represents the number of categories, represents the symbolic function, if the sample The true category is , then it takes 1, otherwise, it takes 0. Indicates that the predicted sample belongs to the category The predicted probability of

[0049] The loss function of the predictor is expressed as follows: ;in, represents the loss function of the predictor, Representation sample The true value of Representation sample The predicted value of

[0050] S303, using a labeled data set to train the fine-tuning model, wherein the weight of the feature extractor is kept unchanged, and only the multilayer perceptron including the input layer, the hidden layer and the output layer is trained, and then the layers of the decoder in the feature extractor are unfrozen to complete the adjustment of the fine-tuning model parameters.

[0051] The above further scheme has the beneficial effect that by using the encoder and projection layer of the pre-trained model as an initialization feature extractor for the fine-tuning model, the rich features learned by the pre-trained model on a large amount of data can be fully utilized. By freezing the weights of the feature extractor so that it remains unchanged during the initial training stage, the amount of computation in the early stage of model training can be reduced, the training time can be shortened, and the knowledge learned by the pre-trained model can be retained. Different output layers are designed according to different tasks, so that the model can be flexibly applied to classification and prediction tasks. At the same time, the loss functions of the classifier and the predictor are defined separately, which allows the model to optimize different types of tasks in a targeted manner. The loss function of the classifier takes into account the number of categories and the number of samples, as well as the true category and predicted probability of the samples; the loss function of the predictor focuses on the difference between the true value and the predicted value. The strategy of gradual fine-tuning helps the model better adapt to new tasks while avoiding the instability that may be caused by a sudden change in the weights of the feature extractor.

[0052] Furthermore, the S4 is specifically:

[0053] The fine-tuned model after parameter adjustment is used to output classification results and prediction results, wherein the classification results include gas wells with liquid accumulation and gas wells without liquid accumulation, and the prediction results include the number of days to liquid accumulation.

[0054] The beneficial effect of the above further solution is that the present invention has shown excellent technical effects when processing gas well liquid accumulation data by fine-tuning the model after parameter adjustment. This fine-tuning model not only significantly improves the accuracy of classification and the reliability of prediction, but also effectively reduces the maintenance cost caused by liquid accumulation problems and significantly improves production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 The present invention is a flow chart of the method. DETAILED DESCRIPTION

[0056] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.

[0057] Example

[0058] As shown in the figure, the present invention discloses a gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision, and its implementation method is as follows:

[0059] S1. Obtain daily production data of gas wells, perform feature selection and preprocessing on the acquired daily production data of gas wells, and construct labeled data sets and unlabeled data sets respectively. The implementation method is as follows:

[0060] S101, obtaining average oil pressure, average casing pressure, daily gas production, daily water production and production time dynamic data from daily production data of gas wells;

[0061] S102, constructing a casing-oil pressure difference characteristic through the average oil pressure and the average casing pressure, and constructing a water-gas ratio characteristic through the daily gas production and the daily water production;

[0062] S103, using the data acquired in S101 and the features constructed in S102 as analysis features;

[0063] S104, using cyclic segmentation detection to eliminate analysis feature data with missing values;

[0064] In this embodiment, the data with more missing values ​​is eliminated through cyclic segmented detection: for the data of a certain well, the missing data ratio of the entire analysis feature data group is first checked. If it does not exceed 80%, it is returned directly. If it does not meet the requirements, the missing data ratio of a subset of the data group (for example, the first 65% of the data) is further checked. If it meets the requirements, the subset is returned, and then the process is repeated multiple times. If all data do not meet the conditions, the data of this well is discarded.

[0065] S105, using the K nearest neighbor missing value filling method to fill the analysis feature data after eliminating the missing values, which is specifically: identifying k samples with similar space in the analysis feature data through distance measurement, and using the k samples to estimate the missing values ​​and fill the missing values, wherein the missing value of each sample is interpolated using the average value of the k neighborhood obtained from the analysis feature data: ; ;in, represents missing values, Indicates The weight of the daily data of the gas well, Indicates the surrounding The value of the gas well day-level data, represents the total number of gas well day-level data near the missing value, Indicates The Euclidean distance between the day-level data of the gas well and the missing values;

[0066] In this embodiment, the missing values ​​of the selected analysis feature data are filled by the K nearest neighbor missing value filling algorithm, and k spatially similar or close samples in the data set are identified by distance measurement; then, these samples are used to estimate the values ​​of the missing data points.

[0067] S106, using a local box plot method to process abnormal values ​​in the analysis feature data;

[0068] In this embodiment, the outliers in the analysis feature data are processed by the local box plot method, and the outliers are replaced by the local mean within a 30-day time window; first, the quartiles (Q1, Q3) and interquartile range (IQR = Q3 - Q1) of the time window data need to be calculated, and then the upper bound (Q3 + 1.5 * IQR) and lower bound (Q1- 1.5 * IQR) are calculated, and the points outside these two bounds are considered to be outliers; next, the local mean (30-day mean) can be used to replace these outliers, where Q1 and Q3 both represent the quartiles of the time window data, and IQR represents the interquartile range.

[0069] S107, performing normalization processing on each analysis feature data;

[0070] In this embodiment, each analysis feature data is normalized separately. , calculate its mean separately and standard deviation , and then apply the following normalization formula: ;in, Represents each analysis feature The normalized value of .

[0071] S108, splicing the static characteristics of the gas well into the data processed by S105-S107, completing the preprocessing of the daily production data of the gas well;

[0072] In this embodiment, in order to prevent the results of different gas wells and layers from being too different, static feature data such as the gas well number and layer are spliced ​​into the processed data.

[0073] S109, in the pre-processed gas well daily production data, manually annotate the labeled data, and record the data other than the labeled data as unlabeled data, wherein the labeled data includes classified data and predicted data, the classified data is annotated with the liquid accumulation time period and the non-liquid accumulation time period, and the predicted data sets the labels far from the liquid accumulation time point as the first threshold value, and sets the labels close to the liquid accumulation time point as the second threshold value;

[0074] In this embodiment, expert knowledge annotation is used to establish a small-scale labeled data set, including a classification data set and a prediction data set. The classification data set is labeled with effusion time periods and non-effusion time periods. In the prediction data set, the labels of time points far away from the effusion time points are set to 30, and the labels of time points gradually approaching the effusion time points are set to gradually decrease from 30 to 0.

[0075] In this embodiment, nearly 2 million daily production data of gas wells in a certain area are collected, nearly 140,000 manually labeled data are collected, and the rest of the data are unlabeled data.

[0076] S1010, performing sliding window processing on the labeled data and the unlabeled data respectively, extracting a number of subsequences, and constructing a labeled data set and an unlabeled data set respectively according to the subsequence combinations.

[0077] In this embodiment, each well is processed using a sliding window, a window length and a step size are moved on the original time series, and multiple subsequences are extracted. The expression is as follows: ;in, represents the total number of subsequences per well, It represents the total number of gas well-day data of each well after processing. represents the sliding window length, Indicates the sliding window step size.

[0078] In this embodiment, for unlabeled data, the window size is set to 30 and the step size is set to 15. For labeled data, the window size is set to 30 and the step size is set to 1.

[0079] S2. Perform frequency channel conversion and mask processing on the subsequence data of the unlabeled data set, and use time-frequency consistency and neighbor weighted aggregation to restore the mask time point, build a pre-training model, and use the unlabeled data set to train the pre-training model. The implementation method is as follows:

[0080] S201, using the data enhancement layer Aug, frequency channel conversion processing is performed on the subsequence data of the unlabeled data set, and the implementation method is as follows:

[0081] S2011, using the data enhancement layer Aug, the analysis feature data is divided into C separate channel variables along the channel dimension using the following formula: ; ; ; ;in, and All represent channel variables. Indicates the batch size of feature data to be analyzed, Indicates the number of channels, Indicates the time length of the input analysis feature data, Indicates the subscript index of the channel variable, express A three-dimensional real tensor of size , Represents the analysis feature data, represents the partition operation, express A three-dimensional real tensor of size;

[0082] S2012, use the following formula to convert each channel variable With all discrete cosine transform DCT components sorted from low frequency to high frequency Multiply element by element to convert each channel variable from time series information to frequency domain information: ;in, Represents the channel variable that is converted from time series information to frequency domain information, represents discrete cosine transform, Represents discrete cosine transform DCT components sorted from low frequency to high frequency index;

[0083] S2013, transform the converted frequency domain information into the original shape by stacking , and use the KAN deep learning network to learn frequency channel attention , where the original shape For the original time series Same shape: ; ;in, represents a deep learning network based on the Kolmogorov-Arnold representation theorem. Indicates stacking operation, Indicates the first order of transformation from time series information to frequency domain information channel variables, Represents the 0th channel variable converted from time series information to frequency domain information, Represents the first channel variable converted from time series information to frequency domain information;

[0084] S2014, input analysis feature data Attention to frequency channels The tensors are multiplied element by element to obtain a weighted representation, and the fully connected layer is used to project the obtained weighted representation to obtain the sequence after frequency channel conversion , complete the frequency channel conversion processing of the analysis feature data: ;in, Represents a fully connected layer operation.

[0085] In this embodiment, the frequency channel conversion technology is applied to the analysis feature data to highlight the effective frequency components in the time series signal while suppressing noise and interference. First, the input analysis feature data (i.e., the original time series) Finely divided into C separate channel variables along the channel dimension ,in, , , Indicates the batch size of feature data to be analyzed, Indicates the number of channels, Indicates the time length of the input analysis feature data, The reason for the split operation is that while extracting frequency domain information from the entire sequence, the frequency information from each channel may be distorted by the information from other channels; therefore, each channel is first divided; then, each channel variable is compared with all discrete cosine transform DCT components sorted from low frequency to high frequency. Multiply each element by element to transform each channel variable from time series information to frequency domain information, and then transform it back to the original shape by stacking. Then, the KAN network is used to learn the frequency channel attention, denoted as This process helps to establish the frequency dependency between different channels. Finally, the input is multiplied element by element with the frequency channel attention tensor to obtain a weighted representation, so that the output of the network layer can adapt to the frequency domain characteristics of the input data, avoiding the computational overhead caused by the inverse transformation, and then passing through the fully connected layer. Project it and further refine it to get .

[0086] S202, using the data enhancement layer Aug, masking the subsequence data of the unlabeled data set to generate multiple masked time series representing different visual signals of the original time series;

[0087] In this embodiment, mask processing is performed to randomly block the original sequence multiple times to generate multiple mask time series representing different visual signals of the original time series: ;in, represents the masked time series, represents the original time series, j Indicates j masked time series, Represents a mask operation, represents the mask matrix, r represents the mask ratio, , M Indicates the number of mask time series generated, by generating M and the original time series X Mask matrices of the same shape , whose value is 0 or 1, indicating whether the corresponding position is masked. With the generated mask matrix Multiply to get the masked time series .

[0088] S203: Based on the frequency channel conversion processing result and the generated multiple mask time series, the mask time points are restored by using time-frequency consistency and neighbor weighted aggregation to reconstruct the original time series. , complete the construction of the pre-training model, and its implementation method is as follows:

[0089] S2031. The original time series , the sequence after frequency channel conversion and masked time series A collection of stitching Input into the pre-trained model, and pass through the feature extraction backbone network Encoder and the point-to-sequence mapping layer Projector in the pre-trained model to obtain a point-level representation set and sequence-level representation collection : ; ; ;in, , , Represent the original time series , the sequence after frequency channel conversion and masked time series A set of point-level representations, , , Represent the original time series , the sequence after frequency channel conversion and masked time series A collection of sequence-level representations, j Indicates j masked time series, M Indicates the number of masked time series generated, represents the feature extraction backbone network, represents the mapping network from point to sequence, Represents the original time series , the sequence after frequency channel conversion and masked time series The assembled collection.

[0090] In this embodiment, the original time series , the sequence after frequency channel conversion and masked time series Splice to are input into the pre-trained model together. (in, Represents the original time series , the sequence after frequency channel conversion and masked time series The batch size of the concatenated collection, M Indicates the number of masked time series generated, Indicates the batch size of feature data to be analyzed, express A three-dimensional real tensor of size , Indicates the number of channels, Represents the time length of the input analysis feature data), and obtains its point-level representation set through the model's feature extraction backbone network Encoder and the point-to-sequence mapping layer Projector respectively. and sequence-level representation collection , where Encoder is the feature extraction backbone network (i.e. encoder) and Projector is the point-to-sequence mapping network.

[0091] S2032, using cosine similarity calculation, by calculating the original time series , the sequence after frequency channel conversion and masked time series The sequence-level representation similarity of different sequences is obtained : ; ; ;in, Represents similarity calculation, express A two-dimensional real tensor of size , Representing sequence-level representation The similarity between Both represent sequence-level representations. represents the transpose operation, Represents the original time series , the sequence after frequency channel conversion and masked time series The batch size of the concatenated collection, M Indicates the number of masked time series generated, Indicates the batch size of feature data to be analyzed;

[0092] S2033, based on sequence level similarity matrix , using the following formula, the point-level representation set Aggregate information to obtain : ; ;in, Represents similarity based on sequence-level representation Point-level representation The result after information aggregation is represents the reconstructed point-level representation, Represents the corresponding time series in a batch The index of express The similarity between express The similarity between Represents the corresponding time series The sequence representation of and Both represent non-time series The corresponding sequence representation is, express The corresponding point-level representation;

[0093] S2034, will Input to the decoder for processing, and use the following formula to reconstruct the original time series , complete the construction of the pre-trained model: ;in, Represents a decoding operation.

[0094] In this embodiment, a data enhancement layer Aug, a feature extraction backbone network Encoder (i.e., encoder), a mapping layer Projector, and a decoder Decoder are constructed, wherein the data enhancement layer Aug is responsible for completing frequency channel conversion and mask processing; the feature extraction backbone network Encoder, the mapping layer Projector, and the decoder Decoder are responsible for completing the reconstruction of the original time series;

[0095] The reconstruction loss function is: ;in, and Respectively represent The true value of the sample and the predicted The reconstructed value of samples, Represents the Euclidean norm, also known as the L2 norm, which calculates the square root of the sum of the squares of the differences of the elements of a vector. Indicates taking a small value. represents the reconstruction loss function, represents the constraint loss function.

[0096] The reconstruction process directly depends on the similarity of the sequence. In the sequence representation space, if there is a lack of clear restrictions, it is difficult for the model to accurately capture the similarity. In order to prevent the results from showing trivial aggregation, the structure of the sequence-level representation set S is adjusted by defining positive sample pairs and negative sample pairs. The structural expressions of positive sample pairs and negative sample pairs are as follows: Positive sample pairs: ; Negative sample pairs: ) ;in, and Respectively indicate distance Near and far elements, The elements include time series The corresponding frequency channel converted sequence level representation set and the masked sequence-level representation set The intersection of The elements include non-time series The corresponding sequence-level representation set , sequence-level representation set after frequency channel conversion and the masked sequence-level representation set The intersection of Represents the corresponding time series in a batch The index of Indicates that the corresponding time series in a batch is not The index of .

[0097] The constraint loss function is: .

[0098] In the pre-trained model, the final loss function is: ;in, represents the loss function of the pre-trained model, Indicates taking a small value. represents the reconstruction loss function, represents the constraint loss function, represents the loss weight of the constraint task, s represents the sequence-level representation, S represents a collection of sequence-level representations, represents a positive sample, represents the set of positive sample pairs, Represents a collection of sequence-level representations Sequence-level representation Every state outside Represents the temperature parameter.

[0099] In this embodiment, the data enhancement layer Aug is divided into two parts: frequency channel conversion and time series data masking. The encoder Encoder adopts the TCN network as the feature extraction backbone network, the mapping layer Projector adopts the MLP network as the point-to-sequence mapping network, and the MLP structure is used as the decoder.

[0100] S204, using the unlabeled data set, iteratively train the pre-trained model, save the encoder parameters and projection layer parameters of the pre-trained model finally obtained, and complete the training of the pre-trained model.

[0101] In this embodiment, after the unlabeled data set is processed, it is sent to the pre-training model for training for multiple rounds, and the final pre-training encoder layer and projection layer parameters are saved for subsequent fine-tuning processing of the fine-tuning model.

[0102] In this embodiment, 80% of the unlabeled data is used as training samples, and the rest is used as test samples. The number of iterations is set to 100, the rate adjustment method of Adam gradient descent learning is adopted, and the initial learning rate is set to 0.0001. The cosine annealing scheduler CosineAnnealingLR is used to adjust the learning rate in each training round to train the self-supervised pre-training model.

[0103] S3. Use the trained pre-trained model to build a fine-tuning model in the downstream effusion task, and use the labeled data set to adjust the parameters of the fine-tuning model. The implementation method is as follows:

[0104] S301, using the encoder and projection layer of the trained pre-trained model as an initialization feature extractor of the fine-tuning model for use in downstream effusion classification and prediction tasks, wherein the encoder of the pre-trained model is a feature extraction backbone network Encoder in the pre-trained model;

[0105] S302, by constructing a multilayer perceptron including an input layer, two hidden layers each using a rectified linear unit as an activation function and including a discard layer, and an output layer for outputting classification results and prediction results, and combining the feature extractor in S301, a fine-tuning model for classification and prediction of downstream effusion tasks is constructed, wherein the loss function of the classifier is expressed as follows: ;in, represents the loss function of the classifier, represents the number of samples, Indicates the index number of the sample, represents the number of categories, represents the symbolic function, if the sample The true category is , then take 1, otherwise, take 0. Indicates that the predicted sample belongs to the category The predicted probability of

[0106] The loss function of the predictor is expressed as follows: ;in, represents the loss function of the predictor, Representation sample The true value of Representation sample The predicted value of

[0107] S303, using a labeled data set to train the fine-tuning model, wherein the weight of the feature extractor is kept unchanged, and only the multilayer perceptron including the input layer, the hidden layer and the output layer is trained, and then the layers of the decoder in the feature extractor are unfrozen to complete the adjustment of the fine-tuning model parameters.

[0108] In this embodiment, when constructing a fine-tuning model for classification and prediction of downstream effusion tasks, a multilayer perceptron including an input layer, two hidden layers, and an output layer is designed; in this multilayer perceptron, each hidden layer uses a rectified linear unit (ReLU) as an activation function to introduce nonlinear factors and help the fine-tuning model capture complex data features; in addition, in order to improve the generalization ability of the multilayer perceptron and reduce the risk of overfitting, the dropout technology is implemented in the hidden layer, and batch normalization is used during the training process; different output layers are designed for classification and prediction according to different tasks.

[0109] In this embodiment, the fine-tuning model is trained using labeled data. Initially, the weights of the feature extractor are kept unchanged, and only the newly added layers are trained. As the training progresses, some layers of the feature extractor are gradually unfrozen, and the weights of these layers are continuously adjusted.

[0110] In this embodiment, the newly added layers refer to a multilayer perceptron including an input layer, two hidden layers that both use rectified linear units as activation functions and include a discard layer, and an output layer for outputting classification results and prediction results. "Part of the layers" refer to certain layers in the feature extractor, mainly some layers in the encoder. During the fine-tuning process, the weights of these layers may be kept unchanged (i.e., "frozen" these layers) at the beginning, and only the newly added layers are trained. When the fine-tuning model shows a certain learning ability on the new task, consider gradually "unfreezing" certain layers in the encoder and allowing their weights to be fine-tuned during the training process to further improve the performance of the fine-tuning model.

[0111] In this embodiment, the encoder layer parameters and projection layer parameters of the above-mentioned pre-trained model are used as the initial parameters of the fine-tuning model feature extractor, and these parameters are frozen first. As the training progresses, some levels of the feature extractor are gradually unfrozen; the fine-tuning model uses 80% of the labeled data as training samples and the rest as test samples, and sets the number of iterations to 100. The rate adjustment method of Adam gradient descent learning is adopted, and the initial learning rate is set to 0.0002. The cosine annealing scheduler CosineAnnealingLR is used to adjust the learning rate in each training round to train the fine-tuning model.

[0112] In this embodiment, the feature extraction backbone network (encoder) Encoder and decoder Decoder in the pre-trained model of the present invention can be replaced by various other network layers, such as CNN and RNN; the multi-layer perceptron in the fine-tuning model can be replaced by classification and prediction models in deep learning or machine learning, such as random forest and ensemble learning; the present invention can train different pre-training and fine-tuning models for classification and prediction tasks respectively, and adjust the pre-training and fine-tuning models according to specific needs for different tasks.

[0113] S4. Based on the obtained gas well liquid accumulation, the fine-tuning model after parameter adjustment is used to output classification results and prediction results, specifically:

[0114] The fine-tuned model after parameter adjustment is used to output classification results and prediction results, wherein the classification results include gas wells with liquid accumulation and gas wells without liquid accumulation, and the prediction results include the number of days to liquid accumulation.

Claims

1. A gas well liquid loading classification and prediction method based on frequency channel conversion and self-supervision, It is characterized in that The following steps are involved: S1. Obtain daily production data of gas wells, perform feature selection and preprocessing on the acquired daily production data of gas wells, and construct labeled data sets and unlabeled data sets respectively; S2, performing frequency channel conversion and masking processing on the subsequence data of the unlabeled data set, and using time-frequency consistency and neighbor weighted aggregation to restore the mask time point, construct a pre-training model, and train the pre-training model using the unlabeled data set; The S2 comprises the following steps: S201, using the data enhancement layer Aug, performing frequency channel conversion processing on the subsequence data of the unlabeled data set; S202, using the data enhancement layer Aug, masking the subsequence data of the unlabeled data set to generate multiple masked time series representing different visual signals of the original time series: in, represents the masked time series, represents the original time series, j Indicates j masked time series, M Indicates the number of masked time series generated, Represents a mask operation, represents the mask matrix, r Indicates the mask ratio; S203: Based on the frequency channel conversion processing result and the generated multiple mask time series, the mask time points are restored by using time-frequency consistency and neighbor weighted aggregation to reconstruct the original time series. , complete the construction of the pre-training model; The S203 comprises the following steps: S2031. The original time series , the sequence after frequency channel conversion and masked time series A collection of stitching Input into the pre-trained model, and pass through the feature extraction backbone network Encoder and the point-to-sequence mapping layer Projector in the pre-trained model to obtain a point-level representation set and sequence-level representation collection : in, , , Represent the original time series , the sequence after frequency channel conversion and masked time series A set of point-level representations, , , Represent the original time series , the sequence after frequency channel conversion and masked time series A collection of sequence-level representations, j Indicates j masked time series, M Indicates the number of masked time series generated, represents the feature extraction backbone network, Represents the mapping network from point to sequence, Represents the original time series , the sequence after frequency channel conversion and masked time series The assembled collection; S2032, using cosine similarity calculation, by calculating the original time series , the sequence after frequency channel conversion and masked time series The sequence-level representation similarity of different sequences is obtained : in, Represents similarity calculation, express A two-dimensional real tensor of size , Representing sequence-level representation The similarity between Both represent sequence-level representations. represents the transpose operation, Represents the original time series , the sequence after frequency channel conversion and masked time series The batch size of the concatenated collection, M Indicates the number of masked time series generated, Indicates the batch size of feature data to be analyzed; S2033, based on sequence level similarity matrix , using the following formula, the point-level representation set Aggregate information to obtain : in, Represents similarity based on sequence-level representation Point-level representation The result after information aggregation is represents the reconstructed point-level representation, Represents the corresponding time series in a batch The index of express The similarity between express The similarity between Represents the corresponding time series The sequence representation of and Both represent non-time series The corresponding sequence representation is, express The corresponding point-level representation; S2034, will Input to the decoder for processing, and use the following formula to reconstruct the original time series , complete the construction of the pre-trained model: in, Indicates a decoding operation; S204, using the unlabeled data set, iteratively training the pre-trained model, saving the encoder parameters and projection layer parameters of the pre-trained model finally obtained, and completing the training of the pre-trained model; S3. Use the trained pre-trained model to build a fine-tuning model in the downstream effusion task, and use the labeled dataset to adjust the parameters of the fine-tuning model; S4. Use the fine-tuned model after parameter adjustment to output classification results and prediction results.

2. The gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision according to claim 1, It is characterized in that The S1 comprises the following steps: S101, obtaining average oil pressure, average casing pressure, daily gas production, daily water production and production time dynamic data from daily production data of gas wells; S102, constructing a casing-oil pressure difference characteristic through the average oil pressure and the average casing pressure, and constructing a water-gas ratio characteristic through the daily gas production and the daily water production; S103, using the data acquired in S101 and the features constructed in S102 as analysis features; S104, using cyclic segmentation detection to eliminate analysis feature data with missing values; S105, using the K nearest neighbor missing value filling method to fill the analysis feature data after removing the missing values; S106, using a local box plot method to process abnormal values ​​in the analysis feature data; S107, performing normalization processing on each analysis feature data; S108, splicing the static characteristics of the gas well into the data processed by S105-S107, completing the preprocessing of the daily production data of the gas well; S109, in the pre-processed gas well daily production data, manually annotate the labeled data, and record the data other than the labeled data as unlabeled data, wherein the labeled data includes classified data and predicted data, the classified data is annotated with the liquid accumulation time period and the non-liquid accumulation time period, and the predicted data sets the labels far from the liquid accumulation time point as the first threshold value, and sets the labels close to the liquid accumulation time point as the second threshold value; S1010, performing sliding window processing on the labeled data and the unlabeled data respectively, extracting a number of subsequences, and constructing a labeled data set and an unlabeled data set respectively according to the subsequence combinations.

3. The gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision according to claim 2, It is characterized in that The K nearest neighbor missing value filling method is used to fill the missing values ​​of the analysis feature data after the missing values ​​are removed, which is specifically as follows: Through distance measurement, k samples with similar space in the feature data are identified and analyzed, and the missing values ​​are estimated and filled using k samples. The missing value of each sample is interpolated using the average value of the k neighborhood obtained by analyzing the feature data: in, represents missing values, Indicates The weight of the daily data of the gas well, Indicates the surrounding The value of the gas well day-level data, represents the total number of gas well day-level data near the missing value, Indicates The Euclidean distance between the day-level data of the gas well and the missing values.

4. The gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision according to claim 1, It is characterized in that The S201 includes the following steps: S2011, using the data enhancement layer Aug, the analysis feature data is divided into C separate channel variables along the channel dimension using the following formula: in, and All represent channel variables. Indicates the batch size of feature data for analysis, Indicates the number of channels, Indicates the time length of the input analysis feature data, Indicates the subscript index of the channel variable, express A three-dimensional real tensor of size , Represents the analysis feature data, represents the partition operation, express A three-dimensional real tensor of size; S2012, use the following formula to convert each channel variable With all discrete cosine transform DCT components sorted from low frequency to high frequency Multiply each element by element to convert each channel variable from time series information to frequency domain information: in, Represents the channel variable that is converted from time series information to frequency domain information, represents discrete cosine transform, Represents discrete cosine transform DCT components sorted from low frequency to high frequency index; S2013, transform the converted frequency domain information into the original shape by stacking , and use the KAN deep learning network to learn frequency channel attention , where the original shape For the original time series Same shape: in, represents a deep learning network based on the Kolmogorov-Arnold representation theorem. Indicates stacking operation, Indicates the first order of transformation from time series information to frequency domain information channel variables, Represents the 0th channel variable converted from time series information to frequency domain information, Represents the first channel variable converted from time series information to frequency domain information; S2014, input analysis feature data Attention to frequency channels The tensors are multiplied element by element to obtain a weighted representation, and the fully connected layer is used to project the obtained weighted representation to obtain the sequence after frequency channel conversion , complete the frequency channel conversion processing of the analysis feature data: in, Represents a fully connected layer operation.

5. The gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision according to claim 1, It is characterized in that The expression of the loss function of the pre-trained model is as follows: in, represents the loss function of the pre-trained model, Indicates taking a small value. represents the reconstruction loss function, represents the constraint loss function, represents the loss weight of the constraint task, s represents the sequence-level representation, represents a positive sample, represents the set of positive samples, Represents a collection of sequence-level representations Sequence-level representation Every state outside represents the temperature parameter, and Respectively represent The true value of the sample and the predicted The reconstructed value of samples, represents the L2 norm.

6. The gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision according to claim 5, It is characterized in that The sequence-level representation set The structure of is adjusted by defining positive sample pairs and negative sample pairs, where the structural expressions of positive sample pairs and negative sample pairs are as follows: Positive sample pairs: Negative sample pairs: ) in, and Respectively indicate distance Near and far elements, The elements include time series The corresponding frequency channel converted sequence level representation set and masked sequence-level representation collection The intersection of The elements include non-time series The corresponding sequence-level representation set , sequence-level representation set after frequency channel conversion and masked sequence-level representation collection The intersection of Represents the corresponding time series in a batch The index of Indicates that the corresponding time series in a batch is not The index of .

7. The gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision according to claim 1, It is characterized in that The S3 comprises the following steps: S301, using the encoder and projection layer of the trained pre-trained model as an initialization feature extractor of the fine-tuning model, wherein the encoder of the pre-trained model is a feature extraction backbone network Encoder in the pre-trained model; S302, by constructing a multilayer perceptron including an input layer, two hidden layers each using a rectified linear unit as an activation function and including a discard layer, and an output layer for outputting classification results and prediction results, and combining the feature extractor in S301, a fine-tuning model for classification and prediction of downstream effusion tasks is constructed, wherein the loss function of the classifier is expressed as follows: in, represents the loss function of the classifier, represents the number of samples, Indicates the index number of the sample, represents the number of categories, represents the symbolic function, if the sample The true category is , then it takes 1, otherwise, it takes 0. Indicates that the predicted sample belongs to the category The predicted probability of The loss function of the predictor is expressed as follows: in, represents the loss function of the predictor, Representation sample The true value of Representation sample The predicted value of S303, using a labeled data set to train the fine-tuning model, wherein the weight of the feature extractor is kept unchanged, and only the multilayer perceptron including the input layer, the hidden layer and the output layer is trained, and then the layers of the decoder in the pre-feature extractor are unfrozen to complete the adjustment of the fine-tuning model parameters.

8. The gas well liquid accumulation classification and prediction method based on frequency channel conversion and self-supervision according to claim 1, It is characterized in that The S4 is specifically: The fine-tuned model after parameter adjustment is used to output classification results and prediction results, wherein the classification results include gas wells with liquid accumulation and gas wells without liquid accumulation, and the prediction results include the number of days to liquid accumulation.