Method for distinguishing whether cigarette ends have textures or not

By combining pattern segmentation and edge detection technology, the texture characteristics of the smoky ends are detected, which solves the problem of accuracy and efficiency in the existing system when dealing with textureless ends, achieving higher feature extraction and matching accuracy, and reducing misjudgment.

CN119540193APending Publication Date: 2025-02-28CHENGDU BRANCH OF SICHUAN TOBACCO CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411642380.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

When the existing automated cigarette order verification system deals with cigarette ends that lack identifiable textures, the accuracy and efficiency are greatly reduced, resulting in an increase in misjudgment.

Method used

Pattern segmentation and edge detection technology are used to detect whether there is a texture that can be used for feature extraction in the image of the strip cigarette end by edge detection method and pattern segmentation method. The results of the two methods are used to judge to distinguish between textured and textured cigarette ends.

Benefits of technology

Effectively distinguish between textured and textured smoky ends, improve the accuracy of feature extraction and matching, reduce misjudgment in automatic verification, and improve the overall matching accuracy and processing speed of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540193A_ABST
    Figure CN119540193A_ABST
Patent Text Reader

Abstract

The invention discloses a method for distinguishing whether a cigarette end has a texture, and relates to the technical field of tobacco product detection, and the method comprises the following steps: S1, collecting a cigarette package image, and detecting the cigarette end in the cigarette package image to obtain a cigarette end image; s2, detecting whether textures which can be used for feature extraction exist in the cigarette end images or not by using an edge detection method and a pattern segmentation method; wherein when any one of the edge detection method and the pattern segmentation method detects that the cigarette end images have textures, the cigarette end images are judged to have texture specifications; and when the edge detection method and the pattern segmentation method do not detect that the cigarette end image has the texture, the cigarette end image is judged to have a texture-free specification. According to the method, the edge detection method and the pattern segmentation method are comprehensively used for verification, the cigarette ends with textures and the cigarette ends without textures can be effectively distinguished, the accuracy of feature extraction and matching is improved, and therefore the misjudgment phenomenon in automatic verification is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of tobacco product detection, and more particularly to a method for distinguishing tobacco product ends with and without textures by using pattern segmentation and edge detection technology. Background Art

[0002] Image recognition and feature matching technologies are core components of current automated carton order verification systems. The main purpose of these systems is to ensure that the carton image matches the order information by analyzing it. However, a major challenge is that the accuracy and efficiency of these systems are greatly reduced when the carton ends lack identifiable textures or features.

[0003] The texture and features of cigarette carton ends play a vital role in the image matching and recognition process. Carton ends with obvious textures usually contain unique patterns and marks, which can serve as key evidence for recognition and matching. However, many cigarette carton ends may have smooth surfaces or single colors without obvious textures or marks, which makes it extremely difficult to extract reliable features from the image, resulting in more false recognition and misjudgment during the matching process.

[0004] Misjudgment leads to incorrect order matching results, which affects operational efficiency. Therefore, in order to improve the accuracy and efficiency of the matching process, there is an urgent need for a method to effectively distinguish between textured and non-textured cigarette ends. Only by first screening out those non-textured ends that are difficult to extract features from the matching process can the system concentrate resources and technology on accurately matching those ends with obvious textures, thereby greatly improving the overall matching accuracy and processing speed.

[0005] Currently, commonly used methods for distinguishing whether an object has texture or not include traditional image processing techniques and deep learning algorithms. However, traditional image processing techniques, including gray-level co-occurrence matrix and other methods, are seriously affected by environmental factors; deep learning algorithms usually use classification networks to classify whether an object has texture or not, but there are many types of textures on the ends of cigarette cartons, and due to the production environment, there will be some irregular stains on the ends, which will interfere with the model. Therefore, it is difficult for existing technologies to meet the application requirements of current scenarios. Summary of the invention

[0006] In order to overcome the defects existing in the above-mentioned prior art, the present invention discloses a method for distinguishing whether the end of a cigarette rod has texture or not. The present invention utilizes pattern segmentation and edge detection technology to distinguish between tobacco product ends with and without texture, and can effectively distinguish between cigarette rod ends with and without texture, thereby improving the accuracy of feature extraction and matching, thereby reducing misjudgment in automatic verification.

[0007] In order to achieve the above objectives, the technical solution adopted by the present invention is: A method for distinguishing whether a cigarette rod end has texture or not comprises the following steps: 1. Terminal detection S1, collecting a cigarette carton package image, and detecting a cigarette carton end in the cigarette carton package image to obtain a cigarette carton end image; Preferably, in step S1, a cigarette rod end detection model is established, and the cigarette rod package image is input into the cigarette rod end detection model, and the cigarette rod end detection model outputs the cigarette rod end image.

[0008] Preferably, in step S1, the cigarette end detection model adopts the yolov8 model, and uses 1500 cigarette verification scene images and labeled cigarette end coordinate images as training sets to perform model training on the cigarette end detection model.

[0009] 2. Edge Detection and Pattern Segmentation S2. Using an edge detection method and a pattern segmentation method, detect whether the cigarette end image has a texture that can be used for feature extraction; wherein, when either the edge detection method or the pattern segmentation method detects that the cigarette end image has a texture, the cigarette end image is determined to have a texture specification; when neither the edge detection method nor the pattern segmentation method detects that the cigarette end image has a texture, the cigarette end image is determined to have a texture-free specification; 2.1 Edge Detection Preferably, in the edge detection method of step S2, the Canny edge detection algorithm is used to measure whether the cigarette end in the image has texture, which is suitable for cigarette ends without special large-area marks but with complex patterned background patterns.

[0010] Preferably, the edge detection method in step S2 comprises the following steps: S211, cropping the peripheral area of ​​the cigarette end image; Preferably, in step S211, the cropping ratio is 5% of the length and width of the cigarette end image.

[0011] S212, removing cigarette end image noise by closing operation; Preferably, step S212 includes: sequentially performing binarization, corrosion, and expansion operations on the cigarette end image.

[0012] S213, using the canny operator to detect the edge of the cigarette end image, and using the edge information to determine whether the cigarette end image has a texture that can be used for feature extraction.

[0013] Preferably, step S213 includes: Using the Canny edge detection algorithm, the edge of the cigarette end image is obtained; Calculating the edge pixel density in the cigarette end image, where the edge pixel density is the proportion of the detected edge pixels in the entire image; It is determined whether the edge pixel density exceeds a density threshold. If so, the cigarette end image has a texture that can be used for feature extraction; otherwise, the image does not have a texture that can be used for feature extraction.

[0014] Preferably, the edge pixel density is: Where D is the edge pixel density, E is the number of pixels detected as edges in the image, and T is the total number of pixels in the image.

[0015] Preferably, the density threshold is 0.004.

[0016] 2.2 Pattern segmentation Preferably, in the pattern segmentation method of step S2, a yolov8-seg model is used to construct a pattern segmentation model to detect whether the cigarette end image has texture that can be used for feature extraction, and the pattern segmentation model marks the pattern or text outline on the cigarette end image as a segmentation label.

[0017] Preferably, during the training process of the pattern segmentation model, reflections or shadows are randomly added to the 1000 labeled images to generate 3000 images, which are trained together. The trained pattern segmentation model is used to segment the pattern in the cigarette end image.

[0018] Preferably, the pattern segmentation method in step S2 comprises the following steps: Inputting the cigarette end image into the pattern segmentation model to obtain the bounding box, confidence score, and segmentation mask of the cigarette end image segmentation object; The confidence score is compared with the confidence threshold, and the part with the confidence score greater than the confidence threshold is regarded as the pattern or text texture part in the cigarette end image, otherwise it is regarded as the non-texture part; For the pattern or text texture part, the area of ​​the segmented object in the segmentation mask is judged, including: calculating the area ratio of the area of ​​the largest segmented object detected to the image area, and judging whether the area ratio is greater than the segmentation area threshold. If the area ratio is greater than the segmentation area threshold, there is a texture in the cigarette end image that can be used for feature extraction, otherwise there is no texture that can be used for feature extraction.

[0019] Preferably, the confidence threshold is 0.62 and the segmentation area threshold is 10%.

[0020] 3. Judgment Result Processing S3, deleting the cigarette end images determined to be without texture specifications, and performing feature extraction and order matching on the cigarette end images determined to be with texture specifications; Preferably, the conditions for successful matching in step S3 during order matching are: the number of cigarette carton ends detected in step S1 matches the total number of cigarettes on the order, and the feature-extracted end texture specifications are consistent with the specifications specified in the order.

[0021] 4. Output S4. Output the successfully matched cigarette end image and order information, as well as the deleted texture-free cigarette end image information.

[0022] Beneficial effects of the present invention: The present invention does not rely on a single method to determine whether the cigarette end has a texture that can be used for matching, but uses a combination of edge detection and pattern segmentation for verification. The existing technical means for distinguishing whether there is texture or not is single, greatly affected by environmental factors, and has a low accuracy rate. In the application scenario of the present invention, distinguishing whether the cigarette end has texture or not is related to the accuracy of subsequent automated cigarette verification, so the requirements for the function of distinguishing whether there is texture or not are high, and the original technology is not applicable. In the present invention, edge detection accurately identifies ends with complex textures, and pattern segmentation can accurately segment the logo or text on the end, providing more detailed information for texture features. The accuracy of end detection is improved, because the combination of the two technologies enables the system to not only identify the position of the end, but also further confirm its texture features, greatly reducing misjudgments caused by environmental factors or other interference. In addition, this mechanism allows the system to perform supplementary verification through another method when one method fails to determine, further ensuring the accuracy of the test results and facilitating subsequent automated verification of cigarettes. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A schematic diagram of a method for distinguishing whether a cigarette end has texture or not according to the present invention; Figure 2 It is a schematic diagram of the practical application of the present invention. DETAILED DESCRIPTION

[0024] The concept, specific structure and technical effects of the present invention will be clearly and completely described below in conjunction with the embodiments and drawings to fully understand the purpose, characteristics and effects of the present invention.

[0025] Example 1 A method for distinguishing whether a cigarette rod end has texture or not, such as Figure 1 and Figure 2 As shown, the following steps are included: S1, collecting a cigarette carton package image, and detecting a cigarette carton end in the cigarette carton package image to obtain a cigarette carton end image; S2. Using an edge detection method and a pattern segmentation method, detect whether the cigarette end image has a texture that can be used for feature extraction; wherein, when either the edge detection method or the pattern segmentation method detects that the cigarette end image has a texture, the cigarette end image is determined to have a texture specification; when neither the edge detection method nor the pattern segmentation method detects that the cigarette end image has a texture, the cigarette end image is determined to have a texture-free specification; S3, deleting the cigarette end images determined to be without texture specifications, and performing feature extraction and order matching on the cigarette end images determined to be with texture specifications; S4. Output the successfully matched cigarette end image and order information, as well as the deleted texture-free cigarette end image information.

[0026] The present invention aims to provide an automated, high-precision and high-robust method for detecting the texture of cigarette carton ends for automatically verifying the matching of cigarette carton and order in pictures. Through this method, it is possible to effectively distinguish between cigarette carton ends with texture and without texture, improve the accuracy of feature extraction and matching, and thus reduce the phenomenon of misjudgment in automatic verification. First, the system collects the image of the cigarette carton package, and then obtains the image of the cigarette carton end through end detection. Next, edge detection and pattern segmentation are performed on the end image, and the results of the two methods are combined to determine whether the cigarette carton end has a texture that can be used for feature extraction. Then, the system filters out the image without texture, and only performs feature extraction and matching processing on the cigarette carton ends with texture. Finally, the matching results are output, including the successfully matched cigarette carton images and related order information, as well as the filtered out textureless end information. Example 2 Based on Example 1, this example further elaborates on step S1. The end detection adopts the yolov8 model, uses 1500 pictures of cigarette verification scenes and annotated cigarette end coordinates as a training set for training, and finally obtains the end detection model.

[0027] Example 3 This embodiment further explains edge detection based on Embodiment 2.

[0028] In the present invention, the core of edge detection is to use the Canny edge detection algorithm to measure whether the cigarette end in the image has sufficient texture. In the automatic verification scenario, the Canny operator can accurately detect the edge of the end with complex texture, which is suitable for cigarette ends with no special large-area marks but with complex patterned background patterns. Edge detection mainly includes the following steps: 1. Crop the peripheral area of ​​the image. Since the terminal image is affected by lighting and environmental factors in the actual scene, the peripheral area of ​​the terminal is not uniformly clear at each boundary. Therefore, by cropping these areas, the interference of these factors on the internal texture detection of the image can be reduced. Through the test of 500 terminal images in the verification scene, the cropping ratio of 5% of the length and width of the image can reduce the impact of the edge of the terminal itself without affecting the internal texture of the terminal.

[0029] 2. Remove image noise. The reflection of the wrinkles of the plastic film on the end of the cigarette may interfere with the judgment of the texture. The closing operation can reduce the impact of these wrinkles to a certain extent. First, the image is binarized, and then the corrosion operation is used to reduce the boundaries of the objects in the image and eliminate the small bright areas (wrinkled parts). Then the expansion operation is used to increase the bright area and restore the bright area caused by corrosion. However, since the small bright area in the image has been removed, it will not appear again. In this way, the closing operation removes small bright color noise while retaining the large dark area.

[0030] 3. Use the canny operator to detect image edges. First, apply the Canny edge detection algorithm to the preprocessed image to obtain the edges in the image. Next, calculate the density of edge pixels in the image. The edge density refers to the proportion of detected edge pixels in the entire image. Finally, set a threshold to determine whether the image has sufficient texture. After testing 500 textured end images and 500 non-textured end images in verification scenarios, the threshold is set to 0.004 for the best effect. The threshold needs to be adjusted for different scenarios. If the calculated edge density exceeds the threshold, the image is considered to have sufficient texture.

[0031] The following is the formula for calculating edge density: Where D is the edge pixel density, E is the number of pixels detected as edges in the image, and T is the total number of pixels in the image.

[0032] Example 4 This embodiment further explains pattern segmentation based on Embodiment 3.

[0033] The yolov8-seg model is selected for pattern segmentation, and the logo or text outline on the end is annotated as the segmentation label, so that the annotation can exclude the interference of stains; during the training process, in order to deal with the visual interference caused by too dark light or reflection, we randomly add reflections or shadows to the 1,000 annotated pictures, and finally generate 3,000 pictures for joint training. The trained pattern segmentation model is used to segment large patterns in the end. During the prediction process, we send the picture into the network to obtain the bounding box, confidence score, and segmentation mask of the detected object in the picture. Next, the confidence threshold of the detected object is set. The points with a confidence score greater than the threshold are considered to be parts of the logo or text, otherwise they are non-texture parts. In order to further exclude false detections caused by environmental factors, it is necessary to judge the area of ​​the segmented object in the segmentation mask. The measurement standard uses the ratio of the area of ​​the largest segmented object detected to the image area. If this ratio is greater than the set threshold, it indicates that there is a significant pattern or text texture.

[0034] By testing 800 verification scene images, the results show that when the confidence threshold is set low, the wrinkled part of the plastic film wrapped outside the terminal will be mistakenly detected as texture. When the confidence threshold is set to 0.62, it can ensure that the detected object is highly likely to be a logo or text; when the segmentation area threshold is set to 10%, most of the small-area detection objects that are misdetected due to wrinkle reflection can be filtered out.

[0035] In order to ensure accurate identification of the terminal specifications and effectively match them with the order, the present invention adopts two methods: edge detection and pattern segmentation. When either method confirms the presence of texture in the image, the terminal is judged to have texture specifications; conversely, if neither method detects texture, the terminal is considered to have no texture specifications. In the process of order matching, only terminals that are judged to have texture specifications participate in the matching. The conditions for a successful match are: the number of detected terminals matches the total number of cigarettes on the order, and the texture specifications of the terminals are consistent with the specifications specified in the order. When these conditions are met, we can confirm that the package matches the order.

[0036] The present invention tested one thousand pictures of cigarette order verification packages, including three hundred pictures without textureless cigarette specifications and seven hundred pictures with different textureless cigarette specifications, and all pictures matched the orders. Without using the present invention for identification, the matching pass rate between pictures and orders was 79%, and with using the present invention for identification, the matching pass rate between pictures and orders was 96%.

[0037] The above is a specific description of the implementation mode of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention, and these equivalents or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A method for distinguishing whether a cigarette end has texture or not, characterized in that: The following steps are involved: S1, collecting a cigarette carton package image, and detecting a cigarette carton end in the cigarette carton package image to obtain a cigarette carton end image; S2. Detect whether the image of the cigarette end has texture that can be used for feature extraction by using an edge detection method and a pattern segmentation method; when either the edge detection method or the pattern segmentation method detects that the image of the cigarette end has texture, the image of the cigarette end is determined to have texture specifications; when neither the edge detection method nor the pattern segmentation method detects that the image of the cigarette end has texture, the image of the cigarette end is determined to have no texture specifications.

2. A method for distinguishing whether a cigarette rod end has texture or not according to claim 1, characterized in that: In step S1, a cigarette carton end detection model is established, and the cigarette carton package image is input into the cigarette carton end detection model, and the cigarette carton end detection model outputs the cigarette carton end image; In step S1, the cigarette end detection model adopts the yolov8 model, and uses 1500 cigarette verification scene images and labeled cigarette end coordinate images as training sets to perform model training on the cigarette end detection model.

3. A method for distinguishing whether a cigarette rod end has texture or not according to claim 1, characterized in that: In the edge detection method of step S2, the Canny edge detection algorithm is used to measure whether the cigarette end in the image has texture, which is suitable for cigarette ends without special large-area marks but with complex patterned background patterns.

4. A method for distinguishing whether a cigarette rod end has texture or not according to claim 1, characterized in that: The edge detection method of step S2 includes the following steps: S211, cropping the peripheral area of ​​the cigarette end image; S212, removing cigarette end image noise by closing operation; S213, using the canny operator to detect the edge of the cigarette end image, and using the edge information to determine whether the cigarette end image has a texture that can be used for feature extraction.

5. A method for distinguishing whether a cigarette rod end has texture or not as claimed in claim 4, characterized in that: In step S211, the cropping ratio is 5% of the length and width of the cigarette end image; Step S212 includes: performing binarization, corrosion and expansion operations on the cigarette end image in sequence.

6. A method for distinguishing whether a cigarette rod end has texture or not as claimed in claim 4, characterized in that: Step S213 includes: Using the Canny edge detection algorithm, the edge of the cigarette end image is obtained; Calculating the edge pixel density in the cigarette end image, where the edge pixel density is the proportion of the detected edge pixels in the entire image; It is determined whether the edge pixel density exceeds a density threshold. If so, the cigarette end image has a texture that can be used for feature extraction; otherwise, the image does not have a texture that can be used for feature extraction.

7. A method for distinguishing whether a cigarette rod end has texture or not according to claim 1, characterized in that: In the pattern segmentation method of step S2, the yolov8-seg model is used to construct a pattern segmentation model to detect whether the cigarette end image has a texture that can be used for feature extraction. The pattern segmentation model marks the pattern or text outline on the cigarette end image as a segmentation label; During the training process of the pattern segmentation model, reflections or shadows were randomly added to the 1,000 labeled images to generate 3,000 images, which were trained together. The trained pattern segmentation model was used to segment the patterns in the cigarette end images.

8. A method for distinguishing whether a cigarette rod end has texture or not according to claim 1, characterized in that: The pattern segmentation method of step S2 comprises the following steps: Inputting the cigarette end image into the pattern segmentation model to obtain the bounding box, confidence score, and segmentation mask of the cigarette end image segmentation object; The confidence score is compared with the confidence threshold, and the part with the confidence score greater than the confidence threshold is regarded as the pattern or text texture part in the cigarette end image, otherwise it is regarded as the non-texture part; For the pattern or text texture part, the area of ​​the segmented object in the segmentation mask is judged, including: calculating the area ratio of the area of ​​the largest segmented object detected to the image area, and judging whether the area ratio is greater than the segmentation area threshold. If the area ratio is greater than the segmentation area threshold, there is a texture in the cigarette end image that can be used for feature extraction, otherwise there is no texture that can be used for feature extraction.

9. A method for distinguishing whether a cigarette rod end has texture or not according to claim 1, characterized in that: The following steps are also included: S3, deleting the cigarette end images determined to be without texture specifications, and performing feature extraction and order matching on the cigarette end images determined to be with texture specifications; S4. Output the successfully matched cigarette end image and order information, as well as the deleted texture-free cigarette end image information.

10. A method for distinguishing whether a cigarette rod end has texture or not according to claim 9, characterized in that: The conditions for successful matching in step S3 during order matching are: the number of cigarette ends detected in step S1 matches the total number of cigarettes on the order, and the end texture specifications extracted by features are consistent with the specifications specified in the order.