A dynamic detection method for defects of a tobacco box

By employing multi-feature extraction and a three-level progressive decision-making method, combined with adaptive threshold range and deep learning, the problems of inaccuracy and low efficiency in cigarette box appearance defect detection are solved, achieving efficient and accurate cigarette box defect detection.

CN122492667APending Publication Date: 2026-07-31CHINA TOBACCO HENAN IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA TOBACCO HENAN IND CO LTD
Filing Date
2026-05-25
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies for detecting defects in cigarette boxes suffer from poor algorithm adaptability, rigid threshold settings, and missed detection of complex defects, resulting in high false detection rates and low efficiency.

Method used

We employ a multi-feature extraction and three-level progressive decision-making method, combining global statistical features, texture features, and geometric structure features. We use an adaptive threshold range to judge defects and utilize grayscale statistics, Canny edge detection, Hough transform, and lightweight convolutional neural networks for accurate detection.

Benefits of technology

It achieves efficient, accurate, and adaptive cigarette box defect detection, significantly reducing the false detection rate and improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492667A_ABST
    Figure CN122492667A_ABST
Patent Text Reader

Abstract

This invention discloses a dynamic detection method for cigarette box defects, comprising: acquiring a cigarette box appearance image and performing image preprocessing; defining a uniform detection area in the cigarette box appearance image through automatic recognition or manual assistance; extracting multiple features from the preprocessed cigarette box appearance image and calculating global statistical features, texture features, and geometric structure features within the detection area; calculating and generating adaptive thresholds for corresponding features based on the sample feature data distribution and benchmark values ​​of the cigarette box appearance image to form dynamic threshold intervals for the corresponding features; and comparing the cigarette box appearance image to be detected with the dynamic threshold intervals for the corresponding features to determine defects. This invention enables efficient, accurate, and adaptive cigarette box defect detection, improving detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of cigarette inspection equipment, and more specifically, to a dynamic detection method for cigarette box defects. Background Technology

[0002] In the automated packaging process of the cigarette industry, the automatic detection of defects in cigarette cartons, such as damage, stains, printing errors, and box deformation, is a major challenge. Existing detection solutions generally suffer from the following limitations: 1. Poor algorithm adaptability: Relying on a single vision algorithm (such as pure grayscale thresholding), they are highly sensitive to changes in lighting conditions during production and slight shifts in the position of the cigarette cartons, resulting in a persistently high false positive rate. 2. Rigid threshold settings: Using fixed defect judgment thresholds cannot adapt to fluctuations in image characteristics caused by different production line speeds and different batches of packaging materials, requiring frequent manual adjustments. 3. Missed detection of complex defects: Traditional algorithms are insufficient in distinguishing defects with complex textures and low contrast, still requiring significant manual intervention for final judgment, hindering automation. Therefore, finding efficient, accurate, and adaptive defect detection methods for cigarette cartons is of great importance. Summary of the Invention

[0003] This invention provides a dynamic detection method for cigarette box defects, which solves the problems of inaccuracy and low efficiency in existing cigarette box appearance defect detection methods. It can achieve efficient, accurate and adaptive cigarette box defect detection, thereby improving detection efficiency.

[0004] To achieve the above objectives, the present invention provides the following technical solution:

[0005] A dynamic detection method for defects in cigarette boxes, comprising:

[0006] Acquire an image of the cigarette box's exterior and perform image preprocessing. Delineate a uniform detection area in the cigarette box's exterior image using automatic recognition or manual assistance.

[0007] Multi-feature extraction is performed on the preprocessed cigarette box appearance image, and global statistical features, texture features, and geometric structure features within the detection area are calculated;

[0008] Based on the sample feature data distribution and benchmark value of the cigarette box appearance image, an adaptive threshold is generated for the corresponding feature to form a dynamic threshold range for the corresponding feature. The dynamic threshold range includes: a dynamic threshold upper limit and a dynamic threshold lower limit.

[0009] The appearance image of the cigarette box to be tested is compared with the dynamic threshold range of the corresponding features to determine defects.

[0010] Preferred options also include:

[0011] Defect judgment is made by a three-level progressive decision-making method using global statistical features, texture features, and geometric structure features. The global statistical features use gray-level statistics, the texture features use contrast and energy representations extracted based on the gray-level co-occurrence matrix, and the geometric structure features use edge and contour area detection.

[0012] Preferably, the three-level progressive decision-making for defect judgment includes:

[0013] First-level decision: Calculate the gray-scale statistics within the current cigarette box appearance image detection area, and compare the gray-scale statistics with the dynamic threshold range of the corresponding benchmark value;

[0014] If the grayscale statistics are less than the corresponding dynamic threshold lower limit, it is determined that there is a defect;

[0015] If the grayscale statistics are between the corresponding upper and lower limits of the dynamic threshold, it is determined to be a suspected defect, and the second-level decision is initiated. The current image and the first-level feature data are then passed to the second-level decision.

[0016] Preferably, the three-level progressive decision-making for defect judgment further includes:

[0017] Second-level decision: Receive suspected defect images from the first level, perform Canny edge detection and Hough transform, and analyze the integrity of the main boundary lines and the geometric features of the angles.

[0018] The detected straight line angle and position are compared with the dynamic threshold range of the corresponding geometric structure feature benchmark value;

[0019] If a major boundary line is found to be missing, broken, or has an excessive angular deviation, it is determined to be a structural defect.

[0020] If the geometric structure is normal, but there are still suspected areas in the image that cannot be clearly determined by geometric rules, it is judged as a highly suspected defect, triggering the third-level decision.

[0021] Preferably, the three-level progressive decision-making for defect judgment further includes:

[0022] Third-level decision: Receive highly suspected defect images from the second level, and use a trained lightweight convolutional neural network to perform deep feature extraction and classification;

[0023] The network output layer uses the Softmax function to provide the defect probability. If the defect probability exceeds a set threshold, a defect is determined to exist; otherwise, no defect exists.

[0024] Preferably, the image preprocessing includes:

[0025] The image of the cigarette box's exterior was subjected to Gaussian filtering and then converted to grayscale.

[0026] Preferably, the calculation of global statistical features within the detection area includes:

[0027] Iterate through the grayscale value I(x,y) of each pixel within the detection region ROI;

[0028] The mean gray value is calculated using the formula: mean gray value μ = (ΣI(x,y)) / N, where N is the total number of pixels within the ROI.

[0029] According to the formula: Standard deviation σ = sqrt(Σ(I(x,y) -μ) 2 / N ), used to quantify the overall brightness and contrast fluctuation range of an image.

[0030] Preferably, calculating texture features within the detection area includes:

[0031] First, a gray-level co-occurrence matrix P(i,j,d,θ) is generated in four directions: 0°, 45°, 90°, and 135°. Here, i and j represent the gray levels of two pixels, θ is the relative direction between the two pixels, and d is the distance between the pixel pairs.

[0032] Contrast ratio Con = Σ|ij| 2 * P(i,j) reflects the sharpness and depth of texture grooves in the image;

[0033] Energy ASM = Σ[P(i,j)] 2 It reflects the uniformity and coarseness of the image texture.

[0034] Preferably, the calculation of geometric structural features within the detection area includes:

[0035] Use the Canny operator to detect edges and calculate the total area of ​​the contour.

[0036] Preferred options also include:

[0037] Record the baseline values ​​calculated from all qualified samples, and calculate the dynamic threshold range of the corresponding feature under the initial sensitivity coefficient based on the distribution of the baseline values ​​and sample feature values;

[0038] A baseline model is constructed based on multidimensional feature vectors and dynamic threshold ranges. The baseline model is stored in the form of a data structure and is called during the real-time detection phase.

[0039] This invention provides a dynamic detection method for cigarette box defects. It extracts multiple features from a preprocessed cigarette box appearance image and calculates global statistical features, texture features, and geometric structure features within the detection area. Based on the sample feature data distribution and benchmark values ​​of the cigarette box appearance image, it generates dynamic threshold intervals for the corresponding features. The method compares the cigarette box appearance image to be detected with these dynamic threshold intervals to determine defects. This solves the problems of inaccuracy and low efficiency in existing cigarette box appearance defect detection methods, enabling efficient, accurate, and adaptive cigarette box defect detection and improving detection efficiency. Attached Figure Description

[0040] To more clearly illustrate the specific embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below.

[0041] Figure 1 This is a schematic diagram of a dynamic detection method for defects in cigarette boxes provided by the present invention. Detailed Implementation

[0042] To enable those skilled in the art to better understand the embodiments of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and implementation methods.

[0043] To address the problems of inaccuracy and low efficiency in current cigarette box appearance defect detection methods, this invention provides a dynamic detection method for cigarette box defects, solving the problems of inaccuracy and low efficiency in current cigarette box appearance defect detection methods, and achieving efficient, accurate, and adaptive cigarette box defect detection, thereby improving detection efficiency.

[0044] like Figure 1 As shown, a dynamic detection method for defects in cigarette boxes includes:

[0045] S1: Acquire an image of the cigarette box's exterior and perform image preprocessing; define a uniform detection area for the cigarette box's exterior image using automatic recognition or manual assistance.

[0046] S2: Perform multi-feature extraction on the preprocessed cigarette box appearance image, and calculate the global statistical features, texture features and geometric structure features within the detection area;

[0047] S3: Based on the sample feature data distribution and benchmark value of the cigarette box appearance image, an adaptive threshold for the corresponding feature is calculated and generated to form a dynamic threshold range for the corresponding feature. The dynamic threshold range includes: a dynamic threshold upper limit and a dynamic threshold lower limit.

[0048] S4: The appearance image of the cigarette box to be detected is compared with the dynamic threshold range of the corresponding feature to determine the defect.

[0049] The method further includes: using a three-level progressive decision-making approach of global statistical features, texture features, and geometric structure features to determine defects. The global statistical features are gray-level statistics, the texture features are contrast and energy representations extracted based on the gray-level co-occurrence matrix, and the geometric structure features are edge and contour area detection.

[0050] Specifically, the industrial camera is controlled to continuously acquire no fewer than 20 images of defect-free, qualified cigarette boxes under stable production conditions. To ensure the representativeness of the baseline model, the acquisition process needs to cover various normal state changes throughout a complete production line cycle. A multi-algorithm collaborative detection system is constructed. The first stage is the offline or initialization calibration process, the output of which is a "baseline model" containing various feature baseline values ​​and dynamic thresholds, serving as the basis for all real-time detection algorithms in the second stage. The second stage is the core of the system's online operation, employing a three-level progressive detection architecture to form a coarse-to-fine decision funnel. Algorithms at each level are executed sequentially, with the output of the preceding algorithm determining whether to trigger the subsequent algorithm.

[0051] Furthermore, the three-level progressive decision-making for defect judgment includes: Level 1 decision: Calculate the grayscale statistics within the detection area of ​​the current cigarette box appearance image, and compare the grayscale statistics with the dynamic threshold range of the corresponding benchmark value; if the grayscale statistics are less than the corresponding lower limit of the dynamic threshold, it is determined that there is a defect; if the grayscale statistics are between the corresponding upper limit and lower limit of the dynamic threshold, it is determined to be a suspected defect, and proceed to Level 2 decision, and transmit the current image and Level 1 feature data to Level 2 decision.

[0052] Furthermore, the three-level progressive decision-making for defect judgment also includes: Second-level decision-making: receiving suspected defect images from the first level, performing Canny edge detection and Hough transform, and analyzing the integrity and geometric features of the main boundary lines and angles; comparing the detected line angles and positions with the dynamic threshold range of the corresponding geometric structure feature benchmark values; if the main boundary lines are missing, broken, or the angle deviation exceeds the limit, it is determined to be a structural defect; if the geometric structure is normal, but there are still suspected areas in the image that cannot be clearly determined by geometric rules, it is determined to be a highly suspected defect, triggering the third-level decision-making.

[0053] Furthermore, the three-level progressive decision-making for defect judgment also includes: third-level decision-making: receiving highly suspected defect images from the second level, and using a trained lightweight convolutional neural network for deep feature extraction and classification; the network output layer provides the defect probability through the Softmax function, and if the defect probability exceeds a set threshold, it is determined that a defect exists, otherwise it does not exist.

[0054] In one embodiment, the baseline model includes: a first-level grayscale statistical detection layer (fast screening layer), a second-level linear structure detection layer (geometric analysis layer), and a third-level AI pattern recognition layer (final decision layer).

[0055] Level 1: Gray-scale statistical detection layer:

[0056] Algorithm structure: grayscale histogram statistical unit + double threshold comparator.

[0057] Processing flow: Calculate the gray-scale statistics of the detection area and compare them with the dynamic threshold range in the benchmark model.

[0058] Performance metrics: Single frame processing time <10ms, capable of handling over 85% of routine cases.

[0059] Level 2: Linear Structure Detection Layer

[0060] Algorithm structure: Canny edge detector + Hough transform line detection unit + geometric relationship analyzer.

[0061] Processing flow: Extract image edge features, detect main boundary lines, and analyze line integrity, angle deviation, and relative positional relationships.

[0062] Performance metrics: Processing time <30ms, capable of handling an additional 10% of complex cases.

[0063] Level 3: AI Pattern Recognition Layer (Final Decision Layer):

[0064] Algorithm structure: Lightweight convolutional neural network, specifically: Input layer (224x224x3) → Convolutional layer (32 3x3 filters) → ReLU → Max pooling layer (2x2) → Convolutional layer (64 3x3 filters) → ReLU → Max pooling layer (2x2) → Flattening layer → Fully connected layer (128 neurons) → ReLU → Output layer (2 neurons, Softmax activation).

[0065] Decision-making mechanism: The final classification is based on the output probability of Softmax, and the judgment result has the highest authority.

[0066] Performance metrics: Processing time <100ms, handling the remaining 5% of the most difficult cases.

[0067] Through the above process, 85% of obvious anomalies are quickly screened out in the first level, 10% of difficult cases are resolved in the second level, and the remaining 5% of the most complex images are finally decided by the third-level AI, which greatly improves the detection rate of complex defects while ensuring speed.

[0068] Furthermore, the image preprocessing includes: applying Gaussian filtering to the cigarette box exterior image and then converting it to grayscale. Subsequently, a uniform detection region (ROI) is defined using automatic identification or manual assistance to ensure that all subsequent feature calculations are based on the same effective image region.

[0069] Furthermore, global statistical features within the detection area are calculated, including: traversing the grayscale value I(x,y) of each pixel within the detection area ROI; calculating the mean grayscale value according to the formula: mean grayscale value μ= (ΣI(x,y)) / N, where N is the total number of pixels within the ROI; and using the formula: standard deviation σ= sqrt(Σ(I(x,y) -μ) 2 / N ), to quantify the overall brightness and contrast fluctuation range of the image.

[0070] Furthermore, the texture features within the detection area are calculated, including: firstly, generating gray-level co-occurrence matrices P(i,j,d,θ) in four directions: 0°, 45°, 90°, and 135°, where i and j represent the gray levels of two pixels, θ is the relative direction between the two pixels, and d is the distance between pixel pairs; contrast Con = Σ|ij|² * P(i,j), reflecting the image's sharpness and the depth of texture grooves; energy ASM = Σ[P(i,j)]², reflecting the uniformity and coarseness of the image texture. Finally, the average of the feature values ​​in the four directions is taken as the texture feature of the sample.

[0071] Furthermore, the geometric features within the detection area are calculated, including: edge detection using the Canny operator and calculation of the total area of ​​the contour.

[0072] The method further includes: recording the benchmark values ​​calculated in all qualified samples, and calculating the dynamic threshold range of the corresponding feature under the initial sensitivity coefficient based on the distribution of the benchmark values ​​and sample feature values; constructing a benchmark model based on the multidimensional feature vector and the dynamic threshold range, wherein the benchmark model is stored in the form of a data structure and is called in the real-time detection stage.

[0073] In practical applications, the benchmark calculation engine generates adaptive thresholds based on the distribution of sample feature data using the following formulas: Dynamic threshold upper limit = BaseValue (benchmark value) + (Sensitivity X Tolerance) Dynamic threshold lower limit = BaseValue (benchmark value) - (Sensitivity X Tolerance) where Sensitivity is an adjustable sensitivity coefficient (range 1.0-5.0), and Tolerance is the absolute tolerance calculated based on the 3σ principle. The benchmark model is a set of multi-dimensional feature vectors and dynamic threshold intervals. Specifically, for each type of feature extracted in step S103 (such as global grayscale mean, contrast, etc.), the model records its benchmark value (BaseValue, usually the mean or median of sample feature values) calculated in all qualified samples, and calculates the dynamic threshold interval [lower limit, upper limit] of the feature under the initial sensitivity coefficient based on the benchmark value and the distribution of sample feature values. This model is stored in the form of a data structure (such as JSON or a database table) and is called during the real-time detection stage as a benchmark for each level of algorithm to determine "normal" and "abnormal".

[0074] New qualified samples are injected during production, and the baseline model is dynamically updated based on the new sample features, enabling continuous optimization to adapt to long-term production line changes. The optimization process employs a sliding window and weighted average method: the system maintains a fixed-capacity (e.g., the most recent 100) queue of qualified sample features. When new qualified sample features are added, the oldest sample features are removed. The BaseValue in the baseline model is recalculated using the following formula: New BaseValue = α * Old BaseValue + (1-α) * New sample feature value, where α is a forgetting factor (e.g., 0.95) used for smooth updates. Simultaneously, the standard deviation of the feature distribution is recalculated based on the updated queue, and the Tolerance is updated accordingly, thereby achieving progressive adaptive adjustment of model parameters.

[0075] In one embodiment, a parameter adaptation mechanism based on a baseline model is configured, which consists of three core components:

[0076] Data monitoring module: Continuously records the complete log of the detection pipeline for each frame of image, including the judgment results of each level of algorithm, feature values, final decision results, and whether the case was overturned by manual review.

[0077] Performance evaluator: Extracts data from monitoring logs at fixed time intervals (e.g., 1 hour) to calculate key performance indicators, primarily the false positive rate (FPR), where FPR = (number of false positives in the period) / (total number of smoke boxes detected in the period). The evaluator also tracks the missed detection rate.

[0078] Parameter Tuner: Receives the output from the performance evaluator and has a built-in tuning strategy. Its core tuning target is the sensitivity coefficient in the dynamic threshold calculation formula of each feature in the "baseline model". The tuner makes adjustment decisions based on the continuous trend of FPR and safely modifies model parameters through the "model dynamic update interface".

[0079] Adaptive adjustment process:

[0080] Monitoring phase: Continuously record detection results, paying special attention to false alarm cases that are overturned by the third-level algorithm.

[0081] Evaluation phase: Calculate the false positive rate (FPR = number of false positives / total number of detections) every hour and analyze the FPR trend over multiple consecutive periods (e.g., 3 periods).

[0082] Decision-making and execution phase:

[0083] If the FPR remains above the target value (e.g., 0.5%) for three consecutive periods, the system is deemed overly sensitive. The parameter tuner issues an instruction to appropriately relax the judgment thresholds of the first and second level algorithms. Specifically, the sensitivity coefficient (Sensitivity) of affected features (such as those triggering false alarms) is decreased in steps (e.g., 0.1), but ensured not to fall below the minimum value of 1.0. The dynamic threshold range is recalculated based on the new Sensitivity, and the baseline model is updated.

[0084] If the FPR remains below the target lower limit (e.g., 0.1%) for three consecutive periods, and no missed detection reports are received, the system is deemed to be too lenient, posing a risk of missed detections. The parameter adjuster issues a command to appropriately increase the detection sensitivity. Specifically, the global sensitivity coefficient Sensitivity is increased in increments (e.g., 0.05), but ensured not to exceed the maximum value of 5.0, and the model is updated.

[0085] If FPR fluctuates within the target range: keep the parameters unchanged.

[0086] Constraints: The adjustment range of any single sensitivity coefficient for any feature is limited to within 5% to ensure system stability and avoid parameter oscillations. All parameter adjustments are logged and can be manually rolled back.

[0087] As can be seen, the present invention provides a dynamic detection method for cigarette box defects. It extracts multiple features from the preprocessed cigarette box appearance image and calculates global statistical features, texture features, and geometric structure features within the detection area. Based on the sample feature data distribution and benchmark value of the cigarette box appearance image, it calculates and generates dynamic threshold intervals for the corresponding features. The method then compares the cigarette box appearance image to be detected with these dynamic threshold intervals to determine defects. This solves the problems of inaccuracy and low efficiency in existing cigarette box appearance defect detection methods, enabling efficient, accurate, and adaptive cigarette box defect detection and improving detection efficiency.

[0088] The structure, features, and effects of the present invention have been described in detail above with reference to the embodiments shown in the figures. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, shall be within the protection scope of the present invention as long as they do not exceed the spirit covered by the specification and figures.

Claims

1. A dynamic detection method for defects in cigarette boxes, characterized in that, include: Acquire an image of the cigarette box's exterior and perform image preprocessing. Delineate a uniform detection area in the cigarette box's exterior image using automatic recognition or manual assistance. Multi-feature extraction is performed on the preprocessed cigarette box appearance image, and global statistical features, texture features, and geometric structure features within the detection area are calculated; Based on the sample feature data distribution and benchmark value of the cigarette box appearance image, an adaptive threshold is generated for the corresponding feature to form a dynamic threshold range for the corresponding feature. The dynamic threshold range includes: a dynamic threshold upper limit and a dynamic threshold lower limit. The appearance image of the cigarette box to be tested is compared with the dynamic threshold range of the corresponding features to determine defects.

2. The dynamic detection method for defects in cigarette boxes according to claim 1, characterized in that, Also includes: Defect judgment is made by a three-level progressive decision-making method using global statistical features, texture features, and geometric structure features. The global statistical features use gray-level statistics, the texture features use contrast and energy representations extracted based on the gray-level co-occurrence matrix, and the geometric structure features use edge and contour area detection.

3. The dynamic detection method for defects in cigarette boxes according to claim 2, characterized in that, The three-level progressive decision-making process for defect assessment includes: First-level decision: Calculate the gray-scale statistics within the current cigarette box appearance image detection area, and compare the gray-scale statistics with the dynamic threshold range of the corresponding benchmark value; If the grayscale statistics are less than the corresponding dynamic threshold lower limit, it is determined that there is a defect; If the grayscale statistics are between the corresponding upper and lower limits of the dynamic threshold, it is determined to be a suspected defect, and the second-level decision is initiated. The current image and the first-level feature data are then passed to the second-level decision.

4. The dynamic detection method for defects in cigarette boxes according to claim 3, characterized in that, The three-level progressive decision-making process for defect assessment also includes: Second-level decision: Receive suspected defect images from the first level, perform Canny edge detection and Hough transform, and analyze the integrity of the main boundary lines and the geometric features of the angles. The detected straight line angle and position are compared with the dynamic threshold range of the corresponding geometric structure feature benchmark value; If a major boundary line is found to be missing, broken, or has an excessive angular deviation, it is determined to be a structural defect. If the geometric structure is normal, but there are still suspected areas in the image that cannot be clearly determined by geometric rules, it is judged as a highly suspected defect, triggering the third-level decision.

5. The dynamic detection method for defects in cigarette boxes according to claim 4, characterized in that, The three-level progressive decision-making process for defect assessment also includes: Third-level decision: Receive highly suspected defective images from the second level, and use a trained lightweight convolutional neural network to perform deep feature extraction and classification; The network output layer uses the Softmax function to provide the defect probability. If the defect probability exceeds a set threshold, a defect is determined to exist; otherwise, no defect exists.

6. The dynamic detection method for defects in cigarette boxes according to claim 5, characterized in that, The image preprocessing includes: The image of the cigarette box's exterior was subjected to Gaussian filtering and then converted to grayscale.

7. The dynamic detection method for defects in cigarette boxes according to claim 6, characterized in that, Calculate the global statistical features within the detection area, including: Iterate through the grayscale value I(x,y) of each pixel within the detection region ROI; The mean gray value is calculated using the formula: mean gray value μ = (ΣI(x,y)) / N, where N is the total number of pixels within the ROI. According to the formula: Standard deviation σ = sqrt(Σ(I(x,y) -μ) 2 / N ), used to quantify the overall brightness and contrast fluctuation range of an image.

8. The dynamic detection method for defects in cigarette boxes according to claim 7, characterized in that, Calculate the texture features within the detection region, including: First, a gray-level co-occurrence matrix P(i,j,d,θ) is generated in four directions: 0°, 45°, 90°, and 135°. Here, i and j represent the gray levels of two pixels, θ is the relative direction between the two pixels, and d is the distance between the pixel pairs. Contrast Con =∑| i - j | 2 * P(i,j), reflecting the sharpness and texture of the image. EnergyASM =∑[P(i,j)] 2 , reflecting the uniformity and coarseness of the image texture.

9. The dynamic detection method for defects in cigarette boxes according to claim 8, characterized in that, Calculate the geometric structural features within the detection area, including: Use the Canny operator to detect edges and calculate the total area of ​​the contour.

10. The dynamic detection method for defects in cigarette boxes according to claim 9, characterized in that, Also includes: Record the baseline values ​​calculated from all qualified samples, and calculate the dynamic threshold range of the corresponding feature under the initial sensitivity coefficient based on the distribution of the baseline values ​​and sample feature values; A baseline model is constructed based on multidimensional feature vectors and dynamic threshold ranges. The baseline model is stored in the form of a data structure and is called during the real-time detection phase.