Visual inspection method for small size bearings

CN117523245BActive Publication Date: 2026-09-11FUJIAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311473355.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-08
Publication Date
2026-09-11
Estimated Expiration
2043-11-08

AI Technical Summary

Technical Problem

这给自动化轴承检测带来了困难

Benefits of technology

[0058] Compared with existing technologies, the present invention has the following advantages: It provides a visual inspection method for small-sized bearings. This method improves and reconstructs the YOLOv5 algorithm model. The reconstructed algorithm model significantly enhances the feature extraction capability and detection accuracy, and both real-time performance and accuracy meet the detection requirements. Compared with mainstream detection networks, this method requires less computation and fewer parameters at the same detection accuracy, which greatly saves computational costs and memory space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117523245B_ABST
    Figure CN117523245B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of visual detection methods of small size bearing, comprising: S1, the picture of different sizes, different batches of rod end joint bearing is acquired, and information is marked to make rod end joint bearing dataset;S2, through multi-feature random fusion data enhancement mode expansion rod end joint bearing dataset;S3, improve YOLOv5 algorithm model, including: using SPD-Conv module improves backbone network, and increases a feature map output channel;Multi-layer fusion module is added in neck network;Increase a P4 detection head in detection head, introduce weighted K-means clustering algorithm to replace original K-means algorithm;In post-processing, introduce confidence propagation clustering algorithm CP-Cluster to replace Softnms algorithm;Through rod end joint bearing dataset, the improved YOLOv5 algorithm model is trained;S4, the image to be detected is input into trained detection model and carries out bearing detection and classification, and automatically identifies each size and model of rod end joint bearing.The method is conducive to improving the detection precision and detection speed of small size bearing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of bearing inspection technology, and specifically to a visual inspection method for small-sized bearings. Background Technology

[0002] With the development of technology, the application of various precision small-sized bearings is becoming increasingly widespread, such as in precision instruments, medical equipment, and aerospace. However, traditional bearing inspection methods have certain limitations. Specifically, for small-sized bearings such as small rod end bearings, their structural dimensions are small, and surface feature information is relatively limited. Furthermore, the tolerances of different batches of bearings vary, resulting in high variability of the bearing's sliding spherical surface. This poses challenges to automated bearing inspection. Therefore, on densely packed and chaotic automated production lines for small-sized bearings, common inspection methods, such as machine vision, often struggle to extract distinguishing features, leading to low accuracy in bearing inspection and indirectly reducing production efficiency. Summary of the Invention

[0003] The purpose of this invention is to provide a visual inspection method for small-sized bearings, which is beneficial to improving the inspection accuracy and speed of small-sized bearings.

[0004] To achieve the above objectives, the technical solution adopted by the present invention is: a visual inspection method for small-sized bearings, comprising the following steps:

[0005] S1. Obtain images of rod end joint bearings of different sizes and batches, and create a rod end joint bearing dataset by labeling the information.

[0006] S2. Expand the rod end joint bearing dataset through multi-feature random fusion data augmentation;

[0007] S3. Improved YOLOv5 algorithm model, including:

[0008] S31. Improve the backbone network using the SPD-Conv module and add a feature map output channel;

[0009] S32. Add a multi-layer fusion module MFSPD to the neck network and reconstruct the neck network;

[0010] S33. Add a P4 detection head to the detection head, and introduce a weighted K-means clustering algorithm to replace the original K-means algorithm to generate higher priority test boxes;

[0011] S34. In post-processing, the confidence propagation clustering algorithm CP-Cluster is introduced to replace the Softnms algorithm, thereby optimizing the confidence of the predicted bounding box and the detection speed.

[0012] The improved YOLOv5 algorithm model was trained using the rod end joint bearing dataset to obtain a trained detection model.

[0013] S4. Input the image to be detected into the trained detection model to perform bearing detection and classification, and automatically identify rod end joint bearings of various sizes and models.

[0014] Furthermore, in step S2, the rod end joint bearing dataset is expanded through multi-feature random fusion data augmentation, including: blurring, adjusting brightness, cropping, rotating, translating, mirroring, cropping, scaling, noise addition, and color changes.

[0015] Furthermore, in step S3, the YOLOv5s network model is improved to obtain an improved YOLOv5s network model.

[0016] Further, in step S3.1, the SPD-Conv module consists of a spatial-to-depth layer and a no-strut convolutional layer; wherein the spatial-to-depth layer performs image processing as follows:

[0017] f 0,0 =X[0:L:k,0:L:k],f 1,0 =X[1:L:k,0:L:k],…,

[0018] f k-1,0 =X[k-1:L:k,0:L:k];

[0019] f 0,1 =X[0:L:k,1:L:k],f 1,1 , ...,

[0020] f k-1,1 =X[k-1:L:k, 1:L:k];

[0021]

[0022] f 0,k-1 =X[0:L:k,k-1:L:k],f 1,k-1 , ...,

[0023] f k-1,k-1 =X[k-1:L:k,k-1:L:k] (1)

[0024] Given any initial feature map X, divide X(i,j) by k to obtain the sub-feature map f. x,y Each sub-feature map is downsampled for X by a scaling factor;

[0025] After spatial to depth transformation, a stride-free convolutional layer with a C2 filter is used to transform k... 2C1 is converted to C2, where C2 < k 2 C1, to retain as much useful feature information as possible;

[0026] The backbone network is improved based on CSPDarknet53, with an additional 160x160x128 feature map output for subsequent detection of small targets; all convolutional layers with a stride of 2 are replaced with SPD-Conv modules; the improved structure outputs feature maps at four scales: 160x160x128, 80x80x256, 40x40x512, and 20x20x1024, which are then input into the neck network for further enhancement and fusion.

[0027] Further, in step S32, a multi-layer fusion module MFSPD is constructed based on the SPD module. The MFSPD module uses the SPD structure to extract features from different network layers to obtain multi-scale features. The MFSPD module uses continuous compression-activation operations to enhance features. The MFSPD module uses weighted residual connections to better preserve and pass low-level semantic information to the top layer of the model. The input data is convolved with a convolution kernel of 3 and a stride of 2, and then fused with the SPD layer using add features.

[0028]

[0029] Then, after passing through a convolutional layer with a kernel size of 3 and a stride of 1, the output feature map is fused with the output of the previous convolutional layer with a stride of 2 using the concat feature fusion method.

[0030]

[0031] The Conv layer consists of Conv2d convolution, BN normalization, and the SiLU activation function, where the SiLU function is formulated as follows:

[0032]

[0033] Furthermore, in step S33, a P4 detection head is added to the detection head. After adding the P4 detection head, detection heads of different sizes can perform multi-scale detection on rod end spherical bearings of different sizes.

[0034] A weighted K-means algorithm is applied to the original K-means algorithm, assigning a weight coefficient to each sample; the maximum intersection-union ratio (UUIR) between cluster centers and samples is used to evaluate the clustering results; specifically including:

[0035] Select k cluster centers as needed;

[0036] Calculate the distance d between each sample and the center point of the feature map. ic The calculation formula is as follows:

[0037]

[0038] Where, x i y i Let x and y be the x and y coordinates of the i-th sample. Let c be the x and y coordinates of the center.

[0039] Calculate the weight of each sample corresponding to its cluster center and construct a weight matrix. Equation (6) is the mean distance of all samples to any center point a, and Equation (7) is the weight calculation formula:

[0040]

[0041]

[0042] Among them, w ijc Let be the weights of the i-th sample and the j-th cluster center, and c be the center point of the feature map corresponding to the cluster center;

[0043] Update the objective function D, i.e., update the cluster centers:

[0044]

[0045] Among them, B i Let C be the width and height of the annotation box for sample i. j This is a preselection box for the j-th cluster center;

[0046] Iterate through all cluster centers until their positions no longer change.

[0047] Furthermore, in step S34, the confidence propagation clustering algorithm CP-Cluster is introduced as a post-processing module in the post-processing stage; the specific implementation method is as follows:

[0048] First, all candidate boxes are converted into an undirected graph set. Then, positive and negative messages are passed between each candidate box in the graph. While the rejected candidate boxes are eliminated, the confidence of the selected candidate boxes is also strengthened.

[0049] In positive message delivery, groups with a confidence level lower than their own and an IOU higher than a set hyperparameter threshold are identified as weak friends. The confidence level of the strong side is updated based on the number of weak friends and their confidence levels, as shown in equation (9):

[0050]

[0051] Among them W bi Let P be the set of disadvantaged friends, and P be the confidence level.

[0052] In the spread of negative news, the original sorting from high to low is changed to a graph structure, eliminating the sorting and suppressing twice; in addition, a SUP matrix is ​​added to prevent a prediction box from being repeatedly suppressed by the same prediction box; Equation (10) suppresses through the strongest friend, and Equation (11) updates the weak side confidence.

[0053]

[0054]

[0055] The algorithm is iterated and looped until it converges to the optimal solution. Finally, the predicted boxes with low confidence are filtered out, leaving only the predicted boxes with the highest confidence.

[0056] Furthermore, in step S4, the trained detection model is used to predict the image of the rod end joint bearing. The specific method is as follows:

[0057] First, image data is input into the backbone network of the model, and after multi-layer feature extraction, semantically rich feature maps are obtained. Then, detection heads of different scales parse the feature maps to obtain predicted boxes for targets of different sizes. Next, the model classifies each predicted box to determine the target category it contains. Then, the post-processing module fine-tunes the predicted boxes and their confidence levels. Finally, based on the confidence threshold, the predicted boxes that meet the requirements are selected, and the detection results are output. Among them, high-confidence boxes correspond to the detected bearing targets.

[0058] Compared with existing technologies, the present invention has the following advantages: It provides a visual inspection method for small-sized bearings. This method improves and reconstructs the YOLOv5 algorithm model. The reconstructed algorithm model significantly enhances the feature extraction capability and detection accuracy, and both real-time performance and accuracy meet the detection requirements. Compared with mainstream detection networks, this method requires less computation and fewer parameters at the same detection accuracy, which greatly saves computational costs and memory space. Attached Figure Description

[0059] Figure 1 This is a flowchart illustrating the method implementation of an embodiment of the present invention;

[0060] Figure 2 This is a diagram of the improved YOLOv5s network model structure in an embodiment of the present invention;

[0061] Figure 3 This is a structural diagram of the SPD-Conv module in an embodiment of the present invention;

[0062] Figure 4 This is a diagram of the improved backbone network structure in an embodiment of the present invention;

[0063] Figure 5 This is a schematic diagram of the MFSPD module structure in an embodiment of the present invention;

[0064] Figure 6 This is a flowchart illustrating the implementation of the CP-Cluster algorithm in this embodiment of the invention.

[0065] Figure 7 This is the experimental dataset used in the embodiments of the present invention;

[0066] Figure 8 These are curves of various loss functions during the training process in this embodiment of the invention;

[0067] Figure 9 This is a comparison chart of detection results in an embodiment of the present invention. Detailed Implementation

[0068] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0069] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0070] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0071] like Figure 1 As shown, this embodiment provides a visual inspection method for small-sized bearings, including the following steps:

[0072] S1. Obtain images of rod end joint bearings of different sizes and batches, and create a rod end joint bearing dataset by labeling the information.

[0073] S2. Expand the rod end joint bearing dataset by using a multi-feature random fusion data augmentation method.

[0074] S3. Improved YOLOv5 algorithm model, including:

[0075] S31. Improve the backbone network using the SPD-Conv module and add a feature map output channel to enhance feature extraction capabilities;

[0076] S32. In order to enhance feature fusion and increase feature value intensity, a multi-layer fusion module MFSPD is added to the neck network to reconstruct the neck network;

[0077] S33. Add a P4 detection head to the detection head, and introduce a weighted K-means clustering algorithm to replace the original K-means algorithm to generate higher priority boxes, thereby increasing the matching degree between the prior boxes and the feature layer and accelerating the model convergence speed.

[0078] S34. In post-processing, the confidence propagation clustering algorithm CP-Cluster is introduced to replace the Softnms algorithm, thereby optimizing the confidence of the predicted bounding box and the detection speed.

[0079] The improved YOLOv5 algorithm model was trained using a rod end joint bearing dataset to obtain a trained detection model.

[0080] S4. Input the image to be detected into the trained detection model to perform bearing detection and classification, and automatically identify rod end joint bearings of various sizes and models.

[0081] In step S1, in PyCharm, the Python language is used to call the industrial camera SDK secondary development package to collect images of rod end joint bearings of different sizes and batches; the image pixels are set according to the model training requirements, and labels such as the ground truth bounding box and bearing category size are added to create a rod end joint bearing dataset.

[0082] In step S2, the rod end joint bearing dataset is expanded using a multi-feature random fusion data augmentation method, including: blurring, brightness adjustment, cropping, rotation, translation, mirroring, scaling, noise addition, and color changes. This random fusion augmentation generates diverse image data, providing ample sample data for subsequent model training.

[0083] YOLO (You Only Look Once) is a single-stage object detection algorithm. YOLOv5, through its end-to-end single-stage detection framework, successfully balances detection accuracy and speed, is easy to adjust, and highly flexible, making it a leader in the field of object detection. However, there is still room for improvement in its performance with small objects. Its network models include: YOLOv5l, YOLOv5m, YOLOv5n, YOLOv5s, and YOLOv5x.

[0084] In step S3 of this embodiment, the YOLOv5s network model is improved to obtain an improved YOLOv5s network model, the overall structure of which is as follows: Figure 2 As shown.

[0085] To address the limited feature information of small-sized targets, the SPD-Conv module is used to improve the backbone network, and an additional feature map output channel is added to enhance feature extraction capabilities. To strengthen feature fusion and increase feature value intensity, the MFSPD module is proposed and a neck network structure is incorporated, thus reconstructing the neck network structure. In the detection head, a P4 detection head is added, and a weighted K-means clustering algorithm is introduced to replace the traditional K-means algorithm in extracting suitable prior boxes from the dataset during the pre-training phase, increasing the matching degree between prior boxes and feature layers and accelerating model convergence. Finally, in post-processing, the confidence propagation clustering algorithm CP-Cluster is introduced to replace the Softnms algorithm, optimizing the confidence of predicted boxes and detection speed.

[0086] In step S31, the SPD-Conv module consists of a space-to-depth layer and a non-strided convolution layer; the space-to-depth layer processes the image as follows:

[0087] f 0,0 =X[0:L:k,0:L:k],f 1,0 =X[1:L:k,0:L:k],…,

[0088] f k-1,0 =X[k-1:L:k,0:L:k];

[0089] f 0,1 =X[0:L:k,1:L:k],f 1,1 , ...,

[0090] f k-1,1 =x[k-1:L:k, 1:L:k];

[0091]

[0092] f 0,k-1 =X[0:L:k,k-1:L:k],f 1,k-1 , ...,

[0093] f k-1,k-1 =X[k-1:L:k,k-1:L:k]. (1)

[0094] Given any initial feature map X, divide X(i,j) by k to obtain the sub-feature map f. x,y Each sub-feature map is downsampled to X by a scaling factor. The SPD-Conv module structure is as follows: Figure 3 As shown. When k=2, the sampled f 0,0 f 0,1 f 1,0f 1,1 And the size is The four sub-feature maps are then downsampled by a factor of 2, and the four sub-feature maps are concatenated according to the channel dimension to obtain a feature map with a channel dimension of 4C1.

[0095] After spatial to depth transformation, a stride-free convolutional layer with a C2 filter is used to transform k... 2 C1 is converted to C2, where C2 < k 2 C1 is used to preserve as much useful feature information as possible. If a 3x3 convolution is used, each pixel is sampled only once; if a 2x2 convolution is used, asymmetric sampling occurs, with different sampling times for odd and even rows and columns.

[0096] The backbone network, based on CSPDarknet53, adds a 160x160x128 feature map output for subsequent detection of small targets; and all convolutional layers with a stride of 2 are replaced with SPD-Conv modules. The improved structure outputs feature maps at four scales: 160x160x128, 80x80x256, 40x40x512, and 20x20x1024, which are then fed into the neck network for further enhancement and fusion. The improved backbone network is shown below. Figure 4 As shown.

[0097] To adapt to the detection of small-sized bearings such as small-sized rod end joint bearings, a P4 detection head is added to the model detection head, which can improve the detection accuracy of small targets. However, increasing the number of detection head layers also carries the risk of long-range memory loss, resulting in the ineffective fusion of low-level features at deeper levels of the model. To fully utilize low-level features to improve the feature representation of small targets, this method constructs a multi-layer fusion module MFSPD based on the SPD module. The core innovations of the MFSPD module are: 1) using the SPD structure to extract features from different network layers to obtain multi-scale features; 2) employing continuous compression-activation operations to enhance features; 3) using weighted residual connections to better preserve and pass low-level semantic information to the top level of the model; 4) multi-layer feature fusion to strengthen feature representation. Through this module, the model can learn richer features of small targets, enhance the strength of feature representation, and make each dimension of features contain more semantic information. The MFSPD module effectively improves the detection performance of small-sized joint bearing targets and is one of the key components of this invention. The neck network structure is as follows: Figure 2 As shown, the MFSPD module structure Figure 5 As shown, the input data is convolved using a convolution with a kernel of 3 and a stride of 2, and then fused with the SPD layer for added features.

[0098]

[0099] Then, after passing through a convolutional layer with a kernel size of 3 and a stride of 1, the output feature map is fused with the output of the previous convolutional layer with a stride of 2 using the concat feature fusion method.

[0100]

[0101] Add feature fusion requires approximately twice the computational cost of concat feature fusion, but its performance is slightly lower. The Conv layer consists of Conv2d convolutions, BN normalization, and the SiLU activation function, where the SiLU function's formula is:

[0102]

[0103] Among them, the SiLU activation function may be more suitable for some scenarios that need to retain more input information than the ReLU function, which is in line with the idea of ​​this invention to solve the problem of limited feature information of small-sized targets.

[0104] Because the head structure of rod end spherical bearings is prone to sliding, various sliding spherical surfaces with different angles can occur. The original YOLOv5 model's P8, P16, and P32 detector heads output feature maps at scales of 80×80, 40×40, and 20×20 respectively, all of which are too large and unsuitable for detecting small-sized bearing targets. To improve the detection performance for small-sized bearings, this invention adds an additional P4 detector head to the YOLOv5 model's detector head structure, outputting a 160×160 resolution feature map. This P4 head is specifically designed for feature learning and prediction of small-sized spherical bearing targets, helping to improve the detection accuracy and recall rate for small targets. With the addition of the P4 detector head, detector heads of different scales can perform multi-scale detection of rod end spherical bearings of different sizes, making the model more robust to changes in target size. The detector head structure is as follows: Figure 2 As shown.

[0105] Before training, it is necessary to determine the anchors for the dataset. Appropriate anchors can increase the detection accuracy and convergence of the model. YOLOv5 anchors are obtained from the COCO dataset, while the rod end joint bearing dataset has small, dense, and randomly stacked anchors, causing a mismatch between the anchors and the dataset. To better address this issue, it is necessary to re-cluster the data based on the labeled bounding boxes to obtain suitable anchor boxes. This method proposes a weighted k-means algorithm based on the original k-means algorithm, assigning a weight coefficient to each sample. The maximum intersection-union ratio (UUIR) between cluster centers and samples is used to evaluate the clustering results. The specific steps are as follows:

[0106] 1) Select k cluster centers as needed.

[0107] 2) Calculate the distance d between each sample and the center point of the feature map. icThe calculation formula is as follows:

[0108]

[0109] Where, x i y i Let x and y be the x and y coordinates of the i-th sample. Let x and y be the x and y coordinates of the c-th center.

[0110] 3) Calculate the weight of each sample corresponding to its cluster center and construct the weight matrix. Equation (6) is the mean distance of all samples to any center point a, and Equation (7) is the weight calculation formula:

[0111]

[0112]

[0113] Among them, w ijc Let be the weights of the i-th sample and the j-th cluster center, and c be the center point of the feature map corresponding to the cluster center.

[0114] 4) Update the objective function D, i.e., update the cluster centers:

[0115]

[0116] Among them, B i Let C be the width and height of the annotation box for sample i. j This is the preselection box for the j-th cluster center.

[0117] 5) Iterate through all cluster centers until their positions no longer change.

[0118] In the post-processing of object detection models, the traditional non-maximum suppression algorithm (NMS) has certain shortcomings. Specifically, NMS only retains the predicted bounding box with the highest confidence, but the predicted bounding box with the highest confidence is not necessarily the best true target box. Furthermore, NMS requires sorting the predicted boxes by confidence before processing them sequentially, making parallel computation impossible. To address these issues, this method introduces the confidence propagation clustering algorithm CP-Cluster as a post-processing module in step S34. The innovations of this algorithm are: 1) It allows the exchange of confidence information between predicted boxes, performing confidence propagation and aggregation, effectively integrating redundant information between boxes; 2) After multiple iterations, the box corresponding to the true target will obtain a higher confidence, while the confidence of background and other erroneous boxes will decrease, playing a role in automatically adjusting the confidence; 3) The algorithm's computation process can be fully parallelized, significantly accelerating the process. In summary, the CP-Cluster algorithm overcomes the limitations of NMS, making the detection model more accurate in determining the confidence of the true target box, and significantly improving the post-processing speed. Experiments demonstrate that using CP-Cluster in this invention can achieve more accurate and faster detection results. like Figure 6 As shown, the implementation process of the CP-Cluster algorithm is as follows:

[0119] First, convert all candidate boxes into an undirected graph set. Then, positive and negative messages are passed between each candidate box in the graph. While the rejected candidate boxes are eliminated, the confidence of the selected candidate boxes is also strengthened.

[0120] In positive message delivery, groups with a confidence level lower than their own and an IOU higher than a set hyperparameter threshold are identified as weak friends. The confidence level of the strong side is updated based on the number of weak friends and their confidence levels, as shown in equation (9):

[0121]

[0122] Among them W bi Let P be the set of disadvantaged friends, and let P be the confidence level.

[0123] In the propagation of negative news, the original sorting from high to low is changed to a graph structure, eliminating the sorting and suppressing twice; in addition, a SUP matrix is ​​added to prevent a prediction box from being repeatedly suppressed by the same prediction box; Equation (10) uses the strongest friend for suppression, and Equation (11) updates the weak-side confidence:

[0124]

[0125]

[0126] The algorithm is iterated and looped until it converges to the optimal solution. Finally, the predicted boxes with low confidence are filtered out, leaving only the predicted boxes with the highest confidence.

[0127] In step S4, the trained detection model is used to predict the image of the rod end joint bearing. The specific method is as follows:

[0128] First, image data is input into the backbone network of the model, and after multi-layer feature extraction, semantically rich feature maps are obtained. Then, detection heads of different scales parse the feature maps to obtain predicted boxes for targets of different sizes. Next, the model classifies each predicted box to determine the target category it contains, such as the specific model of a rod end bearing. Then, the post-processing module fine-tunes the predicted boxes and their confidence levels. Finally, based on the confidence threshold, the predicted boxes that meet the requirements are selected, and the detection results are output. High-confidence boxes correspond to the detected bearing targets. This achieves multi-category bearing detection and classification based on a single image. Simultaneously, by adjusting the confidence threshold, the detection performance and speed can be balanced. The model of this invention successfully detected and identified rod end bearings of different sizes and models, meeting the requirements of automated detection and demonstrating strong engineering application value.

[0129] In the experimental testing, a D435I camera was used to acquire images of the rod end joint bearing using the SDK. The resolution was 640x480, and a total of 1110 images were acquired. The labelimg tool was used for data annotation. Random fusion data augmentation was applied to the first 1000 images, expanding each image to 12, resulting in a dataset containing 13110 images. The training set consisted of 8888 images, the validation set of 2222 images, and the test set of 2000 images. To further validate the algorithm, the T-LESS dataset was selected for object detection because its properties are similar to those in the actual project; therefore, it was used to evaluate the algorithm's performance. The COCO dataset was also used for comparative experiments. Figure 7 The left side shows the rod end joint bearing dataset, and the right side shows the T-LESS dataset.

[0130] The training parameters of the algorithm model of this invention are set as follows: the learning rate and the cyclic learning rate are both 0.01, the stochastic gradient descent momentum is set to 0.937, the weight decay coefficient is 0.0005, and the batch size is 8. The various loss function curves for model training and validation are shown below. Figure 8 As shown.

[0131] Figure 8The vertical axis represents the number of iterations (epochs), and the horizontal axis represents the loss value. Here, `box_loss`, `obj_loss`, and `cls_loss` are the mean GIoU Loss for predicted bounding boxes, the mean Loss for object detection, and the mean Loss for label classification, respectively. `train` and `val` represent the training and validation phases, respectively. Because the weighted K-means algorithm is used to obtain suitable anchor boxes, both the predicted bounding box and object detection losses converge rapidly before 100 iterations. This demonstrates that the weighted K-means algorithm has significant effectiveness in the detection model.

[0132] To further verify the performance and advantages of the algorithm presented in this paper, the method is compared with mainstream algorithms such as YOLOv3-YOLOv7 on the rod end joint bearing dataset, as shown in Table 1.

[0133] Table 1 Comparison of detection methods using different algorithms

[0134]

[0135] The target and background contrast in the rod end joint bearing dataset is significant, resulting in better overall performance than the T-LESS dataset. In the T-LESS dataset, YOLOv3 and YOLOv4 achieve mAP of 80.3% and 87.3% respectively at a threshold of 0.5, lower than our proposed algorithm. Furthermore, their large number of parameters and high floating-point computation make them less suitable for deployment on mobile devices. YOLOv3-tiny and YOLOv4-tiny have lower parameter counts and floating-point computations than our proposed algorithm, offering faster detection speeds but lower accuracy. Compared to YOLOv6 and YOLOv7, our proposed algorithm is 1.9% higher and 1.7% lower, respectively, but their parameter counts and FLOPs are higher.

[0136] Table 2 shows the performance of various algorithms on the COCO dataset.

[0137]

[0138] This method improves mAP on the COCO dataset by 1.1% compared to the previous method, but is 0.7% lower than YOLOv7. Therefore, SCP-YOLOv5 has a more balanced performance compared to mainstream algorithms and is more advantageous.

[0139] To more intuitively demonstrate the detection performance of the improved algorithm, detection was performed on a rod end joint bearing dataset using both the YOLOv5s algorithm and the SCP-YOLOv5 algorithm proposed in this invention. Specifically, as follows... Figure 9 (The left image shows the YOLOv5 algorithm, and the right image shows the SCP-YOLOv5 algorithm proposed in this invention.)

[0140] Figure 9In the study, the confidence scores of the small-sized bearings detected by the SCP-YOLOv5 algorithm were higher than those of the YOLOv5 algorithm. It can be seen that SCP-YOLOv5 can detect small objects very well, and the detection box fits the target better, proving that the improved model can be better applied to practice.

[0141] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0142] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0143] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0144] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0145] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A visual inspection method of small size bearings, characterized in that, Includes the following steps: S1. Obtain images of rod end joint bearings of different sizes and batches, and create a rod end joint bearing dataset by labeling the information. S2. Expand the rod end joint bearing dataset through multi-feature random fusion data augmentation; S3. Improved YOLOv5 algorithm model, including: S31. Improve the backbone network using the SPD-Conv module and add a feature map output channel; the SPD-Conv module consists of a spatial-to-depth layer and a no-strut convolutional layer; S32. Add a multi-layer fusion module MFSPD to the neck network and reconstruct the neck network; In step S32, a multi-layer fusion module MFSPD is constructed based on the SPD module. The MFSPD module uses the SPD structure to extract features from different network layers to obtain multi-scale features. The MFSPD module uses continuous compression-activation operations to enhance features. The MFSPD module uses weighted residual connections to better preserve and pass low-level semantic information to the top layer of the model. The input data is convolved with a convolution kernel of 3 and a stride of 2, and then fused with the SPD layer using add features. (2) Then, after passing through a convolutional layer with a kernel size of 3 and a stride of 1, the output feature map is fused with the output of the previous convolutional layer with a stride of 2 using the concat feature fusion method. (3) The Conv layer consists of Conv2d convolution, BN normalization, and the SiLU activation function, where the SiLU function is formulated as follows: (4) S33. Add a P4 detection head to the detection head, and introduce a weighted K-means clustering algorithm to replace the original K-means algorithm to generate higher priority test boxes; S34. In post-processing, the confidence propagation clustering algorithm CP-Cluster is introduced to replace the Softnms algorithm, thereby optimizing the confidence of the predicted bounding box and the detection speed. The improved YOLOv5 algorithm model was trained using the rod end joint bearing dataset to obtain a trained detection model. S4. Input the image to be detected into the trained detection model to perform bearing detection and classification, and automatically identify rod end joint bearings of various sizes and models.

2. The visual inspection method for small-sized bearings according to claim 1, characterized in that, In step S2, the rod end joint bearing dataset is expanded using a multi-feature random fusion data augmentation method, including: blurring, adjusting brightness, cropping, rotating, translating, mirroring, scaling, noise addition, and color changes.

3. The visual inspection method for small-sized bearings according to claim 1, characterized in that, In step S3, the YOLOv5s network model is improved to obtain the improved YOLOv5s network model.

4. The visual inspection method for small-sized bearings according to claim 3, characterized in that, In step S31, the spatial to depth layer is processed as follows: (1) Given any initial feature map X, pass and Sub-feature maps are obtained by dividing by k. Each sub-feature map is downsampled for X by a scaling factor; After converting from spatial to depth layers, use a layer with... The filter's strideless convolutional layer will Turn to ,in < In order to retain as much useful feature information as possible; The backbone network is improved based on CSPDarknet53, with an additional 160x160x128 feature map output for subsequent detection of small targets; all convolutional layers with a stride of 2 are replaced with SPD-Conv modules; the improved structure outputs feature maps at four scales: 160x160x128, 80x80x256, 40x40x512, and 20x20x1024, which are then input into the neck network for further enhancement and fusion.

5. The visual inspection method for small-sized bearings according to claim 3, characterized in that, In step S33, a P4 detection head is added to the detection head. After adding the P4 detection head, detection heads of different sizes can perform multi-scale detection on rod end spherical bearings of different sizes. A weighted K-means algorithm is applied to the original K-means algorithm, assigning a weight coefficient to each sample; the maximum intersection-union ratio (UUIR) between cluster centers and samples is used to evaluate the clustering results; specifically including: Select k cluster centers as needed; Calculate the distance from each sample to the center point of the feature map. The calculation formula is as follows: (5) in, Let x and y be the x and y coordinates of the i-th sample. , Let c be the x and y coordinates of the center. Calculate the weight of each sample corresponding to its cluster center and construct a weight matrix. Equation (6) is the mean distance of all samples to any center point a, and Equation (7) is the weight calculation formula: (6) (7) in, Let be the weights of the i-th sample and the j-th cluster center, and c be the center point of the feature map corresponding to the cluster center; Update the objective function D, i.e., update the cluster centers: (8) in, Let i be the width and height of the annotation box. This is a preselection box for the j-th cluster center; Iterate through all cluster centers until their positions no longer change.

6. The visual inspection method for small-sized bearings according to claim 3, characterized in that, In step S34, the confidence propagation clustering algorithm CP-Cluster is introduced as a post-processing module in the post-processing stage; the specific implementation method is as follows: First, all candidate boxes are converted into an undirected graph set. Then, positive and negative messages are passed between each candidate box in the graph. While the rejected candidate boxes are eliminated, the confidence of the selected candidate boxes is also strengthened. In positive message delivery, groups with a confidence level lower than their own and an IOU higher than a set hyperparameter threshold are identified as weak friends. The confidence level of the strong side is updated based on the number of weak friends and their confidence level, as shown in equation (9): (9) in Let P be the set of disadvantaged friends, and P be the confidence level. In the spread of negative news, the original sorting from high to low is changed to a graph structure, eliminating the sorting and suppressing twice; in addition, a SUP matrix is ​​added to prevent a prediction box from being repeatedly suppressed by the same prediction box; Equation (10) suppresses through the strongest friend, and Equation (11) updates the weak side confidence. (10) (11) The algorithm is iterated and looped until it converges to the optimal solution. Finally, the predicted boxes with low confidence are filtered out, leaving only the predicted boxes with the highest confidence.

7. The visual inspection method for small-sized bearings according to claim 3, characterized in that, In step S4, the trained detection model is used to predict the image of the rod end joint bearing. The specific method is as follows: First, image data is input into the backbone network of the model, and after multi-layer feature extraction, semantically rich feature maps are obtained. Then, detection heads of different scales parse the feature maps to obtain predicted boxes for targets of different sizes. Next, the model classifies each predicted box to determine the target category it contains. Then, the post-processing module fine-tunes the predicted boxes and their confidence levels. Finally, based on the confidence threshold, the predicted boxes that meet the requirements are selected, and the detection results are output. Among them, high-confidence boxes correspond to the detected bearing targets.

Citation Information

Patent Citations

  • An image clustering algorithm based on depth semantic embedding

    CN109447098A

  • Power transmission line target detection and identification method based on feature fusion

    CN114445706A