Glass bead defect detection method based on improved yolov11
By introducing a feature feedback layer and Wasserstein distance loss function optimization into the YOLOv11 model, combined with depthwise separable convolution and preprocessing steps, the accuracy problem of the YOLOv11 model in detecting small target defects such as glass spheres is solved, and efficient and accurate defect detection is achieved.
Patent Information
- Application Number
- CN202411946399.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2044-12-27
AI Technical Summary
The existing Yolov11 model has insufficient detection accuracy when detecting small target defects in glass spheres, especially in complex backgrounds, and it is difficult to effectively identify weak defect features.
By concatenating a feature feedback layer at the input of the Detect module of the YOLOv11 model and introducing the Wasserstein distance loss function for network optimization, combined with depthwise separable convolution and the MSCA module, the feature representation capability of small targets is enhanced. Furthermore, image quality is improved through preprocessing steps such as ROI region extraction, brightness correction, and noise removal.
It significantly improves the accuracy and robustness of small target defect detection, and can more accurately capture the edge details of tiny defects in glass spheres, thus improving detection efficiency and accuracy.
Smart Images

Figure CN119904679B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of optical defect detection, and particularly relates to a glass bead defect detection method based on an improved Yolov11. BACKGROUND
[0002] With the continuous development of industrial automation and intelligent manufacturing, target detection technology is increasingly important in quality control and defect detection. In particular, in the production process of glass beads, common defects such as scratches, net damage, pit points and dirt on the surface significantly affect the performance and use effect of the product. Although manual detection can identify these defects, it is often low in efficiency and easily affected by the fatigue and attention fluctuations of the detection personnel.
[0003] The rapid development of visual machine technology provides a new way to solve this problem. Based on deep learning, target detection algorithms, especially the YOLO (You Only Look Once) series model, have high speed and high precision, and have gradually become the mainstream choice for industrial defect detection. In particular, Yolov11 uses an advanced network structure and training strategy, which can significantly improve the detection ability of targets in complex scenes. However, due to the small size and weak features of the target defects such as dirt and pit points in glass beads, Yolov11 still faces the challenge of insufficient detection accuracy in some aspects, especially in complex backgrounds, the identification of small targets may be disturbed. Therefore, a high-precision, high-efficiency and high-robustness small-target glass bead defect detection method needs to be proposed to ensure effective identification of target defects in glass beads in complex industrial environments. SUMMARY
[0004] The purpose of the present application is to address the above problems and propose a glass bead defect detection method based on an improved Yolov11, which can efficiently and accurately identify target defects in glass beads and has good robustness, especially for small-target glass bead defect detection.
[0005] To achieve the above purpose, the technical solution adopted by the present application is as follows:
[0006] The glass bead defect detection method based on the improved Yolov11 proposed by the present application comprises the following steps:
[0007] S1, data collection: obtain a plurality of images of different glass beads, at least one image for each glass bead, and classify and label the defects in the images to form a data set;
[0008] S2, model construction: an improved YOLOv11 model is established, the improved YOLOv11 model is formed by respectively connecting a feature feedback layer at the input end of each Detect module of the YOLOv11 model and introducing a Wasserstein distance loss function in the Detect module for network optimization to form an improved Detect module, wherein:
[0009] The feature feedback layer performs the following operations:
[0010] The input features of the feature feedback layer are sequentially subjected to an LN normalization layer, a depth separable convolution, a linear layer and a split channel splitting layer to obtain a first extraction feature map;
[0011] The first extraction feature map is sequentially subjected to a dimension conversion, a depth separable convolution and an MSCA module to obtain a second extraction feature map;
[0012] The first extraction feature map and the second extraction feature map are multiplied element by element to obtain a second fusion feature map;
[0013] The second fusion feature map is added to the input features of the feature feedback layer element by element after passing through a linear layer to obtain the final feedforward feature, which is the output feature of the feature feedback layer;
[0014] The MSCA module performs the following operations:
[0015] The spatial feature map of the input features of the MSCA module is extracted by a depth separable convolution;
[0016] The spatial feature map is subjected to three parallel depth separable convolution modules of different scales to obtain corresponding third extraction feature maps, and the first fusion feature map is obtained by adding the spatial feature map and all the third extraction feature maps element by element, and the depth separable convolution module includes two depth separable convolutions connected in series;
[0017] The first fusion feature map is multiplied element by element with the input features of the MSCA module after passing through a convolution layer to obtain a second extraction feature map;
[0018] S3, pre-processing and defect detection:
[0019] S31, the pre-processing is to sequentially perform ROI region extraction, brightness correction and noise removal on each image;
[0020] S32, the defect detection is to use the improved YOLOv11 model to detect all pre-processed images of a single glass ball, and when there is at least one unqualified prediction box in all images of the single glass ball, the glass ball is considered to be an unqualified product, otherwise, the glass ball is considered to be a qualified product.
[0021] Preferably, the image acquisition method for each glass ball is to rotate the glass ball and take one image at every β angle, for a total of M images, where β and M are both natural numbers; the classification and annotation of defects in the images are achieved using a sprite annotation assistant.
[0022] Preferably, the ROI region extraction involves cropping the image to obtain the glass sphere region;
[0023] Brightness correction involves adjusting the brightness and contrast of the cropped image.
[0024] Noise removal involves using blurring techniques to remove noise or interference from a brightness-corrected image.
[0025] Preferably, the defect detection method for glass microspheres based on the improved Yolov11 further includes the following steps:
[0026] The labeled images are split into training, validation, and test sets in an 8:1:1 ratio. The training, validation, and test sets are then input into the improved YOLOv11 model to obtain the final improved YOLOv11 model. The final improved YOLOv11 model is then used for defect detection.
[0027] Preferably, the improved Detect module performs the following operations:
[0028] The output features of the corresponding feature feedback layer are passed through the parallel first extraction module, second extraction module, and third extraction module to obtain the first output feature, second output feature, and third output feature, respectively. The first extraction module includes a series of convolutional layers and an output layer. The second extraction module includes a series of depthwise separable convolutional layers and an output layer. The third extraction module includes a series of convolutional layers and an output layer. The first output feature is the predicted bounding box information, the second output feature is the confidence level and the defect category, and the third extraction module uses the Wasserstein distance loss function for network optimization.
[0029] Preferably, the Wasserstein distance loss function is as follows:
[0030] ;
[0031] ;
[0032] in, Let Wasserstein distance loss function be used. Let be the Wasserstein distance of the i-th image in the dataset, where i = 1 to N, and N is the number of images in the dataset. W [f,g] is the Wasserstein distance of single images, inf is the minimized loss, r is a single predicted box in a single image and a real box , [f,g] is the joint distribution of all predicted boxes and real boxes , is the differential of the matching coordinates between the predicted box and the real box , , is the horizontal differential of the center coordinates, is the horizontal differential of the center coordinates, is the differential of the width, is the differential of the length, is the horizontal coordinate of the center coordinates of the predicted box, is the vertical coordinate of the center coordinates of the predicted box, is the width of the predicted box, is the length of the predicted box, is the horizontal coordinate of the center coordinates of the real box, is the vertical coordinate of the center coordinates of the real box, is the width of the real box, is the length of the real box,[•] is the Euclidean distance.
[0033] Preferably, the types of labels include dirt, torn edges, net damage, pits, scratches and crescent moon, a total of six types.
[0034] Preferably, the qualified standard of the predicted box is determined as follows:
[0035] According to the predicted box information, confidence and defect category output by the improved YOLOv11 model, the number of each defect category is counted and each defect category is confidence filtered, and the predicted box less than the confidence threshold is marked as qualified, and the predicted box greater than or equal to the confidence threshold is marked as pending, the predicted box information includes length, width and center coordinates;
[0036] The following operations are performed on the pending predicted box:
[0037] If the defect category is scratch, it is judged whether the length or width of the predicted box is greater than the preset size, if yes, the predicted box is marked as unqualified, otherwise, the predicted box is marked as qualified;
[0038] If the defect category is other, the image in the prediction box is extracted and converted into a gray image, the findContours function is used to find the defect contour and calculate the pixel number of the defect contour, if the pixel number of the defect contour is greater than a first preset number, the prediction box is marked as unqualified, or if the pixel number of the defect contour is greater than a second preset number and the number of the current defect category exceeds a third preset number, the prediction box is marked as unqualified, otherwise, the prediction box is marked as qualified, the second preset number is less than the first preset number.
[0039] Preferably, the kernel sizes of the two depth separable convolutions of the depth separable convolution module are 1xM and Mx1 respectively, and M is a positive integer.
[0040] Compared with the prior art, the method has the beneficial effects that: the method first collects glass bead images to ensure high-resolution and high-quality image input, and uses an improved Yolov11 model, which can aggregate small target detail features of different scales by connecting feature feedback layers in series at the input ends of each Detect module, thereby enhancing the feature expression ability of small targets; at the same time, the use of Wasserstein distance loss function makes the model pay more attention to the boundary accuracy of small targets, and the target boundary is optimized more finely, so that the model can more accurately capture the edge details of the tiny defects in the glass beads, further improving the detection performance of small targets; and the collected images are pre-processed to extract the region of interest, correct the brightness and remove noise in sequence, so as to improve the quality of the obtained images and lay a foundation for subsequent model detection, which helps to detect the target defects in the glass beads by using the improved Yolov11 model, can efficiently and accurately identify the target defects in the glass beads, and has good robustness, especially for small target glass bead defect detection. BRIEF DESCRIPTION OF DRAWINGS
[0041] Figure 1 The flowchart of the improved Yolov11-based glass bead defect detection method of the application;
[0042] Figure 2 The structure diagram of the improved Yolov11 model of the application;
[0043] Figure 3 The structure diagram of the feature feedback layer of the application;
[0044] Figure 4 The schematic diagram of the ROI region (a) and the corresponding detection result (b) of different images of the application. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of the present application.
[0046] It should be noted that, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application.
[0047] As shown in the figure, a glass bead defect detection method based on improved Yolov11 includes the following steps: Figures 1-4
[0048] S1, data collection: obtain several images of different glass beads, at least one image for each glass bead, and classify and label the defects in the images to form a data set.
[0049] In an embodiment, the image acquisition method for each glass bead is to rotate the glass bead, and take one image every β angle, a total of M images, β and M are both natural numbers; the classification and labeling of defects in the image is realized by using the wizard labeling assistant.
[0050] In an embodiment, the types of labeling include dirt, broken edge, net damage, pit point, scratch and crescent, a total of six types.
[0051] Specifically, high-definition cameras are used to take images of different glass beads. For each glass bead, rotate its position and take one image every 30°, a total of 12 images for each glass bead. After the image is taken, the target detection labeling software, such as the wizard labeling assistant, or other labeling software well known to those skilled in the art, is used to classify and label the defects of the glass bead in the image. The types of labeling can be adjusted according to actual needs, such as including dirt, broken edge, net damage, pit point, scratch and crescent, a total of 6 types. Finally, the images with labels (including real frame information and defect classification information, etc.) form a data set, which can be split into training set, validation set and test set according to the ratio of 8:1:1, for subsequent improved YOLOv11 model training and testing.
[0052] S2, model building: an improved YOLOv11 model is established, the improved YOLOv11 model is formed by connecting a feature feedback layer in series at the input end of each Detect module of the YOLOv11 model and introducing a Wasserstein distance loss function in the Detect module for network optimization to form an improved Detect module, wherein:
[0053] The feature feedback layer performs the following operations:
[0054] The input features of the feature feedback layer are sequentially subjected to an LN normalization layer, a depth separable convolution, a linear layer, and a split channel split layer to obtain a first extraction feature map;
[0055] The first extraction feature map is sequentially subjected to a dimension conversion, a depth separable convolution, and an MSCA module to obtain a second extraction feature map;
[0056] The first extraction feature map and the second extraction feature map are element-wise multiplied to obtain a second fusion feature map;
[0057] The second fusion feature map is subjected to a linear layer and then element-wise added to the input features of the feature feedback layer to obtain the final feedforward feature, which is the output feature of the feature feedback layer;
[0058] The MSCA module performs the following operations:
[0059] The spatial feature map of the input features of the MSCA module is extracted by a depth separable convolution;
[0060] The spatial feature map is subjected to three parallel depth separable convolution modules of different scales to obtain corresponding third extraction feature maps, and the first fusion feature map is obtained by element-wise adding all the third extraction feature maps and the spatial feature map, and the depth separable convolution module includes two depth separable convolutions in series;
[0061] The first fusion feature map is subjected to a convolution layer and then element-wise multiplied to the input features of the MSCA module to obtain the second extraction feature map.
[0062] In an embodiment, the improved Detect module performs the following operations:
[0063] The output features corresponding to the feature feedback layer are respectively subjected to a parallel first extraction module, a second extraction module, and a third extraction module to obtain first output features, second output features, and third output features, respectively, the first extraction module includes a convolution layer, a convolution layer, a convolution layer, and an output layer in series, the second extraction module includes a depth separable convolution, a convolution layer, a convolution layer, a convolution layer, and an output layer in series, the third extraction module includes a convolution layer, a convolution layer, a convolution layer, and an output layer in series, the first output features are prediction box information, the second output features are confidence and defect categories, and the third extraction module uses a Wasserstein distance loss function for network optimization.
[0064] In an embodiment, the convolution kernel sizes of the two depth separable convolutions in the depth separable convolution module are 1xM and Mx1, respectively, and M is a positive integer.
[0065] In an embodiment, the Wasserstein distance loss function is as follows:
[0066] ;
[0067] ;
[0068] wherein, is the Wasserstein distance loss function, is the Wasserstein distance of the i-th image in the data set, i = 1 ~ N, N is the number of images in the data set, W [f,g] is the Wasserstein distance of a single image, inf is the minimized loss, r is the matching pair of a single predicted box and a real box in a single image, [f,g] is the joint distribution of all predicted boxes and real boxes in a single image, is the differential of the matching coordinates between the predicted box and the real box , and , is the horizontal differential of the center coordinates, is the horizontal differential of the center coordinates, is the differential of the width, is the differential of the length, is the horizontal coordinate of the center coordinates of the predicted box, is the vertical coordinate of the center coordinates of the predicted box, is the width of the predicted box, is the length of the predicted box, is the horizontal coordinate of the center of the real box, is the vertical coordinate of the center of the real box, is the width of the real box, is the length of the real box, and [•] is the Euclidean distance.
[0069] Specifically, the network structure of the improved YOLOv11 model is as shown in Figure 2 . The main improvements include: a feature feedback layer (FFL) is connected in series at the input end of each Detect module, which aggregates the detailed features of small targets at different scales to enhance the feature expression ability of small targets; at the same time, the Wasserstein distance loss function is used to further improve the detection performance of small targets.
[0070] Among them, except for the feature feedback layer (FFL) and the Detect module, the Conv (convolution layer), C3k2 module, SPPF module, C2PSA module, Concat module, and Upsample module in other structures are all module structures and connection modes in the existing YOLOv11 model known to those skilled in the art. The FFL structure is as shown in Figure 3 First, the input features of the feature feedback layer pass through the LN standardization layer, the depth separable convolution, and the linear layer to extract deeper features; then, the split channel splitting layer splits the channels into two parts, one part of the features passes through the dimension conversion, the depth separable convolution, and the MSCA module to extract multi-scale deep information, and then element-wise multiplies with the other part of the features to obtain deep features of different scales; finally, element-wise addition is performed after the linear layer and the input features of the feature feedback layer to obtain the final feedforward features.
[0071] Specifically, the MSCA module performs the following operations:
[0072] 1. Extracting spatial feature maps through 3x3 depth separable convolution The 3x3 depth separable convolution can effectively extract spatial features while reducing computational complexity, and the calculation formula is as follows:
[0073] =DSC(X);
[0074] Where X is the input feature of the MSCA module, and DSC is the depth separable convolution.
[0075] 2. Spatial feature maps Multi-scale features are obtained through three depth separable convolution modules and element-wise added to the spatial feature maps to obtain the first fused feature maps : Multi-scale convolution is used to capture information of different scales, and element-wise addition of fused features can enhance information expression, and the calculation formula is as follows:
[0076] ( , );
[0077] Wherein, represents the mth third extracted feature map, i.e., the spatial information of the mth scale.
[0078] 3. First fused feature maps After multiplying the MSCA module input features through the 1x1 convolution layer, the second extracted feature maps are obtained : The 1x1 convolution adjusts the channel relationship, and multiplying the original features can realize effective fusion of multi-scale information, and the calculation formula is as follows:
[0079] X;
[0080] wherein, is a 1x1 convolutional layer, which adjusts the channel relationship through 1x1 convolution, and is conducive to effective fusion of multi-scale information, is an element-wise multiplication.
[0081] The Detect module is as shown in Figure 2 wherein Conv represents a convolutional layer (ordinary convolution), DWConv represents a depthwise separable convolution, Bbox, Cls, and WD represent output layers of the first output feature, the second output feature, and the third output feature in sequence, and the first output feature and the second output feature can adopt a loss function of the Detect module in an existing YOLOv11 model, and the third output feature adopts a Wasserstein distance loss function.
[0082] The Wasserstein Distance Loss (Wasserstein distance loss function) is used to measure the distance between the predicted bounding box and the true bounding box, so as to more accurately optimize the position of small targets. Specifically, the Wasserstein distance calculates the difference between the center position of the predicted bounding box and the defect size, and incorporates the translation and scaling difference into the loss, so that the model pays more attention to the boundary accuracy of small targets. Compared with the traditional IoU loss, the Wasserstein Distance Loss can more smoothly handle the frame offset error, and has a better optimization effect on small target prediction frames.
[0083] S3, pre-processing and defect detection:
[0084] S31, the pre-processing is to sequentially perform ROI region extraction, brightness correction, and noise removal on each image;
[0085] S32, the defect detection is to use the improved YOLOv11 model to detect all pre-processed images of a single glass ball, and when there is at least one unqualified prediction frame in all images of the single glass ball, the glass ball is considered to be an unqualified product, otherwise, the glass ball is considered to be a qualified product.
[0086] In an embodiment, the ROI region extraction is to crop the image to obtain a glass ball region;
[0087] The brightness correction is to adjust the brightness and contrast of the cropped image;
[0088] The noise removal is to use a blur processing method to remove noise or interference in the brightness-corrected image.
[0089] In an embodiment, the glass bead defect detection method based on the improved Yolov11 further comprises the following steps:
[0090] The images labeled by classification are split into a training set, a validation set and a test set according to a ratio of 8:1:1, the training set, the validation set and the test set are input into the improved YOLOv11 model to obtain a final improved YOLOv11 model, and the final improved YOLOv11 model is used for defect detection.
[0091] In an embodiment, the qualified standard of the prediction box is determined as follows:
[0092] According to the prediction box information, the confidence and the defect category output by the improved YOLOv11 model, the number of each defect category is counted and the confidence is filtered for each defect category, the prediction box less than the confidence threshold is marked as qualified, and the prediction box greater than or equal to the confidence threshold is marked as pending, the prediction box information includes length, width and center coordinates;
[0093] The pending prediction box is operated as follows:
[0094] If the defect category is a scratch, it is determined whether the length or the width of the prediction box is greater than a preset size, if yes, the prediction box is marked as unqualified, otherwise, the prediction box is marked as qualified;
[0095] If the defect category is other, an image in the prediction box is extracted and converted into a grayscale image, a findContours function is used to find a defect contour and calculate the number of pixels of the defect contour, if the number of pixels of the defect contour is greater than a first preset number, the prediction box is marked as unqualified, or if the number of pixels of the defect contour is greater than a second preset number and the number of the current defect category exceeds a third preset number, the prediction box is marked as unqualified, otherwise, the prediction box is marked as qualified, the second preset number is less than the first preset number.
[0096] Specifically, as shown in Figure 1 The pre-processing operation steps are as follows:
[0097] Extracting the region of interest (ROI region): first, the image of the glass bead is cropped to extract the region of interest, and the irrelevant part of the image is removed so that the subsequent focus can be more focused on the surface area of the glass bead, and the extracted ROI region is as shown in Figure 4 (a).
[0098] Brightness correction: brightness correction is performed on the cropped image to adjust the brightness and contrast of the image, improve the visibility of the target, and make the image details clearer for subsequent processing.
[0099] Noise cleaning: mainly used for detecting and cleaning the stains in the image. By smoothing each detection area in the image, significant noise or interference is found and removed using a blur processing method, so that the stain area is smoothly transitioned and the impact of noise on subsequent detection is reduced.
[0100] The defect detection operation steps are as follows:
[0101] After the image pre-processing is completed, the improved YOLOv11 model is used to detect 12 images of a single glass ball. The prediction box information, confidence and defect category detected by the improved YOLOv11 model are collected, and the number of each defect category is counted. The prediction box information includes length, width and center coordinates. For each defect category, confidence threshold filtering is performed: the confidence threshold is set to 0.45, and the prediction box with a confidence threshold less than 0.45 is marked as OK (qualified); the prediction box with a confidence threshold greater than 0.45 is marked as NG (unqualified) and the following operations are performed respectively:
[0102] 1) Scratch defect: set the preset size to 10 pixels, if the length or width of the prediction box is greater than 10 pixels, mark the prediction box as NG (unqualified); otherwise, mark the prediction box as OK (qualified).
[0103] 2) Other defects: convert the image in the prediction box to a grayscale image, use the findContours function in OpenCV to find the defect contour, and filter out the largest defect contour. If the number of pixels (area) of the largest defect contour is greater than 1000 pixels, mark the prediction box as NG; if the area is greater than 220 pixels and the number of the current defect category exceeds two, also mark it as NG, and mark it as OK in other cases.
[0104] In the detection results of the 12 images of the above glass balls, if there is a prediction box with NG, it is judged that the glass ball is NG, and the detection effect is as shown in Figure 4 (b), where the red box represents the NG defect, and the yellow box represents the defect recognized by the improved YOLOv11 model, but is filtered by the threshold, i.e. OK defect. It is easy to understand that the above preset parameters can be adjusted according to actual needs.
[0105] The technical features of the above-described embodiments can be combined in any way. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described, but as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present disclosure.
[0106] The above described embodiments only express the more specific and detailed embodiments of the present application, but are not construed as limiting the scope of the application. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of the patent protection of the present application should be subject to the appended claims.
Claims
1. A glass bead defect detection method based on improved Yolov11, characterized by: The defect detection method for glass microspheres based on the improved Yolov11 includes the following steps: S1. Data collection: Obtain several images of different glass spheres, with at least one image for each glass sphere, and classify and label the defects in the images to form a dataset; S2. Model Construction: An improved YOLOv11 model is established. This improved YOLOv11 model is formed by connecting feature feedback layers in series at the input of each Detect module of the YOLOv11 model and introducing the Wasserstein distance loss function into the Detect module for network optimization, resulting in an improved Detect module. Specifically: The feature feedback layer performs the following operations: The input features of the feature feedback layer are sequentially passed through an LN normalization layer, a depthwise separable convolution, a linear layer, and a split channel splitting layer to obtain the first extracted feature map. The first extracted feature map is sequentially processed through dimension transformation, depthwise separable convolution, and the MSCA module to obtain the second extracted feature map; The first extracted feature map and the second extracted feature map are multiplied element-wise to obtain the second fused feature map; The second fused feature map is passed through a linear layer and then added element by element to the input features of the feature feedback layer to obtain the final feedforward features, which are the output features of the feature feedback layer. The MSCA module performs the following operations: Spatial feature maps of the input features of the MSCA module are extracted using depthwise separable convolution; The spatial feature map is passed through three parallel depthwise separable convolutional modules of different scales to obtain the corresponding third extracted feature map. All the third extracted feature maps and the spatial feature map are added element by element to obtain the first fused feature map. The depthwise separable convolutional module includes two depthwise separable convolutions connected in series. The first fused feature map is passed through a convolutional layer and then multiplied element-wise with the input features of the MSCA module to obtain the second extracted feature map. S3. Pre-processing and defect detection: S31. The preprocessing involves sequentially extracting the ROI region, correcting the brightness, and removing noise from each image. S32. The defect detection is performed by using an improved YOLOv11 model to detect all pre-processed images of a single glass ball. If at least one unqualified prediction box exists in all images of a single glass ball, the glass ball is considered a defective product; otherwise, the glass ball is considered a qualified product.
2. The improved Yolov11-based glass bead defect detection method of claim 1, wherein: The image acquisition method for each glass ball is to rotate the glass ball and take one image at every β angle, for a total of M images, where β and M are natural numbers; the classification and annotation of defects in the images is implemented using a sprite annotation assistant.
3. The method for detecting defects in glass microspheres based on improved Yolov 11 as described in claim 1, characterized in that: The ROI region extraction involves cropping the image to obtain the glass sphere region; The brightness correction refers to adjusting the brightness and contrast of the cropped image. The noise removal method involves using a blurring process to remove noise or interference from the brightness-corrected image.
4. The improved Yolov11-based glass bead defect detection method of claim 1, wherein: The glass microsphere defect detection method based on the improved Yolov11 also includes the following steps: The images labeled with the classification are split into a training set, a validation set and a test set according to a ratio of 8:1:1, and the training set, the validation set and the test set are input into the improved YOLOv11 model to obtain a final improved YOLOv11 model, and the final improved YOLOv11 model is used for defect detection.
5. The improved Yolov11-based glass bead defect detection method of claim 1, wherein: The improved Detect module performs the following operations: The output features corresponding to the feature feedback layer are respectively input into parallel first, second and third extraction modules to obtain first, second and third output features, the first extraction module includes convolution layers connected in series, the second extraction module includes depth separable convolutions connected in series, and the third extraction module includes convolution layers connected in series, the first output feature is prediction box information, the second output feature is confidence and defect category, and the third extraction module uses a Wasserstein distance loss function for network optimization.
6. The improved Yolov11-based glass bead defect detection method of claim 1, wherein: The Wasserstein distance loss function is as follows: ; ; wherein, is the Wasserstein distance loss function, is the Wasserstein distance of the i-th image in the dataset, i = 1 ~ N, N is the number of images in the dataset, is the Wasserstein distance of a single image, inf is the minimized loss, r is a single predicted box and a real box in a single image, is the joint distribution of all predicted boxes and real boxes in a single image, is the differential of the matching coordinates between the predicted box and the real box , and , is the horizontal differential of the center coordinates, is the vertical differential of the center coordinates, is the differential of the width, is the differential of the length, is the horizontal coordinate of the center coordinates of the predicted box, is the vertical coordinate of the center coordinates of the predicted box, is the width of the predicted box, is the length of the predicted box, is the horizontal coordinate of the center coordinates of the real box, is the vertical coordinate of the center coordinates of the real box, is the width of the real box, is the length of the real box, [•] is the Euclidean distance.
7. The improved Yolov11-based glass bead defect detection method of claim 1, wherein: The labeled types include six types of dirt, torn edge, mesh damage, pit, scratch and crescent.
8. The improved Yolov11-based glass bead defect detection method of claim 7, wherein: The qualified standard of the prediction box is as follows: According to the prediction box information, the confidence and the defect category output by the improved YOLOv11 model, the number of each defect category is counted and each defect category is filtered according to the confidence, the prediction box with a confidence less than a confidence threshold is marked as qualified, and the prediction box with a confidence greater than or equal to the confidence threshold is marked as pending, and the prediction box information includes length, width and center coordinates; The pending prediction box is operated as follows: If the defect category is scratch, it is judged whether the length or the width of the prediction box is greater than a preset size, if yes, the prediction box is marked as unqualified, otherwise, the prediction box is marked as qualified; If the defect category is other, an image in the prediction box is extracted and converted into a grayscale image, a findContours function is used to find a defect contour and calculate the number of pixels of the defect contour, if the number of pixels of the defect contour is greater than a first preset number, the prediction box is marked as unqualified, or if the number of pixels of the defect contour is greater than a second preset number and the number of the current defect category exceeds a third preset number, the prediction box is marked as unqualified, otherwise, the prediction box is marked as qualified, and the second preset number is less than the first preset number.
9. The improved Yolov11-based glass bead defect detection method of claim 1, wherein: The kernel sizes of the two depth separable convolutions of the depth separable convolution module are 1xM and Mx1 respectively, and M is a positive integer.
Citation Information
Patent Citations
Optical glass anomaly detection method and device
CN113870204A
Device and method for detecting spherical degree of automotive glass
CN115937571A