Cable surface defect detection method and system based on improved YOLOv11 network
By improving the YOLOv11 network and integrating an enhanced multi-scale attention mechanism and a sparse point sampling convolution module, the problems of feature loss and background noise differentiation in cable surface defect detection are solved, achieving high-precision, lightweight, and real-time detection, which is suitable for industrial scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SINOSTAR CABLE CO LTD
- Filing Date
- 2026-03-30
- Publication Date
- 2026-07-07
Smart Images

Figure CN122347553A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of visual inspection technology, specifically relating to a method and system for detecting cable surface defects based on an improved YOLOv11 network. Background Technology
[0002] With the increasing demands for cable performance and reliability in power systems, surface defect detection during cable manufacturing has become a crucial aspect of quality control. Cable surfaces are prone to defects such as wrinkles, breaks, incomplete sheath peeling, and foreign matter adhesion. These defects are characterized by their small size, complex shapes, and random distribution. Furthermore, production lines typically operate at high speeds, requiring detection systems to possess high precision and real-time performance.
[0003] Traditional inspection methods, such as manual visual inspection or basic image processing technology, are inefficient, easily affected by the operator's subjective factors, and difficult to adapt to high-speed and high-requirement industrial environments.
[0004] In recent years, deep learning object detection algorithms (such as the YOLO series) have been introduced into cable defect detection. However, existing mainstream algorithms face inherent limitations when dealing with small, low-contrast defects on cable surfaces: Loss of shallow features: When YOLO11 and other networks perform multiple standard convolution or pooling downsampling operations in the backbone network, high-resolution shallow features (containing fine spatial details of tiny defects) are easily diluted or lost, resulting in a high false negative rate for small targets.
[0005] Insufficient capture of contextual information: In complex industrial environments, such as those with reflections, shadows, or production line textures, the model struggles to effectively distinguish between minute defects and background noise. This stems from the model's insufficient ability to focus on multi-scale contextual information and key feature regions.
[0006] Trade-off between model robustness and lightweight design: While some improved models enhance accuracy, they often come at the cost of significantly increased computational costs (FLOPs) and the number of model parameters, making them difficult to deploy on edge computing devices that require high efficiency and lightweight design. Summary of the Invention
[0007] The purpose of this invention is to provide a cable surface defect detection method and system based on an improved YOLOv11 network. The YOLOv11 model is improved by integrating an enhanced multi-scale attention mechanism and a sparse point sampling convolution module, which is specifically designed to solve the problems of feature loss and insufficient detection accuracy of small and fuzzy defects such as wrinkles, breaks, and scratches in the cable manufacturing process.
[0008] The technical solution to achieve the purpose of this invention is as follows: A method for detecting cable surface defects based on an improved YOLOv11 network includes the following steps: S01: Acquire an image of the cable surface; S02: Construct a cable surface defect detection model based on an improved YOLOv11 network. The improved YOLOv11 network-based cable surface defect detection model is an improvement on the YOLOv11 model. In the YOLOv11 backbone network, the original module used to enhance high-order semantic features is replaced with an enhanced multi-scale attention module. The multi-scale feature representation capability is enhanced by cross-channel and cross-spatial information aggregation. The standard convolutional layer used for spatial downsampling in the backbone network is replaced with the SPDConv module to achieve refined preservation and efficient expression of shallow features. S03: Train the cable surface defect detection model based on the improved YOLOv11 network, and use the trained cable surface defect detection model based on the improved YOLOv11 network to detect cable defects.
[0009] In the preferred technical solution, the enhanced multi-scale attention module is optimized based on the traditional multi-scale attention method, including: Channel reorganization and feature grouping: The input feature map is divided into multiple sub-feature groups through channel reorganization and feature grouping strategies, and contextual information is extracted at different semantic levels; Constructing parallel paths for attention learning: Three parallel paths are constructed to learn and model attention weights; two of the paths use 1×1 convolutional branches to enhance information interaction between channels and introduce two-dimensional global average pooling operations to compactly model the interaction relationship between channels; the other path uses 3×3 convolution to capture local contextual features. Efficient information aggregation: By integrating global pooling, grouped convolution, matrix multiplication and weight redistribution modules in one-dimensional horizontal and vertical directions, efficient aggregation of cross-channel and cross-space information is achieved.
[0010] In a preferred technical solution, the method for dividing the input feature map into multiple sub-feature groups includes: Obtain the number of channels C of the input feature map; The number of groups is dynamically calculated as G = min(32, [C / 8]).
[0011] In the preferred technical solution, constructing parallel paths for attention learning includes: Path 1 performs X-direction average pooling, 1×1 convolution and Sigmoid activation sequentially on each group of sub-feature maps to generate X-direction attention weights; Path 2 performs Y-direction average pooling, 1×1 convolution and Sigmoid activation sequentially on each group of sub-feature maps to generate Y-direction attention weights; Path 3 sequentially performs 3×3 convolution, normalization, and softmax activation on each group of sub-feature maps to generate local attention weights.
[0012] In the preferred technical solution, efficient information aggregation includes: multiplying the attention weights of the three paths element-wise with the original sub-feature map, then concatenating them into a complete feature map using Concat, and finally adjusting the feature contribution through a 1×1 convolution and recalibration module to output the enhanced feature map.
[0013] In the preferred technical solution, the SPDConv module replaces the original stride convolution downsampling operation after the 2nd, 4th, and 6th convolution layers of the backbone network, corresponding to feature map sizes changing from 640×640 to 320×320, 320×320 to 160×160, 160×160 to 80×80. The SPDConv module retains the original spatial feature information of minor defects during the downsampling process through a sparse point sampling strategy and spatial-channel decoupling.
[0014] In a preferred embodiment, the processing method of the SPDConv module includes: The SPDConv module employs a sparse point sampling strategy on the input feature map X, dividing it into four non-overlapping sub-feature maps G according to a set downsampling ratio. 0,0 G 1,0 G 0,1 G 1,1 ; The four sub-feature maps are concatenated along the channel dimension to form a new feature map X´, achieving spatial compression while retaining more structural information through channel expansion; Non-stride convolutional layers are used to extract and reshape features from X´, so as to compress the number of channels while maintaining key discriminative information, and generate the final output feature map X″.
[0015] This invention also discloses a cable surface defect detection system based on an improved YOLOv11 network, used to implement the aforementioned cable surface defect detection method based on an improved YOLOv11 network, comprising: The image acquisition module acquires images of the cable surface. The cable defect detection model construction module constructs a cable surface defect detection model based on an improved YOLOv11 network. The improved YOLOv11 network-based cable surface defect detection model improves upon the YOLOv11 model. In the YOLOv11 backbone network, the original module used to enhance high-order semantic features is replaced with an enhanced multi-scale attention module. The multi-scale feature representation capability is enhanced through cross-channel and cross-spatial information aggregation. The standard convolutional layer used for spatial downsampling in the backbone network is replaced with the SPDConv module to achieve refined preservation and efficient expression of shallow features. The cable defect detection module trains the constructed cable surface defect detection model based on the improved YOLOv11 network, and uses the trained cable surface defect detection model based on the improved YOLOv11 network to detect cable defects.
[0016] The present invention also discloses a computer storage medium storing a computer program, which, when executed, implements the above-described cable surface defect detection method based on an improved YOLOv11 network.
[0017] The present invention also discloses an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor runs the computer program stored in the memory. When the computer program is executed, it implements the above-described cable surface defect detection method based on the improved YOLOv11 network.
[0018] Compared with the prior art, the significant advantages of this invention are: 1. High detection accuracy and robustness: On a cable surface defect dataset, the method achieved 94.2% mAP50, 92.3% precision, and 92.1% recall.
[0019] This performance is significantly better than the mainstream YOLO series algorithms, such as an improvement of 6.6 percentage points compared to the original YOLO11mAP@0.5=87.6%.
[0020] The model can reliably identify and distinguish four types of defects—wrinkles, damage, unpeeled outer skin, and machine scratches—under complex real-world production environments, such as uneven lighting, reflections, complex surrounding textures, and background interference. This method can accurately detect small and irregularly shaped defects, and the predicted box highly coincides with the actual defect location, demonstrating high precision in locating minute defects.
[0021] Second: Lightweight and High Efficiency The model is small in size, only 5.9MB, and has strong adaptability to edge device deployment.
[0022] It has low computational complexity, with only 9.2 GFLOPs, making the computational load moderate and meeting the needs of real-time detection in actual production lines.
[0023] It can achieve real-time detection. When equipped with an NVIDIA GeForce RTX 3060, it can achieve a real-time detection speed of approximately 88 FPS, with a single frame processing latency of only 11ms, which fully meets the needs of industrial real-time detection.
[0024] Three: Enhance the ability to perceive small goals The attention mechanism-enhanced multi-scale attention mechanism strengthens the model's feature focus on key areas of cable defects through channel reorganization, feature grouping, parallel convolutional paths, and cross-spatial information fusion, effectively enhancing the model's ability to perceive multi-scale targets.
[0025] The SPDConv module avoids the loss of shallow feature details caused by traditional downsampling operations through a sparse point sampling strategy and spatial-channel decoupling, thereby enhancing the perception capability and representation robustness of small targets.
[0026] By leveraging the synergistic effect of EMA and SPDConv, this method effectively addresses the problems of insufficient feature extraction and easy loss of spatial details in existing models for detecting small defects in cables (such as wrinkles and machine scratches).
[0027] IV. Versatility and Practical Value: The model was verified to maintain stable and superior performance on various defect detection datasets, demonstrating strong potential for widespread adoption.
[0028] It provides an efficient and accurate solution for intelligent cable surface defect detection in industrial scenarios, supporting intelligent monitoring and preventive maintenance of cable networks. Attached Figure Description
[0029] Figure 1 This is a flowchart of the cable surface defect detection method based on the improved YOLOv11 network in this embodiment; Figure 2 This is a schematic diagram of the enhanced multi-scale attention mechanism in this embodiment, showing the complete process of channel grouping, three parallel attention learning paths, and information aggregation; Figure 3 This is a schematic diagram of the SPDConv module in this embodiment, showing the implementation process of sparse point sampling, channel splicing, and non-stride convolution renormalization; Figure 4 This is a schematic diagram of the original structure of YOLOv11; Figure 5 This is a schematic diagram of the overall structure of the YOLOv11-ESP network model in this embodiment. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments and the accompanying drawings. It should be understood that these descriptions are merely exemplary and not intended to limit the scope of the invention. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention. Example 1:
[0031] like Figure 1 As shown, a method for detecting cable surface defects based on an improved YOLOv11 network includes the following steps: S01: Acquire an image of the cable surface; S02: Construct a cable surface defect detection model based on an improved YOLOv11 network. The improved YOLOv11 network-based cable surface defect detection model is an improvement on the YOLOv11 model. In the YOLOv11 backbone network, the original module used to enhance high-order semantic features is replaced with an enhanced multi-scale attention module. The multi-scale feature representation capability is enhanced by cross-channel and cross-spatial information aggregation. The standard convolutional layer used for spatial downsampling in the backbone network is replaced with the SPDConv module to achieve refined preservation and efficient expression of shallow features. S03: Train the cable surface defect detection model based on the improved YOLOv11 network, and use the trained cable surface defect detection model based on the improved YOLOv11 network to detect cable defects.
[0032] The ingenuity of this invention lies in constructing a feature-fidelity-reconstruction loop: SPDConv is responsible for converting "spatial loss" into "channel gain" during the downsampling stage, preserving the original details; while the enhanced multi-scale attention module EMA then accurately locates the channelized defect features by weighting across spatial paths from the rich channel information. This "preserve first, then filter" combined mechanism solves the false detection problem that a single improved model is prone to when the background is complex, ultimately resulting in an improved YOLOv11-ESP network model.
[0033] like Figure 2 As shown, the working method of the enhanced multiscale attention mechanism includes: Channel reorganization and feature grouping: The input feature map is divided into multiple sub-feature groups g through channel reorganization and feature grouping strategies, so as to extract contextual information at different semantic levels.
[0034] Constructing parallel paths for attention learning: Constructing three parallel paths for learning and modeling attention weights.
[0035] Two of the paths employ 1×1 convolutional branches to enhance information exchange between channels, and a two-dimensional global average pooling operation is introduced to compactly model the interaction relationship between channels.
[0036] Another approach uses 3×3 convolutions to capture local contextual features.
[0037] Efficient Information Aggregation: The EMA module integrates global pooling, grouped convolution, matrix multiplication, and weight redistribution modules in one-dimensional horizontal and vertical directions to achieve efficient aggregation of cross-channel and cross-spatial information, significantly improving the model's ability to model key defect regions.
[0038] like Figure 3 As shown, the working method of the SPDConv module based on sparse point sampling-channel expansion-non-stride convolution renormalization includes: Sparse point sampling: For an input feature map X of any size S×S×C1 (S×S×C1 is the dimensional representation of a feature map in a convolutional neural network, where S represents the height and width of the input feature map, and C1 represents the number of channels of the feature map input to the SPDConv module), the SPDConv module employs a sparse point sampling strategy, dividing it into four non-overlapping sub-feature maps G at a set downsampling ratio (scale=2). 0,0 G 1,0 G 0,1 G 1,1 .
[0039] Channel splicing and spatial compression: The four sub-feature maps are spliced (Concat) in the channel dimension to form a new feature map X´, whose size becomes (S / 2)×(S / 2)×4C1. This achieves spatial compression while retaining more structural information through channel expansion. Non-stance convolution reshaping: Subsequently, a non-stance convolutional layer (a standard convolution with a stride of 1) is used to extract and reshape features of X´, so as to compress the number of channels while maintaining key discriminative information, and generate an output feature map X″ with a final size of (S / 2)×(S / 2)×C2 (C2 is the number of channels of the output feature map after non-stance convolution reshaping by the SPDConv module, which is the channel dimension parameter of the final output feature map of the module, corresponding to the number of channels of the input feature map C1).
[0040] Feature Preservation: This mechanism effectively avoids the loss of important detail information caused by traditional pooling or stride convolution by decoupling spatial downsampling and channel expansion, significantly improving the model's ability to perceive small targets and its robustness in representation.
[0041] In another embodiment, a cable surface defect detection system based on an improved YOLOv11 network is provided to implement the aforementioned cable surface defect detection method based on an improved YOLOv11 network, comprising: The image acquisition module acquires images of the cable surface. The cable defect detection model construction module constructs a cable surface defect detection model based on an improved YOLOv11 network. The improved YOLOv11 network-based cable surface defect detection model improves upon the YOLOv11 model. In the YOLOv11 backbone network, the original module used to enhance high-order semantic features is replaced with an enhanced multi-scale attention module. The multi-scale feature representation capability is enhanced through cross-channel and cross-spatial information aggregation. The standard convolutional layer used for spatial downsampling in the backbone network is replaced with the SPDConv module to achieve refined preservation and efficient expression of shallow features. The cable defect detection module trains the constructed cable surface defect detection model based on the improved YOLOv11 network, and uses the trained cable surface defect detection model based on the improved YOLOv11 network to detect cable defects.
[0042] This embodiment focuses on the practical application of the YOLO11-ESP model in cable surface defect detection, providing a reproducible and complete technical solution from data acquisition, model improvement, training optimization to actual deployment. The hardware and software environment, parameter settings, and operating procedures of this embodiment have all undergone multiple rounds of verification to ensure the practicality and rigor of the method. Specifically, it includes the following steps: 1. Obtain a dataset of cable surface defect images, which consists of a sequence of high-resolution surface defect images collected during the cable manufacturing process; 2. The cable surface defect image dataset is divided into a training set and a validation set, and the sample diversity is expanded through a multi-dimensional data augmentation strategy; 3. The YOLO11 network structure is innovatively improved by introducing the EMA enhanced multi-scale attention mechanism into the backbone network to enhance the multi-scale feature representation capability, and introducing the SPDConv module to replace some standard convolutional layers and downsampling operations to enhance shallow feature representation, resulting in an improved YOLOv11-ESP network model. 4. Input the training set into the improved network model for phased training to obtain the optimal defect detection model; 5. Use the validation set to evaluate the model's performance.
[0043] The specific implementation method is as follows: Acquiring a dataset of cable surface defect images includes the following steps: S11: Data Acquisition Scene and Equipment: In a 10kV cross-linked polyethylene cable production line at a cable manufacturing plant, the inspection station after the sheath extrusion process was selected as the data acquisition scene (this station has the highest defect incidence rate, including four typical defects: wrinkles, breakage, incomplete sheath peeling, and machine scratches). A Baslerac A2500-14uc high-resolution industrial camera (2592×1944 pixels, 20fps) was used, along with an 8mm fixed-focus lens and a ring LED light source (5500K color temperature, 1200 lux illuminance) to eliminate reflections and shadow interference.
[0044] S12: Acquisition parameter settings: Set the camera trigger mode to "production line encoder synchronous trigger", acquire one image every 0.5m (covering a 0.4m×0.4m area on the cable surface, matching the coverage of subsequent inspections); save the image in JPG format with a compression quality factor of 95% to ensure that defect details are not lost.
[0045] S13: Dataset size: 2000 original images were collected over 30 consecutive days, including 480 images of wrinkles, 520 images of damage, 500 images of unpeeled outer skin, and 500 images of machine scratches. All images contained single or superimposed defects (simulating a scenario of multiple defects occurring concurrently on a production line).
[0046] The dataset consists of a sequence of high-resolution surface defect images collected during the cable manufacturing process, including the following steps: S14: Labeling tools and rules: LabelImg open-source labeling tool (version 1.8.6) was used, and double-blind labeling was performed by two engineers with more than 5 years of experience in cable quality inspection.
[0047] S15: Annotation rules: Bounding box: Close to the edge of the defect, coordinate format is YOLO series standard "center x / image width, center y / image height, width / image width, height / image height"; S16: Category labels: uniformly labeled as "wrinkle (0), breakage (1), unstripped (2), scratch (3)"; S17: Labeling Verification: Cross-verify the labeling results. Inconsistent samples will be judged by a third-party engineer. The final labeling accuracy rate must be ≥99.5%.
[0048] S18: Format Conversion: Convert the XML annotation files generated by LabelImg into YOLO format TXT files in batches using a Python script. Each TXT file has the same name as the corresponding image and is stored in the "annotations" directory, forming a dataset structure with a one-to-one correspondence between "images and annotations".
[0049] Furthermore, the cable surface defect image dataset is divided into a training set and a validation set, including the following steps: S21: Dataset Partitioning A stratified sampling strategy was adopted (keeping the defect ratio of each category constant), dividing the dataset into a training set (1400 images) and a validation set (600 images) in a 7:3 ratio. No separate test set was set (the validation set was also used for final performance evaluation, consistent with common industrial dataset partitioning methods). The distribution of samples in each category after partitioning is shown in Table 1. Table 1. Dataset Classification and Sample Distribution S22: Based on the AugmentAPI of the Ultralytics framework, images are augmented online in real time during the training phase (no augmentation is performed during the validation phase to ensure evaluation accuracy). The augmentation strategies and parameters are as follows: Geometric transformation: random rotation: -15°~15° (step size 1°), probability 0.5; horizontal flip: probability 0.5, vertical flip: probability 0.2 (to avoid unrealistic scenarios with inverted cable orientation); random cropping: cropping ratio 0.7~1.0, probability 0.6; Mosaic enhancement: stitching 4 images together, probability 0.8 (to improve adaptability to scenarios with multiple defects).
[0050] S23: Pixel and lighting adjustment: Brightness adjustment: 0.7~1.3x, Contrast adjustment: 0.7~1.3x, Saturation adjustment: 0.7~1.3x, all with a probability of 0.5; Gaussian noise: Standard deviation 0~0.02, probability 0.3; Random erasure: Erasure area ratio 0.02~0.1, probability 0.4 (simulating local occlusion defects).
[0051] S24: Advanced Enhancement: CutMix (probability 0.3) and AutoAugment (a custom strategy based on cable defect scenarios) are used to further enrich the sample distribution and enhance the model's robustness to complex backgrounds.
[0052] Furthermore, Figure 4 This is the original YOLOv11 architecture diagram. The improved network in this embodiment is named the YOLO11-ESP network model, as follows: Figure 5 As shown, the specific improvement plan is as follows: S31: Module input and output configuration: The EMA module is embedded after the SPPF layer of the backbone network (corresponding feature map size is 80×80×256, C=256), and the output feature map size is kept at 80×80×256 to ensure compatibility with subsequent network layers.
[0053] S32: Channel grouping design: Divide the input feature map into g=4 sub-feature groups according to the channel dimension ( To avoid feature fragmentation caused by excessive grouping, the number of channels in each group is 256 / 4=64; S33: Parallel path design: Path 1 (Global Awareness in the X Direction): Perform "Average Pooling in the X Direction (output 64×1×64) → 1×1 Convolution (compress channels to 32) → Sigmoid Activation" on each group of sub-feature maps to generate X-direction attention weights; Path 2 (Global Awareness in the Y Direction): Similarly, perform "average pooling in the Y direction → 1×1 convolution → Sigmoid activation" to generate attention weights in the Y direction; Path 3 (Local Context Capture): Perform "3×3 convolution (padding=1, maintain size) → GroupNorm normalization → Softmax activation" on each group of sub-feature maps to generate local attention weights; S34: Feature Fusion and Weight Redistribution: The attention weights of the three paths are multiplied element-wise with the original sub-feature maps, then concatenated into a complete feature map using Concat. Finally, a 1×1 convolution (256 channels) and a Reweight module are used to adjust the feature contribution, outputting an enhanced feature map. This design focuses the model on defect regions and suppresses background interference by aggregating cross-channel and cross-spatial information.
[0054] The SPDConv module further replaces the standard downsampling convolution, and the specific implementation is as follows: S35: Module embedding position: After the 2nd, 4th and 6th convolutions of the backbone network (corresponding to feature map sizes from 640×640→320×320, 320×320→160×160, 160×160→80×80), it replaces the original stride 2 convolution downsampling operation.
[0055] S36: Sparse Point Sampling and Channel Expansion: For a feature map with an input size of S×S×C1 (taking S=640, C1=64 as an example), it is divided into 4 non-overlapping sub-feature maps by a downsampling ratio of scale=2: Each sub-feature map is 320×320×64 in size. After being concatenated by channel dimension, X' (320×320×256) is generated, achieving "space compression + channel expansion" and preserving defect details.
[0056] S37: Non-stride convolution reshaping: X' is subjected to a 3×3 convolution with stride = 1 (number of filters C2 = 128, C2 < 4C1), which further extracts local features while compressing the number of channels, and finally outputs X'' (320×320×128), which avoids information loss and controls the amount of computation.
[0057] The overall structure of the S38 improved network: YOLO11-ESP still maintains the four-stage structure of "input layer - backbone network - neck network - head". Except for the above improvements, other modules are consistent with the original YOLO11. Input layer: Images are normalized to 640×640 pixels and Mosaic enhancement and adaptive anchor box calculation are used; Neck network: Preserves the PAFPN structure to ensure multi-scale feature transfer; Detection head: adopts the original classification-regression dual-branch structure, with the loss function being CIoU loss (localization) + cross-entropy loss (classification).
[0058] Furthermore, based on a unified hardware and software environment and hyperparameters, YOLO11-ESP was trained, and the model weights with the best performance were selected. The specific steps are as follows: S41: Hardware Configuration CPU: Intel(R) Core(TM) i7-12700K (2.70GHz, 12 cores and 20 threads). GPU: NVIDIA GeForce RTX 3060 (12GB VRAM, CUDA Compute Capability 8.6). Memory: 32GB DDR4 3200MHz; Storage: 1TB NVMeSSD (used to store datasets and model weights).
[0059] Software environment: Operating system: Ubuntu 22.04LTS; Deep learning framework: PyTorch 2.3.0 (with torchvision 0.18.0); Computational acceleration: CUDA 11.8, cuDNN 8.9.2; Dependencies: Ultralytics 8.3.0, OpenCV-Python 4.8.0, NumPy 1.26.0.
[0060] S42: Hyperparameter settings: To ensure optimal training stability and performance, the hyperparameters are set as follows: Training epochs: 100 epochs (first 50 epochs for warm-up, last 50 epochs for fine-tuning); Initial learning rate: 0.01 (using a cosine annealing learning rate strategy, eventually decaying to 0.0001); Batch size: 8 (limited by RTX 3060 VRAM, the insufficient batch size is compensated for by gradient accumulation). Optimizer: SGD (momentum 0.9, weight decay 0.0005, to avoid overfitting); Input image size: 640×640 (adaptive scaling, maintaining aspect ratio, with black borders). Confidence threshold: 0.25 (used to filter low-confidence prediction boxes during the training phase); IoU threshold: 0.5 (used for label assignment and NMS operation).
[0061] S43: Training Process: Rounds 1-5: Learning rate warm-up (linearly increasing from 0.001 to 0.01), allowing the model to quickly adapt to the data distribution; Rounds 6-50: Normal training, with temporary weights saved every 10 rounds ("epoch_xx.pt"); Rounds 51-100: Early stopping mechanism (Patience=10) is enabled. If the validation set mAP50 shows no improvement for 10 consecutive rounds, training is terminated early. S44: The training log uses TensorBoard to record metrics such as classification loss, localization loss, accuracy, and recall, and outputs a visual report in each round.
[0062] S45: The optimal model selection uses "highest mAP50 on the validation set" as the core indicator, combined with Precision, Recall and model size, to select the optimal weight file that usually appears in rounds 70 to 90 and is named "yolo11-esp_best.pt".
[0063] Furthermore, through comparative and ablation experiments, the superiority of YOLO11-ESP was fully verified. The evaluation metrics included detection accuracy (Precision, Recall, mAP50), computational complexity (GFLOPs), model size, and inference speed. The specific steps are as follows: S51: Definition of Evaluation Indicators Precision: The proportion of true positive samples out of the results predicted as positive. The formula is: Where TP (TruePositive) represents the number of samples that were correctly detected as positive, and FP (FalsePositive) represents the number of negative samples that were incorrectly detected as positive.
[0064] Recall: The proportion of true positive samples that are correctly detected, expressed as: FN (False Negative) represents the number of true positive samples that were not detected.
[0065] Average Precision Rate (mAP): In cable surface defect inspection, mAP is one of the core evaluation metrics. The calculation process of mAP is as follows: First, calculate the PR curve for each type of defect; then, calculate the average precision rate (AP) on each PR curve; finally, average the AP values for all categories to obtain mAP. This calculation process can be expressed as: Where N is the total number of defect categories, and APi represents the average accuracy of the i-th defect category.
[0066] S52: In addition to detection accuracy, to comprehensively evaluate the model's computational performance, this invention also introduces floating-point operations (FLOPs) as a reference metric. FLOPs describe the total number of floating-point operations performed during a single forward inference process and are a key indicator for measuring the computational complexity of neural networks. In this paper, this metric is expressed as GFLOPs (i.e., 10^6 FLOPs). 9 The unit is floating-point operations. Inference speed: Frame rate (FPS) and single-frame processing latency (ms) on RTX 3060, reflecting real-time performance.
[0067] S53: The YOLO11-ESP model was compared with mainstream YOLO models under the same dataset and environment. The results are shown in Table 2. Table 2: Comparison of YOLO11-ESP and YOLO11 models As shown in Table 2: In terms of accuracy: the mAP50 of YOLO11-ESP reaches 94.2%, which is 3.8 percentage points higher than YOLOv8n and 6.6 percentage points higher than the original YOLO11. In particular, the recall for machine scratches (minor defects) is improved to 91.5% (the original YOLO11 is 86.2%). In terms of efficiency: the model size is only 5.9MB, the GFLOPs are 9.2G, the frame rate reaches 88FPS, and the single frame latency is ≤11ms, which meets the dual requirements of "real-time detection (≥20FPS)" and "edge deployment (model ≤10MB)" for the production line.
[0068] S53: To separately verify the contributions of the enhanced multiscale attention mechanism (EMA) and the SPDConv module, an ablation experiment was designed using the original YOLO11 as a baseline. The results are shown in Table 3. Table 3: Contributions of EMA and SPDConv modules The ablation results showed that: The EMA module primarily improves Precision and mAP50: by focusing on defect areas and reducing false background detections, Precision is improved by 6.5 percentage points. The SPDConv module primarily improves Recall: by preserving shallow details and reducing the missed detection of small defects, it increases Recall by 0.6 percentage points. When the two work together, the performance shows a "1+1>2" effect, with mAP50 improving by 6.6 percentage points compared to the baseline, verifying the rationality of the improvement scheme.
[0069] This embodiment demonstrates that the YOLO11-ESP achieves a balance of "high precision, lightweight, and real-time performance" in cable surface defect detection. It can effectively replace traditional manual inspection, reduce quality inspection costs, and improve the stability of cable production quality, thus having significant industrial application value.
[0070] In another embodiment, a computer storage medium stores a computer program that, when executed, implements the above-described cable surface defect detection method based on an improved YOLOv11 network.
[0071] The specific implementation uses the detection method described above, which will not be elaborated here.
[0072] This embodiment provides an electronic device, which can be a high-performance server for model training or an edge computing device (such as an embedded system mounted on a drone, inspection robot, or handheld terminal) for actual cable line inspection. The electronic device includes a processor, a memory, a communication interface, and a bus. The memory stores a computer program, which, when executed by the processor, implements a cable surface defect detection method based on an improved YOLOv11 network.
[0073] Extensive experiments based on cable surface defect datasets collected from actual factory production demonstrate that YOLO-EBD significantly outperforms existing mainstream YOLO models in key metrics such as Precision, Recall, and MAP@0.5. MAP@0.5 reaches 94.2%, Recall is 92.1%, and Precision is 92.3%. While maintaining high detection accuracy, it also retains excellent lightweight characteristics, with only 9.2G GFLOPs and a model size controlled at 5.9MB, exhibiting strong adaptability to edge device deployment.
[0074] Matters not covered in this invention are common knowledge.
[0075] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. A method for detecting cable surface defects based on an improved YOLOv11 network, characterized in that, Includes the following steps: S01: Acquire an image of the cable surface; S02: Construct a cable surface defect detection model based on an improved YOLOv11 network. The improved YOLOv11 network-based cable surface defect detection model is an improvement on the YOLOv11 model. In the YOLOv11 backbone network, the original module used to enhance high-order semantic features is replaced with an enhanced multi-scale attention module. The multi-scale feature representation capability is enhanced by cross-channel and cross-spatial information aggregation. The standard convolutional layer used for spatial downsampling in the backbone network is replaced with the SPDConv module to achieve refined preservation and efficient expression of shallow features. S03: Train the cable surface defect detection model based on the improved YOLOv11 network, and use the trained cable surface defect detection model based on the improved YOLOv11 network to detect cable defects.
2. The cable surface defect detection method based on the improved YOLOv11 network according to claim 1, characterized in that, The enhanced multi-scale attention module optimizes the traditional multi-scale attention method, including: Channel reorganization and feature grouping: The input feature map is divided into multiple sub-feature groups through channel reorganization and feature grouping strategies, and contextual information is extracted at different semantic levels; Constructing parallel paths for attention learning: Three parallel paths are constructed to learn and model attention weights; two of the paths use 1×1 convolutional branches to enhance information interaction between channels and introduce two-dimensional global average pooling operations to compactly model the interaction relationship between channels; the other path uses 3×3 convolution to capture local contextual features. Efficient information aggregation: By integrating global pooling, grouped convolution, matrix multiplication and weight redistribution modules in one-dimensional horizontal and vertical directions, efficient aggregation of cross-channel and cross-space information is achieved.
3. The cable surface defect detection method based on the improved YOLOv11 network according to claim 2, characterized in that, Methods for dividing an input feature map into multiple sub-feature groups include: Obtain the number of channels C of the input feature map; The number of groups is dynamically calculated as G = min(32, [C / 8]).
4. The cable surface defect detection method based on the improved YOLOv11 network according to claim 2, characterized in that, Constructing parallel paths for attention learning includes: Path 1 performs X-direction average pooling, 1×1 convolution and Sigmoid activation sequentially on each group of sub-feature maps to generate X-direction attention weights; Path 2 performs Y-direction average pooling, 1×1 convolution and Sigmoid activation sequentially on each group of sub-feature maps to generate Y-direction attention weights; Path 3 sequentially performs 3×3 convolution, normalization, and softmax activation on each group of sub-feature maps to generate local attention weights.
5. The cable surface defect detection method based on the improved YOLOv11 network according to claim 2, characterized in that, Efficient information aggregation includes: multiplying the attention weights of the three paths element-wise with the original sub-feature maps, then concatenating them into a complete feature map using Concat, and finally adjusting the feature contribution through a 1×1 convolution and recalibration module to output the enhanced feature map.
6. The cable surface defect detection method based on the improved YOLOv11 network according to claim 1, characterized in that, The SPDConv module replaces the original stride convolution downsampling operation after the 2nd, 4th, and 6th convolution layers of the backbone network, corresponding to feature map sizes changing from 640×640 to 320×320, 320×320 to 160×160, 160×160 to 80×80. The SPDConv module retains the original spatial feature information of small defects during the downsampling process through a sparse point sampling strategy and spatial-channel decoupling.
7. The cable surface defect detection method based on the improved YOLOv11 network according to claim 1, characterized in that, The processing method of the SPDConv module includes: The SPDConv module employs a sparse point sampling strategy on the input feature map X, dividing it into four non-overlapping sub-feature maps G according to a set downsampling ratio. 0,0 G 1,0 G 0,1 G 1,1 ; The four sub-feature maps are concatenated along the channel dimension to form a new feature map X´, achieving spatial compression while retaining more structural information through channel expansion; Non-stride convolutional layers are used to extract and reshape features from X´, so as to compress the number of channels while maintaining key discriminative information, and generate the final output feature map X″.
8. A cable surface defect detection system based on an improved YOLOv11 network, characterized in that, The method for detecting cable surface defects based on an improved YOLOv11 network as described in any one of claims 1-7 includes: The image acquisition module acquires images of the cable surface. The cable defect detection model construction module constructs a cable surface defect detection model based on an improved YOLOv11 network. The improved YOLOv11 network-based cable surface defect detection model improves upon the YOLOv11 model. In the YOLOv11 backbone network, the original module used to enhance high-order semantic features is replaced with an enhanced multi-scale attention module. The multi-scale feature representation capability is enhanced through cross-channel and cross-spatial information aggregation. The standard convolutional layer used for spatial downsampling in the backbone network is replaced with the SPDConv module to achieve refined preservation and efficient expression of shallow features. The cable defect detection module trains the constructed cable surface defect detection model based on the improved YOLOv11 network, and uses the trained cable surface defect detection model based on the improved YOLOv11 network to detect cable defects.
9. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the cable surface defect detection method based on the improved YOLOv11 network as described in any one of claims 1-7.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor runs the computer program stored in the memory. When the computer program is executed, it implements the cable surface defect detection method based on the improved YOLOv11 network as described in any one of claims 1-7.