Control cable defect detection method based on improved YOLOv8 algorithm
By improving the YOLOv8 algorithm, combined with Mosa i c-9 data enhancement, G-GhostNet, S-FPN and S I oU loss functions, the problem of insufficient identification in small and medium-sized targets and complex backgrounds in cable defect detection is solved, and efficient and real-time Cable defect monitoring improves detection speed and accuracy.
Patent Information
- Application Number
- CN202411168790.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-24
AI Technical Summary
Existing cable defect detection algorithms have shortcomings in the accuracy and efficiency of identifying small and medium-sized targets and complex contexts, especially in the need of real-time monitoring, which is difficult to meet the requirements of efficient detection.
By improving the YOLOv8 algorithm, Mosa i c-9 data enhancement, G-GhostNet, S-FPN and S I oU loss functions are introduced to enhance the robustness and feature fusion capabilities of the network, optimize the computational complexity and loss functions to improve detection speed and precision.
It realizes real-time and efficient control cable defect monitoring and identification, accelerates detection speed, meets the requirements of control cable defect detection, and improves detection accuracy.
Smart Images

Figure CN119180782A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cable detection, and in particular to a control cable defect detection method based on an improved YOLOv8 algorithm. Background Art Summary of the invention
[0003] The purpose of this invention is to solve the above problems and design a control cable defect detection method based on the improved YOLOv8 algorithm. The specific design scheme is:
[0004] A control cable defect detection method based on an improved YOLOv8 algorithm comprises the following steps: step 1, creating a control cable defect data set and performing preprocessing; step 2, configuring a training environment; step 3, improving the YOLOv8 structure to obtain an improved YOLOv8 network model; step 4, integrating the improved YOLOv8 network model obtained in step 3 into the training environment configured in step 2, and adding the set parameter file to the network model; using divided training set and verification set images to perform model training and verification, wherein the improvements to the YOLOv8 structure in step 3 include Mosaic-9 improvement, G-GhostNet improvement, S-FPN improvement, and SIOU improvement.
[0005] In the Mosaic-9 improvement, the Mosaic-9 data enhancement method is introduced in the input stage to meet the need of identifying small target defects or complex background defects in control cables. The method aims to reduce the input calculation requirements in the training stage, while enhancing the network's ability to capture background details, thereby improving its robustness. This method includes randomly selecting 9 images from the input data, applying random scaling and cropping to each image, and then concatenating them into a single image. Before inputting into the network, this concatenated image is then resized to a standard size. This operation method allows the GPU to process 9 images simultaneously, and during the training process, the method introduces more background and detail information into the input, effectively enhancing the generalization ability of the algorithm. By utilizing Mosaic-9 data enhancement, the algorithm can both optimize hardware resource utilization and improve its ability to handle various real-world scenarios, ultimately improving its overall performance and robustness.
[0006] In the G-GhostNet improvement, G-GhostNet is introduced in the backbone part to enhance the backbone network components, enhance the feature fusion ability of the algorithm, and reduce information loss; in order to achieve network lightweight, this model uses the GhostConv module and the G-GhostNet stage as the basis for constructing the GGC (Ghost-Ghost-Complete) module; through the combination of the GGC module and the GBS (GhostBlockStage) module, G-GhostNet is constructed, which promotes the enhancement of the backbone components and replaces the C2F module of YOLOv8; the G-GhostNet stage significantly optimizes the traditional convolutional neural network structure, and its computational complexity optimization rate can be expressed as:
[0007]
[0008] As can be seen from the formula, compared with regular convolution, the computational complexity of G-GhostNet is significantly reduced, which effectively reduces the computational load of the network.
[0009] In the S-FPN improvement, in the real world, objects of different sizes, features and complex backgrounds often coexist. Achieving accurate and efficient detection under such conditions is a key challenge for target detection algorithms. The introduction of FPN significantly improves the performance of target detection algorithms in this regard, making FPN a standard component of most state-of-the-art (SOTA) target detectors. Feature pyramids can capture visual features of different scales. They retain details such as textures and corners in shallower layers, while covering a wider range of semantic features in deeper layers. In the last layer of the top-down path, they extract spatial and contextual features for accurate target detection. However, the use of only top-down feature fusion in FPN is susceptible to the displacement effect caused by pooling, thereby affecting accurate target positioning. The original YOLOv8 solved this problem through PANet, which introduced bidirectional FPN to recover the information lost from shallow layers due to fusion. However, most FPNs use pooling operations, which usually reduce the image size by half, resulting in scale gaps between layers and smaller and smaller feature maps, resulting in non-smooth feature fusion, such as Figure 2 As shown, SFM consists of three optional inputs. First, it linearly scales the input, then performs element-wise addition, and finally, fuses them with a 3×3 convolution to create the output. SFB includes two batches, a total of five SFBs, and S-FPN is constructed by stacking SFB three times, as shown in Figure 1As shown in the Neck part, the features passed into the S-FPN are first sent from the first layer of the first SFB to the second layer, and then from the second layer to the first layer of the next SFB. This method adopts the feature fusion method of central fusion and outward radiation. SFB inherits the bidirectional feature fusion path from top-down and bottom-up directions. The S-FPN composed of multiple SFBs can perform multiple feature fusion, thereby more accurately extracting the features of the input object and improving the accuracy of the network.
[0010] In the SI oU improvement, the original YOLOv8 uses DFL in combination with CI oU as its loss function. CI oU is usually effective in representing the overlapping area of the bounding box. However, it does not take into account the problem of direction mismatch between the ground truth box and the predicted box. When using CI oU for training, this problem may cause drift in the predicted box, resulting in slower convergence of the algorithm. In order to solve the problems related to CI oU, the SI oU loss function is introduced as an alternative. SI oU includes angle cost, distance cost, shape cost and I oU cost, as shown below:
[0011]
[0012] Ω=(1-e -Ww ) θ +(1-e -Wb ) θ
[0013]
[0014] Δ=2-e -γρx -e -γρy
[0015]
[0016] γ=2-∧
[0017]
[0018]
[0019]
[0020] In the formula, are the center coordinates of the real coordinate system and the center coordinates of the predicted coordinate system respectively; c b ,c w ,σ are the height difference, width difference and distance length of the center point between the real frame and the predicted frame respectively; c w ,c b The width and height of the minimum outer rectangle of the real frame and the predicted frame.
[0021] The control cable defect detection method based on the improved YOLOv8 algorithm obtained by the above technical solution of the present invention has the following beneficial effects:
[0022] It is suitable for real-time and efficient control cable defect monitoring and identification. This method has a faster detection speed than other methods and meets the control cable defect detection requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is the improved YOLOv8 network structure diagram of the present invention;
[0024] Figure 2 1 is a structural diagram of the SFM described in the present invention. DETAILED DESCRIPTION
[0025] The present invention will be described in detail below in conjunction with the accompanying drawings.
[0026] A control cable defect detection method based on an improved YOLOv8 algorithm comprises the following steps: step 1, creating a control cable defect data set and performing preprocessing; step 2, configuring a training environment; step 3, improving the YOLOv8 structure to obtain an improved YOLOv8 network model; step 4, integrating the improved YOLOv8 network model obtained in step 3 into the training environment configured in step 2, and adding the set parameter file to the network model; using divided training set and verification set images to perform model training and verification, wherein the improvements to the YOLOv8 structure in step 3 include Mosaic-9 improvement, G-GhostNet improvement, S-FPN improvement, and SIOU improvement.
[0027] The YOLOv8 algorithm represents the latest achievement of the YOLO target detection algorithm series. The YOLO series of algorithms have been widely used in various engineering fields. YOLOv8 is built on the basis of the YOLOv5 algorithm and strikes a balance between accuracy and detection speed. Its excellent performance makes it widely adopted in practical applications in various fields. Therefore, it is a benchmark algorithm suitable for intelligent detection of cable defects. In order to meet the needs of accurate and real-time identification of cable defects, the present invention improves the various components of YOLOv8 to form an improved YOLOv8 network. The improved YOLOv8 network structure is as follows Figure 1 shown.
[0028] In the Mosaic-9 improvement, the Mosaic-9 data enhancement method is introduced in the input stage to meet the need of identifying small target defects or complex background defects in control cables. The method aims to reduce the input calculation requirements in the training stage, while enhancing the network's ability to capture background details, thereby improving its robustness. This method includes randomly selecting 9 images from the input data, applying random scaling and cropping to each image, and then concatenating them into a single image. Before inputting into the network, this concatenated image is then resized to a standard size. This operation method allows the GPU to process 9 images simultaneously, and during the training process, the method introduces more background and detail information into the input, effectively enhancing the generalization ability of the algorithm. By utilizing Mosaic-9 data enhancement, the algorithm can both optimize hardware resource utilization and improve its ability to handle various real-world scenarios, ultimately improving its overall performance and robustness.
[0029] In the G-GhostNet improvement, G-GhostNet is introduced in the backbone part to enhance the backbone network components, enhance the feature fusion ability of the algorithm, and reduce information loss; in order to achieve network lightweight, this model uses the GhostConv module and the G-GhostNet stage as the basis for constructing the GGC (Ghost-Ghost-Complete) module; through the combination of the GGC module and the GBS (GhostBlockStage) module, G-GhostNet is constructed, which promotes the enhancement of the backbone components and replaces the C2F module of YOLOv8; the G-GhostNet stage significantly optimizes the traditional convolutional neural network structure, and its computational complexity optimization rate can be expressed as:
[0030]
[0031] As can be seen from the formula, compared with regular convolution, the computational complexity of G-GhostNet is significantly reduced, which effectively reduces the computational load of the network.
[0032] In the S-FPN improvement, in the real world, objects of different sizes, features and complex backgrounds often coexist. Achieving accurate and efficient detection under such conditions is a key challenge for target detection algorithms. The introduction of FPN significantly improves the performance of target detection algorithms in this regard, making FPN a standard component of most state-of-the-art (SOTA) target detectors. Feature pyramids can capture visual features of different scales. They retain details such as textures and corners in shallower layers, while covering a wider range of semantic features in deeper layers. In the last layer of the top-down path, they extract spatial and contextual features for accurate target detection. However, the use of only top-down feature fusion in FPN is susceptible to the displacement effect caused by pooling, thereby affecting accurate target positioning. The original YOLOv8 solved this problem through PANet, which introduced bidirectional FPN to recover the information lost from shallow layers due to fusion. However, most FPNs use pooling operations, which usually reduce the image size by half, resulting in scale gaps between layers and smaller and smaller feature maps, resulting in non-smooth feature fusion, such as Figure 2 As shown, SFM consists of three optional inputs. First, it linearly scales the input, then performs element-wise addition, and finally, fuses them with a 3×3 convolution to create the output. SFB includes two batches, a total of five SFBs, and S-FPN is constructed by stacking SFB three times, as shown in Figure 1 As shown in the Neck part, the features passed into the S-FPN are first sent from the first layer of the first SFB to the second layer, and then from the second layer to the first layer of the next SFB. This method adopts the feature fusion method of central fusion and outward radiation. SFB inherits the bidirectional feature fusion path from top-down and bottom-up directions. The S-FPN composed of multiple SFBs can perform multiple feature fusion, thereby more accurately extracting the features of the input object and improving the accuracy of the network.
[0033] In the SI oU improvement, the original YOLOv8 uses DFL in combination with CI oU as its loss function. CI oU is usually effective in representing the overlapping area of the bounding box. However, it does not take into account the problem of direction mismatch between the ground truth box and the predicted box. When using CI oU for training, this problem may cause drift in the predicted box, resulting in slower convergence of the algorithm. In order to solve the problems related to CI oU, the SI oU loss function is introduced as an alternative. SI oU includes angle cost, distance cost, shape cost and I oU cost, as shown below:
[0034]
[0035] Ω=(1-e -Ww ) θ +(1-e-Wb ) θ
[0036]
[0037] Δ=2-e -γρx -e -γρy
[0038]
[0039] γ=2-∧
[0040]
[0041]
[0042]
[0043] In the formula, are the center coordinates of the real coordinate system and the center coordinates of the predicted coordinate system respectively; c b ,c w ,σ are the height difference, width difference and distance length of the center point between the real frame and the predicted frame respectively; c w ,c b The width and height of the minimum outer rectangle of the real frame and the predicted frame.
[0044] Example 1 Evaluation indicators
[0045] In order to objectively evaluate the detection performance of different algorithm models, the present invention adopts the following indicators:
[0046] Frames per Second (FPS) and Inference Time: These metrics evaluate the inference speed of the model. FPS represents the number of frames processed per second, while inference time measures the time it takes the model to make a prediction for a given input.
[0047] FLOPs: This metric evaluates the computational complexity of the model. FLOPs represents the number of floating point operations required by the model to make predictions, which provides insight into the required computational resources.
[0048] Mean Average Precision (mAP): This metric evaluates the recognition accuracy of the model. mAP is a commonly used metric in object detection tasks, which is used to measure the average accuracy of the model across different classes or categories.
[0049]
[0050]
[0051] ΔR i =R i -R i-1 ,R0=0,P0=1
[0052]
[0053]
[0054] Where R is the recall rate, P is the detection rate, TP, FP, and FN are the number of positive cases, the number of negative cases, and the number of positive cases judged by the model.
[0055] Example 2 Control cable defect data set
[0056] By crawling the web and aggregating data from maintenance departments in various provinces and cities, more than 3,000 clear images of control cable defects from different angles and environments were collected. In order to enhance the data set, data enhancement techniques such as rotation and mirroring were used to achieve class balance and improve the robustness of the algorithm. In order to enhance the data set, data enhancement techniques such as rotation and mirroring were used to achieve class balance and improve the robustness of the algorithm. Finally, Label Img annotation software was used for annotation, and the images were divided into training and test sets in a ratio of 8:2 as shown in Table 1:
[0057]
[0058]
[0059] Table 1
[0060] Example 3 Experimental Results and Analysis
[0061] The recognition results of the improved YOLOv8 and YOLOv8 on the test dataset are shown in Table 2.
[0062] It can be clearly seen that after the introduction of G-Ghost Net, S-FPN and SI oU, the convergence speed of the improved YOLOv8 is significantly faster than the original YOLOv8.
[0063]
[0064] Table 2
[0065] In order to verify the effectiveness of YOLO-GSS in improving the original YOLOv8 model, an ablation experiment was conducted. The experimental results obtained under the same training process, hyperparameter settings, training and deployment environment are shown in Table 2.
[0066] In Table 2, when YOLOv8 is not improved, its detection speed is 12FPS (Frames / s) and its mAP is 81.5%. Net-1 uses Mosaic-9 data enhancement method and optimizes the Mosaic-4 data enhancement of YOLOv8. Due to the addition of input features, background information and target scale in Mosaic-9, the mAP of Net-1 is 1.7% higher than that of YOLOv8.
[0067] Table 3 Improved YOLOv8 ablation experiment
[0068]
[0069] Table 3
[0070] Net-2 introduced G-GhostNet to replace Backbone based on Net-1. G-GhostNet introduced cost-effective operations, greatly reducing the parameters and calculations of the backbone part of the model, so that Net-2 achieved an inference speed of 63 frames / second, an increase of 52 frames / second over Net-1. However, G-GhostNet deleted some channels, resulting in a slight decrease in inference accuracy of 1.1% compared to Net-1.
[0071] Net-3 introduces S-FPN on the basis of Net-2 to improve the Neck component of the network. Compared with PANet, S-FPN enhances the feature fusion capability and significantly improves the inference accuracy by 5.4% to 87.5%. However, the higher complexity of S-FPN reduces the inference speed by 4 frames per second.
[0072] Net-4 is an improved YOLOv8. It introduces SI oU based on Net-3 and further enhances the loss function of the YOLOv8 model. SI oU solves the problem of prediction box drift in the CI oU loss function, and the detection accuracy is slightly improved by 1.7% compared with Net-3. However, the computational complexity of SI oU reduces the detection speed of the model by 1 frame / second.
[0073] Net-5 improves the CI oU loss function based on the original YOLOv8 and changes it to SI oU loss function. Since SI oU solves the prediction box drift problem in the CI oU loss function, the detection accuracy of Net-5 is improved by 1.2% and GFLOPs is increased by 0.5, but the detection speed is not affected.
[0074] The ablation experiment shows that the inference speed of the improved YOLOv8 algorithm is increased by 46 frames per second and the detection accuracy is improved by 7.7%, which verifies the effectiveness of the improved YOLOv8 algorithm.
[0075] The above technical solutions only reflect the preferred technical solutions of the technical solutions of the present invention. Some changes that may be made to certain parts thereof by technicians in this technical field all reflect the principles of the present invention and fall within the protection scope of the present invention.
Claims
1. A control cable defect detection method based on an improved YOLOv8 algorithm, step 1, creating a control cable defect data set and preprocessing it; step 2, configuring a training environment; step 3, improving the YOLOv8 structure to obtain an improved YOLOv8 network model; step 4, integrating the improved YOLOv8 network model obtained in step 3 into the training environment configured in step 2, and adding the set parameter file to the network model; using the divided training set and verification set pictures for model training and verification, characterized in that, The improvements to the YOLOv8 structure in step three include Mosaic-9 improvements, G-GhostNet improvements, S-FPN improvements, and SIoU improvements.
2. The control cable defect detection method based on the improved YOLOv8 algorithm according to claim 1, characterized in that: In the Mosaic-9 improvement, 9 images are randomly selected from the input data, random scaling and cropping are applied to each image, and then they are concatenated into a single image.
3. The control cable defect detection method based on the improved YOLOv8 algorithm according to claim 1, characterized in that: In the G-GhostNet improvement, G-GhostNet is introduced in the backbone part to enhance the backbone network components, and its computational complexity optimization rate can be expressed as:
4. The control cable defect detection method based on the improved YOLOv8 algorithm according to claim 1, characterized in that: In the S-FPN improvement, the S-FPN is constructed by stacking SFBs three times, and the features passed into the S-FPN are first sent from the first layer of the first SFB to the second layer, and then sent from the second layer to the first layer of the next SFB.
5. The control cable defect detection method based on the improved YOLOv8 algorithm according to claim 1, characterized in that: In the SIoU improvement, the SIoU loss function is introduced as an alternative. SIoU includes angle cost, distance cost, shape cost and IoU cost, as shown below: Ω=(1-e -Ww ) θ +(1-e -Wb ) θ Δ=2-e -γρx -And -γρy γ=2-∧ In the formula, b cx ,b cy They are the center coordinates of the real coordinate system and the center coordinates of the predicted coordinate system respectively; c b ,c w ,σ are the height difference, width difference and distance length of the center point between the real frame and the predicted frame respectively; c w ,c b The width and height of the minimum outer rectangle of the real frame and the predicted frame.
