Pumping unit horsehair fracture detection method in low-light scene based on improved YOLO11
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-06-26
AI Technical Summary
Under low light conditions at night, the accuracy of YOLO-based diagnosis of pumping unit braid breakage is not high, resulting in low efficiency of manual inspection and difficulty in timely detection of problems, which cannot meet the needs of intelligent oilfield management.
An improved YOLO11 model is adopted, which integrates visible light and infrared light features through dual backbone modules, combines the CBAM attention mechanism and the adaptive PIOU loss function, uses the LAMP amplitude pruning algorithm to prune the model, and deploys it in the edge detection box for real-time detection.
It significantly improves the accuracy of detecting broken oil pumping unit braids under low light conditions, enables real-time monitoring around the clock, reduces manual inspection workload, lowers operating costs, ensures production safety, and improves the level of automation in oilfield production.
Smart Images

Figure CN121330456B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for detecting the breakage of oil pumping unit braids, and more particularly to a method for detecting the breakage of oil pumping unit braids in low-light scenarios based on an improved YOLO11, belonging to the field of intelligent oilfield detection technology. Background Technology
[0002] In oilfield production, the repair of braided pipe fracture faults on beam pumping units has long relied on manual inspection. This method has limitations and consumes a significant amount of manpower. Due to the wide distribution of pumping units and the harsh working environment, manual inspection not only requires a large number of specialized technicians but also suffers from low efficiency and long inspection cycles. Furthermore, braided pipe fractures often occur suddenly, making it difficult for manual inspections to detect problems in a timely manner. Moreover, manual inspections bear a heavy burden, especially at night or in complex environments such as rain and snow. This extensive maintenance model can no longer meet the needs of modern intelligent oilfield management, and there is an urgent need for a more efficient and accurate automated detection method.
[0003] In recent years, the rapid development of computer vision and deep learning technologies has provided new solutions for mechanical fault detection. Object detection algorithms, represented by YOLO, have shown great potential in the field of industrial inspection due to their efficient real-time processing capabilities and excellent feature extraction performance. YOLO11, the latest generation real-time object detection model launched by Ultralytics in 2024, has undergone several architectural optimizations based on YOLOv8. Through innovations such as C3k2, C2PSA, and DWConv, it has achieved breakthroughs in speed, accuracy, and lightweight design, becoming a new benchmark for real-time object detection. Its multi-task support and efficient deployment capabilities make it widely applicable in the industrial field. Furthermore, combined with edge computing technology, these algorithms can achieve millisecond-level real-time detection at the pumping unit site, and continuously optimize model performance through data accumulation. However, under low-light conditions at night, the accuracy of YOLO-based pumping unit braid breakage diagnosis is not high. Therefore, a method for detecting pumping unit braid breakage in low-light scenarios based on an improved YOLO11 is designed to address this problem. Summary of the Invention
[0004] The purpose of this section is to outline some aspects of embodiments of the present invention and to briefly describe some preferred embodiments. Simplifications or omissions may be made in this section, as well as in the abstract and title of this application, and such simplifications or omissions should not be construed as limiting the scope of the invention.
[0005] In view of the problems existing in the prior art, the present invention is proposed.
[0006] The purpose of this invention is to overcome the problem of low accuracy in diagnosing pumping unit braid breakage based on YOLO under low light conditions at night, and to provide a method for detecting pumping unit braid breakage in low light scenarios based on an improved YOLO11, which can significantly improve the accuracy of pumping unit braid breakage detection under low light conditions.
[0007] To solve the above technical problems, the present invention provides a method for detecting the breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11, which includes the following steps in sequence:
[0008] Step 1: Collect the image dataset of the braids on the pumping unit and preprocess it to obtain the preprocessed image dataset of the braids on the pumping unit.
[0009] Step 2: Based on the YOLO11 model, the YOLO11 model is improved by using the backbone1 and backbone2 dual backbone modules and integrating the CBAM attention mechanism and loss function;
[0010] Step 3: Train the improved YOLO11 model using the preprocessed oil pumping unit braid image dataset;
[0011] Step 4: Use the LAMP amplitude pruning algorithm to prune the trained YOLO11 model, and after verification, use it as the detection model and deploy the detection model at the pumping unit site.
[0012] Step 5: Acquire real-time video streams from cameras on the oil pumping unit's braids during operation, and use a detection model to perform real-time detection on them;
[0013] Step 6: In real time, determine whether the pumping unit braid has broken. If yes, proceed to step 7; otherwise, return to step 5.
[0014] Step 7: Upload the fault message and trigger an alarm on the web page.
[0015] Furthermore, step 1 specifically includes the following sub-steps:
[0016] Step 1.1: Equip the pumping unit with a dual-spectrum camera to monitor the pumping unit in real time and obtain both infrared and visible light video of the pumping unit's components.
[0017] Step 1.2: Segment the infrared video and visible light video to obtain the visible light braid dataset and the infrared light braid dataset;
[0018] Step 1.3: Use labelImg software to label the normal braids and broken braids in the visible light braid dataset and the infrared light braid dataset respectively. The visible light braid dataset and the infrared light braid dataset are divided into training subsets, validation subsets and test subsets in a ratio of 8:1:1.
[0019] Furthermore, in step 1.3, the training subsets of the visible light braid dataset and the infrared light braid dataset are respectively subjected to flipping, contrast transformation, noise addition, and cropping operations to expand their respective training subsets.
[0020] Furthermore, step 2 specifically includes the following sub-steps:
[0021] Step 2.1: Add a backbone module to the original YOLO11 model to form a dual backbone module. One is the visible light backbone 1 module to extract visible light features, and the other is the infrared light backbone 2 module to extract infrared light features, preserving the rich details and textures of visible light and the thermal radiation information of infrared light.
[0022] Step 2.2: Integrate the CBAM attention mechanism module into the backbone;
[0023] Step 2.3: The visible light and infrared features are fused through the feature fusion module to generate comprehensive features for target detection;
[0024] Step 2.4: Replace the original IOU loss function in the YOLO11 model with the PIOU loss function, and optimize the PIOU loss function by introducing a penalty factor that adapts to the target size and constructing a gradient adjustment mechanism based on the quality of the target box.
[0025] Furthermore, in step 2.2, a CBAM attention mechanism module is added after the last c3k2 module in the visible light backbone 1 module, and a CBAM attention mechanism module is also added after the last c3k2 module in the infrared light backbone 2 module.
[0026] Furthermore, in step 2.2, the added CBAM attention mechanism is an improved CBAM attention mechanism, which combines channel attention mechanism and spatial attention mechanism.
[0027] Furthermore, the channel attention mechanism is implemented by introducing a global average pooling and fully connected layer structure, specifically including the following steps:
[0028] Step 2.2.1: The channel attention mechanism first processes the feature map through a max pooling layer, reducing the feature map size from H×W×C to 1×1×C;
[0029] Step 2.2.2: Further extract features from the reduced 1×1×C image features through one-dimensional convolution, and then apply the sigmoid activation function to the output of the one-dimensional convolution to obtain the output of the channel attention mechanism;
[0030] Step 2.2.3: Multiply the output of the channel attention mechanism with the original image to restore it to the size of C×H×W.
[0031] Furthermore, the spatial attention mechanism module consists of a spatial attention preprocessing layer and a spatial attention processing layer, specifically including the following steps:
[0032] Step 2.2.4: The output of the channel attention mechanism is first subjected to max pooling and average pooling operations to generate two feature maps of size 1×H×W. These two feature maps are then concatenated using the Concat operation.
[0033] Step 2.2.5: The concatenated feature map is transformed into a 1-channel feature map by a 7×7 convolution kernel, and then processed by a sigmoid activation function to obtain the feature map of the spatial attention mechanism. This output is multiplied with the original image to restore it to the size of C×H×W, so as to comprehensively consider the attention feature map of channel and spatial information.
[0034] Furthermore, in step 2.3, the visible light feature F is fused using the feature fusion module FFN. vis The input is fed into convolution 1 for preliminary feature extraction, resulting in intermediate features f′. vis Infrared light feature F ir The input is fed into convolution 2 for preliminary feature extraction, resulting in intermediate features f′. ir ;f′ vis and f′ ir After convolution, the merged features are obtained by stitching them together again. The fused features are then convolved again to obtain the new features. Features Perform convolution again to obtain the fused feature f fusion .
[0035] Furthermore, step 2.4 specifically includes the following sub-steps:
[0036] Step 2.4.1: The PIOU loss function introduces an adaptive geometric constraint mechanism. By constructing a penalty factor P that depends only on the geometric properties of the true target box, robust optimization against changes in target scale is achieved. The penalty factor P is defined as follows:
[0037]
[0038] Where P is the penalty factor, W1 is the width of the predicted box extending beyond the left side of the true target box, W2 is the width of the predicted box extending beyond the right side of the true target box; H1 is the height of the predicted box extending beyond the top of the true target box, H2 is the height of the predicted box extending beyond the bottom of the true target box; W gt h is the width of the target bounding box. gt The height of the target bounding box;
[0039] Step 2.4.2: Construct a gradient adjustment mechanism based on the quality of the target bounding box, introducing a penalty function f(p), where:
[0040]
[0041] The penalty function f(p) maximizes the gradient of moderately sized predicted boxes and allows for rapid regression to the vicinity of the target box; PIOU loss function:
[0042] PIOU = IOU - f(p), -1 ≤ PIOU ≤ 1
[0043] L PIOU =1-PIOU=L IOU +f(p),0≤L PIOU ≤2
[0044] Where IOU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box, L PIOU L represents the loss value of PIOU. IOU This represents the loss value of IOU.
[0045] Furthermore, step 3 specifically includes the following sub-steps:
[0046] Step 3.1: Set the training environment of the YOLO11 model to the PyTorch deep learning framework and use GPU acceleration;
[0047] Step 3.2: Configure training hyperparameters, set the batch size to 16, the number of iterations to 300, and the initial learning rate to 0.01. Enable Mosaic for data augmentation during model training and disable Mosaic in the last 10 rounds of training.
[0048] Step 3.3: Validate the trained model. When the mAP@0.5 of the validation set reaches more than 92% and the recall of the test set is greater than 90%, the validation is successful. This ensures that the model achieves excellent detection performance while avoiding overfitting.
[0049] Furthermore, step 4 specifically includes the following sub-steps:
[0050] Step 4.1: Prune the trained YOLO11 model using the LAMP amplitude pruning algorithm based on layer adaptive sparsity;
[0051] Step 4.2: Validate the pruned YOLO11 model. If the validation is successful, it will be used as the detection model.
[0052] Step 4.3: Deploy the detection model in the edge detection box at the pumping unit site.
[0053] Furthermore, in step 4.1, the LAMP score calculation formula is as follows:
[0054]
[0055] In the formula: (W[μ]) 2 The weights of the target connection are squared, ∑ v≥μ (W[v]) 2 This is the sum of squared weights for connections with indices greater than μ in the current layer; the larger the squared weight, the higher the corresponding LAMP score and the greater the importance; weights with lower scores are considered relatively unimportant and are pruned.
[0056] Furthermore, in step 4.2, when the mAP@0.5 of the validation set is greater than 90% and the recall rate is greater than 85%, the model is judged to be qualified.
[0057] In step 4.3, the detection model is converted into RKNN format and deployed in the edge detection box. The edge detection box is equipped with Rockchip RK3588 processor, which has an NPU with a computing power of 6 TOPS, and can efficiently process video streams.
[0058] Furthermore, in step 5, the dual-spectrum camera at the oilfield site obtains real-time visible light and infrared light video streams as input information for the edge detection box; the camera address is provided to the edge detection box, which then obtains the real-time video stream of the pumping unit and uses the deployed YOLO detection model to detect the pumping unit's hairline.
[0059] Furthermore, in step 6, the detection of whether the oil pumping unit's braid is broken is performed by an edge detection box deployed on-site, which retrieves information from a dual-spectrum camera for online identification and diagnosis.
[0060] Compared to the prior art, the advantages or beneficial effects of the embodiments of this application include at least the following:
[0061] 1. This invention improves the YOLO11 network backbone by using two backbone modules, which take visible light images and infrared light images as input respectively. This preserves the rich details and textures of visible light and the thermal radiation information of infrared light. Furthermore, CBAM attention modules are added to the two backbones, backbone1 and backbone2, to improve the model's feature extraction capabilities.
[0062] 2. The improved CBAM attention mechanism module combines channel attention and spatial attention mechanisms to enhance the model's sensitivity to key features and effectively improve the feature extraction capability of the YOLO11 model.
[0063] 3. To address the gradient instability issue of traditional loss functions in scale-changing scenarios, the loss function of the YOLO11 network was improved, resulting in a 6% increase in mAP@0.5 and improved detection accuracy in the oil pumping unit hair detection task.
[0064] 4. The LAMP amplitude pruning algorithm is used to prune the trained YOLO11 model to achieve lightweighting and facilitate deployment in the edge detection box on site; the edge detection box processes the video stream locally on site, reducing bandwidth consumption and shortening the fault detection latency;
[0065] 5. It greatly reduces the workload of manual inspections, realizes real-time monitoring around the clock, improves the level of automation in oilfield production, and reduces the operating costs of oilfields; it can reliably identify malfunctions around the clock and issue timely alarms, and can immediately carry out maintenance once a malfunction occurs, effectively avoiding the potential safety risks caused by long-term shutdowns and ensuring the production safety of oilfield well stations; it greatly reduces downtime, improves economic efficiency, and provides an excellent technical approach for accelerating the construction of smart oilfields. Attached Figure Description
[0066] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings are provided for reference and illustration only and are not intended to limit the present invention.
[0067] in:
[0068] Figure 1 This is a flowchart of the method for detecting the breakage of the oil pumping unit braid in low-light scenarios based on the improved YOLO11 of the present invention;
[0069] Figure 2 To improve the YOLO11 network structure diagram;
[0070] Figure 3 Here is a structural diagram of the feature fusion module;
[0071] Figure 4 A geographic information system-based interface for the location distribution and real-time video monitoring of oil pumping units;
[0072] Figure 5 The preview interface for the oil pumping unit's broken braid alarm shows a video pop-up displaying real-time monitoring footage of the faulty oil pumping unit.
[0073] Figure 6 This is the alarm details page for the broken braid of the oil pump. Detailed Implementation
[0074] To make the technical means, creative features, objectives, and effects of this invention easier to understand, the invention is further described below with reference to specific illustrations. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them.
[0075] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
[0076] like Figure 1 As shown, the present invention provides a method for detecting the breakage of oil pumping unit braids in low-light conditions based on the improved YOLO11, which includes the following steps in sequence:
[0077] Step 1: Collect the image dataset of the braids on the pumping unit and preprocess it to obtain the preprocessed image dataset of the braids on the pumping unit.
[0078] Step 2: Based on the YOLO11 model, the YOLO11 model is improved by using the backbone1 and backbone2 dual backbone modules and integrating the CBAM attention mechanism and loss function;
[0079] Step 3: Train the improved YOLO11 model using the preprocessed oil pumping unit braid image dataset;
[0080] Step 4: Use the LAMP amplitude pruning algorithm to prune the trained YOLO11 model, and after verification, use it as the detection model and deploy the detection model at the pumping unit site.
[0081] Step 5: Acquire real-time video streams from cameras on the oil pumping unit's braids during operation, and use a detection model to perform real-time detection on them;
[0082] Step 6: In real time, determine whether the pumping unit braid has broken. If yes, proceed to step 7; otherwise, return to step 5.
[0083] Step 7: Upload the fault message and trigger an alarm on the web page.
[0084] Step 1 specifically includes the following sub-steps:
[0085] Step 1.1: Equip the pumping unit with a dual-spectrum camera to monitor the pumping unit in real time and obtain both infrared and visible light video of the pumping unit's components.
[0086] Step 1.2: Segment the infrared video and visible light video to obtain the visible light braid dataset and the infrared light braid dataset;
[0087] Step 1.3: Use labelImg software to label the normal braids and broken braids in the visible light braid dataset and the infrared braid dataset respectively. The visible light braid dataset and the infrared braid dataset are divided into training subsets, validation subsets and test subsets in a ratio of 8:1:1.
[0088] Specifically, the training subsets of the visible light braid dataset and the infrared light braid dataset can be expanded by performing flipping, contrast transformation, noise addition, and cropping operations respectively.
[0089] Step 2 specifically includes the following sub-steps:
[0090] Step 2.1: Add a backbone module to the original YOLO11 model to form a dual backbone module. One is the visible light backbone 1 module to extract visible light features, and the other is the infrared light backbone 2 module to extract infrared light features, preserving the rich details and textures of visible light and the thermal radiation information of infrared light.
[0091] After adding a backbone module to the original YOLO11 model, the improved YOLO11 structure is as follows: Figure 2 As shown, its main feature is that the feature fusion module FFM is used to fuse the C3k2 module and the C2PSA module in the visible light backbone 1 module and the infrared light backbone 2 module, and then the features are spliced in the Neck part.
[0092] Step 2.2, Backbone Fusion CBAM Attention Mechanism Module: Add a CBAM attention mechanism module after the last c3k2 module in the visible light backbone 1 module, and also add a CBAM attention mechanism module after the last c3k2 module in the infrared light backbone 2 module.
[0093] The CBAM attention mechanism added above is an improved CBAM attention mechanism, which combines channel attention and spatial attention mechanisms. The channel attention mechanism is implemented by introducing global average pooling and a fully connected layer structure. Specifically, it includes the following steps:
[0094] Step 2.2.1: The channel attention mechanism first processes the feature map through a max pooling layer, reducing the feature map size from H×W×C to 1×1×C;
[0095] Step 2.2.2: Further extract features from the reduced 1×1×C image features through one-dimensional convolution, and then apply the sigmoid activation function to the output of the one-dimensional convolution to obtain the output of the channel attention mechanism;
[0096] Step 2.2.3: Multiply the output of the channel attention mechanism with the original image to restore it to the size of C×H×W.
[0097] The spatial attention mechanism module consists of a spatial attention preprocessing layer and a spatial attention processing layer. Specifically, it includes the following steps:
[0098] Step 2.2.4: The output of the channel attention mechanism is first subjected to max pooling and average pooling operations to generate two feature maps of size 1×H×W. These two feature maps are then concatenated using the Concat operation.
[0099] Step 2.2.5: The concatenated feature map is transformed into a 1-channel feature map by a 7×7 convolution kernel, and then processed by a sigmoid activation function to obtain the feature map of the spatial attention mechanism. This output is multiplied with the original image to restore it to the size of C×H×W, so as to comprehensively consider the attention feature map of channel and spatial information.
[0100] Step 2.3, Feature Fusion Module (FFN) as follows: Figure 3 As shown, the feature fusion module is used to fuse visible light features F vis The input is fed into convolution 1 for preliminary feature extraction, resulting in intermediate features f′. vis Infrared light feature F ir The input is fed into convolution 2 for preliminary feature extraction, resulting in intermediate features f′. ir ;f′ vis and f′ ir After convolution, the merged features are obtained by stitching them together again. The fused features are then convolved again to obtain the new features. Features Perform convolution again to obtain the fused feature f fusionThe feature fusion module fuses visible light and infrared features to generate comprehensive features for target detection.
[0101] Step 2.4: Replace the original IOU loss function in the YOLO11 model with the PIOU loss function, and optimize the PIOU loss function by introducing an adaptive penalty factor for target size and constructing a gradient adjustment mechanism based on the quality of the target bounding box. The specific steps are as follows:
[0102] Step 2.4.1: To address the gradient instability issue of the traditional IOU loss function in scale-changing scenarios, the PIOU loss function introduces an innovative adaptive geometric constraint mechanism. This adaptive geometric constraint constructs a penalty factor P that depends only on the geometric properties of the true target box, achieving robust optimization against target scale changes. The penalty factor P is defined as follows:
[0103]
[0104] Where P is the penalty factor, W1 is the width of the predicted box extending beyond the left side of the true target box, W2 is the width of the predicted box extending beyond the right side of the true target box; H1 is the height of the predicted box extending beyond the top of the true target box, H2 is the height of the predicted box extending beyond the bottom of the true target box; W gt h is the width of the target bounding box. gt The height of the target bounding box.
[0105] Step 2.4.2: Construct a gradient adjustment mechanism based on the quality of the target bounding box, introducing a penalty function f(p), where:
[0106]
[0107] The penalty function f(p) maximizes the gradient of moderately sized predicted boxes and allows for rapid regression to the vicinity of the target box. PIOU loss function:
[0108] PIOU = IOU - f(p), -1 ≤ PIOU ≤ 1
[0109] L PIOU =1-PIOU=L IOU +f(p),0≤L PIOU ≤2
[0110] Where IOU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box, L PIOU L represents the loss value of PIOU. IOU This represents the loss value of IOU.
[0111] Step 3 specifically includes the following sub-steps:
[0112] Step 3.1: Set the training environment of the YOLO11 model to the PyTorch deep learning framework and use GPU acceleration;
[0113] Step 3.2: Configure training hyperparameters, set the batch size to 16, the number of iterations to 300, and the initial learning rate to 0.01. Enable Mosaic for data augmentation during model training and disable Mosaic in the last 10 rounds of training.
[0114] Step 3.3: Validate the trained model. When the mAP@0.5 of the validation set reaches more than 92% and the recall of the test set is greater than 90%, the validation is successful. This ensures that the model achieves excellent detection performance while avoiding overfitting.
[0115] Step 4 specifically includes the following sub-steps:
[0116] Step 4.1: Use the LAMP amplitude pruning algorithm based on layer adaptive sparsity to prune the trained YOLO11 model.
[0117] The LAMP score calculation formula is:
[0118]
[0119] In the formula: (W[μ]) 2 The weights of the target connection are squared, ∑ v≥μ (W[v]) 2 This is the sum of squared weights of connections with indices greater than μ in the current layer. The denominator is the sum of squared weights of all remaining connections in the current layer, while connections with indices less than μ are pruned. Larger squared weights result in higher LAMP scores and greater importance. Weights with lower scores are considered relatively unimportant and are pruned.
[0120] Specifically, after setting the target pruning ratio in LAMP pruning, connections with low LAMP scores are globally pruned until the required global sparsity constraint is met. Furthermore, each layer in the LAMP score contains at least one connection with a score of 1, meaning that at least one live connection is retained in each layer, effectively preventing layer collapse. By applying the LAMP algorithm, the number of model parameters can be effectively reduced, making it more suitable for deployment on resource-constrained embedded devices.
[0121] Step 4.2: Validate the pruned YOLO11 model. When the mAP@0.5 of the validation set is greater than 90% and the recall rate is greater than 85%, the model is considered qualified and is used as the detection model.
[0122] Step 4.3: The detection platform deployed on-site at the oil pumping unit is called the edge detection box. The detection model is deployed in the edge detection box. The edge detection box is equipped with a Rockchip RK3588 processor, which has an NPU with a computing power of 6 TOPS to efficiently process video streams.
[0123] Specifically, the detection model needs to be converted to RKNN format and deployed in the edge detection box. RKNN format is a dedicated model format developed by Rockchip for its NPU (Neural Processing Unit), which makes full use of the hardware characteristics of Rockchip NPU and is suitable for processing typical neural network calculations such as convolution and matrix operations.
[0124] In step 5, the dual-spectrum camera at the oilfield site acquires real-time visible and infrared video streams, which serve as input information for the edge detection box. The camera address is provided to the edge detection box, which then acquires the real-time video stream of the pumping unit and uses the deployed YOLO detection model to detect the pumping unit's "braids".
[0125] In step 6, the detection of whether the oil pumping unit's braid is broken is performed by an edge detection box deployed on-site, which retrieves information from a dual-spectrum camera for online identification and diagnosis.
[0126] In step 7, if a broken pumping unit braid is detected, a fault message is uploaded, and an alarm is triggered on the web interface, such as... Figure 4 The image shown is a display of the location distribution of pumping units and a real-time dynamic image of a pumping unit at a specific location. It is part of the web-based alarm platform for detecting broken pumping unit braids.
[0127] like Figure 5 As shown, the web page retrieves the recognition data from the edge detection box and displays the real-time image in the window. If the edge detection box detects a broken oil pump braid, an alarm is triggered on the web page.
[0128] Figure 6 This is the alarm details interface for the broken braid of the pumping unit in the Lian 46-3 oil well.
[0129] The above description is merely a preferred embodiment of the present invention, showing and describing the basic principles, main features, and advantages of the present invention. It is not intended to limit the scope of patent protection of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. In addition to the above embodiments, the present invention may have other implementations without departing from the spirit and scope of the invention. Various changes and modifications to the present invention are possible, and all technical solutions formed by equivalent substitutions or equivalent transformations fall within the scope of protection claimed by the present invention. The scope of protection of the present invention is defined by the appended claims and their equivalents. Technical features not described in the present invention can be implemented by or using existing technology, and will not be elaborated here.
Claims
1. A method for detecting breakage of oil pumping unit braids in low-light scenarios based on an improved YOLO 11, characterized in that, The steps are as follows: Step 1: Collect the image dataset of the braids on the pumping unit and preprocess it to obtain the preprocessed image dataset of the braids on the pumping unit. Step 2: Based on the YOLO11 model, the YOLO11 model is improved by using the backbone1 and backbone2 dual backbone modules and integrating the CBAM attention mechanism and loss function; Step 3: Train the improved YOLO11 model using the preprocessed oil pumping unit braid image dataset; Step 4: Use the LAMP amplitude pruning algorithm to prune the trained YOLO11 model, and after verification, use it as the detection model and deploy the detection model at the pumping unit site. Step 5: Acquire real-time video streams from cameras on the oil pumping unit's braids during operation, and use a detection model to perform real-time detection on them; Step 6: In real time, determine whether the pumping unit braid has broken. If so, proceed to step 7; otherwise, return to step 5. Step 7: Upload the fault message and trigger an alarm on the web page; Step 2 specifically includes the following sub-steps: Step 2.1: Add a backbone module to the original YOLO11 model to form a dual backbone module. One is the visible light backbone 1 module to extract visible light features, and the other is the infrared light backbone 2 module to extract infrared light features, preserving the rich details and textures of visible light and the thermal radiation information of infrared light. Step 2.2: Integrate the CBAM attention mechanism module into the backbone; Step 2.3: The visible light and infrared features are fused through the feature fusion module to generate comprehensive features for target detection; Step 2.4: Replace the original IOU loss function in the YOLO11 model with the PIOU loss function, and optimize the PIOU loss function by introducing a penalty factor that adapts to the target size and constructing a gradient adjustment mechanism based on the quality of the target box. In step 2.2, a CBAM attention mechanism module is added after the last c3k2 module in the visible light backbone 1 module, and a CBAM attention mechanism module is also added after the last c3k2 module in the infrared light backbone 2 module. In step 2.3, the feature fusion module FFN is used to fuse the visible light features F vis The input is fed into convolution 1 for preliminary feature extraction to obtain intermediate features. Infrared light feature F ir The input is fed into convolution 2 for preliminary feature extraction to obtain intermediate features. ; and After convolution, the merged features are obtained by stitching them together again. The fused features are then convolved again to obtain the features. , for features Perform convolution again to obtain fused features .
2. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that: Step 1 specifically includes the following sub-steps: Step 1.1: Equip the pumping unit with a dual-spectrum camera to monitor the pumping unit in real time and obtain both infrared and visible light video of the pumping unit's components. Step 1.2: Segment the infrared video and visible light video to obtain the visible light braid dataset and the infrared light braid dataset; Step 1.3: Use labelImg software to label the normal braids and broken braids in the visible light braid dataset and the infrared light braid dataset respectively. The visible light braid dataset and the infrared light braid dataset are divided into training subsets, validation subsets and test subsets in a ratio of 8:1:
1.
3. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that: In step 1.3, the training subsets of the visible light braid dataset and the infrared light braid dataset are subjected to flipping, contrast transformation, noise addition, and cropping operations to expand their respective training subsets.
4. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that, In step 2.2, the added CBAM attention mechanism is an improved CBAM attention mechanism, which combines channel attention mechanism and spatial attention mechanism.
5. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 4, characterized in that, The channel attention mechanism is implemented by introducing a structure of global average pooling and fully connected layers, specifically including the following steps: Step 2.2.1: The channel attention mechanism first processes the feature map through a max pooling layer, reducing the feature map size from H×W×C to 1×1×C; Step 2.2.2: Further extract features from the reduced 1×1×C image features through one-dimensional convolution, and then apply the sigmoid activation function to the output of the one-dimensional convolution to obtain the output of the channel attention mechanism; Step 2.2.3: Multiply the output of the channel attention mechanism with the original image to restore it to the size of C×H×W.
6. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 5, characterized in that, The spatial attention mechanism module consists of a spatial attention preprocessing layer and a spatial attention processing layer, and specifically includes the following steps: Step 2.2.4: The output of the channel attention mechanism is first subjected to max pooling and average pooling operations to generate two feature maps of size 1×H×W. These two feature maps are then concatenated using the Concat operation. Step 2.2.5: The concatenated feature map is transformed into a 1-channel feature map by a 7×7 convolution kernel, and then processed by a sigmoid activation function to obtain the feature map of the spatial attention mechanism. This output is multiplied with the original image to restore it to the size of C×H×W, so as to comprehensively consider the attention feature map of channel and spatial information.
7. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that, Step 2.4 specifically includes the following sub-steps: Step 2.4.1: The PIOU loss function introduces an adaptive geometric constraint mechanism. By constructing a penalty factor P that depends only on the geometric properties of the true target box, robust optimization against changes in target scale is achieved. The penalty factor P is defined as follows: ; Where P is the penalty factor. The predicted bounding box extends beyond the left side of the actual target bounding box by a certain width. h1 is the width of the predicted bounding box extending beyond the right side of the actual target bounding box; h2 is the height of the predicted bounding box extending beyond the top of the actual target bounding box; h3 is the height of the predicted bounding box extending beyond the bottom of the actual target bounding box. The width of the target bounding box. The height of the target bounding box; Step 2.4.2: Construct a gradient adjustment mechanism based on the quality of the target bounding box, introducing a penalty function f(p), where: ; penalty function It enables moderately high-quality predicted boxes to have maximum gradients and quickly regress to the vicinity of the target box; PIOU loss function: ; ; Where IOU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box. This represents the loss value of PIOU. This represents the loss value of IOU.
8. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that, Step 3 specifically includes the following sub-steps: Step 3.1: Set the training environment of the YOLO11 model to the PyTorch deep learning framework and use GPU acceleration; Step 3.2: Configure training hyperparameters, set the batch size to 16, the number of iterations to 300, and the initial learning rate to 0.
01. Enable Mosaic for data augmentation during model training and disable Mosaic in the last 10 rounds of training. Step 3.3: Validate the trained model. When the mAP@0.5 of the validation set reaches more than 92% and the recall of the test set is greater than 90%, the validation is successful. This ensures that the model achieves excellent detection performance while avoiding overfitting.
9. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that, Step 4 specifically includes the following sub-steps: Step 4.1: Prune the trained YOLO11 model using the LAMP amplitude pruning algorithm based on layer adaptive sparsity; Step 4.2: Validate the pruned YOLO11 model. If the validation is successful, it will be used as the detection model. Step 4.3: Deploy the detection model in the edge detection box at the pumping unit site.
10. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 9, characterized in that, In step 4.1, the LAMP score calculation formula is as follows: ; In the formula: The weights of the target connection are squared. This is the sum of squared weights for connections with indices greater than μ in the current layer; the larger the squared weight, the higher the corresponding LAMP score and the greater the importance. Items with lower weighting scores are considered relatively unimportant and are removed.
11. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 9, characterized in that, In step 4.2, when the mAP@0.5 of the validation set is greater than 90% and the recall rate is greater than 85%, the model is judged to be qualified. In step 4.3, the detection model is converted into RKNN format and deployed in the edge detection box. The edge detection box is equipped with Rockchip RK3588 processor, which has an NPU with a computing power of 6 TOPS, and can efficiently process video streams.
12. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that, In step 5, the dual-spectrum camera at the oilfield site acquires real-time visible light and infrared light video streams, which serve as input information for the edge detection box. The camera address is provided to the edge detection box, which then acquires the real-time video stream of the pumping unit and uses the deployed YOLO detection model to detect the pumping unit's hairline.
13. The method for detecting breakage of oil pumping unit braids in low-light scenarios based on the improved YOLO11 according to claim 1, characterized in that, In step 6, the detection of whether the oil pumping unit's braid is broken is performed by the edge detection box deployed on site, which retrieves information from a dual-spectrum camera for online identification and diagnosis.
Citation Information
Patent Citations
Pumping unit key position inspection method based on artificial intelligence video identification technology
CN119007068A
Traffic scene target detection method based on feature fusion and attention mechanism
CN120260008A