Cable joint polishing image defect detection method and device and medium
By improving the YOLOv10 model, combining the RepHELAN network and attention mechanism, the problem of artificial dependence and low detection accuracy in traditional detection methods is solved, and high-precision automated detection during the grinding of cable connectors is realized to adapt to complex environments and different lighting conditions.
Patent Information
- Application Number
- CN202411724988.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-05-02
AI Technical Summary
Traditional cable joint grinding detection methods rely on manual labor, detection accuracy and consistency are difficult to guarantee, and the rule-based image processing algorithm is not effective in complex backgrounds and low-light conditions.
The improved YOLOv10 model is adopted, combined with the RepHELAN network and attention mechanism to detect the image defect of the cable joint polishing. Improved models predict defect characteristics on the cable joint surface through the combination of feature extraction, classifiers and regressors, and enhance detection of complex backgrounds and tiny defects through attention mechanisms.
It significantly improves the automation level and detection accuracy of cable joint grinding defect detection, reduces the dependence on manual inspection, and can maintain high detection performance under different lighting conditions and complex backgrounds, ensuring the safe and stable operation of the cable system.
Smart Images

Figure CN119919342A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cable joint detection, and in particular to a cable joint polishing image defect detection method based on improved YOLOv10. Background Art
[0002] Grinding of cable joints ensures that the joint surface is smooth and flat, thereby ensuring the electrical connection performance and mechanical strength of the joint. The surface quality directly affects the electrical conductivity and insulation performance of the joint. Through grinding, the oxide layer, impurities and burrs generated during the processing process on the joint surface can be removed, making the joint surface more uniform, which helps to reduce contact resistance and improve electrical performance. At the same time, grinding can also improve the mechanical bonding strength of the joint, reduce the heat caused by poor contact, and thus extend the service life of the cable system.
[0003] Traditional detection methods mainly rely on manual detection. The detection results are limited by the operator's experience and judgment, and are easily affected by fatigue and subjective factors, making it difficult to ensure detection accuracy and consistency. In addition, rule-based image processing algorithms often fail to produce satisfactory results when dealing with complex backgrounds, low light conditions, and other conditions. Summary of the invention
[0004] The purpose of the present invention is to improve the automation level and detection accuracy of defect detection in the process of cable joint polishing, and propose a cable joint polishing image defect detection method, device and medium based on improved YOLOv10.
[0005] The purpose of the present invention can be achieved by the following technical solutions:
[0006] As a first aspect of the present invention, a method for detecting cable joint polishing image defects is provided, the steps comprising:
[0007] Acquire image data of the polished portion of the cable connector;
[0008] The improved YOLOv10 model is used to extract features from the inspection image; the improved YOLOv10 model uses a backbone network based on the RepHELAN network architecture to extract features, and uses an attention mechanism to process to obtain a detection feature map, and the detection feature map is sent to a classifier and a regressor to predict and generate a bounding box and classification results of defect features on the surface of the cable joint;
[0009] Compare the extracted defect features with the standard defect feature library to determine whether there are minor defects;
[0010] If the test results meet the preset standards, they are marked as qualified; if they do not meet the standards, the defective areas are marked and reprocessing is required.
[0011] As a preferred technical solution, the target detection backbone network of the improved YOLOv10 model adopts the RepHELAN network architecture: by setting multi-branch convolutions of different sizes of convolution kernels to extract features of different perceptions, for N branches, the convolution kernel size used in each branch is k i ×k i (i=1,2,........,N), and adopt residual connection to alleviate the gradient vanishing problem in deep networks.
[0012] As a preferred technical solution, the attention mechanism introduced by the improved YOLOv10 model after the target detection backbone network includes channel attention and spatial attention; the channel attention will assign different weight values to different feature channels in the channel dimension, helping the network to focus on feature channels that are helpful for target detection; the spatial attention will assign different weight values in spatial positions, helping the network to focus on local areas in the feature map.
[0013] As a preferred technical solution, the channel attention performs global average pooling on the input feature map, and each channel generates a global description vector z:
[0014]
[0015] Among them, F is the input feature map, the dimension is C×H×W, where C is the number of channels, H is the height, and W is the width; z c is the vector after global average pooling, representing the global information of channel c; F c (i, j) represents the pixel value at position (i, j) on channel c;
[0016] The global description vector z is input into a fully connected layer, and the weight s of each channel is generated through ReLU and sigmoid activation functions c :
[0017] s c =σ(W2·ReLU(W1·z c ))
[0018] Among them, W1 and W2 represent the weight matrix of the fully connected layer, which is used to map the input to the hidden layer to the final result layer; ReLU(x)=max(0,x) represents the activation operation, which makes the result more linear; Represents the sigmoid activation operation, representing the channel weight;
[0019] Channel reweighting applies the generated weights to each channel of the original feature map to obtain a weighted feature map:
[0020] F c ′=s c ·Fc
[0021] Among them, F c ′ is the re-weighted feature map, which is used to emphasize the importance of channel c; F c is the original feature map;
[0022] The spatial attention mechanism performs maximum pooling or average pooling operations on the input feature map F to obtain the channel attention tensor and channel index tensor:
[0023] Concatenate the channel attention tensor and the channel index tensor and input them into the convolution layer to obtain the spatial attention map M. s ;
[0024] The calculated spatial attention map M s Act on each spatial position of the original feature map F respectively to obtain the weighted final feature map F":
[0025] F″(i,j)=M s (i,j)·F(i,j)
[0026] Among them, F″(i,j) is the weighted feature map.
[0027] As a preferred technical solution, the matching stage of the improved YOLOv10 model adopts dual allocation:
[0028] In one-to-one matching, only one optimal prediction box is assigned to each true box, and the matching metric is calculated as follows:
[0029]
[0030] Where p represents the classification score; is the bounding box of the prediction box and the instance; s represents the spatial prior, indicating whether the anchor point of the prediction box is within the instance; α and β are two hyperparameters used to balance the semantic prediction task and the location regression task;
[0031] In one-to-many matching, a ground-truth box is matched with multiple predicted boxes with high confidence:
[0032]
[0033] Among them, m multi is a multi-matching metric used to determine the matching of multiple predicted boxes with the real box in a one-to-many matching strategy; s is a spatial prior indicating whether the anchor point of the predicted box is within the instance of the real box; α is a hyperparameter used to adjust the influence of the classification score in the matching metric; For the prediction box The intersection-over-union ratio with the true box b; β is a hyperparameter used to adjust the influence of the intersection-over-union ratio in the matching metric; λ is a weight factor used to balance the diversity and consistency of different matching situations in the multi-matching metric; It is a consistency measure used to ensure the consistency of rectangular head predictions for multi-scale detection.
[0034] As a preferred technical solution, the detection output of the improved YOLOv10 model includes: the bounding box of each target object (b x ,b y ,b w ,b h ), the classification label class of the target object and the confidence score D;
[0035] b x =σ(t x )+c x
[0036] b y =σ(t y )+c y
[0037] b w =p w e tw
[0038]
[0039] Among them, (b x ,b y ) is the center coordinate of the bounding box, (b w ,b h ) are the width and height of the bounding box, p w and p h is the width and height of the anchor box, c x and c y is the coordinate of the upper left corner of the grid, σ represents the classification confidence D described by the Sigmoid function is expressed as:
[0040] D=p c ·p class,i
[0041] Among them, p c The classification confidence of each bounding box, p class is the conditional probability of each category of the bounding box.
[0042] As a preferred technical solution, the improved YOLOv10 model adopts the Focal-EIoU loss function, which is as follows:
[0043] FocalEIoU Loss = α(1-IoU) γ×EIoU
[0044] Among them, α is the balance factor, which is used for positive and negative samples and proportion distribution, and can adjust the loss of difficult and easy samples at an exponential level. γ is the focus factor, which is used to adjust the weight of difficult and easy samples. IoU represents the intersection over union ratio of the predicted box and the bounding box of the instance.
[0045] The EIoU loss is calculated as:
[0046]
[0047] Among them, ρ(b,b * ) is the distance between the center point of the predicted box and the true box; c is the diagonal length of the bounding box; v is the consistency measure of the aspect ratio; c w and c h are the width and height of the predicted box and the true box respectively.
[0048] As a preferred technical solution, the method adopts the contrast adaptive CLAHE method to perform image enhancement when constructing a training set, and the steps are as follows:
[0049]
[0050] Where h(r) is the frequency of occurrence of pixels with gray level r in the image, i.e., the histogram value; n is the total number of pixels in the image; r i is the gray value of the i-th pixel in the image; δ(x) is a function that takes the value of 1 when x=0 and takes the value of 0 otherwise;
[0051] Clip the histogram of each subblock to limit the degree of contrast enhancement:
[0052] h′(r)=min(h(r),clip_limit)
[0053] Where h′(r) is the clipped histogram value, h(r) is the original histogram value, and clip_limit is the threshold for histogram clipping;
[0054] Allocation of redundant pixels in the image:
[0055]
[0056] Among them, r new is the gray value after redistribution; h max is the maximum value of the histogram after clipping;
[0057] Interpolate the grayscale value at the center of each sub-block to generate the final enhanced image:
[0058] f(x,y)=(1-u)(1-v)f(i,j)+u(1-v)f(i+1,j)+(1-u)vf(i,j+1)+uvf(i+1,j+1)
[0059] Among them, f(x,y) is the interpolated pixel value; (i,j), (i+1,j), (i,j+1), (i+1,j+1) are the coordinates of four adjacent pixels; u and v are the coordinates of the sub-block center relative to the input image.
[0060] As a second aspect of the present invention, there is provided an electronic device, comprising:
[0061] one or more processors;
[0062] A memory for storing one or more programs;
[0063] When the one or more programs are executed by the one or more processors, the one or more processors implement the cable joint polishing image defect detection method as described above.
[0064] As a third aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the cable connector polishing image defect detection method as described above are implemented.
[0065] Compared with the prior art, the present invention has the following beneficial effects:
[0066] 1) This invention improves the YOLOv10 model, introduces the Focal-EIoU loss function and the RepHELAN module to optimize the detection of cable joint surface defects, including adjusting the size of the anchor box, a more sophisticated feature extraction network structure, etc., to improve the detection accuracy of small defects. The improved algorithm can maintain high detection performance under different lighting conditions and complex backgrounds, significantly reduce the dependence on manual detection, improve detection efficiency and accuracy, and provide reliable technical guarantee for the safe and stable operation of the cable system.
[0067] 2) This method introduces an attention mechanism, which learns the important information in the feature map output by the target detection backbone network, emphasizes the important information, strengthens the network's judgment of the salient area, and thus improves the detection accuracy of the target. The model has a stronger processing ability for complex backgrounds, weak targets, and multi-scale objects. The attention network will sample and amplify the feature map, so that more "important" areas can be "focused" more times, thereby achieving better detection effect and robustness.
[0068] 3) The present invention introduces the Focal-EIoU loss function, which is composed of Focal Loss and EIoU loss. FocalLoss reduces the weight relative to simple samples, and is committed to solving the problem of the impact of unbalanced samples on the target detection model. This loss mechanism helps to focus on training difficult samples. EIoU loss introduces the result of two-dimensional square root division of the center coordinates of the real box and the center coordinates of the predicted box, thereby optimizing the center deviation size of the target during the positioning process.
[0069] 4) The present invention adopts a dual allocation strategy, and the bounding box set finally generated does not need to be processed by non-maximum suppression. Each bounding box has a high confidence in the set and maintains good distribution consistency in space, thereby effectively reducing redundant prediction results. This method not only simplifies the post-processing steps, but also ensures the accuracy and rationality of the detection results. The final detection output includes the category information, confidence score and precise bounding box position of each target, thereby providing high-quality detection results for subsequent applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 A flow chart of the cable joint polishing image defect detection method based on improved YOLOv10 provided by the present invention;
[0071] Figure 2 A schematic diagram of the network structure of the improved YOLOv10 provided by the present invention;
[0072] Figure 3 Schematic diagram of the channel attention mechanism adopted by the present invention;
[0073] Figure 4 Schematic diagram of the spatial attention mechanism adopted by the present invention;
[0074] Figure 5 This is a flow chart of cable joint polishing image defect detection provided by the present invention. DETAILED DESCRIPTION
[0075] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0076] Example 1
[0077] The present invention designs, improves and trains the YOLOv10 model, introduces the Focal-EIoU loss function and the RepHELAN module to optimize the cable joint surface defect detection, including adjusting the size of the anchor box, a more sophisticated feature extraction network structure, etc. Figure 1As shown, the specific detection process of this method is as follows: collect image data during the polishing process of cable joints through high-definition camera equipment; use the improved YOLOv10 model to extract features from the detection image and extract the defect features on the surface of the cable joint; compare the extracted features with the standard defect feature library to determine whether there are minor defects; if the test results meet the preset standards, they are marked as qualified; if they do not meet the standards, the defective area is marked and reprocessing is required. It can accurately monitor defects in the polishing process of cable joints, significantly improve the deployability, detection efficiency and accuracy, reduce manual intervention, and ensure the quality and electrical performance of cable joints. Among them, the specific implementation process of building and training the improved YOLOv10 model is as follows:
[0078] 1. Data collection and preprocessing
[0079] During the polishing process of the cable joint, a high-definition camera is used to take a group of photos with multiple angles, different lighting, and large background differences as the training set and test set of the model data set. The captured training set and test set training data are preprocessed to perform denoising, enhancement, and size standardization. This can ensure that the shooting quality of pictures at different angles is uniform and effective. The image clarity and contrast can be improved, so the image enhancement method used is as follows. The contrast-adaptive CLAHE method will be used as part of the image enhancement. The steps are as follows:
[0080]
[0081] Among them, h(r) is the frequency of the pixel with gray level r in the image, that is, the histogram value, n is the total number of pixels in the image, r i is the gray value of the i-th pixel in the image, δ(x) is a function that takes the value of 1 when x=0 and 0 otherwise.
[0082] Clip the histogram of each sub-block to limit the degree of contrast enhancement:
[0083] h′(r)=min(h(r),clip_limit)
[0084] Among them, h′(r) is the clipped histogram value, h(r) is the original histogram value, and clip_limit is the threshold of histogram clipping, which is used to limit the maximum value of the histogram to avoid excessive contrast enhancement.
[0085] Redistribute the extra pixels into the image:
[0086]
[0087] Among them, r new is the gray value after redistribution; hmax is the maximum value of the histogram after clipping; 255 is the maximum value of the image grayscale (for 8-bit images).
[0088] Interpolate the grayscale value at the center of each sub-block to generate the final enhanced image:
[0089] f(x,y)=(1-u)(1-v)f(i,j)+u(1-v)f(i+1,j)+(1-u)vf(i,j+1)+uvf(i+1,j+1)
[0090] Among them, f(x,y) is the interpolated pixel value, (i,j), (i+1,j), (i,j+1), (i+1,j+1) are the coordinates of four adjacent pixels, and u and v are the coordinates of the sub-block center relative to the input image.
[0091] 2. Data labeling and model training
[0092] Defects are annotated on the data-enhanced images. The graphic annotation tool LabelImg is used to annotate the defect locations in the images for training the target detection model to improve the data quality of the training model. After the annotation is completed, the data is divided into a training set and a test set at a ratio of 3:1. When training the model, a sufficient training set is ensured, and the remaining test set is used to evaluate the training results.
[0093] 3. Model optimization and verification
[0094] After the model is trained on the cross-validation set, the model's detection performance is evaluated on a separate validation set. The improved YOLOv10 network structure is shown in the figure below: Figure 2 As shown. In addition, other optimization methods are also carried out to improve the detection performance of the detection model, especially paying more attention to difficult-to-detect targets. The Focal-EIoU loss function is introduced, which is composed of FocalLoss and EIoU losses. Focal Loss reduces the weight relative to simple samples and is committed to solving the problem of the impact of unbalanced samples on the target detection model. This loss mechanism helps to focus on training difficult samples. EIoU loss is an improved method of IoUloss. Based on IoU loss, EIoU loss introduces the result of two-dimensional square root division of the center coordinates of the real box and the center coordinates of the predicted box, thereby optimizing the center deviation size of the target during positioning.
[0095] FocalEIoU Loss = α(1-IoU) γ ×EIoU
[0096] Among them, α is the balance factor, which is used for positive and negative samples and proportion distribution, and can adjust the loss of difficult and easy samples at an exponential level. γ is the focus factor, which is used to adjust the weight of difficult and easy samples. IoU represents the intersection over union ratio of the predicted box and the bounding box of the instance.
[0097] The EIoU loss is calculated as:
[0098]
[0099] Among them, ρ(b,b * ) is the distance between the center point of the predicted box and the true box; c is the diagonal length of the bounding box; v is the consistency measure of the aspect ratio; c w and c h are the width and height of the predicted box and the true box respectively.
[0100] The backbone network of the YOLOv10 model adopts the RepHELAN network architecture, in which multi-branch convolution is used to extract features of different perceptions, which is achieved by setting convolution kernels of different sizes. Assuming there are N branches, the size of each branch is k i ×k i (i=1,2,........,N) then the convolution output formula is:
[0101]
[0102] The output feature map is Such a multi-branch structure can obtain richer feature representations while keeping the computational complexity under control. In order to make the training process more stable, residual connections are used in the module to alleviate the gradient vanishing problem in deep networks, thereby improving training stability. The mathematical expression of residual connection is f out =f in +Γ(f in ), f in ,f out is the input and output characteristics, Γ(f in ) are the features extracted by the convolutional layer.
[0103] Based on the target detection network proposed above, in order to improve the detection ability of the target detection network in complex backgrounds, weak targets and objects of different sizes, the attention mechanism is further introduced. The attention mechanism learns the important information in the feature map, emphasizes the important information, strengthens the network's judgment of the salient area, and thus improves the detection accuracy of the target. The attention mechanism mainly includes channel attention (Attention) and spatial attention (Spatial Attention). Channel attention will assign different weight values to different feature channels in the channel dimension, helping the network to focus on feature channels that are helpful for target detection. Spatial attention will assign different weight values in spatial positions, helping the network to focus on local areas in the feature map. The combination of the two types of attention can enable the model to accurately detect and classify targets of different sizes in different levels and complex backgrounds, and better complete the learning task.
[0104] (3.1) Channel Attention
[0105] The channel attention mechanism is to weight different channels in the feature map, which plays a role in strengthening effective features. The SE (Squeeze-and-Excitation) module is used to implement the channel attention mechanism. Its principle is as follows:
[0106] The schematic diagram of global average pooling of the input feature map F is as follows Figure 3 As shown, each channel produces a global description vector z:
[0107]
[0108] Among them, F is the input feature map, the dimension is C×H×W, where C is the number of channels, H is the height, and W is the width; z c is the vector after global average pooling, representing the global information of channel c; F c (i,j) represents the pixel value at position (i,j) on channel c.
[0109] The description vector is input into a fully connected layer, and the weight s of each channel is generated through ReLU and sigmoid activation functions c :
[0110] s c =σ(W2·ReLU(W1·z c ))
[0111] Among them, W1 and W2 represent the weight matrix of the fully connected layer, which is used to map the input to the hidden layer to the final result layer; ReLU(x)=max(0,x) refers to the activation operation, which can make the result more linear; It is a sigmoid activation operation, and its result ranges from 0 to 1, representing the channel weight.
[0112] Channel reweighting applies the generated weights to each channel of the original feature map to obtain a weighted feature map:
[0113] F c ′=s c ·F c
[0114] Among them, F c ′ is a re-weighted feature map used to emphasize the importance of channel c.
[0115] (3.2) Spatial Attention
[0116] Pooling operation refers to the maximum pooling (pooling) or average pooling (pooling) operation on the input feature map F. Figure 4 As shown, we get a feature map F max , a feature map F avg :
[0117]
[0118] Among them, F max It is obtained by GlobalMaxPooling the feature map, where (i, j) represents the global maximum activation value map of each channel; F avg By performing GlobalAveragePooling on the feature map, (i, j) represents the global average activation value map of each channel. c represents the channel index. Then the two feature maps are concatenated as the channel attention tensor and the channel index tensor, and input into the convolution layer to obtain the spatial attention map M. s :
[0119] M s =σ(Conv(F concat ))
[0120] Among them, F concat It is the image after the feature map concatenation operation, and its size is 2×H×W; Conv represents the convolution operation, which is used to generate the spatial attention map M s , represents the size of spatial attention at each position.
[0121] For the calculated spatial attention map M s , respectively act on each spatial position of the original feature map F, and obtain the weighted final feature map F":
[0122] F″(i,j)=Ms (i,j)·F(i,j)
[0123] Among them, F″(i,j) is the weighted feature map used to emphasize the important spatial position (i,j).
[0124] The RPN features extracted by the detector backbone network are directly processed using the attention mechanism and sent to the classifier and regressor after processing. The detection feature map processed by the attention mechanism is applied with the Focal-EIoU loss function.
[0125] FocalEIoU Loss=α(1-IoU(F″)) γ ×EIoU(F″)
[0126] Among them, α is the balance factor, which is used for positive and negative samples and proportion distribution, and can adjust the loss of difficult and easy samples at an exponential level. γ is the focus factor, which is used to adjust the weight of difficult and easy samples. IoU (F″) represents the intersection over union ratio of the predicted feature map and the real defect image.
[0127] This is based on the edge point weights of the feature map as a measure of the overlap between the current predicted box and the true box. EIoU(F″) is a stronger intersection over union ratio based on the edge point weights of the feature map, which takes into account the embedding relationship between boxes, as well as the distance and aspect ratio of the center points.
[0128] This method introduces the attention mechanism, which enables the model to have stronger processing capabilities for complex backgrounds, weak targets, and multi-scale objects. The attention network will sample and amplify the feature map so that more "important" areas can be "attended" more times, thereby achieving better detection effects and robustness.
[0129] 4. Defect Detection
[0130] The trained improved YOLOv10 model is deployed on the cable joint grinding detection device to collect and process the image data generated during grinding. It can identify and calibrate the defective areas that have already occurred during the grinding process. The system has detection characteristics and can promptly feedback the identified defect information to relevant personnel for adjustment.
[0131] During the defect detection process, the input image is processed to generate predicted bounding boxes and classification results. Multiple anchor boxes are generated at each feature map position. These anchor boxes are used to predict the position and category of the object. The prediction of each anchor box includes: position regression (t x ,t y ,t w ,t h ). The calculation formula for position regression is:
[0132] bx =σ(t x )+c x
[0133] b y =σ(t y )+c y
[0134] b w =p w e tw
[0135]
[0136] Among them, (b x ,b y ) is the center coordinate of the bounding box, (b w ,b h ) are the width and height of the bounding box, p w and p h is the width and height of the anchor box, c x and c y is the coordinate of the upper left corner of the grid, and σ represents the Sigmoid function.
[0137] Each bounding box also predicts a classification confidence p c And the conditional probability p of each category class :
[0138] p c =σ(t c )
[0139] Class conditional probability p class It is calculated by the softmax function:
[0140]
[0141] Finally, the confidence score D of each predicted box is:
[0142] D=p c ·p class,i
[0143] In one-to-one matching, the improved YOLOv10 model assigns only one optimal prediction box to each true box, ensuring that each target object can be uniquely detected. The matching metric is calculated based on the following formula:
[0144]
[0145] Where: p is the classification score; is the bounding box of the prediction box and the instance; s represents the spatial prior, indicating whether the anchor point of the prediction box is within the instance; α and β are two hyperparameters used to balance the semantic prediction task and the location regression task.
[0146] In one-to-many matching, YOLOv10 allows a true box to be matched with multiple high-confidence predicted boxes. This helps improve recall, especially in complex scenes.
[0147]
[0148] Among them, m multi is a multi-matching metric used to determine the matching of multiple predicted boxes with the real box in a one-to-many matching strategy; s is a spatial prior indicating whether the anchor point of the predicted box is within the instance of the real box; α is a hyperparameter used to adjust the influence of the classification score in the matching metric; For the prediction box The intersection over union ratio with the ground-truth box b; β is a hyperparameter used to adjust the impact of IoU in the matching metric; λ is a weight factor used to balance the diversity and consistency of different matching situations in the multi-matching metric; a It is a consistency measure used to ensure that the rectangular head prediction of multi-scale detection is "consistent".
[0149] Through the above-mentioned dual allocation strategy, the bounding box set finally generated no longer needs to be processed by non-maximum suppression (NMS). Each bounding box has a high confidence in set B and maintains good distribution consistency in space, thereby effectively reducing redundant prediction results. The predictions of the scheme of the present invention are completely inconsistent with many existing schemes, and the instance scores (areas) between predictions are also relatively high. At this time, it does not matter whether the number of spatial overlapping clusters is large or small, and it will not be very messy. The final detection result only needs to be processed post-processing. This method not only simplifies the post-processing steps, but also ensures the accuracy and rationality of the detection results. The final detection output includes the category information, confidence score and precise bounding box position of each target, thereby providing high-quality detection results for subsequent applications. The final detection output includes:
[0150] The bounding box of each target object (b x ,b y ,b w ,b h );
[0151] The classification label class of the target object;
[0152] Confidence score D;
[0153] 5. Data storage and management: The image data and test results generated during the test will be stored in the database to facilitate subsequent quality traceability and analysis. The system also has data management functions to ensure the integrity, security and traceability of the data.
[0154] The present invention significantly improves the accuracy and efficiency of cable joint polishing defect detection. By introducing the improved YOLOv10 model, it can accurately identify tiny defects, reduce the possibility of missed detection and false detection, realize detection and speed up the production rhythm. At the same time, the present invention performs well in complex environments, can adapt to changing lighting conditions and background interference, and ensure the reliability of detection. The automated detection process reduces the reliance on manual operation, improves detection consistency, and reduces labor costs. In addition, the present invention also enhances quality traceability, provides a complete quality traceability chain through data storage and management functions, and provides data support for continuous improvement and optimization.
[0155] Example 2
[0156] As a second aspect of the present invention, the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned cable joint polishing image defect detection method based on improved YOLOv10. In addition to the above-mentioned processor, memory and interface, any device with data processing capability in which the device in the embodiment is located may also include other hardware according to the actual function of the device with data processing capability, which will not be described in detail.
[0157] Example 3
[0158] As a third aspect of the present invention, the present application also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implements the above-mentioned cable joint polishing image defect detection method based on improved YOLOv10. The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the foregoing embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be an external storage device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card (Flash Card), etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capability. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.
[0159] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A method for detecting defects in a polished image of a cable joint, characterized in that the steps include: Acquire image data of the polished portion of the cable connector; Use the improved YOLOv10 model to extract features from the detection image; The improved YOLOv10 model uses a backbone network based on the RepHELAN network architecture to extract features, and uses an attention mechanism to process to obtain a detection feature map, and sends the detection feature map to a classifier and a regressor to predict and generate a bounding box and classification result of the defect features on the surface of the cable joint; Compare the extracted defect features with the standard defect feature library to determine whether there are minor defects; If the test results meet the preset standards, they are marked as qualified; If the standards are not met, the defective area is marked and reprocessing is required.
2. A cable joint polishing image defect detection method according to claim 1, characterized in that: The improved YOLOv10 model's target detection backbone network adopts the RepHELAN network architecture: by setting multi-branch convolutions with different convolution kernels, different perception features are extracted. For N branches, the convolution kernel size used in each branch is k. i ×k i (i=1,2,........,N), and adopt residual connection to alleviate the gradient vanishing problem in deep networks.
3. A cable joint polishing image defect detection method according to claim 1, characterized in that: The attention mechanism introduced by the improved YOLOv10 model after the target detection backbone network includes channel attention and spatial attention; the channel attention will assign different weight values to different feature channels in the channel dimension to help the network focus on feature channels that are helpful for target detection; The spatial attention described above assigns different weight values to spatial positions, helping the network to focus on local areas in the feature map.
4. A cable joint polishing image defect detection method according to claim 3, characterized in that: The channel attention performs global average pooling on the input feature map, and each channel generates a global description vector z: Among them, F is the input feature map, the dimension is C×H×W, where C is the number of channels, H is the height, and W is the width; z c is the vector after global average pooling, representing the global information of channel c; F c (i, j) represents the pixel value at position (i, j) on channel c; The global description vector z is input into a fully connected layer, and the weight s of each channel is generated through ReLU and sigmoid activation functions c : s c =σ(W2 ReLU(W1 z c )) Among them, W1 and W2 represent the weight matrix of the fully connected layer, which is used to map the input to the hidden layer to the final result layer; ReLU(x)=max(0,x) represents the activation operation, which makes the result more linear; Represents the sigmoid activation operation and represents the channel weight; Channel reweighting applies the generated weights to each channel of the original feature map to obtain a weighted feature map: F′ c =s c ·F c Among them, F c ′ is the re-weighted feature map, which is used to emphasize the importance of channel c; F c is the original feature map; The spatial attention mechanism performs maximum pooling or average pooling operations on the input feature map F to obtain the channel attention tensor and channel index tensor: Concatenate the channel attention tensor and the channel index tensor and input them into the convolution layer to obtain the spatial attention map M. s ; The calculated spatial attention map M s Act on each spatial position of the original feature map F respectively to obtain the weighted final feature map F": F″(i,j)=M s (i,j)·F(i,j) Among them, F″(i,j) is the weighted feature map.
5. A cable joint polishing image defect detection method according to claim 3, characterized in that: The matching phase of the improved YOLOv10 model adopts dual allocation: In one-to-one matching, only one optimal prediction box is assigned to each true box, and the matching metric is calculated as follows: Where p represents the classification score; is the bounding box of the prediction box and the instance; s represents the spatial prior, indicating whether the anchor point of the prediction box is within the instance; α and β are two hyperparameters used to balance the semantic prediction task and the location regression task; In one-to-many matching, a ground-truth box is matched with multiple predicted boxes with high confidence: Among them, m multi is a multi-matching metric used to determine the matching of multiple predicted boxes with the real box in a one-to-many matching strategy; s is a spatial prior indicating whether the anchor point of the predicted box is within the instance of the real box; α is a hyperparameter used to adjust the influence of the classification score in the matching metric; For the prediction box The intersection-over-union ratio with the true box b; β is a hyperparameter used to adjust the influence of the intersection-over-union ratio in the matching metric; λ is a weight factor used to balance the diversity and consistency of different matching situations in the multi-matching metric; It is a consistency measure used to ensure the consistency of rectangular head predictions for multi-scale detection.
6. A cable joint polishing image defect detection method according to claim 1, characterized in that: The detection output of the improved YOLOv10 model includes: the bounding box of each target object (b x ,b y ,b w ,b h ), the classification label class of the target object and the confidence score D; b x =σ(t x )+c x b y =σ(t y )+c y b w =p w e tw Among them, (b x ,b y ) is the center coordinate of the bounding box, (b w ,b h ) are the width and height of the bounding box, p w and p h is the width and height of the anchor box, c x and c y is the coordinate of the upper left corner of the grid, σ represents the Sigmoid function The classification confidence D is expressed as: D=p c ·p class,i Among them, p c The classification confidence of each bounding box, p class is the conditional probability of each category of the bounding box.
7. A cable joint polishing image defect detection method according to claim 1, characterized in that: The improved YOLOv10 model adopts the Focal-EIoU loss function, which is as follows: FocalEIoU Loss=α(1-IoU) γ ×EIoU Among them, α is the balance factor, which is used for positive and negative samples and proportion distribution, and can adjust the loss of difficult and easy samples at an exponential level. γ is the focus factor, which is used to adjust the weight of difficult and easy samples. IoU represents the intersection over union ratio of the predicted box and the bounding box of the instance. The EIoU loss is calculated as: Among them, ρ(b,b * ) is the distance between the center point of the predicted box and the true box; c is the diagonal length of the bounding box; v is the consistency measure of the aspect ratio; c w and c h are the width and height of the predicted box and the true box respectively.
8. A cable joint polishing image defect detection method according to claim 1, characterized in that: The method adopts the contrast adaptive CLAHE method to perform image enhancement when constructing the training set, and the steps are as follows: Where h(r) is the frequency of occurrence of pixels with gray level r in the image, i.e., the histogram value; n is the total number of pixels in the image; r i is the gray value of the i-th pixel in the image; δ(x) is a function that takes the value of 1 when x=0 and takes the value of 0 otherwise; Clip the histogram of each subblock to limit the degree of contrast enhancement: h′(r)=min(h(r),clip_limit) Where h′(r) is the clipped histogram value, h(r) is the original histogram value, and clip_limit is the threshold for histogram clipping; Allocation of redundant pixels in the image: Among them, r new is the gray value after redistribution; h max is the maximum value of the histogram after clipping; Interpolate the grayscale value at the center of each sub-block to generate the final enhanced image: f(x,y)=(1-u)(1-v)f(i,j)+u(1-v)f(i+1,j)+(1-u)vf(i,j+1)+uvf(i+1,j+1) Among them, f(x,y) is the interpolated pixel value; (i,j), (i+1,j), (i,j+1), (i+1,j+1) are the coordinates of four adjacent pixels; u and v are the coordinates of the sub-block center relative to the input image.
9. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the cable joint polishing image defect detection method as described in any one of claims 1-8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the cable joint polishing image defect detection method as described in any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Cable fault infrared image target detection method and system based on improved YOLO10
CN120747491A
Cable surface defect detection method and system based on machine vision
CN121169927A