Cigarette packet surface printing defect detection method and system based on vision intelligence

By using adaptive optical parameter adjustment and various visual processing methods based on visual intelligence technology, the problems of unstable image acquisition and inaccurate defect identification in the detection of printing defects on the surface of cigarette packs have been solved, achieving continuous and accurate identification in complex environments.

CN121707971APending Publication Date: 2026-03-20SHENZHEN GOODYEAR PRINTING

Patent Information

Application Number
CN202511900927.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies for detecting printing defects on cigarette packs suffer from unstable image acquisition clarity, making them unsuitable for different cigarette pack materials and complex lighting environments. This results in insufficient detection accuracy, especially for defects such as slight color deviations, localized font deformations, and minor pattern blurring, which are prone to false alarms or missed detections.

Method used

A vision-based detection method is adopted. By adjusting the adaptive optical parameters, clear images are acquired, pixel-level features are extracted and grayscale conversion is performed to identify potential defect areas. Combined with depth feature scanning and ambiguity evaluation, a comprehensive defect description vector is generated, and the imaging system parameters are updated in real time to achieve continuous and accurate identification.

Benefits of technology

It significantly improves image clarity and stability, enhances the accuracy and robustness of identifying various types of defects, and forms a continuous and efficient defect identification capability, adapting to high-speed production line environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121707971A_ABST
    Figure CN121707971A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machine vision and industrial quality control, and discloses a cigarette packet surface printing defect detection method and system based on vision intelligence. The method comprises the following steps: obtaining an initial image of the surface of a cigarette packet, and adaptively adjusting optical parameters to obtain a clear image; pixel-level features are extracted, gray level conversion is carried out, and a potential defect area boundary is positioned; identifying edge distortion features and classifying font deformation types; separating a target pixel block, matching the target pixel block with a standard template, and quantifying color deviation; carrying out ambiguity evaluation on the deviation overrun region, and determining a fuzzy position; extracting the sub-image blocks and performing cross validation in combination with the classification labels to generate a comprehensive defect description vector; and generating a real-time feedback signal in the high-speed production line according to the vector, dynamically adjusting imaging parameters, and realizing continuous and accurate defect identification. The method can effectively improve the detection precision and adaptability of the cigarette packet surface printing defects, and is suitable for real-time quality control in a complex industrial environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine vision and industrial quality control technology, and in particular to a method and system for detecting printing defects on the surface of cigarette packs based on visual intelligence. Background Technology

[0002] Printing defect detection is a core application area of ​​industrial vision inspection in the packaging industry's quality control, crucial for ensuring product appearance consistency and enhancing market competitiveness. Cigarette packaging, as a typical example of consumer product packaging, directly impacts brand image and consumer trust through its surface printing quality.

[0003] In one existing technology, a traditional machine vision-based inspection method is used. A fixed combination of industrial camera and light source is used. Static camera exposure parameters and light source brightness are preset. After acquiring an image of the cigarette pack surface, a pixel-level difference operation is performed with a preset standard template. If the difference value exceeds a fixed threshold, the product is determined to be defective.

[0004] However, the parameters of existing imaging systems are usually pre-set statically, making them unsuitable for adapting to different cigarette pack materials and the complex and variable lighting environments on production lines. This results in unstable image quality, with overexposure or underexposure, directly affecting the accuracy of subsequent analysis. Furthermore, the image processing algorithms used are simple and lack robustness, exhibiting low sensitivity to complex defects such as slight color deviations, localized font distortions, and subtle pattern blurring, easily leading to false alarms or missed detections. Therefore, existing technologies still have significant shortcomings in terms of image acquisition clarity stability and accurate identification of various defects. Summary of the Invention

[0005] This invention provides a visual intelligence-based method and system for detecting printing defects on the surface of cigarette packs, addressing the significant shortcomings of existing technologies in terms of image acquisition clarity and stability, as well as the accurate identification of various defects.

[0006] In a first aspect, to solve the above-mentioned technical problems, the present invention provides a method for detecting printing defects on the surface of cigarette packs based on visual intelligence, comprising: Acquire the initial image, adjust the optical parameters, and obtain a clear image; Pixel-level features are extracted from the clearly acquired image, and grayscale conversion is performed to determine the boundary coordinates of potential defect areas. If the boundary coordinates show edge distortion features, determine whether it belongs to the font deformation type and obtain the classification label; Based on the classification labels, corresponding pixel blocks are separated from the clear acquisition image and matched with a preset standard template to obtain a quantitative score of the degree of color deviation; If the quantization score exceeds the preset quantization score threshold, then perform blur assessment on the separated pixel blocks, calculate the local variance distribution, and determine the specific location coordinates of the pattern blur. Sub-image patches are extracted from the specific location coordinates and cross-validated using the classification labels to obtain a comprehensive defect description vector. Based on the comprehensive defect description vector, a real-time feedback signal is generated in the high-speed production line environment, and the imaging system parameters are updated in real time to obtain continuously accurate identification results.

[0007] Preferably, acquiring an initial image and adjusting optical parameters to obtain a clear image includes: The surface of the cigarette pack is scanned with high precision using an imaging system to obtain the initial image. Extract the light sensitivity from the initial acquired image, calculate the optical parameter adjustment value, and obtain the optimized optical parameters; If the optical parameters meet the preset feasible range threshold of optical parameters, the imaging system parameters are adjusted to obtain the adjusted acquisition image; The adjusted acquired image is then sharpened to obtain a clear acquired image.

[0008] Preferably, the step of extracting pixel-level features from the clearly acquired image and performing grayscale conversion processing to determine the boundary coordinates of the potential defect region includes: Pixel-level features are extracted from the clearly captured image, and the gradient value of each pixel is calculated to obtain feature distribution data; Based on the feature distribution data, grayscale conversion processing is performed to address the differences in cigarette pack materials, and the grayscale value range is adjusted to obtain a standardized grayscale image. If the contrast of the standardized grayscale image meets the preset effective contrast threshold range, then the potential defect region range is obtained by segmentation. The boundary of the potential defect area is extracted and the boundary coordinates are calculated to obtain the boundary coordinates of the defect area.

[0009] Preferably, if the boundary coordinates show edge distortion characteristics, then it is determined whether it belongs to the font deformation type, and a classification label is obtained, including: If the boundary coordinates show edge distortion features, then perform a depth scan on the edge distortion area and extract the depth feature data to obtain the feature distribution result; Based on the feature distribution results, the depth feature data is analyzed and judged. If it belongs to the font deformation type, the abnormal change classification label is obtained.

[0010] Preferably, based on the classification labels, corresponding pixel blocks are separated from the clearly captured image and matched with a preset standard template to obtain a quantified score of the degree of color deviation, including: Based on the classification labels, pixel blocks in the corresponding target region are separated from the clear acquisition image to obtain target pixel block data; The target pixel block data is matched with a preset standard template to generate an initial matching result; Based on the initial matching result, the color distribution features of the target pixel block data and the preset standard template are extracted to obtain color deviation data; The color deviation data is analyzed and classified based on a preset color deviation threshold range to obtain a quantitative score of the degree of color deviation.

[0011] Preferably, if the quantization score exceeds a preset quantization score threshold, a blur assessment is performed on the separated pixel block, the local variance distribution is calculated, and the specific location coordinates of the pattern blur are determined, including: If the quantization score exceeds the preset quantization score threshold, the target pixel block data is separated to obtain the first pixel block dataset; For the first pixel block dataset, calculate the local variance distribution of the pixel blocks to obtain variance distribution data; If the variance distribution data is lower than the preset fuzzy determination variance threshold, then the spatial feature data of the first pixel block dataset is extracted and obtained. Based on the spatial feature data, the blurred areas are classified to determine the specific location coordinates of the blurred pattern.

[0012] Preferably, sub-image patches are extracted from the specific location coordinates and cross-validated using the classification labels to obtain a comprehensive defect description vector, including: Extract sub-image patches from the specific location coordinates of the blurred pattern to generate a set of sub-image patches; Texture and color features are extracted from the set of sub-image patches to generate a feature dataset; If the matching degree between the feature dataset and the classification label is lower than the preset matching degree threshold, then the consistency between the two is verified and verification result data is generated. Based on the verification result data, the feature dataset and the classification label are integrated to generate a comprehensive defect description vector.

[0013] Preferably, a real-time feedback signal is generated in a high-speed production line environment based on the comprehensive defect description vector, and the imaging system parameters are updated in real time to obtain continuously accurate identification results, including: Based on the comprehensive defect description vector, the real-time feedback signal is calculated to obtain the real-time feedback signal data. If the real-time feedback signal data deviates from the preset feedback signal stability threshold, the imaging system parameters are adjusted to determine the optimized parameter values. The image acquisition process is updated using the optimized parameter values ​​to obtain the final, consistently accurate recognition result.

[0014] Secondly, the present invention provides a visual intelligence-based system for detecting printing defects on the surface of cigarette packs, comprising: The adaptive optics imaging module acquires the initial image, adjusts the optical parameters, and obtains a clear image. The defect area localization module extracts pixel-level features from the clearly acquired image and performs grayscale conversion processing to determine the boundary coordinates of the potential defect area; The font deformation recognition module determines whether a font deformation type exists and obtains a classification label if the boundary coordinates show edge distortion features. The color deviation quantification module separates the corresponding pixel blocks from the clear acquisition image according to the classification label and matches them with a preset standard template to obtain a quantified score of the degree of color deviation. The blurred region detection module performs a blur assessment on the separated pixel blocks, calculates the local variance distribution, and determines the specific location coordinates of the blurred pattern if the quantization score exceeds a preset quantization score threshold. The defect cross-validation module extracts sub-image patches from the specific location coordinates and performs cross-validation with the classification labels to obtain a comprehensive defect description vector. The real-time feedback optimization module generates a real-time feedback signal in the high-speed production line environment based on the comprehensive defect description vector, updates the imaging system parameters in real time, and obtains continuously accurate identification results.

[0015] Thirdly, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the visual intelligence-based method for detecting printing defects on the surface of cigarette packs as described above.

[0016] Fourthly, the present invention also provides a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the visual intelligence-based cigarette pack surface printing defect detection method described above.

[0017] Compared with the prior art, the present invention has the following beneficial effects: (1) By introducing visual intelligence technology, this invention realizes the adaptive dynamic adjustment of the optical parameters of the imaging system, effectively overcomes the problem of unstable image quality caused by different cigarette pack materials and complex lighting environment of the production line, significantly improves image clarity and stability, and provides a reliable data basis for subsequent defect identification.

[0018] (2) By comprehensively utilizing various visual intelligent processing methods such as grayscale conversion, edge feature extraction, color matching, fuzzy evaluation and multi-label cross-validation, this invention achieves accurate identification and quantitative evaluation of various types of defects such as font deformation, color deviation and pattern blurring, which greatly improves the robustness and accuracy of the detection algorithm.

[0019] (3) By constructing a real-time feedback optimization mechanism based on a comprehensive defect description vector, the present invention can dynamically adjust imaging parameters in a high-speed production line environment, forming a "detection-feedback-optimization" closed-loop system, realizing continuous, efficient and accurate defect identification, and significantly improving the automation level and system adaptability of production quality control. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the process for detecting printing defects on the surface of cigarette packs based on visual intelligence, provided in the first embodiment of the present invention. Figure 2 This is a schematic diagram of the structure of the visual intelligence-based cigarette pack surface printing defect detection system provided in the second embodiment of the present invention. Detailed Implementation

[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] Reference Figure 1 The first embodiment of the present invention provides a method for detecting printing defects on the surface of cigarette packs based on visual intelligence, including the following steps: S11: Acquire the initial image, adjust the optical parameters, and obtain a clear image; S12, extract pixel-level features based on the clear acquired image, perform grayscale conversion processing to determine the boundary coordinates of the potential defect area; S13, if the boundary coordinates show edge distortion features, determine whether it belongs to the font deformation type and obtain the classification label; S14, Based on the classification label, separate the corresponding pixel blocks from the clear acquisition image and match them with a preset standard template to obtain a quantitative score of the degree of color deviation; S15, if the quantization score exceeds the preset quantization score threshold, then perform fuzziness evaluation on the separated pixel block, calculate the local variance distribution, and determine the specific location coordinates of the pattern fuzziness; S16, extract sub-image patches from the specific location coordinates, and perform cross-validation with the classification labels to obtain a comprehensive defect description vector; S17. Based on the comprehensive defect description vector, a real-time feedback signal is generated in the high-speed production line environment to update the imaging system parameters in real time and obtain continuously accurate identification results.

[0023] In step S11, an initial image is acquired, and optical parameters are adjusted to obtain a clear image, including: S1101 uses an imaging system to perform high-precision scanning of the surface of the cigarette pack to acquire an initial image; S1102, Extract the light sensitivity from the initial acquired image, calculate the optical parameter adjustment value, and obtain the optimized optical parameters; S1103, if the optical parameters meet the preset feasible range threshold of optical parameters, adjust the parameters of the imaging system and obtain the adjusted acquisition image; S1104, The adjusted acquired image is sharpened to obtain a clear acquired image.

[0024] In step S1101, the surface of the cigarette pack is scanned with high precision using an imaging system to obtain an initial image.

[0025] It should be noted that the process of acquiring an initial image by performing a high-precision scan of the cigarette pack surface using an imaging system involves the coordinated operation of a high-resolution camera and a light source. The imaging system typically employs an industrial-grade CCD or CMOS camera, combined with a uniform LED light source, to ensure that the details on the cigarette pack surface are clearly visible.

[0026] In one embodiment, when scanning barcodes or patterns on cigarette packs, the camera resolution can reach 12 megapixels, and the light source illuminance is controlled at 5000 lux to capture subtle textures. The light sensitivity of the initially acquired images reflects the influence of ambient light and the cigarette pack material on imaging, such as reflections or color deviations, and further analysis is needed to optimize the imaging effect.

[0027] In step S1102, the light sensitivity in the initial acquired image is extracted, the optical parameter adjustment value is calculated, and the optimized optical parameters are obtained.

[0028] It should be noted that when calculating the optical parameter adjustment values, the contrast threshold needs to be dynamically adjusted based on the image's grayscale histogram to adapt to different lighting conditions. The contrast threshold is a control signal used to determine whether the current image quality meets the standard and to guide how the optical parameters should be adjusted. Its establishment is primarily based on statistical analysis of a large number of standard cigarette pack sample images to obtain the distribution range of contrast indices in their grayscale histograms, establishing a baseline range for the contrast threshold, and then correcting this baseline range based on the reflective characteristics of different materials. For highly reflective materials, the expected value of the contrast threshold will increase, and vice versa.

[0029] In one embodiment, when scanning a gold cigarette pack, the metallic texture causes glare. After analyzing the image brightness distribution, based on the lower limit of acceptable image contrast obtained from statistical analysis of a large number of standard cigarette pack sample images, a contrast threshold of 0.7 is set to reduce the impact of overexposed areas. Optimized optical parameters are then generated, such as adjusting the exposure time to 1 / 1000 second and setting the gain value to 1.5 times. Such parameter adjustments ensure the preservation of image details and improve the accuracy of subsequent processing.

[0030] In step S1103, if the optical parameters meet the preset feasible range threshold of optical parameters, the imaging system is adjusted to obtain the adjusted acquisition image.

[0031] It should be noted that the feasible range threshold of optical parameters is the allowable numerical range of the core parameters of the imaging system. Its establishment should be based on statistical analysis of historical data, meet the physical limits of the hardware, ensure that the parameters can be executed by the hardware, and the parameter range must ensure that the acquired image can meet the minimum requirements for subsequent detection of image quality defects.

[0032] In one embodiment, if the optimized optical parameters meet a preset feasible range threshold, such as an exposure time between 1 / 500 and 1 / 2000 of a second, the imaging system automatically adjusts the lens aperture and shutter speed to complete the parameter adjustment and acquire the adjusted image. The aperture is then adjusted to F / 8 to increase the depth of field, and the adjusted image is acquired. This image is significantly superior to the initial image in terms of detail retention and noise control, which is helpful for subsequent detection of surface defects in the cigarette pack, such as scratches or printing deviations.

[0033] In step S1104, the adjusted acquired image is sharpened to obtain a clear acquired image.

[0034] It should be noted that the adjusted acquired image is processed by calculating the second derivative of the image's grayscale to detect areas of grayscale variation. Edge contrast is enhanced by subtracting a factor of k from the Laplacian result from the original image, thus achieving sharpening and obtaining a clear acquired image (where k is a positive coefficient used to control the sharpening intensity; when k=1, it represents the result of subtracting the Laplacian calculation from the original image). The formula for calculating the Laplacian operator used in the sharpening process is as follows:

[0035] In one embodiment, when processing barcode images, grayscale variation areas in the image are detected by calculating the second derivative of the image's grayscale. Edge contrast is enhanced by subtracting a factor of k from the original image using the Laplacian operator. This Laplacian operator strengthens the image edges, making the barcode edges more distinct, and increasing the scanning recognition rate from 90% to 98%. The clearer image significantly improves the accuracy of defect detection and reduces the false positive rate.

[0036] In step S12, pixel-level features are extracted from the clearly acquired image, and grayscale conversion is performed to determine the boundary coordinates of the potential defect region, including: S1201, Extract pixel-level features from the clear image, calculate the gradient value of each pixel, and obtain feature distribution data; S1202, Based on the feature distribution data, perform grayscale conversion processing on the differences in cigarette pack materials, adjust the grayscale value range, and obtain a standardized grayscale image; S1203, if the contrast of the standardized grayscale image meets the preset effective contrast threshold range, then the potential defect area range is obtained by dividing it. S1204, extract the boundary of the potential defect area and calculate the boundary coordinates to obtain the boundary coordinates of the defect area.

[0037] In step S1201, pixel-level features are extracted from the clear image, the gradient value of each pixel is calculated, and feature distribution data is obtained.

[0038] It should be noted that when extracting pixel-level features from the optimized, clear image, regions with significant brightness variations, such as the edges of text or patterns on a cigarette pack, are identified by calculating the gradient value of each pixel in the image. The Sobel operator is used for edge detection, calculating the gradient values ​​in the horizontal and vertical directions to generate feature distribution data.

[0039] In one embodiment, when scanning a silver cigarette pack, the Sobel operator identifies a gradient value of approximately 150 at the edge of the barcode, significantly higher than the 20 value in the background area, highlighting key features. This method effectively distinguishes the pattern on the cigarette pack surface from the background, providing reliable data for subsequent processing.

[0040] In step S1202, based on the feature distribution data, grayscale conversion processing is performed on the differences in cigarette pack materials to adjust the grayscale value range and obtain a standardized grayscale image.

[0041] It should be noted that grayscale conversion is performed based on feature distribution data, and the grayscale value range is adjusted to account for differences in cigarette pack materials. When processing cigarette packs with a glossy coating, grayscale conversion can reduce the overexposure of highlight areas and ensure balanced image details.

[0042] In one embodiment, for paper cigarette packs and metallic cigarette packs, the grayscale value range of paper cigarette packs is wider and needs to be compressed to 50-200 to reduce noise; the grayscale value of metallic cigarette packs is highly reflective and needs to be expanded to 30-220 to preserve details. The standardized grayscale image generated after adjustment can unify the imaging effect of different materials.

[0043] In step S1203, if the contrast of the standardized grayscale image meets the preset effective contrast threshold range, then the potential defect area range is obtained by segmentation.

[0044] It should be noted that the effective contrast threshold range is a pre-defined numerical range used to determine whether a standardized grayscale image has sufficient and appropriate contrast. It is typically established based on statistical analysis of historical data and meets the theoretical foundations of image processing, the specific characteristics of hot-stamped cigarette packs, and the practical needs of industrial inspection. Using Michelson contrast as the metric, based on a large number of cigarette pack sample images, the Michelson contrast of qualified images is concentrated between 0.6 and 0.9, which is set as the effective contrast threshold range. If the contrast of the standardized grayscale image meets the pre-defined effective contrast threshold range, the image is divided into multiple regions based on the differences in grayscale values ​​to identify areas that may have scratches or printing deviations. The formula for calculating Michelson contrast is as follows.

[0045] in, Michelson contrast; These are the maximum and minimum gray values ​​in the image, respectively.

[0046] In one embodiment, when scanning a cigarette pack with a gold foil pattern, the Michelson contrast value of its standardized grayscale image is calculated to be 0.7, which falls within the effective contrast threshold range of 0.6-0.9, indicating that the image contrast is acceptable. Subsequently, based on the difference in grayscale values, the pattern area is separated from the background, and an abnormal grayscale area of ​​approximately 2 square millimeters is detected, suspected to be a printing defect. This segmentation method can quickly locate the problem area and improve detection efficiency.

[0047] It should be noted that the effective contrast threshold range is used to determine whether the standardized grayscale image has appropriate contrast. Given that Michelson contrast is sensitive to extreme points, this step actually uses the standard deviation of the grayscale values ​​of all pixels in the image as the contrast measure; based on a large number of cigarette pack sample images, the standard deviation of qualified images is concentrated in the range of 15-25 (in the grayscale range of 0-255), so the effective contrast threshold range is set to [15, 25].

[0048] In step S1204, the boundary of the potential defect area is extracted and the boundary coordinates are calculated to obtain the boundary coordinates of the defect area.

[0049] It should be noted that the boundary extraction and boundary coordinate calculation of the potential defect area range are performed using the Moore neighborhood tracing algorithm. The algorithm scans the binarized image to locate the starting boundary point of the defect area; then it searches for its neighboring pixels in a predetermined direction (such as clockwise), determines the adjacent pixels with changing gray values ​​as the next boundary point, and iterates this process until it backtracks to the starting point to form a closed contour. Finally, it outputs a sequence of ordered boundary point coordinates, thereby accurately describing the shape of the defect area.

[0050] In one embodiment, for the detected scratch area, boundary points are extracted based on gradient value changes to generate a precise coordinate sequence, such as [(100,150), (101,151), ..., (120,160)]. When processing cigarette packs with complex patterns, the defect outline can be accurately delineated by combining the region segmentation results. After detecting a 0.5 mm wide scratch, the algorithm outputs boundary coordinate data, clearly marking the defect location. This method ensures the precise location of the defect area, facilitating subsequent analysis and processing.

[0051] In step S13, if the boundary coordinates show edge distortion features, it is determined whether they belong to the font deformation type, and a classification label is obtained, including: S1301, if the boundary coordinates show edge distortion features, then perform a depth scan on the edge distortion area and extract depth feature data to obtain the feature distribution result. S1302, Based on the feature distribution results, the depth feature data is analyzed and judged. If it belongs to the font deformation type, the abnormal change classification label is obtained.

[0052] In step S1301, if the boundary coordinates show edge distortion features, then a depth scan is performed on the edge distortion area and depth feature data is extracted to obtain the feature distribution result.

[0053] It should be noted that Gaussian filtering is used to remove noise, and then gradient values ​​are calculated to extract edge features for pixel-level analysis. For areas with edge distortion, a pre-trained convolutional neural network specifically designed for cigarette pack defect identification is used for deep feature scanning to extract more complex deep feature data. The convolutional neural network adopts a lightweight ResNet-18 architecture, and its input is a standardized region image, such as 64x64 pixels.

[0054] In one implementation, the training process involves publicly collecting a dataset of 10,000 cigarette pack surface images, covering normal products and various typical defects such as font distortion, scratches, and dirt. The images are labeled according to industry standards (such as the "Cigarette Pack Printing Quality Inspection Standard"), and a labeling consistency evaluation method such as the Kappa coefficient is used to ensure labeling quality. The dataset is randomly divided into training, validation, and test sets in a 7:2:1 ratio. Transfer learning is performed using ResNet-18 weights pre-trained on the ImageNet dataset. The training hyperparameters are set as follows: batch size of 32, initial learning rate of 1e-4, using the Adam optimizer, and setting... The loss function is cross-entropy loss. During training, the network is monitored on the validation set. If the validation set loss does not decrease for 10 consecutive epochs, the learning rate is halved; if it does not decrease for 20 consecutive epochs, training is terminated early. The maximum number of training epochs is set to 100. After training, a 64x64 pixel image patch to be detected is input into the network, and the output of the network layers before the final fully connected layer is extracted as a high-dimensional feature vector. This vector represents the depth feature distribution of that region.

[0055] In one embodiment, when scanning the barcode on a cigarette pack, the gradient value at the edge of the barcode is identified as approximately 160, while the gradient value in the background area is only 30, generating clear edge feature data. If edge distortion is detected, such as blurred or broken barcode lines, the algorithm outputs boundary coordinates, such as (50, 100) to (70, 110), marking potential defect areas. When processing cigarette packs with gold-stamped text, the network identifies depth features of the text edges, such as variations in line thickness or breaks, generating feature distribution results to quantify the degree of distortion in the text area. For example, a feature value decreasing from 0.9 for normal text to 0.6 indicates a potential defect.

[0056] In step S1302, the depth feature data is analyzed and judged based on the feature distribution results. If it belongs to the font deformation type, the classification label of abnormal change is obtained.

[0057] It should be noted that, based on the feature distribution results, a Support Vector Machine (SVM) classification algorithm is employed. By analyzing deep feature data, font deformation is distinguished from other defect types to determine the defect type. The SVM classifier uses a radial basis function kernel function and is trained based on the feature vectors of historical defect samples. The hyperparameters are determined through grid search. The input is the N-dimensional feature vector, which is obtained by training on a large number of labeled cigarette pack defect samples, including font deformation, scratches, and dirt. Platt scaling is used to convert the SVM decision values ​​into probabilities for each defect type. Finally, the type with the highest probability is used as the classification label for that defect.

[0058] In one embodiment, for cigarette packs with gold-stamped lettering, the feature distribution results are input into an SVM classifier. After calculation, the classifier outputs a probability of 0.92 for the vector belonging to "font deformation," 0.05 for "scratches," and probabilities of belonging to other types all below 0.03. Therefore, the algorithm ultimately outputs a "font deformation" classification label. This result is based on the overall distribution pattern of the feature vectors, which is more accurate and reliable than judging based on a single feature value.

[0059] In step S14, based on the classification label, corresponding pixel blocks are separated from the clear acquisition image and matched with a preset standard template to obtain a quantified score of the color deviation degree, including: S1401, Based on the classification label, separate the pixel blocks in the corresponding target area from the clear acquisition image to obtain target pixel block data; S1402, Match the target pixel block data with a preset standard template to generate an initial matching result; S1403, Based on the initial matching result, extract the color distribution features of the target pixel block data and the preset standard template to obtain color deviation data; S1404, The color deviation data is analyzed and classified based on a preset color deviation threshold range to obtain a quantitative score of the degree of color deviation.

[0060] In step S1401, according to the classification label, the pixel blocks in the corresponding target area are separated from the clear acquisition image to obtain target pixel block data.

[0061] It should be noted that in the defect detection scenario of cigarette pack images, based on the precise location information of defects in the classification labels, the target area corresponding to the classification labels is obtained from the clear acquisition image. By analyzing the gray value differences of pixel distribution in the image, the target area is distinguished from other areas, and target pixel block data is generated.

[0062] In one embodiment, the grayscale histogram of the printed text area on the cigarette pack exhibits a typical bimodal distribution: the peak grayscale value of the text area is approximately 100, while the peak grayscale value of the background area is approximately 35. Based on this distribution, a global fixed threshold of 100 is automatically calculated using the maximum inter-class variance method. Pixels with grayscale values ​​greater than or equal to 100 are classified as text areas, thereby separating the pixel blocks in this area from the background and forming independent binary pixel block data. This method effectively isolates the target area, ensuring the accuracy of subsequent analysis. The global fixed threshold is a critical value used for image segmentation, and its establishment is mainly based on statistical analysis of the image's grayscale distribution and specific application requirements.

[0063] In step S1402, the target pixel block data is matched with a preset standard template to generate an initial matching result.

[0064] It should be noted that the preset standard template is the average image of a defect-free sample or an ideal image generated from the design drawing. For the target pixel block data, the standard template is traversed within the corresponding region of the target pixel block data. At each position, the similarity between the template and the image sub-window is calculated, for example using the Normalized Cross-Correlation Coefficient (NCC). After finding the position with the highest similarity, this maximum similarity value is compared with a preset similarity threshold. If it is higher than the similarity threshold, an initial matching result is generated; otherwise, the matching fails.

[0065] The similarity threshold is a critical similarity value used for binary classification decisions. Its setting is determined through ROC curve analysis. This involves collecting a representative dataset containing known qualified and defective samples; then calculating the NCC values ​​of all samples and their corresponding standard templates, and plotting histograms of the distribution of NCC values ​​for qualified and defective samples respectively; next, using different NCC values ​​as candidate thresholds, calculating the true positive rate and false positive rate corresponding to each candidate threshold; finally, plotting ROC curves, and selecting the candidate threshold closest to the upper left corner of the curve (i.e., the highest true positive rate and lowest false positive rate) as the final similarity threshold.

[0066] In one embodiment, the ROC curve analysis method described above was applied to collect 1000 qualified cigarette pack samples and 200 typical defective samples, and their NCC value distribution was calculated. Analysis revealed that when the similarity threshold was set to 0.90, the true positive rate reached 98%, while the false positive rate was controlled below 5%, achieving good differentiation. When processing brand logos on cigarette packs, the preset standard template was an ideal image of the brand logo. The calculated NCC value for the optimal matching position was 0.94, higher than the preset similarity threshold of 0.90, therefore the initial matching result was successful. This method can effectively overcome minor positional shifts and uniform illumination changes, achieving robust image region comparison.

[0067] In step S1403, based on the initial matching result, the color distribution features of the target pixel block data and the preset standard template are extracted to obtain color deviation data.

[0068] It should be noted that, based on the initial matching results, the RGB image is converted to the HSV color space, and the color distribution features of the pixel blocks and the standard template are extracted to better analyze the distribution differences of hue, saturation and brightness, and obtain color deviation data.

[0069] In one embodiment, for the colored patterns on cigarette packs, the hue values ​​of a preset standard template are concentrated between 30 and 40 degrees, while the hue values ​​of the acquired images may shift to 35-45 degrees due to printing deviations. After conversion, the hue deviation is calculated to be 5 degrees, generating color deviation data. This method can more accurately quantify color differences and is suitable for handling complex patterns or color variations on cigarette packs.

[0070] In step S1404, the color deviation data is analyzed and classified based on a preset color deviation threshold range to obtain a quantitative score of the degree of color deviation.

[0071] It should be noted that the color deviation threshold range is a pre-defined numerical range for the amount of color deviation. It is used to map continuously and objectively measured color deviation data to discrete, meaningful quality levels, primarily based on the limits of human visual perception and product quality requirements. By comparing the color deviation data with the pre-defined color deviation threshold range, its deviation level (e.g., slight, moderate, severe) is directly determined and mapped to the corresponding quantified score.

[0072] In one embodiment, for the hot-stamped area on the cigarette pack, the HSV color space is used to determine the hue deviation, setting the hue deviation threshold range as follows: [0, 5] degrees is "slight", (5, 10] degrees is "moderate", and >10 degrees is "severe". The corresponding quantization scores are 0.3, 0.6, and 0.9, respectively. If a hue deviation of 3 degrees is detected, it is classified as "slight deviation" with a quantization score of 0.3; if the deviation is 8 degrees, it is classified as "moderate deviation" with a quantization score of 0.6. This rule-based method can clearly and efficiently distinguish the degree of deviation.

[0073] In step S15, if the quantization score exceeds a preset quantization score threshold, a blur assessment is performed on the separated pixel block, the local variance distribution is calculated, and the specific location coordinates of the pattern blur are determined, including: S1501, If ​​the quantization score exceeds the preset quantization score threshold, the target pixel block data is separated to obtain the first pixel block dataset; S1502, For the first pixel block dataset, calculate the local variance distribution of the pixel blocks to obtain variance distribution data; S1503, if the variance distribution data is lower than the preset fuzzy determination variance threshold, then the spatial feature data of the first pixel block dataset is extracted and obtained. S1504, classify the blurred areas according to the spatial feature data, and determine the specific location coordinates of the blurred pattern.

[0074] In step S1501, if the quantization score exceeds a preset quantization score threshold, the target pixel block data is separated to obtain the first pixel block dataset.

[0075] It should be noted that the preset quantization score threshold is an independently set value used to determine whether the severity of color deviation has reached the level requiring pixel-level fine analysis. This threshold is set by collecting a batch of confirmed qualified cigarette pack images, for example, 200 defect-free samples extracted from a stable production line. For each qualified image in the sample library, the color deviation quantization score is calculated for key areas requiring inspection, such as barcodes, logos, and color blocks. The average μ and standard deviation σ of the quantization scores of all qualified samples are then calculated, and the quantization score threshold is calculated based on this. The calculation formula is as follows. S

[0076] Where S represents the quantification threshold score, and n=3 is chosen based on the "3σ criterion" in statistics.

[0077] In one embodiment, 150 manually verified qualified cigarette pack images were collected, and color deviation quantization scores were calculated for their barcode areas. Statistically, the average score μ of these qualified samples was close to 0 (e.g., 0.05), and the standard deviation σ was 0.03. For ease of processing, a quantization score threshold of 0.14 was calculated. This threshold is much lower than the "slight deviation" score of 0.3, ensuring that the vast majority of qualified products can be distinguished from defective products. For the barcode area on the cigarette pack, when the color deviation quantization score of this area exceeds the quantization score threshold, for example, 0.14, it indicates that there is a significant defect in this area, requiring further analysis. In this case, the image is first preprocessed with grayscale conversion and Gaussian filtering to reduce noise. Then, using the Canny edge detection algorithm, the overall grayscale threshold of the image is calculated. The high threshold is set to 1.5 times the Otsu threshold, and the low threshold is set to half the high threshold, distinguishing the barcode area from the background. If the edge contrast of the barcode area is high, edge detection technology is used to identify the barcode boundary, and morphological closing operations are used to connect discontinuous edge points, thereby forming continuous and complete first pixel block data. This method can accurately separate the target area, providing a reliable foundation for subsequent analysis.

[0078] In step S1502, for the first pixel block dataset, the local variance distribution of the pixel blocks is calculated to obtain variance distribution data.

[0079] It should be noted that, for the first pixel block data, a sliding window is used to traverse each pixel within the pixel block, calculating the variance of the grayscale values ​​of all pixels within its neighboring window (e.g., 3×3 or 5×5 pixels). This variance reflects the local texture uniformity or fluctuation of the image. The local variance distribution of the pixel block is then obtained, generating variance distribution data.

[0080] In one embodiment, for the first pixel block data of the barcode region separated from the cigarette pack image, local variance is calculated using a 3×3 window, and the local variance value is divided by 255. After normalization to the [0,1] range, the local variance values ​​of the barcode region are generally high, typically exceeding 0.8, while the variance values ​​of the background region are low, typically around 0.2. This indicates that the barcode region has obvious texture features, generating variance distribution data. This method can effectively distinguish regions with complex textures, providing a basis for subsequent feature extraction.

[0081] In step S1503, if the variance distribution data is lower than the preset fuzzy determination variance threshold, then the spatial feature data of the first pixel block dataset is extracted and obtained.

[0082] It should be noted that the preset fuzziness determination variance threshold is a critical value used to determine whether a region has sufficient texture detail for effective fuzz analysis. This is achieved by collecting a representative sample set of 300 known clear cigarette pack images, calculating the mean local variance of key regions such as logos and patterns, and taking the smaller of all means or the 5th percentile as the lower limit of the fuzziness determination variance threshold, such as 0.4. If the variance distribution data is lower than the preset fuzziness determination variance threshold, the frequency distribution in the spatial features of the first pixel block data is analyzed using Fourier transform to extract high-frequency and low-frequency features, obtaining spatial feature data. Specifically, the Fourier spectrum is divided, and components with frequencies higher than a set cutoff frequency (e.g., 1 / 4 of the Nyquist frequency corresponding to the image size) are defined as high-frequency components.

[0083] In one embodiment, for the printed pattern area on the cigarette pack, a blur determination variance threshold of 0.4 is calculated based on the lower limit of the mean in the statistical analysis of historical data samples. If the variance value is lower than the preset blur determination variance threshold of 0.4, it indicates that the texture of the area is relatively smooth and may be blurry. Next, a two-dimensional Fourier transform is performed on the pixel block of the area to obtain a spectrum. The spectrum is divided into high-frequency and low-frequency regions, and the percentage of high-frequency energy in the total energy is calculated as the high-frequency component ratio. By acquiring 100 sets of clear / blurry cigarette pack images, and statistically analyzing the local variance and high-frequency energy ratio, it is determined that clear, fine pattern areas, due to their sharp edges, typically have a higher high-frequency component ratio, for example, 30%; while if the area is blurry, high-frequency information will be lost, and the high-frequency component ratio will significantly decrease, for example, to 15%. By extracting this type of spatial feature data, the degree of image blur can be quantitatively evaluated.

[0084] In step S1504, the blurred regions are classified according to the spatial feature data to determine the specific location coordinates of the blurred pattern.

[0085] It should be noted that a Support Vector Machine (SVM) classifier based on radial basis function kernel function is used for blurry / sharp classification based on spatial feature data. This SVM classifier needs to be trained before use: a large number of cigarette pack pattern samples with known sharp and blurry states are collected, and their spatial feature data, such as the proportion of high-frequency components and low-frequency energy, are extracted to form a training set. The SVM model is then trained to obtain the optimal classification hyperplane. The determination of the position coordinates relies on the premise that, when separating the first pixel block data, the position information of this data block in the original image is recorded simultaneously, such as the coordinates of the top-left corner and the width and height of the smallest bounding rectangle.

[0086] In one embodiment, for the brand logo area on the cigarette pack, the spatial feature data shows that the high-frequency component accounts for 15%. This feature vector is input into a trained SVM model, which classifies it as "fuzzy" based on the learned decision boundary. Subsequently, the system retrieves the location metadata recorded when separating this area, calculates the center point coordinates (200, 300) of the area, and outputs them. This method can accurately locate fuzzy areas, providing an accurate basis for subsequent defect processing.

[0087] In step S16, sub-image patches are extracted from the specific location coordinates and cross-validated using the classification labels to obtain a comprehensive defect description vector, including: S1601, extract sub-image blocks from the specific location coordinates of the blurred pattern, and generate a set of sub-image blocks; S1602, Extract texture and color features from the sub-image block set to generate a feature dataset; S1603, if the matching degree between the feature dataset and the classification label is lower than the preset matching degree threshold, then verify the consistency between the two and generate verification result data. S1604, Based on the verification result data, integrate the feature dataset and the classification label to generate a comprehensive defect description vector.

[0088] In step S1601, sub-image blocks are extracted from the specific location coordinates of the blurred pattern to generate a set of sub-image blocks.

[0089] In one embodiment, for the barcode area on the cigarette pack, the specific coordinates of the blurred pattern are the center point (200, 300). By analyzing the grayscale gradient and edge features around this coordinate, a sub-image patch centered on this point is extracted, with a size of 50x50 pixels. These sub-image patches form a set of sub-image patches, providing a basis for subsequent feature extraction.

[0090] In step S1602, texture and color features are extracted from the set of sub-image blocks to generate a feature dataset.

[0091] In one embodiment, the Gray-Level Co-occurrence Matrix (GLCM) method is used to extract texture and color features from the sub-image patch set. First, the sub-image patches are converted to grayscale images. Then, the calculation parameters of GLCM are set, such as pixel-to-pixel distance d=1 and angle θ=0°, to calculate the contrast and correlation features of the sub-image patches. For example, after calculation and normalization on an 8-bit grayscale image (value range 0-255), the contrast value of the sub-image patch in the barcode area is approximately 0.7. Color features are extracted by calculating the histogram statistics of each channel in the RGB color space, such as the mean of the red channel. The mean of the red channel is 120, falling within the range of 0-255. This method can capture the texture complexity and color distribution of the sub-image patches, forming a feature dataset containing vectors of contrast, correlation, and color mean.

[0092] In step S1603, if the matching degree between the feature dataset and the classification label is lower than the preset matching degree threshold, the consistency between the two is verified and verification result data is generated.

[0093] It should be noted that the matching threshold is a critical value used to determine whether the extracted features are sufficient to support their classification labels. It is typically set as a similarity score between 0 and 1, such as 0.6. This threshold value is mainly based on statistical analysis of a large number of correct samples to determine the feature values ​​of each category, such as "barcode" or "logo." For example, contrast usually falls within a stable range. The matching threshold defines the lower limit of this range; if it is lower than this limit, the current sample is considered to have abnormal features, possibly indicating incorrect labeling or defects. The 95th percentile of the matching degree of qualified samples is calculated based on historical data. Specifically, feature analysis is performed on 500 known qualified cigarette pack samples, and after calculating their matching degree distribution, a matching threshold of 0.6 is set. If the matching degree between the feature dataset and the previous classification labels is lower than the preset matching threshold of 0.6, the consistency between the feature dataset and the classification labels is verified by calculating the normalized Euclidean distance. The matching degree can be defined as 1 minus the normalized Euclidean distance, generating verification result data. The formula for calculating the Euclidean distance between each feature vector in the feature dataset and the classification label is as follows:

[0094] Where d represents the normalized Euclidean distance between the feature dataset and the classification label, used for subsequent matching degree calculation. n represents the total number of feature categories used to judge the reasonableness of the classification label, and i represents the index of all features traversed. This represents the contrast value of the i-th feature actually extracted from the sample to be tested. This indicates the expected contrast of the category labels.

[0095] In one embodiment, for a sub-image patch labeled "barcode," the actual extracted contrast value is 0.7, while the expected contrast value obtained from the trained "barcode" category model is 0.9. The normalized Euclidean distance between the two is calculated to be 0.2, resulting in a matching degree of 1 - 0.2 = 0.8. Since 0.8 is greater than 0.6, they are considered to be consistent. Conversely, if the actual contrast is 0.5, the matching degree might only be 0.4, below the threshold of 0.6, and the system will generate a "label mismatch" verification result. This method can effectively identify biases in the feature dataset, providing a reliable basis for subsequent data cleaning or model retraining.

[0096] In step S1604, based on the verification result data, the feature dataset and the classification label are integrated to generate a comprehensive defect description vector.

[0097] It should be noted that, based on the verification result data, the confidence scores of texture features, color features, and classification labels are integrated into a multi-dimensional vector through weighted fusion to generate a comprehensive defect description vector.

[0098] In one embodiment, the sub-image patch features of the barcode region include a contrast of 0.7, a red mean of 120, and a classification label confidence of 0.4. The vector generation method weights these features, with the weights determined based on a grid search. The default values ​​are 0.6 for texture features and 0.4 for color features, generating a comprehensive defect description vector that includes texture, color, and defect category. This vector comprehensively describes the defect characteristics, providing support for subsequent defect localization and processing.

[0099] In step S17, a real-time feedback signal is generated in the high-speed production line environment based on the comprehensive defect description vector, and the imaging system parameters are updated in real time to obtain continuously accurate identification results, including: S1701, Calculate the real-time feedback signal based on the comprehensive defect description vector to obtain real-time feedback signal data; S1702, if the real-time feedback signal data deviates from the preset feedback signal stability threshold, then adjust the imaging system parameters and determine the optimized parameter values; S1703, the image acquisition process is updated using the optimized parameter values ​​to obtain the final, continuously accurate recognition result.

[0100] In step S1701, the real-time feedback signal is calculated based on the comprehensive defect description vector to obtain real-time feedback signal data.

[0101] It should be noted that the comprehensive defect description vector is generated through a feature fusion method, integrating texture and color features into a multi-dimensional vector. Based on this multi-dimensional vector, a real-time feedback signal value reflecting the overall severity of the defect is calculated through weighted summation.

[0102] In one embodiment, feature normalization is first performed to unify features with different dimensions, such as texture uniformity (0.8) and hue mean (150), into the [0,1] interval. Then, weighted summation is used as a fusion method to assign weights to the normalized features, such as a texture feature weight of 0.6 and a color feature weight of 0.4, resulting in a comprehensive signal value of 0.75. This signal value is compared with a preset defect alarm threshold, such as 0.8. If the signal value exceeds the defect alarm threshold, it indicates the presence of a defect, and the real-time feedback signal data can be used to trigger subsequent adjustments. The defect alarm threshold is a pre-set critical signal value used to determine whether a product has a defect. It is typically established by testing a large number of known qualified and unqualified samples and statistically determining the upper limit of the signal value for qualified samples, for example, by taking the 95th percentile of the distribution of qualified sample signal values.

[0103] In step S1702, if the real-time feedback signal data deviates from the preset feedback signal stabilization threshold, the imaging system parameters are adjusted to determine the optimized parameter values.

[0104] It should be noted that the feedback signal stabilization threshold is a preset ideal signal value range, such as [0.75, 0.85], or a target value, such as 0.8. This represents the feedback signal level corresponding to the optimal image quality achieved under the current imaging system parameters. Its establishment is primarily based on the initial system calibration phase, where a standard template is used for imaging, parameters are adjusted to achieve optimal image quality (e.g., sharpness, contrast), and the calculated feedback signal value is recorded and set as the target threshold or the median of the range. If the real-time feedback signal data deviates from the preset feedback signal stabilization threshold, a PID control algorithm is used to dynamically adjust the imaging system parameters, such as exposure time or lens focal length, to optimize image quality. The PID parameters are tuned based on the Ziegler-Nichols method, with a proportional gain Kp = 0.8, an integral time Ti = 0.1s, and a derivative time Td = 0.05s. The adjusted imaging system parameters are applied to re-acquire an image of the current detection target, and the real-time feedback signal data is recalculated. If stable, the next step is performed; otherwise, the parameters are adjusted again until the feedback signal stabilizes or the maximum number of adjustment iterations is reached.

[0105] In one embodiment, when the real-time feedback signal value of 0.75 is lower than a preset feedback signal stabilization threshold of 0.8, it indicates that the image quality is not optimal, such as the image being too dark or lacking contrast. Based on the negative deviation of the signal value from the feedback signal stabilization threshold, the exposure time is dynamically increased by 10 milliseconds to improve image brightness and signal-to-noise ratio, thereby generating optimized parameter values. This adjustment can enhance image sharpness and reduce the interference of blur on defect detection.

[0106] In step S1703, the image acquisition process is updated using the optimized parameter values ​​to obtain the final, continuously accurate recognition result.

[0107] It should be noted that by updating the image acquisition process with optimized parameter values, the imaging system can re-acquire images of the cigarette pack, obtaining more accurate image data. The defect feature values ​​calculated in this round of identification, such as texture uniformity, tonal average, and the final defect classification conclusion, such as "qualified" or "unqualified," together constitute the continuously accurate identification result.

[0108] In one embodiment, the image is reacquired using an adjusted exposure time. In the new image, the texture uniformity of the barcode area improves from 0.75 to 0.85, and the hue mean stabilizes at 148. These improved feature values ​​are input into the classifier, resulting in a higher confidence level for a "pass" rating, leading to consistently accurate identification results. This method, through dynamic optimization, ensures that the production line can continuously and efficiently detect defects in cigarette packs.

[0109] It should be noted that the real-time feedback optimization of the present invention is a dynamic iterative process. When the imaging parameters are adjusted, the system will automatically re-execute the entire process from image acquisition (S11) to defect identification (S16), forming a closed-loop control of detection-feedback-optimization, ensuring that the optimal detection accuracy is maintained continuously in a high-speed production line environment.

[0110] In summary, this invention discloses a visual intelligence-based method for detecting printing defects on the surface of cigarette packs. The method includes acquiring an initial image of the cigarette pack surface and adaptively adjusting optical parameters to obtain a clear image; extracting pixel-level features and performing grayscale conversion to locate the boundaries of potential defect areas; identifying edge distortion features and classifying font deformation types; separating target pixel blocks and matching them with a standard template to quantify color deviation; evaluating the blurriness of areas exceeding deviation limits to determine the blur location; extracting sub-image blocks and performing cross-validation with classification labels to generate a comprehensive defect description vector; and generating a real-time feedback signal based on this vector in a high-speed production line to dynamically adjust imaging parameters and achieve continuous and accurate defect identification. This invention combines multiple visual processing techniques such as grayscale conversion, edge analysis, color matching, and blur assessment to achieve accurate identification of various defects, including font deformation, color deviation, and pattern blur. This invention is applicable to automated quality inspection scenarios in the tobacco packaging industry and has significant application value and promising prospects for wider adoption.

[0111] Reference Figure 2 The second embodiment of the present invention provides a visual intelligence-based system for detecting printing defects on the surface of cigarette packs, comprising: The adaptive optics imaging module acquires the initial image, adjusts the optical parameters, and obtains a clear image. The defect area localization module extracts pixel-level features from the clearly acquired image and performs grayscale conversion processing to determine the boundary coordinates of the potential defect area; The font deformation recognition module determines whether a font deformation type exists and obtains a classification label if the boundary coordinates show edge distortion features. The color deviation quantification module separates the corresponding pixel blocks from the clear acquisition image according to the classification label and matches them with a preset standard template to obtain a quantified score of the degree of color deviation. The blurred region detection module performs a blur assessment on the separated pixel blocks, calculates the local variance distribution, and determines the specific location coordinates of the blurred pattern if the quantization score exceeds a preset quantization score threshold. The defect cross-validation module extracts sub-image patches from the specific location coordinates and performs cross-validation with the classification labels to obtain a comprehensive defect description vector. The real-time feedback optimization module generates a real-time feedback signal in the high-speed production line environment based on the comprehensive defect description vector, updates the imaging system parameters in real time, and obtains continuously accurate identification results.

[0112] It should be noted that the visual intelligence-based cigarette pack surface printing defect detection system provided in this embodiment of the invention is used to execute all the process steps of the visual intelligence-based cigarette pack surface printing defect detection method in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.

[0113] This invention also provides an electronic device. The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a vision-based intelligent method for detecting printing defects on the surface of cigarette packs. When the processor executes the computer program, it implements the steps described in the various vision-based intelligent methods for detecting printing defects on the surface of cigarette packs, for example... Figure 1 The step S11 shown. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the above system embodiments, such as the fuzzy region detection module.

[0114] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.

[0115] The electronic device may be a desktop computer, laptop, handheld computer, or smart tablet, etc. The electronic device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. It may include more or fewer components than described above, or combine certain components, or different components. For example, the electronic device may also include input / output devices, network access devices, buses, etc.

[0116] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the electronic device, connecting all parts of the electronic device via various interfaces and lines.

[0117] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0118] Wherein, if the modules / units integrated in the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0119] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0120] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A method for detecting printing defects on the surface of cigarette packs based on visual intelligence, characterized in that, include: Acquire the initial image, adjust the optical parameters, and obtain a clear image; Pixel-level features are extracted from the clearly acquired image, and grayscale conversion is performed to determine the boundary coordinates of potential defect areas. If the boundary coordinates show edge distortion features, determine whether it belongs to the font deformation type and obtain the classification label; Based on the classification labels, corresponding pixel blocks are separated from the clear acquisition image and matched with a preset standard template to obtain a quantitative score of the degree of color deviation; If the quantization score exceeds the preset quantization score threshold, then perform blur assessment on the separated pixel blocks, calculate the local variance distribution, and determine the specific location coordinates of the pattern blur. Sub-image patches are extracted from the specific location coordinates and cross-validated using the classification labels to obtain a comprehensive defect description vector. Based on the comprehensive defect description vector, a real-time feedback signal is generated in the high-speed production line environment, and the imaging system parameters are updated in real time to obtain continuously accurate identification results.

2. The method for detecting printing defects on the surface of cigarette packs based on visual intelligence according to claim 1, characterized in that, Acquire the initial image, adjust the optical parameters, and obtain a clear image, including: The surface of the cigarette pack is scanned with high precision using an imaging system to obtain the initial image. Extract the light sensitivity from the initial acquired image, calculate the optical parameter adjustment value, and obtain the optimized optical parameters; If the optical parameters meet the preset feasible range threshold of optical parameters, the imaging system parameters are adjusted to obtain the adjusted acquisition image; The adjusted acquired image is then sharpened to obtain a clear acquired image.

3. The method for detecting printing defects on the surface of cigarette packs based on visual intelligence according to claim 1, characterized in that, Based on the clearly acquired image, pixel-level features are extracted, and grayscale conversion processing is performed to determine the boundary coordinates of potential defect areas, including: Pixel-level features are extracted from the clearly captured image, and the gradient value of each pixel is calculated to obtain feature distribution data; Based on the feature distribution data, grayscale conversion processing is performed to address the differences in cigarette pack materials, and the grayscale value range is adjusted to obtain a standardized grayscale image. If the contrast of the standardized grayscale image meets the preset effective contrast threshold range, then the potential defect region range is obtained by segmentation. The boundary of the potential defect area is extracted and the boundary coordinates are calculated to obtain the boundary coordinates of the defect area.

4. The method for detecting printing defects on the surface of cigarette packs based on visual intelligence according to claim 1, characterized in that, If the boundary coordinates show edge distortion features, then determine whether it belongs to the font deformation type and obtain a classification label, including: If the boundary coordinates show edge distortion features, then perform a depth scan on the edge distortion area and extract the depth feature data to obtain the feature distribution result; Based on the feature distribution results, the depth feature data is analyzed and judged. If it belongs to the font deformation type, the abnormal change classification label is obtained.

5. The method for detecting printing defects on the surface of cigarette packs based on visual intelligence according to claim 1, characterized in that, Based on the classification labels, corresponding pixel blocks are separated from the clearly captured image and matched with a preset standard template to obtain a quantitative score of the degree of color deviation, including: Based on the classification labels, pixel blocks in the corresponding target region are separated from the clear acquisition image to obtain target pixel block data; The target pixel block data is matched with a preset standard template to generate an initial matching result; Based on the initial matching result, the color distribution features of the target pixel block data and the preset standard template are extracted to obtain color deviation data; The color deviation data is analyzed and classified based on a preset color deviation threshold range to obtain a quantitative score of the degree of color deviation.

6. The method for detecting printing defects on the surface of cigarette packs based on visual intelligence according to claim 5, characterized in that, If the quantization score exceeds a preset quantization score threshold, a blur assessment is performed on the separated pixel block, the local variance distribution is calculated, and the specific location coordinates of the pattern blur are determined, including: If the quantization score exceeds the preset quantization score threshold, the target pixel block data is separated to obtain the first pixel block dataset; For the first pixel block dataset, calculate the local variance distribution of the pixel blocks to obtain variance distribution data; If the variance distribution data is lower than the preset fuzzy determination variance threshold, then the spatial feature data of the first pixel block dataset is extracted and obtained. Based on the spatial feature data, the blurred areas are classified to determine the specific location coordinates of the blurred pattern.

7. The method for detecting printing defects on the surface of cigarette packs based on visual intelligence according to claim 1, characterized in that, Sub-image patches are extracted from the specific location coordinates and cross-validated using the classification labels to obtain a comprehensive defect description vector, including: Extract sub-image patches from the specific location coordinates of the blurred pattern to generate a set of sub-image patches; Texture and color features are extracted from the set of sub-image patches to generate a feature dataset; If the matching degree between the feature dataset and the classification label is lower than the preset matching degree threshold, then the consistency between the two is verified and verification result data is generated. Based on the verification result data, the feature dataset and the classification label are integrated to generate a comprehensive defect description vector.

8. The method for detecting printing defects on the surface of cigarette packs based on visual intelligence according to claim 1, characterized in that, Based on the comprehensive defect description vector, a real-time feedback signal is generated in a high-speed production line environment to update the imaging system parameters in real time, thereby obtaining continuously accurate identification results, including: Based on the comprehensive defect description vector, the real-time feedback signal is calculated to obtain the real-time feedback signal data. If the real-time feedback signal data deviates from the preset feedback signal stability threshold, the imaging system parameters are adjusted to determine the optimized parameter values. The image acquisition process is updated using the optimized parameter values ​​to obtain the final, consistently accurate recognition result.

9. A visual intelligence-based system for detecting printing defects on the surface of cigarette packs, characterized in that, include: The adaptive optics imaging module acquires the initial image, adjusts the optical parameters, and obtains a clear image. The defect area localization module extracts pixel-level features from the clearly acquired image and performs grayscale conversion processing to determine the boundary coordinates of the potential defect area; The font deformation recognition module determines whether a font deformation type exists and obtains a classification label if the boundary coordinates show edge distortion features. The color deviation quantification module separates the corresponding pixel blocks from the clear acquisition image according to the classification label and matches them with a preset standard template to obtain a quantified score of the degree of color deviation. The blurred region detection module performs a blur assessment on the separated pixel blocks, calculates the local variance distribution, and determines the specific location coordinates of the blurred pattern if the quantization score exceeds a preset quantization score threshold. The defect cross-validation module extracts sub-image patches from the specific location coordinates and performs cross-validation with the classification labels to obtain a comprehensive defect description vector. The real-time feedback optimization module generates a real-time feedback signal in the high-speed production line environment based on the comprehensive defect description vector, updates the imaging system parameters in real time, and obtains continuously accurate identification results.

Citation Information

Patent Citations

  • Apparent defect detection system and method for finished cigarette box

    CN118781071A

  • Cigarette quality detection system based on image detection

    CN118823004A

  • Character printing defect detection method based on deep learning and applied to manual cigarette case

    CN119205792A

  • Printing quality evaluation method, system and equipment based on image recognition and medium

    CN120807448A

  • Food printing machine printing quality detection method based on image processing

    CN121120601A

Cited By

  • An image recognition-based powder spraying quality detection system for aviation accessories

    CN122130697A