A pumping unit working condition recognition method based on orthogonal depth hashing and graph reasoning

CN122673791APending Publication Date: 2026-09-01NANJING FUDAO OIL & GAS INTELLIGENT CONTROL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610684777.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-18
Publication Date
2026-09-01

AI Technical Summary

Technical Problem

由于卷积神经网络提取的特征在各个维度上往往存在较高的相关性(Coupling),直接二值化生成的哈希码在汉明空间中分布不均匀,导致各二进制位携带的信息重叠

Benefits of technology

[0083]1) 采用的正交深度哈希网络解决了传统哈希检索的冲突与负载不均问题,通过在深度哈希网络训练中引入正交约束损失(Orthogonal Loss)和量化损失,本发明强制生成的二进制哈希码各维度间互不相关,最大化了编码的信息熵。这一策略有效克服了传统方法(如直接截断或均值二值化)造成的哈希桶负载严重不均衡现象,确保了海量样本在汉明空间中的均匀分布,显著提升了粗筛阶段的召回率与检索速度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122673791A_ABST
    Figure CN122673791A_ABST
Patent Text Reader

Abstract

This invention discloses a method for identifying the operating conditions of a pumping unit based on orthogonal depth hashing and graph reasoning, comprising: (1) acquiring, labeling, classifying, and training an orthogonal depth hashing network; (2) using the trained orthogonal depth hashing network to extract features from each dynamometer in the sample set, generating and saving bit-independent binary hash codes; (3) constructing an inverted index library based on the hash codes of different sample graphs, storing the storage node information of different sample graphs in the corresponding hash buckets; (4) acquiring the load and displacement data collected by the dynamometer of the pumping well to be detected, and drawing the dynamometer; (5) performing pumping condition fusion reasoning judgment based on a graph convolutional network with dual sorting. The binary hash codes generated by this invention are mutually uncorrelated in each dimension, maximizing the information entropy of the encoding. This ensures the uniform distribution of massive samples in Hamming space, significantly improving the recall rate and retrieval speed in the coarse screening stage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of oil well production and pumping, specifically to a method for identifying the operating conditions of pumping units based on orthogonal depth hashing and graph reasoning. Background Technology

[0002] Pumping units, commonly known as "nodding donkeys," are the most important lifting equipment in oil extraction and production. During the pumping process, pumping units often experience various malfunctions due to complex downhole factors such as formation fluid supply capacity, pump and valve wear, and gas influence. Dynamometer cards, as closed curves recording the relationship between suspension point load and displacement, contain rich downhole operating information and are the core basis for judging the operating status of pumping units. Timely and accurate identification of the operating conditions represented by the dynamometer card is of great significance for ensuring safe oil well production and improving oil recovery.

[0003] With the development of Industrial Internet of Things (IIoT) and artificial intelligence (AI) technologies, the automatic identification of dynamometer cards using deep learning has become an industry trend. Early research mainly relied on convolutional neural networks (CNNs) for end-to-end classification (e.g., using softmax layers to output categories). However, traditional classification models suffer from "black box" characteristics, lack interpretability, and have poor ability to identify complex faults or new fault types (open set problems) not present in the training set. Therefore, the technical approach based on "image retrieval" and "case-based reasoning (CBR)" has gradually gained attention. This type of method calculates the similarity between the image to be tested and a historical sample library, retrieves the most similar historical cases as evidence, and then derives a diagnostic result through fusion reasoning, exhibiting strong interpretability and robustness.

[0004] However, existing image retrieval-based working condition identification methods (including some techniques that incorporate hash algorithms) still suffer from the following significant technical bottlenecks and shortcomings in practical applications:

[0005] First, the feature encoding has high redundancy, which limits the efficiency of hash retrieval.

[0006] Existing deep hashing methods typically utilize the intermediate layer features of pre-trained networks (such as ResNet50) for simple binarization (e.g., mean thresholding). Because the features extracted by convolutional neural networks often exhibit high correlation across dimensions, the hash codes generated by direct binarization are unevenly distributed in Hamming space, leading to overlap in the information carried by each bit. This can cause severe **hash collisions** (i.e., a large number of dissimilar samples are mapped to the same hash bucket), degrading the inverted index mechanism. The retrieval process still needs to traverse a large number of irrelevant samples, severely impacting retrieval speed and initial recall.

[0007] Second, global hash retrieval loses local details, leading to false recalls that are "similar in form but not in essence".

[0008] Hash algorithms are essentially a form of lossy dimensionality reduction compression, tending to preserve the global contour features of an image while ignoring subtle local textures. In dynamometer card diagnostics, the contours of many different operating conditions are extremely similar. For example, the overall shape of the dynamometer cards for "insufficient fluid supply" and "gas influence" operating conditions is similar to a "knife handle," differing only in the curvature or a small gap in the unloading line at the lower right corner. Traditional coarse comparisons based on Hamming distance cannot capture these crucial local differences, resulting in a large number of interference samples (false positives) with similar contours but drastically different operating conditions being mixed into the retrieved Top-N candidate set, directly reducing diagnostic accuracy.

[0009] Third, the evidence fusion mechanism is rigid and struggles to handle evidence conflicts and sample correlations.

[0010] After retrieving the Top-N similar samples, existing techniques typically employ weighted voting or Dempster-Shafer Theory for decision fusion. These methods often assume that the retrieved evidence samples are independent of each other, ignoring the potential manifold structure and topological relationships between samples. When outliers exist in the Top-N list or when there is significant evidence conflict (e.g., 3 images point to condition A, and 2 images point to condition B), traditional mathematical formulas struggle to effectively suppress noise interference, leading to low confidence in the final inference result and even misjudgments.

[0011] In summary, there is an urgent need for a method for identifying the operating conditions of oil pumping units that can generate highly independent and uniformly distributed hash codes, accurately capture local minor fault features, and utilize the topological relationships between samples for intelligent reasoning. Summary of the Invention

[0012] To address the problems existing in the background technology, this application proposes a method for identifying the operating conditions of oil pumping units based on orthogonal depth hashing and graph reasoning.

[0013] Technical solution:

[0014] This invention discloses a method for identifying the operating conditions of oil pumping units based on orthogonal depth hashing and graph reasoning, which includes the following steps:

[0015] (1) Obtaining, labeling, classifying, and training an orthogonal deep hashing network for dynamometer maps;

[0016] (2) Use the trained orthogonal deep hash network to extract features from each dynamometer in the sample set, and generate and save bit-independent binary hash codes;

[0017] (3) Construct an inverted index library based on the hash codes of different sample graphs, and store the storage node information of different sample graphs in the corresponding hash buckets;

[0018] (4) Obtain the load and displacement data collected by the dynamometer of the oil well to be tested, and draw the dynamometer diagram;

[0019] (5) Use a graph convolutional network with dual sorting to perform fusion reasoning and judgment of oil pumping conditions.

[0020] Preferably, the steps of acquiring, labeling, classifying, and training the indicator map include acquiring the indicator map, labeling and classifying the existing indicator map dataset, and training the orthogonal deep hash network using the labeled indicator map dataset, and saving the training weights; the specific steps are as follows:

[0021] (1-1) Obtain the load and displacement data collected by the dynamometer of the oil well, with displacement as the abscissa. The load is on the x-axis. The data is plotted as a diagram using the polygon drawing function toolkit in OpenCV.

[0022] (1-2) Business experts preprocess the indicator diagrams, remove those with obvious errors, and form an indicator diagram dataset;

[0023] (1-3) Business experts labeled and classified the dynamometer maps in the dynamometer map dataset. The labeled and classified dataset was then divided into training and test sets in a 7:3 ratio.

[0024] (1-4) The training set is fed into an orthogonal deep hash neural network for training; the activation function is ReLU, and the hash layer uses the Tanh activation function; the joint loss function is used to optimize the cost function. Its definition is as follows:

[0025]

[0026] Among them: Among them: To compare the loss, used to bring similar samples closer together and push apart dissimilar samples, the calculation formula is as follows: In the formula and For each sample pair, there is a continuous feature vector. A label indicator to indicate whether a sample pair belongs to the same type of operating condition (when the label indicates that the sample pair belongs to the same type of operating condition). When it does not belong to the same type of working condition label ), The preset boundary threshold, The number of sample pairs; To quantize the loss, used to reduce binarization error. and To balance the hyperparameters of the weights of each loss term, the calculation formula is as follows: ; The orthogonal constraint loss is used to constrain the Gram matrix of the hash code matrix to approximate the identity matrix, ensuring that the dimensions of the generated hash codes are uncorrelated. The calculation formula is as follows:

[0027]

[0028] In the formula, For batch size The hash code output matrix, Transpose it. It is the identity matrix. Denotes the Frobenius norm;

[0029] (1-5) Set the training termination condition: when the joint loss function... Training is stopped when the values ​​on the validation set no longer decrease for 10 consecutive epochs, or when the training rounds reach the preset maximum number of iterations; the trained network weights are then saved.

[0030] Preferably, the specific steps in step (2) of using the trained orthogonal deep hash network to extract features from each dynamometer image in the sample set and generate and save bit-independent binary hash codes are as follows:

[0031] (2-1) Input the dynamometer maps from the sample set into the backbone network of the orthogonal deep hash network to extract high-dimensional feature vectors. ;

[0032] (2-2) The high-dimensional feature vector Input to a fully connected hash layer, via a weight matrix Mapping and bias terms After offsetting, the eigenvectors are processed using the Tanh activation function to obtain continuous-value feature vectors. :

[0033]

[0034] (2-3) Using symbolic functions For the continuous value eigenvector Perform binarization to generate the binary hash code corresponding to the sample. :

[0035]

[0036] in, The generated binary hash code is represented by the first... Bit, The eigenvector representing the continuous value eigenvector is the first... Each element.

[0037] Preferably, the specific steps in step (3) of constructing the inverted index library based on the hash codes of different sample graphs are as follows:

[0038] (3-1) Initialize the hash table structure and set up multiple hash buckets;

[0039] (3-2) Use the sample binary hash code generated in step (2) as the unique index key Key of the hash bucket;

[0040] (3-3) The sample image ID, working condition label and metadata that generated the hash code are used as the value, mapped and stored in the corresponding hash bucket;

[0041] (3-4) For different samples that generate hash collisions, a linked list structure is used to append them to the same hash bucket to complete the construction of the inverted index from the hash code to the sample set.

[0042] Preferably, the step of performing oil pumping condition fusion inference and judgment based on a graph convolutional network with dual sorting specifically includes:

[0043] (5-1) Use an orthogonal depth hashing network to extract features of the dynamometer map to be detected.

[0044] The input test image is fed into a trained orthogonal deep hashing network to extract the spatial feature map of the test image. and global hash code ;

[0045] (5-2) Coarse screening and preliminary sorting

[0046] Using the generated global hash code As an index key, it enables fast matching in the inverted index; calculation The Hamming distance between the samples and the hash codes of the samples in the library is used to identify samples whose Hamming distance is less than a preset radius R as initial matching objects, thereby quickly obtaining M initial candidate samples.

[0047] (5-3) Refined reordering based on spatial attention mechanism

[0048] To address the issues of coarse sorting granularity and mixed interference samples in the initial ordered candidate set M, a spatial feature map is introduced for secondary fine sorting; the feature map to be tested is then calculated. With M initial candidate sample feature maps =1, 2, ..., M weighted similarity The initial order determined solely by Hamming distance in the initial screening stage is corrected by reordering candidate samples based on weighted similarity scores. This elevates truly similar samples to the top, selecting the leading ones. Zhang's most similar samples Top-N were used as the evidence set;

[0049] (5-4) Constructing an evidence association diagram

[0050] The test sample is the central node, the Top-N recommended samples are the neighboring nodes, the node features are the semantic feature vectors of the image, and the edge weights are the similarity between samples.

[0051] (5-5) Fusion Inference Based on Graph Convolutional Networks

[0052] A graph convolutional network (GCN) model is used to perform message passing and evidence aggregation on the evidence association graph, and the confidence probability distribution of the test sample belonging to each working condition is calculated. ;

[0053] (5-6) Output Results

[0054] Output the current operating condition status judgment result based on the confidence level.

[0055] Preferably, the global hash code of the dynamometer card to be detected is calculated. The specific steps are as follows:

[0056] (5-2-1) Input the dynamometer image to be tested into the backbone network to extract high-dimensional feature vectors. ;

[0057] (5-2-2) Transform the vector Input to a fully connected hash layer, via a weight matrix Mapping and Tanh activation function processing yield a continuous value vector. :

[0058]

[0059] In the formula, This represents the "bias vector" of the fully connected hash layer.

[0060] (5-2-3) Using symbolic functions For vectors Perform binarization to generate the final binary hash code. :

[0061]

[0062] in The first hash code Bit, Represents the first continuous value vector Each element.

[0063] Preferably, in step (5-3), the weighted similarity is calculated based on the spatial attention mechanism. The specific steps are as follows:

[0064] (5-3-1) Obtain the feature map to be tested With the Feature map of candidate samples Both dimensions are ;,in For the number of channels, , Spatial resolution;

[0065] (5-3-2) Calculate the absolute difference matrix of the feature maps ;

[0066] (5-3-3) Generating spatial attention masks using convolution operations ,in Indicates the kernel size as Convolutional layers, Use the Sigmoid activation function;

[0067] (5-3-4) Calculate the weighted similarity score :

[0068]

[0069] in This indicates the difference plot in the channel. ,Location The value at that location, The smaller the value, the higher the similarity.

[0070] Preferably, the specific steps for fusion inference based on graph convolutional networks in step (5-5) are as follows:

[0071] (5-5-1) Transformation from graph structure to matrix based on one-to-one mapping rules: The graph is mapped according to a preset order (e.g., first the test samples, then the Top-N samples). Each node is indexed and numbered. =0,1,2,…,N; Construct the node feature matrix X, and set the node number... The eigenvector of the nth node is directly used as the eigenvector of matrix X. Okay; construct adjacency matrix A, directly linking the nodes With nodes The edge weights (i.e., similarity scores) between the elements are assigned to the matrix elements. This completes the numerical mapping from non-Euclidean graph structures to Euclidean matrix forms.

[0072] (5-5-2) Constructing the normalized matrix: Calculating the adjacency matrix with added self-loops ( (as the identity matrix), and calculate the degree matrix. ,in It is a diagonal matrix, and its diagonal elements ;

[0073] (5-5-3) Feature aggregation: Perform feature propagation of the graph convolutional layer, the first... Layer node features The calculation formula is:

[0074]

[0075] in For the first The node feature matrix of the layer This is the learnable weight matrix for the current layer;

[0076] (5-5-4) Output: After multiple propagation layers, the set of probability distributions of the test sample nodes belonging to various working conditions is output through the Softmax layer. .

[0077] Preferably, step (5-6) further includes a difficult example feedback closed-loop mechanism, the specific steps of which are as follows:

[0078] (5-6-1) Determine whether the maximum confidence level output in step (5-5) is greater than the preset safety threshold;

[0079] (5-6-2) If the value is greater than the threshold, the working condition identification result will be output directly;

[0080] (5-6-3) If it is less than or equal to the threshold, it is determined to be an unknown working condition or a fuzzy sample, prompting manual intervention for verification; and the test dynamometer and its expert-verified label are stored in the difficult case mining database for subsequent incremental fine-tuning of the orthogonal deep hash network and graph convolutional network.

[0081] Preferably, the method further includes step (6): sending the working condition judgment result to the host computer for display.

[0082] Beneficial effects

[0083] 1) The orthogonal deep hashing network employed solves the collision and uneven load problems of traditional hash retrieval. By introducing orthogonal constraint loss and quantization loss during the training of the deep hashing network, this invention forces the generated binary hash codes to be uncorrelated across dimensions, maximizing the information entropy of the encoding. This strategy effectively overcomes the severe imbalance in hash bucket load caused by traditional methods (such as direct truncation or mean binarization), ensuring a uniform distribution of massive samples in the Hamming space and significantly improving the recall rate and retrieval speed in the coarse screening stage.

[0084] 2) This invention overcomes the bottleneck of coarse-grained and fine-grained recognition, which relies on superficial resemblance, by employing a dual sorting mechanism. After coarsely screening and extracting initial candidate samples, it introduces a spatial attention re-ranking mechanism for further sorting. The coarse screening significantly improves the screening speed, achieving preliminary identification of the "form." Then, a fine-grained screening of the "details" is performed: unlike traditional methods that rely solely on global hash codes for sorting, this method utilizes spatial feature maps to calculate pixel-level differences and automatically focuses on key local fault areas in the dynamometer card (such as minute gaps in the unloading line or changes in curvature at inflection points) through attention masks, effectively suppressing background noise interference. This corrects the accuracy loss caused by hash dimensionality reduction and achieves refined differentiation of similar working conditions.

[0085] 3) This invention utilizes Graph Convolutional Networks (GCNs) to construct an evidence association graph, achieving intelligent noise-resistant decision-making based on topological associations. It abandons the rigid assumption of "independent evidence" in traditional DS evidence theory. Through a message passing mechanism, the model can mine the manifold structure relationship between the test sample and the Top-N candidate samples. This means the model can automatically identify and suppress outlier noise samples in the candidate set (i.e., samples that are similar to the test graph but inconsistent with other candidate graphs), thus providing more robust and accurate judgment results in scenarios involving multiple scenarios or conflicting evidence.

[0086] 4) A difficult example feedback loop based on a confidence threshold is designed to help continuously improve the model's adaptive capability. This invention designs a difficult example feedback loop based on a confidence threshold. For ambiguous samples with low confidence, the system does not force a misclassification but instead transfers them to manual review and stores them in the difficult example database. This mechanism enables the model to continuously adapt to the dynamic drift of oilfield field conditions through subsequent incremental fine-tuning, solving the engineering problem of performance degradation over time after static model deployment. Attached Figure Description

[0087] Figure 1 This is an overall flowchart of the method of the present invention.

[0088] Figure 2 This invention provides a method for acquiring, labeling, classifying, and training indicator diagrams.

[0089] Figure 3 This is the graph for oil pumping condition fusion inference and judgment based on the dual-sorting graph convolutional network of the present invention.

[0090] Figure 4 This is a diagram of the orthogonal hash network structure of the present invention.

[0091] Figure 5 This is a diagram of the GCN network structure of the present invention.

[0092] Figure 6 The dynamometer diagram ID-505 for the insufficient liquid supply condition of this invention is shown.

[0093] Figure 7 This is a dynamometer diagram of the gas-affected operating conditions of the present invention.

[0094] Figure 8 This is the indicator diagram for the insufficient liquid supply condition of the present invention. Detailed Implementation

[0095] A method for identifying the operating conditions of pumping units based on orthogonal depth hashing and graph reasoning, combined with... Figure 1 The detailed process includes the following:

[0096] (1) Acquisition, labeling, classification, and training of indicator diagrams;

[0097] (1-1) Raw data acquisition and image rendering

[0098] Data source: Displacement discrete vectors are collected within a complete stroke cycle using a dynamometer installed at the suspension point of the pumping unit, at a sampling rate of 144 points / stroke. and load discrete vector .

[0099] Drawing processing: by displacement x-axis , load y-axis The `polylines` function from the OpenCV library is used to connect discrete points into a closed curve, and the canvas resolution is adjusted to generate a curve with a size of [size missing]. Single-channel grayscale image of a pixel.

[0100] Normalization: Normalizing image pixel values ​​from Normalization to The interval is used as the network input tensor.

[0101] (1-2) Dataset Construction and Partitioning

[0102] Business experts manually annotated 10,000 historical dynamometer diagrams to remove distorted samples caused by communication anomalies.

[0103] The dataset covers 10 typical operating conditions, including "normal", "insufficient fluid supply", "vacuum leakage", and "floating valve failure".

[0104] The dataset was randomly divided into a training set (7,000 images) and a test set (3,000 images) in a 7:3 ratio.

[0105] (1-3) Construction and Training of Orthogonal Deep Hash Networks

[0106] Network Structure: A deep network with ResNet50 as the backbone is constructed. The original fully connected layers are removed, and the feature maps output by Layer 4 are retained (dimensions). This is followed by a Global Average Pooling (GAP) layer and an output node with a number of... A fully connected hash layer, using the Tanh activation function to restrict the output to... .

[0107] Example of orthogonal constraint calculation: Setting batch size In one forward propagation, the hash layer outputs a continuous-value matrix. Calculate the Gram matrix. (dimension) ).

[0108] Ideally, It should approximate the identity matrix If the calculation reveals The off-diagonal elements (e.g., the covariance between the 1st and 2nd elements) are This indicates that these two features are highly correlated and redundant.

[0109] Through the joint loss function In The term generates a gradient penalty, forcing the network to adjust the weights during backpropagation until the off-diagonal elements approach 0, ensuring that the generated 48-bit hash code is uncorrelated across dimensions.

[0110] Combination Figure 4 As shown, this embodiment uses ResNet50 as the backbone network.

[0111] Dual-output mechanism: such as Figure 4 As shown, after passing through the ResNet50 convolutional layer group, the data stream is split into two paths at the Layer4 output.

[0112] Spatial feature output path: directly retains the dimension as Spatial feature map ( Figure 4 (Left branch) This feature map preserves the local geometric topology information of the dynamometer map and is dedicated to subsequent spatial attention reordering.

[0113] Hash-encoded output path: After the feature map is reduced to a 2048-dimensional vector by a global average pooling (GAP) layer, the number of input nodes is... A fully connected hash layer. The activation function is Tanh, and the output is a continuous-valued feature vector. .

[0114] Joint loss constraint mechanism: In order to solve the problem of directly using the sign function ( To address the gradient vanishing problem caused by binarization, this invention employs a continuous relaxation strategy. For example... Figure 4 As shown in the dashed box, no hard truncation is performed during the training phase; instead, a joint loss function is used. For continuous vectors Three-dimensional synchronization constraints are applied. The joint loss function is defined as:

[0115]

[0116] in and To balance the hyperparameters of the weights for each loss term, the specific constraint mechanisms for these three sub-terms are as follows:

[0117] 1. Quantification loss ( — Constraining numerical values ​​to approximate the vertices of a binarized hypercube.

[0118] Objective: Minimize a continuous vector With the final binary code The quantization error between them. The calculation formula is as follows: .

[0119] Example of use: Due to the characteristics of the Tanh function, the output may have the following characteristics: or Ambiguous values ​​in the unsaturated region. If binarization is directly forced ( This will produce a large error. This loss term is calculated... and The Euclidean distance results in a gradient penalty, forcing the network output to move towards... or The two ends converge, thus preserving the feature accuracy after binarization to a great extent.

[0120] 2. Orthogonal constraint loss ( — Constraint that the dimensions of the hash code are independent of each other.

[0121] Objective: To eliminate redundancy between feature dimensions, maximize the information entropy of hash encoding, and solve the problem of uneven load distribution in hash buckets. The calculation formula is as follows: .

[0122] Example of use: Setting batch size The continuous value matrix output by the network is: Calculate its Gram matrix. If the calculation reveals The off-diagonal elements (e.g., the covariance between the 1st and 2nd elements) are This indicates that these two features are highly coupled. The loss term forces the Gram matrix... Approximation of the identity matrix This drives the network to decouple features during backpropagation, ensuring that each bit of the generated 48-bit hash code represents an independent image feature (e.g., the first bit represents the gap and the second bit represents the curvature).

[0123] 3. Comparison of losses ( — Constraining the semantic clustering of similar samples in the feature space

[0124] Objective: To ensure that hash codes possess classification and discrimination capabilities, achieving "clustering" within the Hamming space. The calculation formula is:

[0125] .

[0126] Example of application: Extracting continuous feature vectors of sample pairs in a training batch. and , For label indicators, The preset boundary distance (Margin). If both extracted images are "insufficient fluid supply" samples ( The first part of the formula takes effect, strongly constraining the Euclidean distance between the two in the feature space to approach 0; if one is "insufficient liquid supply" and the other is "gas influence" ( The latter part of the formula takes effect when the distance between the two is less than the threshold. When the distance is greater than a certain value, the system will incur a severe gradient penalty to forcibly push the two apart. No penalty is incurred under certain conditions. This mechanism ensures that different operating conditions have clear boundaries in the feature space.

[0127] (2) Use the trained orthogonal deep hash network to extract features from each dynamometer in the sample set, and generate and save bit-independent binary hash codes;

[0128] Using one of the typical "insufficient fluid supply" sample images labeled ID-505 for training Figure 6 For example, the complete generation process is shown below:

[0129] (2-1) Backbone Feature Extraction

[0130] The preprocessed ID-505 image is input into the network.

[0131] Extract the spatial feature map before the GAP layer, denoted as... (For subsequent reordering).

[0132] A 2048-dimensional global feature vector is obtained after the GAP layer. .

[0133] (2-2) Hash Mapping and Binarization

[0134] Will The input hash layer is used to calculate a 48-dimensional continuous value vector. .

[0135] Binarization rule: Based on the sign function, if... but ,otherwise .

[0136] Full numerical display: The final 48-bit binary hash code generated for this sample For: 101011001110001010110110101010101011011000110101

[0137] (3) Construct an inverted index library based on the hash codes of different sample graphs, and store the storage node information of different sample graphs in the corresponding hash buckets;

[0138] (3-1) Index creation: Initialize the hash table structure.

[0139] (3-2) Storage Mapping: Use the 48-bit code 101011...0101 generated above as the index key. Store the sample ID-505 and its operating condition label "insufficient liquid supply" as the value in the corresponding hash bucket.

[0140] (3-3) Conflict handling: If a sample ID-608 generates the exact same hash code, it will be appended to ID-505 in the form of a linked list.

[0141] (4) Obtain the load and displacement data collected by the dynamometer of the oil well to be tested, and draw the dynamometer diagram.

[0142] Acquire load and displacement data collected by the dynamometer of the oil well to be tested, and use OpenCV to convert the load and displacement data...

[0143] The data is then plotted into a dynamometer diagram to be identified. (The method for plotting the dynamometer diagram involves using displacement as the x-axis and load as the y-axis, and employing polygon plotting functions in OpenCV to draw the data into a dynamometer diagram format.)

[0144] (5) Operating condition identification and judgment based on dynamometer diagram content retrieval and graph convolutional network fusion reasoning.

[0145] (6) Send the working condition judgment result to the upper-level display.

[0146] The overall process of dynamometer map acquisition, labeling, classification, and training mainly includes acquiring dynamometer maps, labeling and classifying existing dynamometer map datasets, training an orthogonal hash network using the labeled dynamometer map dataset, and saving the training weights. Combined with... Figure 2 The specific steps are as follows:

[0147] (1-1) Obtain the load and displacement data collected by the dynamometer of the oil well. With displacement as the x-axis and load as the y-axis, use the polygon drawing function toolkit in OpenCV to draw the data into a dynamometer diagram.

[0148] (1-2) Business experts preprocess the indicator diagrams, remove those with obvious errors, and form an indicator diagram dataset;

[0149] (1-3) Business experts labeled and classified the dynamometer maps in the dynamometer map dataset. The labeled and classified dataset was then divided into training set and test set in a 7:3 ratio.

[0150] (1-4) Construct a deep network with ResNet50 as the backbone. Remove the original fully connected layers and retain the feature maps (dimension 2048×7×7) output by Layer4. Then follow with a global average pooling layer (GAP) and a fully connected hash layer with L=48 output nodes. The activation function is Tanh to restrict the output to [-1,1].

[0151] (1-5) After training is completed, save the weights of the trained orthogonal hash network.

[0152] Combination Figure 3 The oil pumping condition fusion inference and judgment based on a double-sorting graph convolutional network, as described in the overall process, specifically includes:

[0153] (5-1) Extracting features of the indicator diagram to be detected

[0154] Obtain the dynamometer diagram of the insufficient fluid supply condition to be tested, such as... Figure 8 As shown, it is used as the graph to be tested. Input the trained network.

[0155] Extracting spatial feature maps (dimension) ).

[0156] Extract global hash code Assuming the generated The result is: 101011001110001010110110101010101011011000110111 (Note: Compared to ID-505 in the database, only the last two digits change from 01 to 11, and the Hamming distance is 1).

[0157] (5-2) Based on the global hash code Hq, perform a coarse screening search in the inverted index to obtain M initial candidate samples.

[0158] use Search in the inverted index. Set the Hamming distance radius. .

[0159] Search results: Since the distance is 1, the condition is met. The system retrieved results including ID-505. Zhang is the initial candidate sample.

[0160] Sample composition: Of these 50 images, 42 are genuine "insufficient fluid supply" samples, one of which is as follows: Figure 6 As shown; and 8 "gas-affected" interference samples with extremely similar outlines (false recall), one of which is as follows: Figure 7 As shown.

[0161] (5-3): Introduce a spatial attention mechanism to calculate the weighted similarity score between the image to be tested and the candidate samples, and sort them in descending order.

[0162] To eliminate the eight interfering samples, a fine-grained comparison at the feature map level was performed. The following demonstrates the specific matrix calculation process; for simplicity, the feature map dimensions are simplified to [missing information]. :

[0163] Comparison object: Image to be tested (Insufficient liquid supply, gap in the lower right corner, low eigenvalue) vs. interfering sample (Gas influence, bottom right corner is full, high eigenvalue).

[0164] The matrix of the graph to be tested :

[0165]

[0166] Interference sample matrix :

[0167]

[0168] (5-3-1) Calculate the absolute difference matrix :

[0169]

[0170] (Note: There are significant differences at the bottom right corners (2,2), (3,2), and (3,3).)

[0171] (5-3-2) Generate spatial attention mask :

[0172] The network learns through convolutional layers that the bottom right corner is the key region distinguishing these two operating conditions; therefore, the sigmoid activation outputs a high-weight mask.

[0173]

[0174] (5-3-3) Calculate the weighted similarity score :

[0175] Perform the Hadamard product (element-wise multiplication) and sum it:

[0176]

[0177]

[0178] In contrast, if it is a genuine "insufficient fluid supply" sample, its lower right corner feature value is also 0.1. ,final .

[0179] (5-3-4) Rearrangement and truncation:

[0180] System by Sort by size from smallest to largest. Distractor samples (2.02) are placed at the back of the queue, and truly similar samples (0.15) are placed at the front of the queue.

[0181] (5-4) Before selection The samples constitute a Top-N evidence set.

[0182] Combination Figure 5 As shown, this embodiment constructs an end-to-end graph inference module based on the GCN network.

[0183] Graph construction layer: such as Figure 5As shown at the top, the sample to be tested is the central node, and the Top-N evidence samples are the neighboring nodes. The weights of the connections between nodes ( The weighted similarity calculated in the preceding steps is used to determine the order of the samples. As a key optimization of the graph reasoning mechanism in this scheme, the Top-N samples are not independent of each other, but rather connected by mutually validating edges based on their internal feature similarities (forming...). Figure 5 (The implicit fully connected topology). This fully connected graph optimization provides the mathematical foundation for the subsequent "automatic noise isolation" capability of GCN.

[0184] Feature aggregation layer: such as Figure 5 As shown in the middle section, the graph structure is transformed into a normalized adjacency matrix. Perform matrix multiplication This process achieves feature message passing: the central node aggregates the working condition features of all Top-N neighbors, with highly similar neighbors (strong evidence) contributing more, while outliers (noise) with low similarity are suppressed. The aggregated features are then processed by the ReLU nonlinear activation function to form an updated feature matrix. .

[0185] Decision Output Layer: The features of the central node are extracted through the Readout operation, and the final working condition confidence distribution is output through a fully connected layer (FC) and a Softmax classifier.

[0186] (5-5) Combine the test sample with the Top-N sample to construct a fully connected evidence graph.

[0187] Establish 6 nodes: Node 0 (the graph to be tested), Nodes 1-5 (Top-5 evidence samples).

[0188] Each node carries a 2048-dimensional feature vector.

[0189] (5-6) Use graph convolutional networks (GCN) for message passing and evidence aggregation, and calculate the confidence level of each working condition.

[0190] (5-6-1) Constructing the adjacency matrix :

[0191] Cosine similarity is used to measure the directional consistency between node feature vectors, and is used as the edge weight. The formula is:

[0192]

[0193] Calculation Example: To visually demonstrate the calculation process, this embodiment simplifies the 2048-dimensional feature vector into a 4-dimensional vector for illustration.

[0194] Feature vector of node 0 (insufficient fluid supply):

[0195] Evidence node 1 (insufficient fluid supply) feature vector:

[0196] Noisy node 5 (normal) feature vector:

[0197] A. Calculate the edge weights between Node 0 and Node 1 (for similar samples):

[0198] 1) Dot product:

[0199] 2) Length of the module:

[0200] 3) Similarity:

[0201] Conclusion: The value is close to 1.0, indicating that the feature directions of the two are highly consistent, and a strong connection is established.

[0202] B. Calculate the edge weights (outlier noise) between Node 0 and Node 5:

[0203] 1) Dot product:

[0204] 2) Length of the module:

[0205] 3) Similarity:

[0206] Conclusion: The low numerical value indicates that the two features are uncorrelated, and a weak connection should be established.

[0207] C. Calculate the edge weights (inter-evidence associations) between Node 1 and Node 5:

[0208] 1) Dot product:

[0209] 2) Length of the module:

[0210] 3) Similarity:

[0211] Conclusion: The low numerical value indicates that the two features are uncorrelated, and a weak connection should be established.

[0212] Generating the final adjacency matrix: Based on the above calculation logic, traverse all node pairs to construct the adjacency matrix. (Partial) as follows:

[0213]

[0214] The similarity between Node 0 and Node 1 (strong evidence) is 0.95.

[0215] The similarity between Node 0 and Node 5 (weak evidence) is 0.345.

[0216] The similarity between Node 1 and Node 5 (conflict between pieces of evidence) is 0.30.

[0217] (5-6-2) Perform GCN feature aggregation:

[0218] Using formula Perform the calculation.

[0219] In matrix multiplication, the eigenvector update of Node 0 is a weighted sum of the features of its neighbors.

[0220]

[0221] Inference results: Due to the huge difference in weights (0.95 vs 0.345), the "normal" working condition features carried by Node 5 are greatly suppressed during the aggregation process, and the feature vector of Node 0 is forcibly corrected to move closer to the feature cluster center of "insufficient liquid supply".

[0222] (5-7) Determine whether the maximum confidence level of the output is greater than the preset safety threshold;

[0223] (5-7-1) If the value is greater than the threshold, the working condition identification result will be output directly;

[0224] (5-7-2) If it is less than or equal to the threshold, it is determined to be an unknown working condition or a fuzzy sample, prompting manual intervention for verification; and the test dynamometer and its expert-verified label are stored in the difficult case mining database for subsequent incremental fine-tuning of the orthogonal deep hash network and graph convolutional network.

[0225] (5-8) Output the current operating condition status judgment result

[0226] The Node 0 features output by GCN are input into the Softmax classification layer.

[0227] Output probability distribution:

[0228] Insufficient fluid supply: 0.96

[0229] Normal: 0.02

[0230] Other: 0.02

[0231] Judgment: Maximum confidence level (Preset safety threshold).

[0232] Final result: The system determines the current operating condition as "insufficient liquid supply" and outputs the result to the host computer interface in the central control room for display.

[0233] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

Claims

1. A method for identifying the operating conditions of an oil pumping unit based on orthogonal depth hashing and graph reasoning, characterized in that... It includes the following processes: (1) Obtaining, labeling, classifying, and training an orthogonal deep hashing network for dynamometer maps; (2) Use the trained orthogonal deep hash network to extract features from each dynamometer in the sample set, and generate and save bit-independent binary hash codes; (3) Construct an inverted index library based on the hash codes of different sample graphs, and store the storage node information of different sample graphs in the corresponding hash buckets; (4) Obtain the load and displacement data collected by the dynamometer of the oil well to be tested, and draw the dynamometer diagram; (5) Use a graph convolutional network with dual sorting to perform fusion reasoning and judgment of oil pumping conditions.

2. The method according to claim 1, characterized in that, The steps of obtaining, labeling, classifying, and training dynamometer maps include obtaining dynamometer maps, labeling and classifying existing dynamometer map datasets, training an orthogonal deep hash network using the labeled dynamometer map dataset, and saving the training weights. The specific steps are as follows: (1-1) Obtain the load and displacement data collected by the dynamometer of the oil well, with displacement as the abscissa. The load is on the x-axis. The data is plotted as a diagram using the polygon drawing function toolkit in OpenCV. (1-2) Business experts preprocess the indicator diagrams, remove those with obvious errors, and form an indicator diagram dataset; (1-3) Business experts labeled and classified the dynamometer maps in the dynamometer map dataset. The labeled and classified dataset was then divided into training and test sets in a 7:3 ratio. (1-4) The training set is fed into an orthogonal deep hash neural network for training; the activation function is ReLU, and the hash layer uses the Tanh activation function; the joint loss function is used to optimize the cost function. Its definition is as follows: Among them: Among them: To compare the loss, used to bring similar samples closer together and push apart dissimilar samples, the calculation formula is as follows: In the formula and For each sample pair, there is a continuous feature vector. A label indicator to indicate whether a sample pair belongs to the same type of operating condition. The preset boundary threshold, The number of sample pairs; To quantize the loss, used to reduce binarization error. and To balance the hyperparameters of the weights of each loss term, the calculation formula is as follows: ; The orthogonal constraint loss is used to constrain the Gram matrix of the hash code matrix to approximate the identity matrix, ensuring that the dimensions of the generated hash codes are uncorrelated. The calculation formula is as follows: In the formula, For batch size The hash code output matrix, Transpose it. It is the identity matrix. Denotes the Frobenius norm; (1-5) Set the training termination condition: when the joint loss function... Training is stopped when the values ​​on the validation set no longer decrease for 10 consecutive epochs, or when the training rounds reach the preset maximum number of iterations; the trained network weights are then saved.

3. The method according to claim 1, characterized in that, The specific steps in step (2) of extracting features from each power diagram in the sample set using the trained orthogonal deep hash network and generating and saving bit-independent binary hash codes are as follows: (2-1) Input the dynamometer maps from the sample set into the backbone network of the orthogonal deep hash network to extract high-dimensional feature vectors. ; (2-2) The high-dimensional feature vector Input to a fully connected hash layer, via a weight matrix Mapping and bias terms After offsetting, the eigenvectors are processed using the Tanh activation function to obtain continuous-value feature vectors. : (2-3) Using symbolic functions For the continuous value eigenvector Perform binarization to generate the binary hash code corresponding to the sample. : in, The generated binary hash code is represented by the first... Bit, The eigenvector representing the continuous value eigenvector is the first... Each element.

4. The method according to claim 1, characterized in that, The specific steps for constructing the inverted index library based on the hash codes of different sample graphs in step (3) are as follows: (3-1) Initialize the hash table structure and set up multiple hash buckets; (3-2) Use the sample binary hash code generated in step (2) as the unique index key Key of the hash bucket; (3-3) The sample image ID, working condition label and metadata that generated the hash code are used as the value, mapped and stored in the corresponding hash bucket; (3-4) For different samples that generate hash collisions, a linked list structure is used to append them to the same hash bucket to complete the construction of the inverted index from the hash code to the sample set.

5. The method according to claim 1, characterized in that, The steps for oil pumping condition fusion inference and judgment based on the graph convolutional network with dual sorting specifically include: (5-1) Use an orthogonal depth hashing network to extract features of the dynamometer map to be detected. The input test image is fed into a trained orthogonal deep hashing network to extract the spatial feature map of the test image. and global hash code ; (5-2) Coarse screening and preliminary sorting Using the generated global hash code As an index key, it enables fast matching in the inverted index; calculation The Hamming distance between the samples and the hash codes of the samples in the library is used to identify samples whose Hamming distance is less than a preset radius R as initial matching objects, thereby quickly obtaining M initial candidate samples. (5-3) Refined reordering based on spatial attention mechanism To address the issues of coarse sorting granularity and mixed interference samples in the initial ordered candidate set M, a spatial feature map is introduced for secondary fine sorting; the feature map to be tested is then calculated. With M initial candidate sample feature maps =1, 2, ..., M weighted similarity The initial order determined solely by Hamming distance in the initial screening stage is corrected by reordering candidate samples based on weighted similarity scores. This elevates truly similar samples to the top, selecting the leading ones. Zhang's most similar samples Top-N were used as the evidence set; (5-4) Constructing an evidence association diagram The test sample is the central node, the Top-N recommended samples are the neighboring nodes, the node features are the semantic feature vectors of the image, and the edge weights are the similarity between samples. (5-5) Fusion Inference Based on Graph Convolutional Networks A graph convolutional network (GCN) model is used to perform message passing and evidence aggregation on the evidence association graph, and the confidence probability distribution of the test sample belonging to each working condition is calculated. ; (5-6) Output Results Output the current operating condition status judgment result based on the confidence level.

6. The method according to claim 5, characterized in that... Calculate the global hash code of the dynamometer card to be tested. The specific steps are as follows: (5-2-1) Input the dynamometer image to be tested into the backbone network to extract high-dimensional feature vectors. ; (5-2-2) Transform the vector Input to a fully connected hash layer, via a weight matrix Mapping and Tanh activation function processing yield a continuous value vector. : In the formula, This represents the "bias vector" of the fully connected hash layer. (5-2-3) Using symbolic functions For vectors Perform binarization to generate the final binary hash code. : in The first hash code Bit, Represents the first continuous value vector Each element.

7. The method according to claim 5, characterized in that... In step (5-3), weighted similarity is calculated based on spatial attention mechanism. The specific steps are as follows: (5-3-1) Obtain the feature map to be tested With the Feature map of candidate samples Both dimensions are ;,in For the number of channels, , Spatial resolution; (5-3-2) Calculate the absolute difference matrix of the feature maps ; (5-3-3) Generating spatial attention masks using convolution operations ,in Indicates the kernel size as Convolutional layers, Use the Sigmoid activation function; (5-3-4) Calculate the weighted similarity score : in This indicates the difference plot in the channel. ,Location The value at that location, The smaller the value, the higher the similarity.

8. The method according to claim 5, characterized in that... The specific steps for fusion inference based on graph convolutional networks in step (5-5) are as follows: (5-5-1) Transformation from graph structure to matrix based on one-to-one mapping rules: The graph is mapped according to a preset order... Each node is indexed and numbered. =0,1,2,…,N; Construct the node feature matrix X, and set the node number... The eigenvector of the nth node is directly used as the eigenvector of matrix X. Okay; construct adjacency matrix A, directly linking the nodes With nodes The edge weights between the elements are assigned to the matrix elements. This completes the numerical mapping from non-Euclidean graph structures to Euclidean matrix forms. (5-5-2) Constructing the normalized matrix: Calculating the adjacency matrix with added self-loops And calculate the degree matrix. ,in It is a diagonal matrix, and its diagonal elements ; (5-5-3) Feature aggregation: Perform feature propagation of the graph convolutional layer, the first... Layer node features The calculation formula is: in For the first The node feature matrix of the layer This is the learnable weight matrix for the current layer; (5-5-4) Output: After multiple propagation layers, the set of probability distributions of the test sample nodes belonging to various working conditions is output through the Softmax layer. .

9. The method according to claim 5, characterized in that, Steps (5-6) also include a difficult example feedback closed-loop mechanism, the specific steps of which are as follows: (5-6-1) Determine whether the maximum confidence level output in step (5-5) is greater than the preset safety threshold; (5-6-2) If the value is greater than the threshold, the working condition identification result will be output directly; (5-6-3) If it is less than or equal to the threshold, it is determined to be an unknown working condition or a fuzzy sample, prompting manual intervention for verification; and the test dynamometer and its expert-verified label are stored in the difficult case mining database for subsequent incremental fine-tuning of the orthogonal deep hash network and graph convolutional network.

10. The method according to claim 1, characterized in that, It also includes step (6): sending the working condition judgment result to the upper-level display.