Cigarette surface defect detection algorithm deployment method
Through deep learning technology, multi-scale feature fusion and background noise suppression optimization, the problem of small and medium-sized targets for surface stain detection of cigarette support and multiple types of stain recognition is solved, efficient and accurate detection results are achieved, and the real-time and efficient requirements of the production line are met.
Patent Information
- Application Number
- CN202510118471.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art is difficult to accurately identify small targets and multiple types of stains in the detection of smoke stick surface stains, and the real-time and computational efficiency of the model are insufficient.
Deep learning technology is adopted to collect and pre-process the surface images of cigarette spoils, label and extract features, train the object detection model, and improve the accuracy and real-timeness of the model through multi-scale feature fusion and background noise suppression optimization.
It realizes efficient and accurate detection of small targets on the surface of cigarette support and multiple types of stains, improves the real-time and computing efficiency of detection, and meets the efficient detection needs of the production line.
Smart Images

Figure CN119992206A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cigarette manufacturing, and in particular to a method for deploying a cigarette surface defect detection algorithm. Background Art
[0002] Currently, the detection of stain defects on the surface of cigarettes mainly relies on traditional image processing methods and deep learning technology. Traditional methods such as edge detection, threshold segmentation and morphological processing mainly identify stains through image feature extraction and classification. However, these methods are difficult to accurately identify stains on the surface of cigarettes under complex backgrounds and lighting changes, especially tiny stains such as oil stains and yellow spots. In order to solve these problems, target detection networks based on deep learning have been widely used in recent years. Specifically, network structures such as YOLO (You Only Look Once) and Faster R-CNN (Region-based Convolutional Neural Networks) have achieved remarkable results in object detection and image segmentation. These networks automatically extract image features through multi-layer convolution operations, thereby achieving more accurate stain detection.
[0003] Although deep learning methods have made some progress in target detection, there are still some technical difficulties in the practice of detecting stains on the surface of cigarettes. First, stains are usually small in size and may be confused with the texture, illumination changes or reflections on the surface of cigarettes, making it difficult for traditional target detection networks to effectively identify these small targets. Second, there may be multiple types of stains (such as oil stains, yellow spots, etc.) on the surface of cigarettes at the same time, and these stains have different colors, shapes and texture characteristics. Existing target detection networks often need to be specially trained and optimized for these diverse stains to ensure high-precision detection results. Finally, due to the real-time detection requirements on the production line, how to improve the real-time performance and computational efficiency of the model while ensuring high detection accuracy is another challenge faced by deep learning target detection networks. Therefore, the industry needs to design more efficient and accurate target detection networks to solve problems such as small target detection and multi-type stain distinction in order to further improve the accuracy and real-time performance of stain detection. Summary of the invention
[0004] In view of the above, the present invention aims to provide a method for deploying a cigarette surface defect detection algorithm to solve the above-mentioned technical problems.
[0005] The technical solution adopted by the present invention is as follows:
[0006] The present invention provides a method for deploying a cigarette surface defect detection algorithm, which includes:
[0007] Collect the original two-dimensional image of the finished cigarette;
[0008] Preprocessing the original two-dimensional image;
[0009] Label and extract several types of features from the preprocessed cigarette surface image;
[0010] Based on the extracted features, a pre-built object detection model is trained to predict and output the category and location of the cigarette surface defects;
[0011] Evaluate the output of the target detection model and optimize the performance of the target detection model;
[0012] The optimized target detection model is used to perform surface defect detection on the actual collected cigarette images.
[0013] In at least one possible implementation, the preprocessing includes:
[0014] Remove noise from the original two-dimensional image and adjust the image brightness equally;
[0015] By adjusting the contrast, the presentation effect of the surface defect area in the original two-dimensional image is enhanced;
[0016] After using binarization processing to distinguish the foreground and background of the image, the edge information of several surface defect areas is extracted.
[0017] In at least one possible implementation, the process of marking and extracting features includes: marking information that is not relevant to cigarette surface defect detection and does not need to be extracted.
[0018] In at least one possible implementation manner, the process of marking and extracting features further includes: performing multi-scale feature fusion processing on the extracted features.
[0019] In at least one possible implementation, evaluating the output result of the target detection model at least includes:
[0020] The accuracy of the model detection is evaluated using the precision index, which is used to measure the proportion of samples detected as surface defects that are actually real defects;
[0021] The recall rate metric is used to evaluate whether surface defects are missed. It is used to measure the proportion of samples that are correctly detected as defects among all samples that are actually real defects.
[0022] In at least one possible implementation, collecting the original two-dimensional image of the finished cigarette includes:
[0023] A line scanning camera is arranged above the conveyor belt to obtain two-dimensional surface images of several cigarettes through continuous scanning.
[0024] Compared with the prior art, the main design concept of the present invention is to combine the technical route of deep learning with the online real-time detection of stains on the surface of cigarettes and the actual production needs on site, so that the target detection algorithm architecture can efficiently and accurately identify and locate defects such as oil stains and yellow spots on the surface of cigarettes. Specifically, the original two-dimensional image of the finished cigarette is collected; the original two-dimensional image is preprocessed; several types of features in the preprocessed cigarette surface image are labeled and extracted; the pre-constructed target detection model is trained based on the extracted features, so that the model predicts and outputs the category and location of the surface defects of the cigarette; the output results of the target detection model are evaluated, and the performance of the target detection model is optimized; the surface defect detection of the actual collected cigarette images is performed using the optimized target detection model. The present invention combines the actual on-site production conditions of cigarettes to conduct targeted training and deployment of the target detection algorithm, so that it can effectively adapt to the needs of cigarette surface defect detection.
[0025] Furthermore, a multi-scale feature fusion strategy and background noise suppression optimization are adopted to improve the accuracy and real-time performance of the target detection model, fully meeting the efficient requirements of stain detection in cigarette production lines. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described below with reference to the accompanying drawings, in which:
[0027] Figure 1 A schematic diagram of a cigarette surface defect detection algorithm deployment method provided by an embodiment of the present invention;
[0028] Figure 2 A schematic diagram of a two-dimensional unfolding of a cigarette provided by an embodiment of the present invention;
[0029] Figure 3 A schematic diagram of cigarette surface defect detection results obtained by using a deployed algorithm according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.
[0031] The present invention proposes an embodiment of a method for deploying a cigarette surface defect detection algorithm. Specifically, Figure 1 shown, including:
[0032] Step S1, collecting the original two-dimensional image of the finished cigarette;
[0033] Specifically, in the detection of stain defects on the surface of cigarettes, for example, a line scan camera (line scan camera) can be arranged above a rotating conveyor belt to collect data to obtain a two-dimensional expanded image of the cigarette surface. The line scan camera continuously scans the surface of several cigarette samples to be tested, capturing image data line by line, thereby forming a continuous two-dimensional expanded image, such as Figure 2 Hint.
[0034] Step S2, preprocessing the original two-dimensional image;
[0035] The preprocessing process mainly uses denoising, such as using Gaussian filtering or mean filtering to remove noise in the image and improve image quality. Since the exposure time of the line scan camera is short, the image may contain high-frequency noise, and filtering can improve the image signal-to-noise ratio.
[0036] During actual scanning and shooting, the brightness of the image may be uneven due to camera angle or light source fluctuations. Therefore, the image brightness can be balanced to ensure that the lighting conditions in each area of the image are consistent, which is convenient for subsequent analysis and detection.
[0037] Next, contrast enhancement methods such as histogram equalization or CLAHE are used to improve the image's detail, especially surface defect areas such as stains and yellow spots.
[0038] Subsequently, the image is divided into foreground and background through binarization, and the target region (ROI) is highlighted.
[0039] Finally, edge detection algorithms (such as Canny edge detection) are applied to extract edge information of different targets in the image to further enhance the visibility of cigarette surface defects.
[0040] After the above steps, the preprocessed image is generated as the input of the target detection and defect recognition model, providing a clear data basis for subsequent analysis and detection. Regarding the model architecture that needs to be input, in the preferred embodiment, based on the characteristics of the YOLOv8 (You Only Look Once) architecture that can efficiently and accurately identify and locate defects such as oil stains and yellow spots on the surface of cigarettes, YOLOv8 is used as an example in the following text. In addition, the single forward propagation method of YOLOv8 can enable the model to have higher speed and accuracy during the detection process, which is suitable for the real-time monitoring needs of the production line.
[0041] Step S3, marking and extracting several types of features from the preprocessed cigarette surface image;
[0042] For stain defect detection on cigarette surfaces, it is necessary to extract relatively fine features, especially for subtle defects on the cigarette surface. For example, the texture left by stains on the surface is very small, so it is preferred to use a convolutional layer with better performance to extract detailed information in the image. The present invention will not elaborate on this and will not limit this, but two additional points can be explained for this step:
[0043] First, when performing feature annotation and extraction, mark out irrelevant information that does not need to be extracted. Background noise suppression optimization plays a vital role in the detection of cigarette surface defects, especially in the cigarette production process, where the complexity and interference of the production background often pose great challenges to surface defect recognition. For example, the background may contain packaging materials, equipment on the production line, the shape of other cigarettes and other elements that are irrelevant to the target defect. These noise information not only increases the complexity of image processing, but also may affect the accuracy of the model. Therefore, unlike the aforementioned denoising preprocessing of the original two-dimensional image itself, in the feature extraction and post-processing stage, the present invention further proposes to introduce noise filtering technology to suppress and optimize the background noise, effectively eliminate irrelevant information, and ensure that the defect detection model can focus more on the target area (such as the surface and appearance of the cigarette). This optimization not only improves the model's ability to recognize cigarette surface defects, but also enhances its robustness in complex backgrounds. For example, in the detection of common stain defects on the surface of cigarettes (such as oil stains, water stains, poor printing, etc.), background noise suppression optimization can effectively filter out unnecessary background elements, allowing the model to focus more on the details of surface stains. Such defects are usually caused by mechanical equipment or operator negligence during the production process, and these stains may sometimes appear in different tones or textures, further increasing the difficulty of identification. In addition, background noise suppression technology can also cope with various interference factors commonly found in actual production environments, such as lighting changes, viewing angle deviations, and inaccurate camera focus. These factors may lead to a decline in image quality, limiting the detection effect of the model. However, with the help of noise suppression optimization, the model can maintain a high degree of accuracy under these changing conditions, ensuring that even in dim light, different viewing angles, or partial occlusion, it can still stably identify defects such as stains and scratches on the surface of cigarettes.
[0044] Second, for stains on the surface of cigarettes, defects may appear in different positions and their sizes may vary greatly. In order to better detect these defects, in some preferred embodiments, by combining a multi-scale feature fusion strategy (for example, using multi-scale feature fusion technologies such as PANet and FP in the YOLOv8 feature fusion module), the model can extract information from feature maps of different scales, thereby improving detection accuracy. The core idea of this strategy is that feature maps of different scales can capture detailed information of different sizes in the image, which is especially important for defects of different sizes and shapes. In the detection of stains or yellow spots on the surface of cigarettes, the size and shape of the defects may vary, and features of a single scale are often difficult to fully capture all the details. Through multi-scale feature fusion, the model can integrate features at different scales to ensure comprehensive recognition of various defects, especially in the effective detection of subtle defects, thereby enhancing the overall accuracy of the model.
[0045] Step S4: training a pre-built target detection model based on the extracted features, so that the model predicts and outputs the category and location of the cigarette surface defects;
[0046] The process of stain defect detection on the surface of cigarettes can involve the precise location (bounding box) and category of each stain area, and predict the category and location of the defect target from the aforementioned fused features. Furthermore, for the multiple candidate frames output by the YOLOv8 target detection model, there may be multiple stain detection frames on the surface of the cigarette, and there may be detection frames of the same or similar areas. Therefore, the non-maximum suppression algorithm NMS can be considered to help remove the frames with large overlaps and retain the most representative defect areas, thereby effectively reducing false detections.
[0047] Step S5: Evaluate the output result of the target detection model and optimize the performance of the target detection model;
[0048] When evaluating the detection results of stains on the surface of cigarettes, you can use indicators such as precision, recall, and F1-score. Among them, precision can help determine whether the system accurately identifies stains on cigarettes, and recall can evaluate whether small stain defects are missed. The comprehensive evaluation of F1-score can help determine the overall performance of the model on different defect types.
[0049] Specifically, for the task of detecting surface stains and yellow spots, the selected evaluation indicators not only focus on the accuracy of the model, but also consider its efficiency, stability, and applicability in the actual production environment of cigarettes. For specific applications such as cigarette surface stains and yellow spots detection, the following key evaluation indicators are crucial, which can comprehensively evaluate the performance of the model from multiple dimensions:
[0050] Precision is used to measure the proportion of samples that are actually defects among all samples detected as defects by the model. For details, please refer to the following mature formula: (1)
[0051] The recall rate is used to measure the proportion of samples that can be correctly detected as defects among all samples that are actually defects. For details, please refer to the following mature formula: (2)
[0052] F1-score is the harmonic mean of precision and recall, which combines these two indicators and is particularly suitable for cases of class imbalance. For details, please refer to the following mature formula: (3)
[0053] IoU measures the degree of overlap between the predicted defect area and the actual defect area. For details, please refer to the following mature formula: IoU (4)
[0054] Step S6: Use the optimized target detection model to perform surface defect detection on the actually collected cigarette images.
[0055] After the target detection model for detecting stain defects on the surface of cigarettes is trained and optimized, it can be converted into an inference format suitable for the production environment: for example, the trained YOLOv8 model can be exported to ONNX format to facilitate deployment in embedded hardware devices for real-time detection. In addition, configuring an inference engine (such as TensorRT, OpenVINO, etc.) can accelerate model inference, so that the actual detection process can adapt to the situation of the cigarette production site and quickly respond to and process the real-time collected cigarette image data.
[0056] Through the detection algorithm deployment solutions provided by the above embodiments of the present invention, Figure 3 From the detection results in , we can see that the model performs well in dealing with different types of surface stains, especially in the detection of oil stains and yellow spots, accurately locating and marking the stain area; the overlap of the detection frames is high, indicating that the model has strong accuracy in positioning. In addition, the suppression optimization of background noise and the multi-scale feature fusion strategy also effectively reduce false detections and missed detections, ensuring stability in complex environments. Overall, the above-mentioned target detection model after deployment can achieve fast and real-time defect recognition while ensuring high detection accuracy, meeting the production line's requirements for real-time and high efficiency of cigarette surface stain detection.
[0057] In summary, the main design concept of the present invention is to combine the technical route of deep learning with the online real-time detection of stains on the surface of cigarettes and the actual production needs on site, so that the target detection algorithm architecture can efficiently and accurately identify and locate defects such as oil stains and yellow spots on the surface of cigarettes. Specifically, the original two-dimensional image of the finished cigarette is collected; the original two-dimensional image is preprocessed; several types of features in the preprocessed cigarette surface image are labeled and extracted; the pre-constructed target detection model is trained based on the extracted features, so that the model predicts and outputs the category and location of the surface defects of the cigarette; the output results of the target detection model are evaluated, and the performance of the target detection model is optimized; the surface defect detection of the actual collected cigarette images is performed using the optimized target detection model. The present invention combines the actual on-site production conditions of cigarettes to carry out targeted training and deployment of the target detection algorithm, so that it can effectively adapt to the needs of cigarette surface defect detection.
[0058] If the expressions expressing orientation are mentioned in the embodiments of the present invention, they are relative concepts based on the embodiments. In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a and b, a and c, b and c, or a and b and c, wherein a, b, c can be single or multiple.
[0059] The above describes in detail the structure, features and effects of the present invention based on the embodiments shown in the drawings, but the above is only a preferred embodiment of the present invention. It should be noted that the technical features involved in the above embodiments and their preferred methods can be reasonably combined and matched into a variety of equivalent schemes by those skilled in the art without departing from or changing the design ideas and technical effects of the present invention; therefore, the present invention is not limited to the scope of implementation shown in the drawings, and all changes made in accordance with the concept of the present invention, or modifications to equivalent embodiments with equivalent changes, which still do not exceed the spirit covered by the specification and drawings, should be within the protection scope of the present invention.
Claims
1. A method for deploying a cigarette surface defect detection algorithm, characterized in that: include: Collect the original two-dimensional image of the finished cigarette; Preprocessing the original two-dimensional image; Label and extract several types of features from the preprocessed cigarette surface image; Based on the extracted features, a pre-built object detection model is trained to predict and output the category and location of the cigarette surface defects; Evaluate the output of the target detection model and optimize the performance of the target detection model; The optimized target detection model is used to perform surface defect detection on the actual collected cigarette images.
2. The method for deploying a cigarette surface defect detection algorithm according to claim 1, characterized in that: The pre-processing comprises: Remove noise from the original two-dimensional image and adjust the image brightness equally; By adjusting the contrast, the presentation effect of the surface defect area in the original two-dimensional image is enhanced; After using binarization processing to distinguish the foreground and background of the image, the edge information of several surface defect areas is extracted.
3. The method for deploying a cigarette surface defect detection algorithm according to claim 1, characterized in that: The process of marking and extracting features includes: marking information that is not related to cigarette surface defect detection and does not need to be extracted.
4. The method for deploying a cigarette surface defect detection algorithm according to claim 3, characterized in that: The process of labeling and extracting features also includes: performing multi-scale feature fusion processing on the extracted features.
5. The method for deploying a cigarette surface defect detection algorithm according to claim 1, characterized in that: The evaluation of the output result of the target detection model at least includes: The accuracy index is used to evaluate the detection accuracy of the model, which is used to measure the proportion of samples detected as surface defects that are actually real defects; The recall rate metric is used to evaluate whether surface defects are missed. It is used to measure the proportion of samples that are correctly detected as defects among all samples that are actually real defects.
6. The method for deploying a cigarette surface defect detection algorithm according to any one of claims 1 to 5, characterized in that: The collecting of the original two-dimensional image of the finished cigarette comprises: A line scanning camera is arranged above the conveyor belt to obtain two-dimensional surface images of several cigarettes by continuous scanning.
Citation Information
Cited By
Real-time online detection method for appearance quality of cigarette stacking anti-collision strip
CN120971439A