Paper cup defect detection method based on improved YOLOv11 model
By combining the improved YOLOv11 model with the traditional visual algorithm of adaptive curvature analysis, an end-to-end paper cup defect detection method is formed, which solves the problem of difficulty in collecting low-probability defect samples and achieves efficient and accurate paper cup defect detection.
Patent Information
- Application Number
- CN202510208960.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-06-27
AI Technical Summary
It is difficult to collect low-probability defect samples during paper cup manufacturing, resulting in poor detection performance of deep learning models. The traditional visual detection methods have low accuracy in complex backgrounds, which are prone to missed and missed detection.
Combining the improved YOLOv11 model with traditional visual algorithms for adaptive curvature analysis, an end-to-end paper cup defect detection method is formed. This method achieves efficient and accurate detection of paper cups through image acquisition, cup mouth curvature calculation and improved defect detection of YOLOv11 model.
It improves environmental adaptability and micro defect detection effect, significantly improves detection accuracy and robustness, and reduces the calculation cost and resource consumption of the model.
Smart Images

Figure CN120219289A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting defects of paper cups, and particularly to a method for detecting defects of paper cups based on an improved YOLOv11 model. Background Art
[0002] With the booming development of the fast-moving consumer goods industry, paper cups, as an environmentally friendly and portable packaging material, play an increasingly important role in the beverage service field. However, various defects inevitably occur during the production process of paper cups, such as stains, deformations, color differences, poor printing, loose seals, etc. These defects not only directly affect product quality and user experience but may also lead to food safety problems, thereby damaging the brand image and market competitiveness. Therefore, developing efficient and accurate defect detection methods is of great significance for ensuring product quality, improving production efficiency, and maintaining brand reputation.
[0003] Traditional defect detection methods mainly include manual visual inspection and detection methods based on traditional machine vision. Although manual visual inspection can identify complex defect types, its low efficiency, strong subjectivity, poor consistency, and high cost are doomed to be unable to meet the high-efficiency requirements of modern large-scale production. Detection methods based on traditional machine vision, although improving detection efficiency and consistency to a certain extent, still face many challenges. For example, they are sensitive to the environment and have poor adaptability; the detection accuracy for defects in complex backgrounds is low, and it is easy to miss detections and misclassifications. Moreover, currently, traditional visual detection algorithms need to divide the paper cup area for detection, and the algorithm process is cumbersome and cannot achieve end-to-end detection.
[0004] In recent years, with the rapid development of deep learning technology, image processing technology based on deep learning has gradually become an important tool in the field of defect detection. Among them, the YOLO (You Only Look Once) series of algorithms have received wide attention due to their excellent real-time performance and high accuracy. The YOLOv11 model is the latest version released by the Ultralytics team. The YOLOv11 model introduces an improved backbone network and neck architecture and adopts multi-scale feature fusion technology, enabling the model to better capture important information under different input conditions. It is more superior to the YOLOv5 model in processing complex data and feature extraction, and can effectively improve the detection accuracy and robustness; in terms of the number of parameters, the YOLOv11 model uses 22% fewer parameters than the YOLOv8 model while maintaining high accuracy, which will greatly improve the computational efficiency and speed of the model; in the COCO dataset, the YOLOv11 model performs excellently on multiple benchmarks and has a great improvement compared with previous versions of YOLO. Therefore, the present invention uses an improved YOLOv11 model to detect defects of paper cups.
[0005] However, with the continuous maturity of the production process, the probability of certain types of defects occurring during the paper cup manufacturing process is relatively low. For example, defects such as burst openings caused by insufficient bonding of the cup edge seams or deformation defects caused during the forming process. Simply using deep learning technology to detect these defects with a relatively low occurrence probability requires obtaining a large number of defect samples. Otherwise, if the richness of the dataset cannot be satisfied, the detection performance of the model will also be poor. Therefore, there is a problem of excessively high costs caused by obtaining such defect samples. Summary of the Invention
[0006] In order to make up for the problem of difficult collection of low-probability defect samples mentioned above, the present invention combines the improved deep learning model YOLOv11 with the traditional vision algorithm of adaptive curvature analysis. Through complementary advantages, an end-to-end paper cup defect detection method is formed, which has the technical advantages of strong environmental adaptability and good detection effect for tiny defects.
[0007] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0008] A paper cup defect detection method based on an improved YOLOv11 model, comprising the following steps:
[0009] Step 1): Obtain a paper cup image through an image acquisition device;
[0010] Step 2): Calculate the curvature of the cup mouth of the obtained paper cup image, compare the calculated cup mouth curvature with the set curvature threshold relationship, and judge whether the cup mouth curvature meets the set standard. If it does not meet the standard, the detected paper cup will be removed online. If it meets the standard, continue to the next step;
[0011] Step 3): Input the paper cup image that meets the cup mouth curvature standard into the improved YOLOv11 model for defect detection, and output the defect detection result;
[0012] The structure of the improved YOLOv11 model is as follows: The traditional downsampling convolution module in the original YOLOv11 model is replaced by an ADown downsampling module, a P2 feature layer detection head is newly added to the original YOLOv11 model, and the SAHI module is combined with the Detect module of the Head network in the original YOLOv11 model;
[0013] Step 4): Remove the defective paper cups detected in Step 3 online, and stack and package the non-defective paper cups.
[0014] Furthermore, the cup mouth curvature calculation and judgment method in Step 2) are as follows:
[0015] Step 2.1): First, perform binarization processing on the paper cup image;
[0016] Step 2.2): Then extract the contour of the cup mouth;
[0017] Step 2.3): Then calculate the curvature of the contour;
[0018] Step 2.4): Set the curvature threshold as T, T = μ + kσ, where μ and σ are the mean and standard deviation of the smoothed curvature respectively, and k is an adjustment coefficient. Detect the set of points S with abnormal curvature = {i|H i > T}.
[0019] Furthermore, in the said Step 2.1), perform grayscale processing on the paper cup image to obtain a grayscale image I, and then perform binary processing on the grayscale image to obtain a binary image B;
[0020] In the said Step 2.2), use the Canny edge detection algorithm to identify the contour point set C = [p1, p2,..., p n in the binary image B, where p i = (x i , y i ) represents a pixel point on the contour, n is the total number of contour points, and use the chain code method to track the boundary to extract the contour;
[0021] First, calculate the cumulative arc length s of the original contour:
[0022]
[0023] where p i is the original contour point and M is the total number of original points;
[0024] Then, generate a new equidistant arc length sequence s':
[0025]
[0026] where N is the number of new sampling points, and then use linear interpolation to generate a new arc length sequence at equal intervals within the total arc length range, and perform Gaussian smoothing on the resampled contour;
[0027] In the said 2.3), calculate the curvature of the smoothed contour according to the following formula:
[0028]
[0029] In the above formula, ò is a small positive number to prevent the denominator from being zero.
[0030] Furthermore, k = 2, N = 500, ò = 1×10 -6 .
[0031] Furthermore, the ADown downsampling module in the said Step 3) is implemented by combining average pooling and convolution operations, that is:
[0032] First, the input feature map undergoes 2×2 average pooling.
[0033] Next, the feature map is divided into two parts, x1 and x2. x1 is processed through a 3×3 convolution with a stride of 2; x2 undergoes 3×3 max pooling with a stride of 2 and then the feature mapping is adjusted through a 1×1 convolution.
[0034] Furthermore, before using the improved YOLOv11 model, the model is trained according to the following process:
[0035] Step 3.1): Use an image acquisition device to collect various types of defect images of paper cups in a laboratory environment and a production line environment respectively, and complete the data annotation of the defects.
[0036] Step 3.2): Perform data augmentation on the collected original data.
[0037] Step 3.3): Divide the augmented dataset into a validation set, a training set, and a test set according to a ratio.
[0038] Step 3.4): Input the augmented training set into the improved YOLOv11 model for training. After each round of training, use the validation set to verify the trained model. After the model completes the final training, use the test set to test and analyze the trained model.
[0039] Step 3.5): Evaluate the trained model using accuracy P, recall rate R, mAP, and F1 score metrics respectively.
[0040] Furthermore, in the above step 3.1), the image acquisition device includes a black and white industrial camera and an annular light source. The defect types of the paper cups are divided into 5 categories, namely stain, smear, wrinkle, breakage, and empty cup. Use labeling software to perform data annotation on the collected images and save them as txt format labels.
[0041] Furthermore, in the above step 3.2), the data augmentation process is as follows: First, add Gaussian noise to simulate different shooting environments; Second, randomly adjust the brightness of the image to enhance the model's adaptability to light changes; In addition, use the Cutout method to randomly occlude part of the image, ensuring that the overlap degree of the occluded area and the target box does not exceed the set threshold; At the same time, randomly rotate the image; In terms of cropping, randomly crop the image according to the target box information, ensuring that the cropped image contains all target boxes; Randomly translate the image, ensuring that the translated image still contains all target boxes; Finally, randomly flip the image horizontally or vertically.
[0042] Further, when rotating the image, the rotation angle range is [-5°, 5°].
[0043] Further, in step 3.3), the data set is divided into a training set, a validation set, and a test set according to a ratio of 8:1:1.
[0044] In the present invention, by cascading and combining traditional vision algorithms and deep learning algorithms, a multi-stage detection strategy is formed to achieve the complementary advantages of the two algorithms; in terms of model detection, the existing YOLOv11 model is improved, and the downsampling convolution operation with a stride of 2 is replaced by an ADown convolution, effectively reducing the loss of fine-grained information and significantly improving the model efficiency and performance; a special small object detection head is designed to further improve the model's detection ability for small target defects; the SAHI method is also used for image slicing to assist in the inference processing of large-resolution images, improving the model's detection accuracy and inference efficiency, especially the detection ability for small target defects in large-format images. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is a flowchart of the paper cup defect detection method disclosed in the embodiment of the present invention;
[0046] Figure 2 It is a framework diagram of the improved YOLOv11 model adopted in the embodiment of the present invention;
[0047] Figure 3 It is a structural diagram of the Adown downsampling module in the improved YOLOv11 model;
[0048] Figure 4 It is a schematic diagram of the principle of the auxiliary slicing inference technology;
[0049] Figure 5 It is a diagram showing the detection results of adaptive curvature analysis for two paper cups in a specific example;
[0050] Figure 6 It is a deployment diagram of the online detection device using the paper cup defect detection method of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] 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.
[0052] This embodiment discloses a paper cup defect detection method based on an improved YOLOv11 model, which can be used for defect detection of online paper cups. The online deployment of the entire detection device is as Figure 6As shown, paper cup containers are arranged on the feeding channel of the detection device. A light source and an industrial camera are respectively installed above the paper cup containers to collect images of the paper cups. The industrial camera can use gxipy (network camera) or cv2.VideoCapture (USB camera). The entire detection process is as follows Figure 1 As shown, when the paper cup is conveyed to the designated photographing position, the industrial control computer of the detection device sends an instruction to the industrial camera to take an image, and stores the obtained paper cup image as the object to be detected; subsequently, the control system enables a preset adaptive curvature analysis program to calculate and analyze the curvature of the cup mouth in the image to determine whether there are defects such as cup mouth bursting and deformation in the detected paper cup. If an abnormal curvature is detected, the system directly determines that the paper cup is a non-conforming product, no longer performs subsequent model detection, directly notifies the industrial control computer to output a "rejection signal (NG)", controls the corresponding air valve to blow the non-conforming paper cup into the waste cup pipeline, and continues to detect the next paper cup; if the detected curvature is normal, it means that the cup mouth is basically intact, then the paper cup image is input into the improved YOLOv11 model for defect detection to determine whether there are subtle defects such as small-area breakage, flaws, and dirt. If defects are detected in this link, the system will still mark the paper cup as a non-conforming product, send an instruction to the industrial control computer through the serial port or communication interface, and drive the air valve to blow the paper cup into the waste cup pipeline; if the detection result in this link is normal, it means that the paper cup is a qualified product, then a finished product signal is sent to the industrial control computer, and the air valve is controlled to blow the paper cup into the receiving cup pipeline for sorting, packing, and boxing.
[0053] The above briefly describes the entire detection process, and the following will further detail the specific detection steps:
[0054] Step 1): Use an industrial camera and an annular light source to collect images of the paper cup to obtain the paper cup image of the paper cup to be detected.
[0055] Step 2): Calculate the curvature of the cup mouth of the obtained paper cup image, compare the calculated curvature of the cup mouth with the set curvature threshold relationship, and determine whether the curvature of the cup mouth meets the set standard. If it does not meet the standard, the detected paper cup is removed online. If it meets the standard, proceed to the next step.
[0056] In this step, the calculation and judgment method of the curvature of the cup mouth are described as follows:
[0057] Step 2.1): Perform grayscale processing on the obtained paper cup image to obtain a grayscale image I, and then perform binary processing on the grayscale image to obtain a binary image B;
[0058] Step 2.2): Then extract the contour of the cup mouth in the image;
[0059] Specifically, the Canny edge detection algorithm is used to identify the contour point set C = [p1, p2,..., p n in the binary image B, where p i = (x i , y i ) represents a pixel point on the contour, and n is the total number of contour points. The boundary is tracked by the chain code method to extract the contour. To make the contour points evenly distributed, the linear interpolation method is used to resample the contour. First, calculate the cumulative arc length s of the original contour, and the formula is as follows:
[0060]
[0061] In the above formula, p i is the original contour point, and M is the total number of original points. The cumulative arc length of the original contour is re - sorted to generate the following new equidistant arc length sequence s':
[0062]
[0063] In the above formula, N is the number of new sampling points. In this embodiment, N = 500 is set. Then, linear interpolation is used to generate a new arc length sequence at equal intervals within the total arc length range, and Gaussian smoothing is performed on the resampled contour.
[0064] Step 2.3): Calculate the curvature of the smoothed contour according to the following formula;
[0065]
[0066] In the above formula, ò is a small positive number to prevent the denominator from being zero. In this embodiment, ò = 1×10 -6 . To automatically detect abnormal curvature points, an adaptive threshold method is used to determine the curvature threshold T, and the formula is as follows:
[0067] T = μ + kσ
[0068] In the above formula, μ and σ are the mean and standard deviation of the smoothed curvature respectively, and k is an adjustment coefficient. In this embodiment, k = 2. Finally, according to the adaptive threshold, detect the set of points S = {i|H i > T}, and a specific detection result example can be seen in Figure 5 .
[0069] Step 3): Input the paper cup image that meets the cup - mouth curvature standard into the improved YOLOv11 model for defect detection, and output the defect detection result.
[0070] Step 4): Online remove the defective paper cups detected in step 3), and stack and package the non - defective paper cups.
[0071] The improved YOLOv11 model mentioned in step 3) above has a network model composed of a Backbone network, a Neck network, and a Head network. The network structure is as shown in Figure 2 the appendix. The Backbone consists of multiple modules, including an initial convolutional layer, an ADown module, a C3k2 module, an SPPF module, and a C2PSA module. The initial convolutional layer performs preliminary feature extraction on the input image of 640x640 and outputs a feature map of 320x320. The ADown module gradually reduces the size of the feature map and increases the number of channels through downsampling operations, and outputs feature maps of 160x160, 80x80, 40x40, and 20x20 respectively. The C3k2 module extracts more advanced features through convolution and residual connections and optimizes the feature representation at multiple scales. The SPPF module enhances the global information extraction ability through spatial pyramid pooling. The C2PSA module introduces a channel attention mechanism to further optimize the feature representation. The characteristics of the Backbone include multi-scale feature extraction, residual connections, and attention mechanisms, which enable the model to efficiently extract rich features from the input image. The Head layer is responsible for upsampling and fusing the extracted features and finally outputs the detection results. Through multi-scale feature fusion and the Detect module, the model can detect targets of different sizes simultaneously.
[0072] Combined with the above description and Figure 2 it can be seen that compared with the structure of the original YOLOv11 model, the improvements to the model in this embodiment are mainly reflected in the following aspects:
[0073] Improvement point (1): Use the ADown downsampling module to replace the traditional downsampling convolutional module in the original YOLOv11 model;
[0074] Improvement point (2): Add a P2 feature layer detection head to the original YOLOv11 model;
[0075] Improvement point (3): Combine the SAHI module with the Detect module in the Head network of the original YOLOv11 model.
[0076] In the above improvement point (1), the ADown downsampling module is implemented by combining average pooling and convolution operations, as shown in Figure 3As shown in the figure, first, the input feature map undergoes 2×2 average pooling, which reduces the spatial resolution while retaining important global information. Then, the feature map is divided into two parts, x1 and x2. x1 is processed through a 3×3 convolution with a stride of 2 to further extract features and reduce the dimension. While x2 undergoes 3×3 max pooling with a stride of 2 to capture more prominent features, and then the feature map is adjusted through 1×1 convolution. This design enables the ADown module to effectively fuse information from different scales. By combining average pooling with convolution, ADown can not only reduce the size of the feature map but also retain more fine-grained information during the downsampling process. This method effectively alleviates the problem of information loss commonly found in traditional downsampling methods, especially when dealing with small objects. In addition, the structural design of the ADown module significantly reduces the computational amount and the number of parameters, thus improving the overall computational efficiency of the model. This efficient downsampling strategy enables the ADown module to perform excellently in object detection tasks, especially when dealing with complex scenes and multi-scale objects, and can significantly improve the detection performance.
[0077] Regarding the above improvement point (2), the original YOLOv11 model has three detection heads: the P3 layer (8x downsampling), the P4 layer (16x downsampling), and the P5 layer (32x downsampling). This enables the model to perform multi-scale object detection. Although the high-level features of the original model contain rich semantic information, their spatial resolution is low, and it is difficult for low-resolution feature maps to capture the details of small objects. Therefore, the original model performs poorly in small object detection. For this reason, in this embodiment, a detection head from the P2 feature layer (4x downsampling) is additionally introduced. By optimizing the feature fusion strategy and adjusting the receptive field, this detection head can more effectively capture the feature information of small objects and significantly improve the model's recognition ability for small-sized defects.
[0078] Regarding the above improvement point (3), to address the challenge of small object detection in high-resolution images, the model in this embodiment adopts the Slice-assisted Hyper Inference (SAHI) technique. SAHI is a general framework for solving small object detection problems in the fine-tuning and inference stages, as Figure 4 shown. Specifically, this technique divides the input image into several sub-images for independent detection, thereby increasing the pixel area of tiny objects, and then integrates the results through post-processing. SAHI adopts a detection strategy similar to a sliding window, dividing the original input image I into l overlapping slices P1 of size p×q I , ……,P l I. By adjusting the size of the slices while maintaining the aspect ratio, each overlapping slice will apply forward propagation object detection separately to infer small objects, and at the same time use the full inference (FI) of the entire image to detect large objects. Finally, SAHI will summarize the results of full inference and local inference and finally convert them to the original image size. By this method, not only the computational complexity is reduced, but also the problem of feature dilution that may occur when directly processing high-resolution images is avoided, effectively solving the problem of blurred details of small objects that may occur in the object detection model when processing high-resolution images.
[0079] The improved YOLOv11 model adopted by the present invention needs to complete the training of the model according to the following process before use:
[0080] Step 3.1): Use an image acquisition device to collect various types of defective images of paper cups in a laboratory environment and a production line environment respectively, and complete the data annotation of the defects.
[0081] Specifically, a black and white industrial camera and a ring light source can be used as the image acquisition device. A total of 2000 images are collected and divided into 5 categories according to the defect types of the paper cups, namely stains, smudges, wrinkles, breakages, and empty cups. The collected images are annotated with data using marking software and saved as txt format labels.
[0082] Step 3.2): Perform data augmentation processing on the collected original data.
[0083] Specifically, the data augmentation process is as follows: First, add Gaussian noise to simulate different shooting environments to enhance the robustness of the model to noise; second, randomly adjust the brightness of the image to simulate images under different lighting conditions and enhance the adaptability of the model to lighting changes; in addition, use the Cutout method to randomly occlude part of the image, ensuring that the overlap degree of the occluded area and the target box does not exceed the set threshold, thereby improving the robustness of the model to partial missing information; at the same time, randomly rotate the image (the rotation angle range is [-5°, 5°]) to enhance the adaptability of the model to target direction changes; in terms of cropping, randomly crop the image according to the target box information to ensure that the cropped image contains all target boxes to improve the robustness of the model to target position changes; in addition, randomly translate the image to ensure that the translated image still contains all target boxes and enhance the adaptability of the model to target position changes; finally, randomly flip the image horizontally or vertically to increase the diversity of the dataset. Each original image generates 5 enhanced samples, and a total of 10000 data samples are generated.
[0084] Step 3.3): Divide the augmented dataset into a training set, a validation set, and a test set according to a ratio of 8:1:1. Specifically, it is divided into 8000 training sets, 1000 validation sets, and 1000 test sets.
[0085] Step 3.4): Input the enhanced training set into the improved YOLOv11 model for training. After each round of training, verify the trained model through the validation set. After the model completes the final training, test and analyze the trained model through the test set.
[0086] Step 3.5): Evaluate the trained model using the metrics of Precision (denoted by symbol P), Recall (denoted by symbol R), mAP (mean Average Precision), and F1 Score to evaluate the performance of the model on the validation set.
[0087] Precision measures the proportion of samples predicted as positive by the model that are actually positive; Recall measures the proportion of positive samples correctly predicted by the model among all true positive samples. The F1 Score is the harmonic mean of Precision and Recall, which combines the performance of Precision and Recall and provides a balanced evaluation metric. The calculation formulas for these metrics are as follows:
[0088]
[0089]
[0090] TP represents the number of samples correctly predicted as non-defective; FP represents the number of samples wrongly predicted as non-defective but actually defective; FN represents the number of samples wrongly predicted as defective but actually non-defective. In a multi-class task, mAP is the average precision of all classes, c represents the number of classes, and P(R) represents the precision at a specific recall rate R.
[0091] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A paper cup defect detection method based on an improved YOLOv11 model, characterized in that: The steps include: Step 1): Acquire a paper cup image through an image acquisition device; Step 2): Calculate the cup curvature of the acquired paper cup image, compare the calculated cup curvature with the set curvature threshold, and determine whether the cup curvature meets the set standard. If not, the detected paper cup is removed online. If it meets, proceed to the next step. Step 3): Input the paper cup image that meets the cup curvature standard into the improved YOLOv11 model for defect detection, and output the defect detection result; The structure of the improved YOLOv11 model is as follows: the ADown downsampling module is used to replace the traditional downsampling convolution module in the original YOLOv11 model, a P2 feature layer detection head is newly added to the original YOLOv11 model, and the SAHI module is combined with the Detect module of the Head network in the original YOLOv11 model; Step 4): The defective paper cups detected in step 3) are removed online, and the defect-free paper cups are sorted and packaged.
2. The paper cup defect detection method based on the improved YOLOv11 model according to claim 1, characterized in that: The calculation and determination method of the cup opening curvature in step 2) is as follows: Step 2.1): First, perform binarization on the paper cup image; Step 2.2): Then extract the outline of the cup mouth; Step 2.3): Calculate the curvature of the contour again; Step 2.4): Set the curvature threshold to T, T = μ + kσ, μ and σ are the mean and standard deviation of the smoothed curvature, k is the adjustment coefficient, and the point set S = {i|H i >T}.
3. The paper cup defect detection method based on the improved YOLOv11 model according to claim 2, characterized in that: In the step 2.1), grayscale processing is performed on the paper cup image to obtain a grayscale image I, and then the grayscale image is binarized to obtain a binary image B; In step 2.2), the Canny edge detection algorithm is used to identify the contour point set C in the binary image B = [p1, p2, ..., p n ], where p i =(x i ,y i ) represents a pixel point on the contour, n is the total number of contour points, and the chain code method is used to track the boundary to extract the contour; First, calculate the cumulative arc length s of the original contour: Among them, p i is the original contour point, M is the total number of original points; Then, a new equidistant arc length sequence s′ is generated: s′={s0,s0+Δs,s0+2Δs,...,s0+(N-1)Δs} Where N is the number of new sampling points. Then, linear interpolation is used to generate a new arc length sequence with equal spacing within the total arc length range, and Gaussian smoothing is performed on the resampled contour. In 2.3), the curvature of the smoothed profile is calculated according to the following formula: In the above formula, ò is a small positive number to prevent the denominator from being zero.
4. The paper cup defect detection method based on the improved YOLOv11 model according to claim 3 is characterized in that: k = 2, N = 500, ò = 1 × 10 -6 .
5. The paper cup defect detection method based on the improved YOLOv11 model according to claim 1, characterized in that: The ADown downsampling module in step 3) is implemented by combining average pooling and convolution operations, namely: First, the input feature map undergoes 2×2 average pooling; Next, the feature map is divided into two parts, x1 and x2. x1 is processed by a 3×3 convolution with a stride of 2; x2 undergoes a 3×3 maximum pooling with a stride of 2, and then the feature map is adjusted by a 1×1 convolution.
6. The paper cup defect detection method based on the improved YOLOv11 model according to claim 1, characterized in that: The improved YOLOv11 model is trained according to the following process before use: Step 3.1): Use image acquisition equipment to collect various types of defect images of paper cups in the laboratory environment and the production line environment, and complete the defect data annotation; Step 3.2): Perform data enhancement processing on the collected original data; Step 3.3): Divide the enhanced dataset into validation set, training set and test set according to the proportion; Step 3.4): Input the enhanced training set into the improved YOLOv11 model for training. After each round of training, the trained model is verified by the validation set. After the model completes the final training, the trained model is tested and analyzed by the test set. Step 3.5): Use precision P, recall R, mAP, and F1 score indicators to evaluate the trained model.
7. The paper cup defect detection method based on the improved YOLOv11 model according to claim 6, characterized in that: In the step 3.1), the image acquisition equipment includes a black and white industrial camera and a ring light source, and the defect types of the paper cups are divided into five categories, namely stains, stains, wrinkles, damage and empty cups. The collected images are annotated with data using labeling software and saved as labels in txt format.
8. The paper cup defect detection method based on the improved YOLOv11 model according to claim 6, characterized in that: In the step 3.2), the data enhancement process is as follows: first, by adding Gaussian noise to simulate different shooting environments; second, randomly adjusting the brightness of the image to enhance the adaptability of the model to lighting changes; in addition, using the Cutout method to randomly block part of the image area to ensure that the overlap between the blocked area and the target frame does not exceed the set threshold; at the same time, randomly rotate the image; in terms of cropping, randomly crop the image according to the target frame information to ensure that the cropped image contains all target frames; randomly translate the image to ensure that the translated image still contains all target frames; finally, randomly flip the image horizontally or vertically.
9. The paper cup defect detection method based on the improved YOLOv11 model according to claim 8, characterized in that: When the image is rotated, the rotation angle range is [-5°, 5°].
10. The paper cup defect detection method based on the improved YOLOv11 model according to claim 6, characterized in that: In the step 3.3), the data set is divided into a training set, a validation set and a test set in a ratio of 8:1:1.