Beer bottle cap production defect visual detection method based on improved YOLOv10n
By improving the YOLOv10n network, the local receptive field restrictions and large parameters in beer bottle cap detection are solved, and defect detection with high accuracy and low error detection rate is achieved, which is suitable for real-time detection and edge equipment deployment in industrial production.
Patent Information
- Application Number
- CN202510224901.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-07-04
AI Technical Summary
The existing deep learning object detection algorithms based on YOLOv5, YOLOv6, YOLOv7 and other deep learning object detection algorithms have local receptive field limitations, lack of global environmental modeling, large number of model parameters and no edge device portability, resulting in insufficient detection accuracy and efficiency.
Using the improved YOLOv10n network, by designing the C2f-CMAC module, FPSC module, LSWD-Detect module and introducing the MDPIoU loss function, the CLFM-YOLO network architecture is built, image preprocessing and model optimization is carried out, feature extraction and fusion capabilities are enhanced, parameter amount is reduced, detection accuracy and portability are improved.
It realizes high accuracy and low error detection rate for beer bottle cap defect detection, meets the real-time detection needs of industrial production, improves production efficiency, and has good portability.
Smart Images

Figure CN120259180A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image defect recognition, and particularly relates to a visual detection method for beer bottle cap production defects based on improved YOLOv10n. Background Art
[0002] Beer bottle caps play a crucial role in the packaging system. Whether its structure is intact is an intuitive and important reference basis for consumers to judge product quality. However, due to various conditions such as the performance of bottle cap production equipment and the level of manufacturing technology, the metal caps produced often have various defects, such as stains, scratches, cracks, deformation, etc. are common. If products with packaging defects flow into the market, it will inevitably damage the brand image and increase the enterprise's maintenance costs. Therefore, it is necessary to rely on defect detection technology to detect the surface of metal caps to ensure the integrity of product packaging and enhance the market competitiveness of products.
[0003] When the digital wave sweeps through the industrial field, unmanned and intelligent become the mainstream development trends. In this environment, machine vision technology stands out, and its excellent performance in defect detection has gradually phased out the traditional manual defect detection method.
[0004] Jin Yijun et al. proposed a method for detecting surface defects of beer metal caps based on machine vision to improve the accuracy and precision of surface defect detection of beer metal caps. The image is processed using filtering noise suppression and high-contrast retention algorithms, and the optimization algorithm is based on the YOLOv5 network to complete the defect detection of the bottle cap, with an accuracy of 93.1%. However, its network convolution is limited by the local receptive field, the imbalance between details and the global situation, and the feature information expression is incomplete; at the same time, the number of model parameters is too large and it does not have portability on edge devices. To meet the requirements of high precision and portability in industrial production, the detection performance still needs to be further improved.
[0005] When the current object detection algorithms based on deep learning are applied to beer bottle cap defect detection, such as YOLOv5, YOLOv6, YOLOv7, etc., there are the following problems: First, due to the limitation of the local receptive field of the convolutional neural network, the semantic features of beer bottle cap defects extracted are incompletely expressed, lacking the modeling of the global environment; Second, the detection network focuses on local feature learning and fails to fully utilize the global context information of beer bottle cap defect images; Third, there is a lack of a lightweight model friendly to edge deployment devices. Summary of the Invention
[0006] To overcome the above technical problems, the object of the present invention is to provide a visual detection method for beer bottle cap production defects based on improved YOLOv10n. This method has a significant improvement in detection accuracy, can accurately identify subtle defects such as scratches and deformations in the beer bottle cap production process, and effectively reduce the missed detection rate and false detection rate; by optimizing the YOLOv10n model, it can meet the real-time detection requirements of large-scale production of beer bottle caps, greatly improving production efficiency; the optimization of the YOLOv10n model is lightweight and has good portability.
[0007] The technical solution adopted by the present invention is as follows:
[0008] A visual detection method for beer bottle cap production defects based on improved YOLOv10n includes the following steps;
[0009] S1. Collect images of the bottle cap surface and establish a dataset of beer bottle cap surface defects;
[0010] S2. Perform two image preprocessing operations on the collected images of the beer bottle cap surface defect dataset, namely median filtering and double blur contrast retention;
[0011] S3. Use the annotation tool labelimg to annotate the preprocessed images, and divide the annotated dataset images and label files to obtain a training set, a validation set, and a prediction set;
[0012] S4. Design a C2f-CMAC module, an FPSC module, an LSWD-Detect module, and improve the YOLOv10n network by introducing an MDPIoU loss function to construct a beer bottle cap surface defect recognition model with a CLFM-YOLO network architecture;
[0013] S5. Input the training set obtained in step S3 into the beer bottle cap defect recognition model for model training; use the validation set for validation during the training process;
[0014] S6. Use the trained beer bottle cap defect recognition model to predict the defects in the prediction set of the beer bottle cap surface defect dataset.
[0015] Further, in step S1, in the manner of collecting images of the bottle cap surface, image collection is sequentially performed on a number of defective bottle caps to obtain a sufficient number of images of the bottle cap surface for dataset construction.
[0016] Further, in step S2, first perform median filtering on the collected images of the beer bottle cap surface defect dataset to remove the influence of some non-defective small impurities; subsequently, design a double blur contrast retention algorithm to strengthen the detail information and edge values of the picture, ensuring that the region of interest in the image is more prominent, that is
[0017] Img out = Img in + X, X = GB{[Img in - GB(Img in , σ1)], σ2}
[0018] Where: Img in and Img out represent the images before and after processing respectively; GB is GaussianBlur, representing the Gaussian blur operation, and σ i represents different standard deviations (generally σ1 = 5, σ2 = 3), which can better retain the extracted high-frequency features.
[0019] Furthermore, in step S3, using the labeling tool labelimg, label the defective parts of the bottle caps in each image obtained in step S2 in sequence to construct a dataset of surface defects of beer bottle caps; among them, the dataset of surface defects of beer bottle caps should include bottle cap images with three types of defects: oil stains, scratches, and deformations.
[0020] Furthermore, the improvement of the YOLOv10n network in step S4 is specifically as follows:
[0021] S401. Based on the C2f module and CMAConv convolution, construct a C2f-CMAC feature extraction and fusion module, and replace the C2f modules in the 3rd, 5th, and 7th layers of the backbone and the C2f module in the neck part in sequence;
[0022] S402. Construct an FPSC shared parameter pyramid fusion module, and replace the SPPF module in the backbone in sequence to reduce the loss of extracted feature information;
[0023] S403. Construct a lightweight shared parameter detection head LSWD-Detect module to replace the detection head of YOLOv10n.
[0024] S404. Introduce the MDPIoU loss function to replace the CIoU loss function of YOLOv10n to accelerate model convergence and inference.
[0025] In step S4, the operation of the C2f-CMAC module is expressed as:
[0026] F1 = C 1x1 (F in );
[0027] F2 = 0.5 * F1;
[0028] F3 = 0.5 * F1;
[0029] F4 = CMAConv(F2);
[0030] F5 = CMAConv(F4);
[0031] F6 = CMAConv(F5);
[0032] F out = Concat[F3,F4,F5,F6];
[0033] Among them, F in represents the feature information passed into the C2f-CMAC module and serves as the input of the C2f-CMAC module. F out represents the image features extracted after being processed by the C2f-CMAC module. C represents the convolution operation. F1 represents the output after the input passes through a 1×1 convolution. F2 and F3 represent the outputs after evenly dividing the number of channels of F1. F4, F5, and F6 respectively represent the outputs passing through the CMAConv module in sequence.
[0034] The CA attention mechanism is introduced, and the ordinary convolution is replaced by depthwise separable convolution to design the CMAConv module. The operation of the CMAConv module is expressed as:
[0035] F 11 = C 1x1 (CA(DW 3x3 (C 1x1 (F 1in ))));
[0036] F 12 = F 1in ;
[0037] F 1out = Add[F 11 ,F 12 ;
[0038] Among them, F 1in represents the feature information passed into the Backbone part of the C2f module and serves as the input of the CMAConv module. F 1out represents the image features extracted after being processed by the CMAConv module. F1 represents the output after the input passes through a 1×1 convolution, a 3×3 depthwise separable convolution, the CA attention mechanism, and a 1×1 convolution. F2 represents the output of the residual path.
[0039] In step S4, the LSWD-Detect module includes the detection head outputs in three dimensions. The detection head route in each dimension includes 1×1 groups of convolutional layers (Conv_GN), 3×3 depthwise separable convolutional layers (DWConv), 3×3 grouped convolutional layers, and finally parallel regression convolutional layers (Conv_reg) and classification convolutional layers (Conv_cls). Here, the 3×3 depthwise separable convolutional layer (DWConv) and the 3×3 grouped convolutional layer are shared-parameter convolutional layers, aiming to reduce the number of parameters and complexity, and improve the computational efficiency and model detection accuracy.
[0040] Furthermore, in step S4, based on the MBConv module, the CA attention mechanism is introduced to replace the SE attention mechanism, and depthwise separable convolutional layers are introduced. This convolutional module is named CMAConv to replace the Bottleneck part in the C2f module, and the C2f-CMAC module is designed. Among them, the CA attention mechanism takes into account the information in both the channel and spatial dimensions. By calculating the attention on the channel and spatial positions of the feature map, it can more accurately focus on the regions with important semantic information in the image. Secondly, the introduction of depthwise separable convolutional layers greatly reduces the computational amount and the number of parameters of the model, and speeds up the training and inference speed of the model.
[0041] Furthermore, in step S4, the FPSC module is used to replace the SPPF structure in the YOLOv10 network. Multi-scale feature extraction is achieved through shared-parameter convolutional layers with different dilation rates. Low dilation rates capture local details, and high dilation rates capture global context, reducing the number of training parameters and improving computational efficiency. At the same time, the output feature map contains multi-scale information and appropriate channels, compensating for the loss of detailed information in the pooling of the SPPF module, thereby improving the accuracy and robustness of object detection.
[0042] Furthermore, in step S4, the LSWD-Detect is used to replace the original model network Head part of YOLOv10; a detection head structure with three different-dimensional outputs is constructed, and a shared-parameter convolutional path is adopted to reduce the network parameters. The shared-parameter path is 3×3 depthwise separable convolutional layer (DWConv_GN) and 3×3 grouped convolutional layer (Conv_GN).
[0043] Furthermore, in step S4, MPDIoU is introduced as the bounding box regression loss to replace the CIoU loss function. It focuses on the core part of the bounding box, better measures the overlapping area between the predicted bounding box and the ground truth bounding box, and improves the localization of the target and the robustness of the model.
[0044] In step S5, the surface defect dataset of beer bottle caps is resized to images of 640×640, and then the images are preprocessed and input into the model;
[0045] The C2f-CMAC module of the backbone and neck networks can adaptively adjust the convolution kernel weights according to the input features, enhancing the multi-scale feature fusion ability;
[0046] The FPSC module of the backbone network increases the receptive field of extracting image features during training by formulating convolutions with shared parameters of different dilation rates, and transmits the feature information extracted deeply to the next-level neck network;
[0047] The head network receives the features output by the neck, and then outputs feature maps of three scales of 20*20, 40*40, and 80*80 for data classification;
[0048] Among them, the number of input samples per batch is 16, the training loop iterates 300 rounds, and the initial learning rate is set to 0.01;
[0049] The training process optimizes the model parameters according to forward propagation, MPDIoU loss calculation, backpropagation, and stochastic gradient descent (SGD). Finally, the model performance is optimized through training and visualizing the loss curve to obtain an efficient beer bottle cap defect recognition model.
[0050] In step S6, through training and visualizing the loss curve, the model result with the best result on the test set is obtained as the trained beer bottle cap defect recognition model. The prediction set in the beer bottle cap surface defect dataset is preprocessed and then input into the trained model. Finally, after model inference, a prediction picture with defect location information is output. The predicted picture contains confidence, defect category, and defect location information.
[0051] Advantages of the present invention:
[0052] After median filtering the collected data images, and then through the designed double fuzzy contrast retention image processing algorithm, while denoising the image, it can better retain the detail information and enhance the defect texture information of the image. Design the C2f-CMAC module and FPSC module. Through the CA attention and pyramid feature fusion structures in the modules, the ability of the model to capture and fuse defect feature information is improved. Design the LSWD-Detect module to replace the original detection head in the YOLOv10n network. Use shared parameter convolution, group normalization, and depthwise separable convolution to lightweight the parameters of the detection head while slightly improving the detection accuracy. At the same time, introduce the MPDIoU loss function into the YOLOv10n network to replace the CIoU loss function of the network model, accelerating the convergence speed and model inference speed. The method of the present invention improves the detection accuracy of the model, reduces the missed detection and false detection rates of products; and also realizes the lightweight of the model parameters, improving the portability of the model. Description of the Drawings
[0053] Figure 1 This is the overall framework diagram for the model improvement of the visual inspection method for beer bottle cap production defects based on the improved YOLOv10n of the present invention.
[0054] Figure 2 This is the schematic diagram of the C2f-CMAC module structure of the visual inspection method for beer bottle cap production defects based on the improved YOLOv10n of the present invention.
[0055] Figure 3 This is the schematic diagram of the CA attention structure of the visual inspection method for beer bottle cap production defects based on the improved YOLOv10n of the present invention.
[0056] Figure 4 This is the schematic diagram of the FPSC module structure of the visual inspection method for beer bottle cap production defects based on the improved YOLOv10n of the present invention.
[0057] Figure 5 This is the schematic diagram of the LSWD-Detect module structure of the visual inspection method for beer bottle cap production defects based on the improved YOLOv10n of the present invention.
[0058] Figure 6 This is the model training parameter configuration diagram of the visual inspection method for beer bottle cap production defects based on the improved YOLOv10n of the present invention.
[0059] Figure 7 This is the comparison diagram of the defect detection effects of the visual inspection method for beer bottle cap production defects based on the improved YOLOv10n of the present invention. Detailed implementation manners
[0060] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present invention.
[0061] For the collected beer bottle cap images, median filtering, double blur contrast retention and other image preprocessing methods are performed to remove noise, retain edge information and detail information.
[0062] See Figure 1, in the overall framework diagram of the model improvement of the visual detection method for beer bottle cap production defects based on the improved YOLOv10n, the C2f-CMAC feature extraction and fusion module is adopted to sequentially replace the C2f modules in the 3rd, 5th, and 7th layers of the backbone of the YOLOv10 model and the C2f modules in the neck part, enhancing the feature extraction and fusion capabilities of the backbone network and the neck network, and improving the model detection accuracy; since the SPPF module uses the max pooling operation and will lose detailed information, the FPSC shared-parameter pyramid fusion module is used to replace the SPPF module in the 10th layer of the backbone of the YOLOv10 model. Through the shared-parameter dilated convolution with different dilation rates, the receptive field of the model is expanded to capture multi-scale feature information; the LSWD-Detect module is used to replace the original detection head of the YOLOv10 model, realizing the lightweight of the detection head while improving the model detection accuracy.
[0063] See Figure 2 , the CMAConv convolution module is constructed to replace the Bottleneck part in the C2f module. The CMAConv convolution contains a residual path and a main path. The main path passes through a 3×3 DWConv depthwise separable convolution and a CA attention mechanism, and then passes through a 1×1 convolution. In the main path, after each convolution, group normalization and the SiLU activation function are passed through. Finally, the output results of the residual path and the main path are added as the output of the CMAConv convolution module. Among them, the CA attention mechanism effectively improves the model's ability to extract and process image features, enhances the performance and robustness of the model, by comprehensively considering channel and spatial information without significantly increasing the computational burden.
[0064] Figure 3 is the structure diagram of the CA attention mechanism. The residual structure is used for improvement. First, the residual path is respectively passed to the horizontal global average pooling and the vertical global average pooling, and then the feature information is concatenated. Then, after convolution, feature decomposition is performed, and attention is generated through the Sigmoid function. After feature decomposition, convolution and attention weighting are performed on the decomposed features to highlight important features and suppress unimportant features. Finally, the feature information is fused.
[0065] See Figure 4 , the FPSC shared-parameter pyramid fusion module realizes multi-scale feature extraction by formulating convolution layers with different dilation rates. Low dilation rates capture local details, and high dilation rates capture global context, which is beneficial for object detection. Among them, the 3×3 shared convolution layer S_Conv is used to replace the max pooling module in the SPPF module. On the basis of making up for the loss of detailed information caused by pooling in the SPPF module, parameter sharing is achieved, the number of model training parameters is reduced, and the computational efficiency is improved.
[0066] See Figure 5 As shown in Figure 5 , the LSWD-Detect module is an improved YOLOv10 detection head that introduces depthwise separable convolution and shared-parameter convolution. At the same time, each of the output convolutions Conv_reg and Conv_cls of the detection head has two forms, which are used for single-object detection head training and multi-object detection head training during model training, respectively. Figure 5 In Figure 5 , the light-colored Conv_reg and Conv_cls are used for single-object detection head training and output; the dark-colored Conv_reg and Conv_cls are used for the case of multiple objects during the training process for training.
[0067] MPDIoU is a new boundary similarity comparison metric based on the minimum point distance proposed by considering all the characteristics of existing loss functions. It not only outperforms existing loss functions in terms of performance but also simplifies the calculation process. The definition formula of MPDIoU is as follows:
[0068]
[0069] In the formula: respectively represent the coordinates of the upper left and lower right of the ground truth bounding box, respectively represent the coordinates of the upper left and lower right of the predicted bounding box, and w and h represent the width and height of the input image, respectively. The definition formula of the loss function based on MPDIoU is as follows:
[0070] L MPDIoU = 1 - MPDIoU
[0071] See Figure 6 As shown in Figure 6 , the model training platform uses the Windows 11 operating system, the graphics card is selected as Nvidia GeForce RTX 4090, and the video memory reaches 16GB. The deep learning framework is selected as Pytorch-GPU 2.1.1, and the matching CUDA version is 12.1. At the same time, cuDNN with version number v8.8.01 is used to achieve GPU acceleration, and the programming environment uses python 3.10. In the training data stage, the image resolution is set to 640×640, the number of training epochs is set to 300 times, and the batch size Batchsize is set to 16. The SGD stochastic gradient descent algorithm is used as the optimizer, the initial learning rate lr0 is accurately set to 0.01, the learning rate momentum parameter is determined to be 0.937, and the weight decay coefficient is set to 0.0005.
[0072] See Figure 7, the images of three types of surface defects (oil spots, scratches, and deformations) of beer bottle caps collected by the above method are randomly input into the YOLOv10n model and the trained beer bottle cap defect recognition model obtained in step S5, and comparison images of detection results with marked defective parts and showing defective categories and confidence levels are obtained, namely the original image, the inference result image of the original YOLOv10 model, and the inference result of the improved model of the present invention. Among the inference results of the three types of defects, the confidence level inferred by the improved model of the present invention is improved compared with the original YOLOv10 model, and when dealing with the recognition of bottle cap deformation defects, the generation of other invalid detection frames is effectively suppressed, optimizing the quality of the recognition results.
[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A visual inspection method for production defects of beer bottle caps based on improved YOLOv10n, characterized in that, It includes the following steps; S1. Collect the images of the bottle cap surface and establish a dataset of beer bottle cap surface defects; S2. Perform two image preprocessing operations on the images of the beer bottle cap surface defect dataset collected, namely median filtering and double blur contrast retention; S3. Use the annotation tool labelimg to annotate the preprocessed images, and divide the annotated dataset images and label files to obtain the training set, validation set and prediction set; S4. Design the C2f-CMAC module, FPSC module, LSWD-Detect module, and improve the YOLOv10n network by introducing the MDPIoU loss function to construct a beer bottle cap surface defect recognition model with the CLFM-YOLO network architecture; S5. Input the training set obtained in step S3 into the beer bottle cap defect recognition model for model training; use the validation set for validation during the training process; S6. Use the trained beer bottle cap defect recognition model to predict the defects in the prediction set of the beer bottle cap surface defect dataset.
2. A visual inspection method for production defects of beer bottle caps based on the improved YOLOv10n according to claim 1, characterized in that, In step S1, in the way of collecting the images of the bottle cap surface, the images of several defective bottle caps are collected in sequence to obtain a sufficient number of bottle cap surface images for dataset construction.
3. A visual inspection method for production defects of beer bottle caps based on the improved YOLOv10n according to claim 1, characterized in that, In step S2, first perform median filtering on the images of the beer bottle cap surface defect dataset collected to remove the influence of some non-defective tiny impurities; then design a double blur contrast retention algorithm to strengthen the detail information and edge values of the picture, ensuring that the region of interest in the image is more prominent, that is Img out = Img in + X, X = GB{[Img in - GB(Img in , σ1)], σ2} where: Img in , Img out represent the images before and after processing respectively; GB, i.e., GaussianBlur, represents the Gaussian blur operation, and σ i represents different standard deviations.
4. A visual inspection method for production defects of beer bottle caps based on improved YOLOv10n according to claim 1, characterized in that, In step S3, use the annotation tool labelimg to annotate the defective parts of the bottle caps in each image obtained in step S2 in sequence to construct a beer bottle cap surface defect dataset; among them, the beer bottle cap surface defect dataset should include the bottle cap images with three types of defects: oil stains, scratches and deformations.
5. A visual inspection method for production defects of beer bottle caps based on improved YOLOv10n according to claim 1, characterized in that, In step S4, the improvement of the YOLOv10n network is specifically as follows: S401. Based on the C2f module and CMAConv convolution, construct a C2f-CMAC feature extraction and fusion module, and replace the C2f modules in the 3rd, 5th, and 7th layers of the backbone and part of the C2f modules in the neck in sequence; S402. Construct an FPSC shared parameter pyramid fusion module and replace the SPPF module in the backbone in sequence to reduce the loss of extracted feature information; S403. Construct a lightweight shared parameter detection head LSWD-Detect module to replace the detection head of YOLOv10n; S404. Introduce the MDPIoU loss function to replace the CIoU loss function of YOLOv10n to accelerate model convergence and inference.
6. A visual inspection method for production defects of beer bottle caps based on improved YOLOv10n according to claim 5, characterized in that, In step S4, the operation of the C2f-CMAC module is expressed as: F1 = C 1x1 (F in ) F2 = 0.5 * F1; F3 = 0.5 * F1; F4 = CMAConv(F2); F5 = CMAConv(F4); F6 = CMAConv(F5); F out = Concat[F3,F4,F5,F6]; Among them, F in represents the feature information input into the C2f-CMAC module and serves as the input of the C2f-CMAC module. F out represents the image features extracted after being processed by the C2f-CMAC module. C represents the convolution operation. F1 represents the output after the input passes through a 1×1 convolution. F2 and F3 represent the outputs after evenly dividing the number of channels of F1. F4, F5, and F6 respectively represent the outputs that successively pass through the CMAConv module; The operation of the CMAConv module is expressed as: F 11 = C 1x1 (CA(DW 3x3 (C 1x1 (F 1in )))); F 12 = F 1in ; F 1out = Add[F 11 , F 12 ; Among them, F 1in represents the feature information passed into the Backbone part of the C2f module and serves as the input to the CMAConv module. F 1out represents the image features extracted after the CMAConv module processes. F1 represents the output after the input passes through a 1×1 convolution, a 3×3 depthwise separable convolution, a CA attention mechanism, and a 1×1 convolution. F2 represents the output of the residual path; The LSWD-Detect module contains the detection head outputs in three dimensions. The detection head route in each dimension includes a 1×1 group convolution (Conv_GN), a 3×3 depthwise separable convolution (DWConv), a 3×3 group convolution, and finally the parallel regression convolution (Conv_reg) and classification convolution (Conv_cls). Using the FPSC module, multi-scale feature extraction is achieved by formulating a shared-parameter convolutional layer with different dilation rates (dilations). Using LSWD-Detect to construct a detection head structure with three different-dimensional outputs, in which a convolutional path with shared parameters is adopted; the shared-parameter path is a 3×3 depthwise separable convolution (DWConv_GN) and a 3×3 group convolution (Conv_GN). Introduce MPDIoU as the bounding box regression loss.
7. A visual inspection method for production defects of beer bottle caps based on the improved YOLOv10n according to claim 1, characterized in that, In step S5, the beer bottle cap surface defect dataset is resized to an image of 640×640, and then the image is preprocessed and input to the model. The FPSC module of the backbone network increases the receptive field of the image features extracted during training by formulating a shared-parameter convolution with different dilation rates, and transmits the deeply extracted feature information to the next-level neck network. The head network receives the features output by the neck, and then outputs feature maps of three scales of 20*20, 40*40, and 80*80 for data classification. The training process optimizes the model parameters according to forward propagation, MPDIoU loss calculation, backpropagation, and stochastic gradient descent (SGD). Finally, the model performance is optimized through training and visualizing the loss curve to obtain an efficient beer bottle cap defect recognition model.
8. A visual inspection method for production defects of beer bottle caps based on the improved YOLOv10n according to claim 1, characterized in that In step S6, through training and visualizing the loss curve, the model result with the best result on the test set is obtained as the trained beer bottle cap defect recognition model. The prediction set in the beer bottle cap surface defect dataset is input into the trained model. Finally, after model inference, a prediction picture with defect location information is output. The predicted picture contains confidence, defect category, and defect location information.
Citation Information
Cited By
Stator welding spot defect detection method and device
CN121121283A
Drainage pipeline defect identification method based on improved YOLOv10
CN121259514A
Defect lightweight detection model and method based on multi-scale dynamic fusion and application
CN121482010A