A confidence-driven dynamic-gated fault detection method and system

By adopting a belief-driven dynamic gating fault detection method, the problems of insufficient computational efficiency and adaptability in oil well fault detection are solved, achieving efficient and reliable fault detection and improving detection accuracy and computational efficiency.

CN122133809BActive Publication Date: 2026-07-14ZHONGBEI UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHONGBEI UNIV
Filing Date
2026-04-15
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing oil well fault detection models have fixed computational efficiency, insufficient adaptability, and lack of quantitative decision confidence, resulting in computational waste and limited decision reliability.

Method used

A confidence-driven dynamic gating fault detection method is adopted. Through iterative temporal reasoning and a confidence-driven dynamic early termination mechanism, the computation depth is adaptively adjusted and a highly deterministic decision is output.

Benefits of technology

It achieves adaptive allocation of computing resources and high-reliability decision output in oil well fault detection, significantly improving inference efficiency and detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122133809B_ABST
    Figure CN122133809B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of oil well fault detection, and particularly relates to a confidence-driven dynamic gating fault detection method and system, wherein the method comprises the following steps: receiving preprocessed oil well space-time features; performing multi-round double-flow attention operation through an iterative time sequence reasoning module to deeply refine system-level time sequence features; after each round of iteration, evaluating the current reasoning confidence; based on the confidence, performing a dynamic gating decision, using a special loss function that fuses classification loss and uncertainty penalty to optimize the model during training, and realizing adaptive early exit according to the confidence threshold during reasoning; and finally outputting a fault classification result with high confidence. The application innovatively combines iterative reasoning, confidence evaluation and dynamic gating, solves the problems of fixed calculation efficiency and low decision reliability of traditional models, realizes significant reduction of reasoning calculation amount while ensuring high detection accuracy and low false negative rate, and provides an efficient and reliable intelligent solution for industrial safety monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of oil well fault detection technology, and in particular to a confidence-driven dynamic gating fault detection method and system. Background Technology

[0002] In safety-critical industrial sectors such as oil and gas production, early, accurate, and reliable fault detection is crucial. Deep learning models, particularly time-series models based on recurrent neural networks and Transformers, have been widely applied to such tasks. However, existing methods suffer from two main limitations: First, the trade-off between computational efficiency and adaptability. Most models employ a fixed computational graph depth (such as a fixed-layer LSTM or Transformer encoder), performing the same amount of computation regardless of the complexity of the input samples. For simple or obvious fault symptoms, this results in unnecessary computational waste; for complex, hidden faults, a fixed shallow network may be insufficient to fully capture their patterns. Second, the lack of quantification of decision confidence. Models typically only output classification probabilities without providing an explicit measure of their confidence level in making decisions. In industrial settings, a low-confidence "anomaly" alarm may still require manual review, which is not only costly but also easily overlooked when alarms are frequent, while a high-confidence alarm can directly trigger automated operation and maintenance processes.

[0003] Existing "early termination" mechanisms (such as BranchyNet) achieve adaptive inference by adding classification branches to intermediate layers of the network. However, their termination decisions are usually based on the entropy or probability of intermediate classification results, without a dedicated confidence evaluation mechanism closely related to the quality of the model's internal representation. Furthermore, these methods often only optimize classification accuracy during training, without explicitly optimizing confidence, resulting in limited reliability of their early termination decisions. Therefore, designing a fault detection system that can adaptively adjust computational depth and output highly deterministic decisions is a pressing technical challenge in the field of industrial artificial intelligence. Summary of the Invention

[0004] This invention proposes a confidence-driven dynamic gating fault detection method and system, aiming to solve the technical problems of fixed computational efficiency and uncontrollable decision confidence in existing fault detection models.

[0005] In a first aspect, the present invention provides a confidence-driven dynamic gating fault detection method, comprising:

[0006] S1 receives pre-processed spatiotemporal characteristic data of oil well multi-sensor;

[0007] S2, input the spatiotemporal feature data into the iterative temporal reasoning model, and generate temporal reasoning features through multiple rounds of dual-stream attention iterative computation;

[0008] S3, after each iteration, calculate the confidence score based on the inference features of the current iteration;

[0009] S4. Based on the confidence score, use the confidence-driven dynamic gating mechanism to determine whether to exit the iteration early, and calculate the dynamic gating loss to optimize the iterative temporal inference model.

[0010] S5 performs fault classification and outputs the detection results based on the final iteration output or the output when exiting early.

[0011] The technical effect of the confidence-driven dynamic gating fault detection method disclosed in this invention is that: through iterative temporal reasoning and a confidence-driven dynamic early termination mechanism, this invention achieves the unification of adaptive allocation of computing resources and high-reliability decision output in oil well fault detection, and significantly improves reasoning efficiency while ensuring high detection accuracy.

[0012] Furthermore, the iterative temporal reasoning model in S2 employs a two-stream attention mechanism, including a context stream and a reasoning stream; a single iteration process includes:

[0013] S21, Inference Flow to Context Flow Update: Using context flow features as query vectors and inference flow features as key and value vectors, the context flow features are updated through cross-attention calculation.

[0014] S22, Context flow to inference flow update: Using the updated inference flow features as the query vector and the updated context flow features as the key vector and value vector, the inference flow features are updated through cross-attention calculation; through multiple rounds of iteration, deep fusion of system-level temporal features is achieved.

[0015] Furthermore, the calculation of the confidence score in S3 specifically involves: after each iteration, inputting the current inference flow features into a small multilayer perceptron and outputting a scalar confidence score. ,in , This represents the current iteration round.

[0016] Furthermore, in S4, the dynamic gating loss function is used to calculate the dynamic gating loss. Defined as:

[0017] ;

[0018] in, For the first Round Iteration Prediction Results With real labels Cross-entropy loss between; λ is a hyperparameter; This is an uncertainty penalty term, and its penalty strength increases with the number of iterations. It increases as it increases.

[0019] Furthermore, the design of the dynamic gating loss function guides model training through three stages:

[0020] (1) Suppression phase: In the early stage of training, when the cross-entropy loss At that time, the loss function affects the confidence score When the gradient is positive, the model tends to maintain a low confidence level.

[0021] (2) Enhancement phase: As training progresses, when When the gradient is negative, the model is driven to increase its confidence.

[0022] (3) Early departure incentives: due to the penalty items and Proportional to this, the model is motivated to achieve higher confidence levels in earlier iterations.

[0023] Furthermore, the early exit judgment mechanism in S4 is as follows: during the verification or testing phase, a confidence threshold θ is set; if a sample exits the iteration early in the first iteration... The confidence score calculated after rounds of iteration If the value is greater than or equal to θ, then immediately terminate subsequent iterations, starting with the current iteration. The reasoning features and classification results of the wheel are used as the final output.

[0024] Secondly, the present invention provides a confidence-driven dynamic gating fault detection system, comprising:

[0025] The spatiotemporal feature input module is used to receive preprocessed spatiotemporal feature data from multiple oil well sensors;

[0026] The iterative temporal reasoning module is used to perform multi-round dual-stream attention iterative operations on the input spatiotemporal features to generate system-level temporal reasoning features;

[0027] The confidence assessment module is used to calculate a confidence score based on the current inference features after each iteration.

[0028] The dynamic gating decision module is used to make early exit judgments based on confidence scores and calculate dynamic gating loss to guide model training;

[0029] The classification output module is used to classify faults based on the output of the final iteration or early exit.

[0030] The technical effect of the system disclosed in this invention is that, through modular integration of iterative reasoning, confidence assessment and dynamic gating functions, the system constructs a fault detection device that can adaptively adjust the computation depth and output quantitative confidence results, providing an efficient and reliable automated diagnostic solution for industrial sites.

[0031] Furthermore, the iterative temporal reasoning module includes an initial encoding unit, a context flow unit, an inference flow unit, and a cross-attention calculation unit; the context flow unit and the inference flow unit perform bidirectional information interaction and updates through the cross-attention calculation unit in each iteration.

[0032] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method. Attached Figure Description

[0033] Figure 1 This is a flowchart illustrating a confidence-driven dynamic gating fault detection method proposed in an embodiment of the present invention.

[0034] Figure 2 This is a schematic diagram of a single iteration process of the iterative temporal reasoning module provided in an embodiment of the present invention;

[0035] Figure 3 This is a schematic diagram of the training and inference process of the confidence-driven dynamic gating mechanism provided in an embodiment of the present invention;

[0036] Figure 4 This is a schematic diagram illustrating the convergence process and confidence distribution of the dynamic gated loss function provided in an embodiment of the present invention.

[0037] Figure 5 A schematic diagram illustrating the evolution of the model iterative inference depth during the verification phase, as provided in an embodiment of the present invention.

[0038] Figure 6 This is a schematic diagram comparing the performance of iterative inference under different strategies provided in the embodiments of the present invention, wherein the arrows indicate the direction of optimal performance;

[0039] Figure 7 This is a schematic diagram of the density distribution of model confidence during the testing phase, provided in an embodiment of the present invention. Detailed Implementation

[0040] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0041] The deep learning models used for fault detection in the oil and gas production field, as mentioned in the background technology, suffer from a contradiction between computational efficiency and adaptability, and lack quantification of decision confidence. Therefore, this invention provides a confidence-driven dynamic gating fault detection method. This embodiment uses the detection of two typical faults in offshore oil wells (Fault 2: false closure of downhole safety valve; Fault 8: pipeline hydrate formation) as application scenarios to demonstrate the implementation process of the method and system described in this invention. The original data uses the 3W dataset and has undergone preprocessing such as spatial relationship modeling as described in this application, resulting in node feature sequences rich in spatiotemporal information.

[0042] refer to Figures 1 to 4 As shown, the specific steps include:

[0043] Step S1: Receive spatiotemporal feature data.

[0044] Assume that after preprocessing, the input features at each time step are F∈R C’×d Where C' is the number of effective sensor nodes (e.g., 10), and d is the feature dimension of each node (e.g., 16-dimensional, obtained from the output of spatial graph convolution). The features from T consecutive time steps are stacked to obtain the input sequence X∈R. T×C’×d First, it is transformed into the model's internal dimension d through a linear projection layer. model (e.g., 32-dimensional), to obtain the initial spatiotemporal feature data H (0) ∈R T×C’×dmodel .

[0045] Step S2: Iterative temporal reasoning. Initialize context flow features. and reasoning flow All Set the maximum iteration round N=5. For the _th ( =1,2,...,N) iterations:

[0046] S21, Inference flow to context flow update: update the context flow features from the previous round. As the query vector Q, the features of the previous round of inference flow are used. As a key vector Value vector V. Calculate cross-attention:

[0047] ;

[0048] in, It is a scaling factor. The attention output is used to update the context stream, resulting in... This step can be understood as using the current "instant judgment" to revise and enrich the "background knowledge".

[0049] S22, Context flow to inference flow update: Update the current inference flow features. as query vector The newly updated context stream As the key vector K' and value vector V', we recalculate the cross-attention:

[0050] ;

[0051] Attention output is used to update the inference flow, resulting in This step can be understood as re-examining and revising the "instant judgment" based on the updated and more accurate "background knowledge".

[0052] After one iteration, both stream features undergo a deep interaction and refinement. This process is repeated, resulting in the inference stream features for the k-th round. This is the system-level time-series inference output for this round.

[0053] This iterative mechanism breaks away from the traditional unidirectional deep stacking of encoders. Through bidirectional, multi-round attention interactions, it can effectively capture complex system-level correlations across sensors and time. For example, it can learn the combined pattern of "annular pressure drop" and "slight rise in outlet temperature" at a specific time lag, which is an early sign of some slow faults.

[0054] Step S3: Calculate the confidence score. After the k-th iteration, extract the inference flow features. Global average pooling is performed across the time and sensor node dimensions to obtain a d model A vector of dimension. Input this vector into a lightweight multilayer perceptron (MLP), which can be designed as follows:

[0055] ;

[0056] The Sigmoid function restricts the output to the interval (0,1], which serves as the confidence score for this iteration. This score represents the model's level of confidence in the judgment based on the current "depth of thought".

[0057] Step S4, belief-driven dynamic gating, exhibits different behavioral patterns during the training and inference phases. Specifically, it includes the following steps:

[0058] S41. Training phase: During training, a complete N-round iteration is performed. After each round of iteration, in addition to calculating the confidence score , it will also be input into a classification head (such as a linear layer + Softmax) to obtain the prediction result of the k-th round of iteration , and calculate its cross-entropy loss with the true label . Then, calculate the dynamic gating loss function for the k-th round , which is defined as: ;

[0059] ;

[0060] where λ is a hyperparameter, for example, set to 0.1. The first term is the weighted classification loss, which encourages high confidence accompanied by low classification error. The second term is the uncertainty penalty, which is proportional to the iteration round k, punishes low confidence, and the penalty intensity increases as the iteration deepens, strongly motivating the model to achieve high confidence in earlier rounds. The total training loss of the model is the sum of the losses of all rounds: . Through backpropagation optimization, the model learns to make confident judgments while accurately classifying.

[0061] S42. Inference / Testing phase: During inference, we enable an early exit mechanism. Set a confidence threshold θ, for example, θ = 0.95. Starting from the first round of iteration:

[0062] Perform the iteration and obtain the confidence score . Judgment: If ≥ θ, then immediately terminate the subsequent iteration, and send the current of the k-th round into the classification head to obtain the final prediction. If and k < N, then proceed to the next round of iteration. If the threshold is still not met when the maximum iteration round N is reached, then force the use of the output of the N-th round.

[0063] Technical effect: This gating mechanism is the key to the high efficiency and high reliability of this invention. The design of the loss function guides confidence learning from the gradient, while the early exit mechanism realizes the dynamic allocation of computing resources. Experiments show that approximately 80% of the samples can meet the threshold and exit after 1 - 2 rounds of iteration, saving an average of 20 - 25% of the computational amount. At the same time, the confidence distribution of the exited samples is highly concentrated above 0.95, ensuring the reliability of the early exit decision.

[0064] Step S5, classification output. Finally, the classification head (a linear layer) will use the selected inference flow features The logits are mapped to each fault category and then transformed into a probability distribution p using the Softmax function. The system output is: the predicted fault category. and the corresponding confidence score. This confidence level can be directly used for subsequent decisions; for example, when c... final An alarm work order is automatically triggered when the value is >0.98, and when it is 0.8... <c final When the value is less than 0.98, a manual review is requested.

[0065] Overall technical effectiveness verification: Experiments on the 3W dataset show that for rapidly evolving fault 2, this method significantly reduces inference computation while maintaining an F1 score of 0.9955. Particularly in long-term evolving fault 8, the F1 score reaches 0.97, with a false negative rate as low as 0.02, while reducing inference computation by 20-25%, and the confidence distribution is significantly better than that of a fixed iteration baseline. This demonstrates the comprehensive advantages of this invention in improving efficiency, ensuring reliability, and enhancing the ability to detect complex faults.

[0066] The following is an experimental verification and analysis:

[0067] 1. Iterative inference depth data ( Figure 5 On the validation set, as the training process progresses (after approximately 10 epochs), the model in most cases only requires one iteration to meet the confidence threshold (0.95), thus triggering early exit. In a few cases, it exits on the second iteration. Compared to the baseline model with a fixed 5 iterations, the inference computation load of the method in this application is significantly reduced to 20%–25% of the original.

[0068] 2. Iterative inference performance data ( Figure 6 In pure iterative testing without gating, increasing the number of iterations can significantly improve performance. For complex Class-8 faults, increasing from 0 iterations to 1 iteration increased the MCC from 0.89 to 0.97; after increasing to 5 iterations, the MCC reached 0.99, and the false negative rate (FNR) decreased by 2.7 times, while the false positive rate (FPR) decreased by 4.4 times.

[0069] Among them, (1) ITR.A does not use the iterative inference module and directly uses MLP classification; (2) ITR.B uses the iterative inference module, but only iterates once and uses cross-entropy as the loss function; (3) ITR.C uses the iterative inference module, iterates 5 times and uses cross-entropy as the loss function.

[0070] 3. Decision reliability (confidence distribution) data ( Figure 7Analysis of the model confidence distribution during the testing phase using Gaussian kernel density estimation revealed that the model employing the gating strategy described in this application exhibits a highly concentrated confidence distribution in the region approaching 1.0, forming a sharp density peak (approximately 2500). In contrast, the baseline model (ITR.C) without confidence gating constraints primarily hovers around the highly uncertain decision boundary of 0.55–0.60.

[0071] Beneficial effects:

[0072] (1) While ensuring high accuracy, the inference process is greatly accelerated: The confidence-driven dynamic gating mechanism and the loss function with penalty term proposed in this method are extremely successful. It gives the model the ability to accurately quantify its own decision certainty, enabling the model to decisively trigger "early exit" when it reaches an engineering-acceptable high confidence level (such as 0.95). Experiments have shown that this reduces the amount of inference computation by 75% to 80%, perfectly meeting the needs of industrial edge devices for low latency and low computing power consumption.

[0073] (2) Significantly improved reliability and determinism of fault alarms: Maximizing classification accuracy is not the only goal of this application; the core is to improve the "determinism" of prediction. The kernel density distribution of the test data proves that after introducing the dynamic gating loss function (using prediction uncertainty as an iterative penalty term), the model completely gets rid of the defect of traditional neural networks that easily outputs "ambiguous" probabilities. The high-confidence alarms (close to 100% determinism) provided by the system can greatly reduce the cost of manual review and provide a reliable foundation for automated decision-making in oil production safety.

[0074] (3) Overfitting prevention and adaptive depth adjustment: By comparing simple faults (Class-2) and complex faults (Class-8), it was verified that the dynamic system can adaptively allocate computing resources according to the evolution difficulty of different faults. Even when using deep inference for simple modes, it did not cause overfitting and has strong robustness.

[0075] Based on the same inventive concept, embodiments of the present invention also provide a confidence-driven dynamic gating fault detection system for performing the method, comprising:

[0076] The spatiotemporal feature input module is used to receive preprocessed spatiotemporal feature data from multiple oil well sensors;

[0077] The iterative temporal reasoning module is used to perform multi-round dual-stream attention iterative operations on the input spatiotemporal features to generate system-level temporal reasoning features;

[0078] The confidence assessment module is used to calculate a confidence score based on the current inference features after each iteration.

[0079] The dynamic gating decision module is used to make early exit judgments based on confidence scores and calculate dynamic gating loss to guide model training;

[0080] The classification output module is used to classify faults based on the output of the final iteration or early exit.

[0081] Based on the same inventive concept, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method.

[0082] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of the invention as set forth in the appended claims.

Claims

1. A confidence-driven dynamic gating fault detection method, characterized in that, include: S1 receives pre-processed spatiotemporal characteristic data of oil well multi-sensor; S2, input the spatiotemporal feature data into the iterative temporal reasoning model, and generate temporal reasoning features through multiple rounds of dual-stream attention iterative computation; S3, after each iteration, calculate the confidence score based on the temporal inference features of the current iteration; S4. Based on the confidence score, use the confidence-driven dynamic gating mechanism to determine whether to exit the iteration early, and calculate the dynamic gating loss to optimize the iterative temporal inference model. S5, based on the final iteration output or the output when exiting early, performs fault classification and outputs the detection results; The calculation of the confidence score in S3 specifically involves: after each iteration, inputting the current inference flow features into a small multilayer perceptron and outputting a scalar confidence score. ,in , This refers to the current iteration round; The dynamic gating loss function used in S4 to calculate the dynamic gating loss. Defined as: ; in, For the first Round Iteration Prediction Results With real labels Cross-entropy loss between; λ is a hyperparameter; This is an uncertainty penalty term, the severity of which varies with the number of iterations. Increase and grow; The design of the dynamic gating loss function guides model training through three stages: (1) Suppression phase: In the early stage of training, when the cross-entropy loss At that time, the loss function affects the confidence score When the gradient is positive, the model tends to maintain a low confidence level. (2) Enhancement phase: As training progresses, when When the gradient is negative, the model is driven to increase its confidence. (3) Early departure incentives: due to the penalty items and Proportional to this, the model is motivated to achieve higher confidence levels in earlier iterations.

2. The confidence-driven dynamic gating fault detection method according to claim 1, characterized in that, The iterative temporal reasoning model in S2 employs a dual-stream attention mechanism, including a context stream and a reasoning stream. A single iteration process includes: S21, Inference Flow to Context Flow Update: Using context flow features as query vectors and inference flow features as key and value vectors, the context flow features are updated through cross-attention calculation. S22, Context flow to inference flow update: Using the updated inference flow features as the query vector and the updated context flow features as the key vector and value vector, the inference flow features are updated through cross-attention calculation; through multiple rounds of iteration, deep fusion of system-level temporal features is achieved.

3. The confidence-driven dynamic gating fault detection method according to claim 1, characterized in that, The mechanism for early exit from iteration described in S4 is as follows: During the verification or testing phase, a confidence threshold θ is set; if a sample exits the iteration prematurely in the first iteration... The confidence score calculated after rounds of iteration If the value is greater than or equal to θ, then immediately terminate subsequent iterations, starting with the current iteration. The reasoning features and classification results of the wheel are used as the final output.

4. The confidence-driven dynamic gating fault detection method according to claim 1, characterized in that, The preprocessing in S1 includes cleaning and aligning the raw sensor data, and extracting dual-view features containing state and trend.

5. A confidence-driven dynamic gating fault detection system for performing the method of any one of claims 1-4, characterized in that, include: The spatiotemporal feature input module is used to receive preprocessed spatiotemporal feature data from multiple oil well sensors; The iterative temporal reasoning module is used to perform multi-round dual-stream attention iterative operations on the input spatiotemporal features to generate system-level temporal reasoning features; The confidence assessment module is used to calculate a confidence score based on the current inference features after each iteration. The dynamic gating decision module is used to make early exit judgments based on confidence scores and calculate dynamic gating loss to guide model training; The classification output module is used to classify faults based on the output of the final iteration or early exit.

6. The confidence-driven dynamic gating fault detection system according to claim 5, characterized in that, The iterative temporal reasoning module includes an initial encoding unit, a context flow unit, an inference flow unit, and a cross-attention calculation unit; the context flow unit and the inference flow unit perform bidirectional information interaction and updates through the cross-attention calculation unit in each iteration.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 4.