Detection and identification method for single loose-end cigarette
By using improved adaptive median filtering and Retinex illumination equalization preprocessing techniques, combined with Hough circle transform and lightweight CNN for image feature extraction, and SVM for classification, the problem of efficient identification of slightly hollow cigarettes in cigarette production was solved, achieving high-precision and low-cost detection results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies are insufficient to efficiently identify cigarettes with slight defects of up to 1mm in diameter during production, leading to substandard products entering the market. Existing detection methods suffer from problems such as system complexity, high maintenance costs, high failure rates, and low identification accuracy.
An improved adaptive median filtering and Retinex illumination equalization preprocessing technique are used, combined with Hough circle transform and lightweight convolutional neural network (CNN) for image preprocessing and feature extraction, and support vector machine (SVM) is used for classification to achieve high-precision identification of slightly hollow cigarettes.
It achieves high-precision identification of slightly hollow cigarettes, with an accuracy rate of over 98.5%, a false negative rate of less than 0.5%, and a false positive rate of less than 1%. It maintains high robustness in complex production environments, meets the real-time requirements of cigarette production lines, and reduces equipment upgrade costs.
Smart Images

Figure CN121783846A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of detection and identification technology, specifically relating to a method for detecting and identifying a single empty cigarette. Background Technology
[0002] Hollow cigarettes are a common quality defect in cigarette production. The national standard GB / T22838 clearly defines a hollow cigarette as one with a surface depression greater than 1mm. Existing hollow cigarette detection technologies mostly rely on mechanical detection or infrared photoelectric detection, which suffer from complex system structures, high maintenance costs, and high failure rates. Some machine vision-based detection methods, as mentioned in the technical solution with patent publication number "CN105852202A", only use simple grayscale threshold segmentation or contour feature extraction, which is difficult to cope with the complex background of the production line (such as packaging reflection, uneven tobacco color, and vibration interference from the conveyor line). The accuracy of identifying slight hollows close to the 1mm threshold is low, and it is easy to miss or misdetect, resulting in unqualified products entering the market and affecting the product quality and brand reputation of cigarette companies. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this invention provides a method for detecting and identifying single empty cigarettes. This method is suitable for high-precision identification of empty cigarettes (especially slight empty cigarettes close to 1mm) in the cigarette production and packaging process, and can be used in conjunction with empty cigarette rejection devices.
[0004] The present invention employs the following technical solution.
[0005] A method for detecting and identifying a single empty cigarette tip, comprising:
[0006] Step 1: The controller controls the camera to acquire and preprocess images of cigarette packaging boxes entering the detection area;
[0007] Step 2: The controller extracts the region of interest from the preprocessed top image of the cigarette packaging;
[0008] Step 3: The controller performs multi-dimensional feature extraction on the circular ROI;
[0009] Step 4: Classify and determine the type of empty cigarettes based on the fused feature vector.
[0010] Furthermore, in step 1, the specific methods for image acquisition include:
[0011] Dynamic trigger acquisition: Based on the photoelectric sensor connected to the controller, the system detects whether the cigarette packaging box has entered the detection area. When the photoelectric sensor outputs a low-level trigger signal to the controller, the controller controls the CMOS camera and LED light source connected to it to work synchronously, acquire the image of the top of the cigarette packaging box and transmit it to the controller.
[0012] Furthermore, in step 1, the specific methods for preprocessing include:
[0013] Noise Suppression: An improved adaptive median filtering algorithm is used to reduce noise in the acquired images of the top of cigarette packaging. The formula for the improved adaptive median filtering algorithm is as follows:
[0014] ;
[0015] in, The original image for the top of the cigarette pack. Pixel value at that location, The x-coordinate of the pixel in the top image of the cigarette packaging. The x-coordinate of the pixel in the top image of the cigarette packaging. The image on the top of the cigarette pack Filtered pixel values at the location , , These represent the minimum, median, and maximum pixel values within the filter window, respectively.
[0016] Illumination equalization: An improved Retinex algorithm is used to correct uneven illumination in the top image after noise suppression. This involves separating the illumination and reflection components of the noise-suppressed top image to highlight the concave and convex features of the tobacco surface. The calculation formula for the improved Retinex algorithm is as follows:
[0017] ;
[0018] in, The reflection component of the top image after noise suppression. It is a Gaussian filter kernel. This represents the convolution operation.
[0019] Furthermore, step 2 specifically includes:
[0020] Step 2-1: The controller positions the cigarettes based on the pre-processed image of the top of the cigarette packaging;
[0021] Step 2-2: The controller performs ROI clipping and normalization on the circular ROI corresponding to each cigarette.
[0022] Furthermore, step 2-1 specifically includes:
[0023] The controller uses Hough circle transform to detect the circular region at the top of the cigarette in the preprocessed image of the cigarette packaging. Based on the standard dimensions of the cigarette packaging, a radius range is set, and the circular ROI corresponding to each cigarette is selected. The polar coordinate equation of the Hough circle transform is:
[0024] ;
[0025] in, Let the coordinates be the center of the circle. Let x be the x-coordinate of the center of the circle. Let be the ordinate of the center of the circle. Let be the radius of the circle.
[0026] Furthermore, step 2-2 specifically includes:
[0027] The controller crops the circular ROI of each cigarette into a 224×224 pixel square image and normalizes the pixel values to the [0,1] range to obtain the desired image. Normalized pixel values at The formula is as follows:
[0028] ;
[0029] in, For the cropped circular ROI in Pixel value at that location, , These represent the minimum and maximum pixel values within the circular ROI, respectively. After normalization The pixel value at that location.
[0030] Furthermore, step 3 specifically includes:
[0031] Step 3-1: The controller extracts texture features from the circular ROI;
[0032] Step 3-2: Extract depth features from the normalized circular ROI image;
[0033] Step 3-3: Perform feature fusion based on the texture feature vector and the depth feature vector.
[0034] Furthermore, step 3-1 specifically includes:
[0035] Texture features of circular ROIs are extracted using gray-level co-occurrence matrix (GLCM), with gray levels set to 256 and distances set to [missing information]. =1, Angle =0°, 45°, 90°, or 135°, calculate the five texture feature parameters at these four angles, and take the average of each texture feature parameter at these four angles as the final texture feature vector. The five elements of the texture feature vector are the average values of the five texture feature parameters at these four angles. The five texture feature parameters include:
[0036] Energy: Energy reflects the uniformity of the texture of a circular ROI. The formula for calculating Energy is:
[0037] ,in The gray-level co-occurrence matrix is the first... Line number Column elements;
[0038] Entropy: Entropy reflects the complexity of the texture of a circular ROI. The formula for calculating entropy is:
[0039] ;
[0040] Contrast: Contrast reflects the clarity of the texture of a circular ROI. The formula for calculating Contrast is:
[0041] ;
[0042] Correlation: Correlation reflects the similarity of textures among circular ROIs. The formula for calculating correlation is:
[0043] ,in , These are the gray-level co-occurrence matrices of the th The mean gray level of the row and the gray-level co-occurrence matrix of the first row The average gray value of the row. , These are the gray-level co-occurrence matrices of the th The gray standard deviation of the row and the gray co-occurrence matrix of the first row The standard deviation of gray levels in the row;
[0044] Inverse Gap IDM: Inverse Gap IDM reflects the smoothness of the texture of a circular ROI. The formula for calculating Inverse Gap IDM is:
[0045] .
[0046] Furthermore, step 3-2 specifically includes:
[0047] A lightweight convolutional neural network is constructed to extract deep features from the normalized circular ROI image. The network structure of the lightweight convolutional neural network includes 3 convolutional layers, 2 max pooling layers, and 1 fully connected layer, and finally outputs a 128-dimensional deep feature vector. The convolutional layers use the ReLU activation function f(x1), with the formula: f(x1)=max(0,x1), where x1 is the input value of the ReLU activation function f(x1).
[0048] Furthermore, step 3-3 specifically includes:
[0049] The texture feature vector obtained using the gray-level co-occurrence matrix is concatenated with the deep feature vector obtained using a lightweight convolutional neural network to obtain a 133-dimensional fused feature vector. The concatenated expression is:
[0050] ,in For texture feature vectors, This is a depth feature vector.
[0051] Furthermore, step 4 specifically includes:
[0052] Step 4-1: Train the classification model;
[0053] Step 4-2: Perform real-time classification and judgment.
[0054] Furthermore, step 4-1 specifically includes:
[0055] A support vector machine (SVM) classifier is constructed, with fused feature vectors as input and "empty" or "normal" as output labels, using radial basis functions as kernel functions. The SVM classifier is trained using labeled datasets, and the model parameters are optimized using 5-fold cross-validation to achieve a classification accuracy of over 99%.
[0056] Furthermore, step 4-2 specifically includes:
[0057] The fused feature vector of the cigarette to be detected is input into the trained SVM classifier, which outputs the classification result. If the cigarette to be detected is determined to be "empty", the controller sends a signal to the rejection valve connected to it as a sorting execution device to reject the cigarette. At the same time, the detection result is uploaded to the host computer connected to the controller for quality traceability and statistical analysis.
[0058] Furthermore, in step 4-2, the air outlet of the rejection valve must be aligned with the center of the cigarette filter, and the rejection phase of the rejection valve must be after the detection phase. At the location.
[0059] The beneficial effects of the present invention are as follows, compared with the prior art:
[0060] Improved accuracy in identifying minor gaps: By using multi-dimensional feature fusion (texture features + depth features), the problem that simple grayscale / contour analysis cannot capture the details of minor gaps (close to 1mm) is solved. Experimental results show that the accuracy of identifying minor gaps can reach over 98.5%, with a false negative rate of less than 0.5% and a false positive rate of less than 1%, which is far superior to existing technologies.
[0061] Enhanced robustness against complex backgrounds: Through adaptive median filtering and Retinex illumination equalization preprocessing, interference factors such as packaging reflection, uneven tobacco color, and conveyor line vibration are effectively suppressed. Even in complex production environments (illuminance fluctuation ±20%, background noise density ≤10%), the detection accuracy can still be maintained above 97%, and the robustness is significantly improved.
[0062] Balancing real-time performance and practicality: It adopts a lightweight CNN (≤1M parameters) and SVM classifier, with a single frame image detection time of ≤50ms, meeting the high-speed operation requirements of cigarette production lines (line speed ≤3m / s); at the same time, the detection results can be uploaded to the host computer in real time, supporting quality data traceability and statistical analysis, which facilitates production process control.
[0063] High compatibility: This method can be directly used with existing empty cigarette stick removal devices (such as the device described in patent publication number CN105852202A), without the need for large-scale modification of the hardware structure. Functional optimization can be achieved simply through software upgrades, reducing the equipment upgrade costs for enterprises. Attached Figure Description
[0064] Figure 1 This is a flowchart of the method for detecting and identifying hollow cigarettes in this invention. Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this invention. The embodiments described in this application are merely some embodiments of this invention, and not all embodiments. Based on the spirit of this invention, other embodiments obtained by those skilled in the art without creative effort are all within the protection scope of this invention.
[0066] like Figure 1 As shown, a method for detecting and identifying a single empty cigarette tip includes:
[0067] Step 1: The controller controls the camera to acquire and preprocess images of cigarette packaging boxes entering the detection area; the controller can be an industrial computer or a PLC.
[0068] In a preferred but non-limiting embodiment of the present invention, the specific method for image acquisition in step 1 includes:
[0069] Dynamic trigger acquisition: A photoelectric sensor (such as a BF3R fiber optic amplifier) connected to the controller detects whether the cigarette packaging box has entered the detection area. When the photoelectric sensor outputs a low-level trigger signal to the controller, the controller controls the connected CMOS camera (such as an OV7620) and LED light source to work synchronously, acquiring an image of the top of the cigarette packaging and transmitting it to the controller. The LED light source is powered by a MAX16800 constant current drive circuit to ensure stable light intensity (controlled between 800-1200 lux), avoiding image grayscale deviations caused by light fluctuations. In this embodiment, the image acquisition primarily focuses on a single cigarette, which is then used to determine whether the cigarette is empty.
[0070] The CMOS camera is positioned next to the LED light source.
[0071] In a preferred but non-limiting embodiment of the present invention, the specific method for preprocessing in step 1 includes:
[0072] Noise suppression: An improved adaptive median filtering algorithm is used to perform noise reduction on the acquired top image (RGB image) of the cigarette packaging. The formula for the improved adaptive median filtering algorithm is as follows:
[0073] ;
[0074] in, The original image of the top of the cigarette pack (RGB image) Pixel value at that location, The x-coordinate of the pixels in the top image (RGB image) of the cigarette packaging. The x-coordinate of the pixels in the top image (RGB image) of the cigarette packaging. For the top image (RGB image) of cigarette packaging Filtered pixel values at the location , , These represent the minimum, median, and maximum values of the pixels within the filtering window, respectively. The algorithm can dynamically adjust the filtering window (window size range 3×3~7×7) according to the noise density, while suppressing salt-and-pepper noise and Gaussian noise and preserving the texture details of the tobacco shreds at the top of the cigarette.
[0075] The algorithm can dynamically adjust the filtering window based on noise density as follows:
[0076] Initial window settings: Improved adaptive median filtering algorithms typically start with a small window size, such as 3×3. This is because in areas with low noise density, a small window is sufficient to identify and process noise while preserving image details to the greatest extent possible. In relatively quiet parts of the image, a small window can effectively remove occasional noise points, avoiding excessive interference with the original image information.
[0077] Determine noise levels: Calculate the minimum value of pixels within the window ( ), maximum value ( ) and median ( ).when < < If this condition is not met, it means there may be a lot of noise within the window, and the current window size is insufficient to effectively handle this noise, requiring the window to be enlarged. In areas with a lot of salt-and-pepper noise, pixel values may be extremely large or small, causing the above condition to be unmet, thus triggering the window enlargement operation.
[0078] Gradually increase the window size: If it's determined that the window needs to be enlarged, increase the size by a certain amount each time, commonly by 2, such as from 3×3 to 5×5. After enlarging the window, recalculate the pixel size within the new window. , and Then perform the judgment again until the condition is met. < < Conditions. In areas with high noise density, continuously increasing the window size can include more pixels in the calculation range, making the median calculation more reflective of the true pixel situation, thereby removing noise more effectively.
[0079] Maximum Window Limit: To prevent the image from becoming excessively blurry due to the window growing indefinitely, the algorithm sets a maximum window size. If the image still doesn't meet the maximum size requirement... < < If the maximum window size is not found, the median of the current window will be returned directly as the filtering result. In practical applications, the setting of the maximum window size needs to take into account factors such as image resolution, noise type and intensity, in order to balance noise removal effect and image detail preservation.
[0080] Illumination equalization: An improved Retinex algorithm is used to correct the uneven illumination in the noise-suppressed top image (RGB image). This involves separating the illumination and reflection components of the noise-suppressed top image (RGB image) to highlight the concave and convex features of the tobacco surface. The calculation formula for the improved Retinex algorithm is as follows:
[0081] ;
[0082] in, This refers to the reflection component of the top image (RGB image) after noise suppression (i.e., the corrected image). It is a Gaussian filter kernel (standard deviation σ=2.5). This represents the convolution operation; this step eliminates the interference of packaging reflections and local shadows on the detection.
[0083] Step 2: The controller extracts the region of interest (ROI) from the preprocessed top image of the cigarette packaging;
[0084] In a preferred but non-limiting embodiment of the present invention, step 2 specifically includes:
[0085] Step 2-1: The controller positions the cigarettes based on the pre-processed image of the top of the cigarette packaging;
[0086] In a preferred but non-limiting embodiment of the present invention, step 2-1 specifically includes:
[0087] The controller uses Hough circle transform to detect the circular region at the top of the cigarette in the preprocessed image of the cigarette packaging. Based on the standard dimensions of the cigarette packaging (e.g., a diameter of 7.8 mm), a radius range (7-8.5 mm) is set to filter out the circular ROI corresponding to each cigarette. The polar coordinate equation of the Hough circle transform is:
[0088] ;
[0089] in, Let the coordinates be the center of the circle. Let x be the x-coordinate of the center of the circle. Let be the ordinate of the center of the circle. Let be the radius of the circle. By using an accumulator to count the pixels in the image that satisfy this equation, the ROI location of the cigarette can be determined.
[0090] Step 2-2: The controller performs ROI clipping and normalization on the circular ROI corresponding to each cigarette.
[0091] In a preferred but non-limiting embodiment of the present invention, step 2-2 specifically includes:
[0092] The controller crops the circular ROI of each cigarette into a 224×224 pixel square image and normalizes the pixel values to the [0,1] range to obtain the desired image. Normalized pixel values at The formula is as follows:
[0093] ;
[0094] in, For the cropped circular ROI in Pixel value at that location, , These represent the minimum and maximum pixel values within the circular ROI, respectively. After normalization The pixel value at the location; normalization can eliminate the influence of grayscale differences between different cigarettes on subsequent feature extraction.
[0095] Step 3: The controller performs multi-dimensional feature extraction on the circular ROI;
[0096] In a preferred but non-limiting embodiment of the present invention, step 3 specifically includes:
[0097] Step 3-1: The controller extracts texture features from the circular ROI;
[0098] In a preferred but non-limiting embodiment of the present invention, step 3-1 specifically includes:
[0099] Texture features of circular ROIs were extracted using Gray-Level Co-occurrence Matrix (GLCM), with gray levels set to 256 and distances set to [missing information]. =1, Angle =0°, 45°, 90°, or 135°, calculate the five texture feature parameters at these four angles, and take the average of each texture feature parameter at these four angles as the final texture feature vector. The five elements of the texture feature vector are the average values of the five texture feature parameters at these four angles. The five texture feature parameters include:
[0100] Energy: Energy reflects the uniformity of the texture of a circular ROI. The formula for calculating Energy is:
[0101] ,in The gray-level co-occurrence matrix is the first... Line number Column elements;
[0102] Entropy: Entropy reflects the complexity of the texture of a circular ROI. The formula for calculating entropy is:
[0103] ;
[0104] Contrast: Contrast reflects the clarity of the texture of a circular ROI. The formula for calculating Contrast is:
[0105] ;
[0106] Correlation: Correlation reflects the similarity of textures among circular ROIs. The formula for calculating correlation is:
[0107] ,in , These are the gray-level co-occurrence matrices of the th The mean gray level of the row and the gray-level co-occurrence matrix of the first row The average gray value of the row. , These are the gray-level co-occurrence matrices of the th The gray standard deviation of the row and the gray co-occurrence matrix of the first row The standard deviation of gray levels in the row;
[0108] Inverse Gap IDM: Inverse Gap IDM reflects the smoothness of the texture of a circular ROI. The formula for calculating Inverse Gap IDM is:
[0109] .
[0110] Step 3-2: Extract depth features from the normalized circular ROI image;
[0111] In a preferred but non-limiting embodiment of the present invention, step 3-2 specifically includes:
[0112] A lightweight convolutional neural network (CNN) is constructed to extract deep features from the normalized circular region of interest (ROI) image. The CNN network structure includes three convolutional layers (3×3 kernels, with 16, 32, and 64 kernels respectively), two max-pooling layers (2×2 kernels), and one fully connected layer (output dimension 128), ultimately outputting a 128-dimensional deep feature vector. The convolutional layers use the ReLU activation function f(x1), with the formula: f(x1) = max(0, x1), where x1 is the input value of the ReLU activation function f(x1), which enhances the non-linear fitting ability of the lightweight CNN network. The pooling layer is used to reduce the feature dimension and reduce the computational cost.
[0113] Step 3-3: Perform feature fusion based on the texture feature vector and the depth feature vector.
[0114] In a preferred but non-limiting embodiment of the present invention, step 3-3 specifically includes:
[0115] The texture feature vector (5-dimensional) obtained using the Gray-Level Co-occurrence Matrix (GLCM) is concatenated with the depth feature vector (128-dimensional) obtained using a Lightweight Convolutional Neural Network (CNN) to obtain a 133-dimensional fused feature vector. The concatenated expression is:
[0116] ,in For texture feature vectors, It is a deep feature vector; the fused features can simultaneously reflect the texture details and deep semantic information of the cigarette surface, improving the ability to identify slight hollows.
[0117] Step 4: Classify and determine the type of empty cigarettes based on the fused feature vector.
[0118] In a preferred but non-limiting embodiment of the present invention, step 4 specifically includes:
[0119] Step 4-1: Train the classification model;
[0120] In a preferred but non-limiting embodiment of the present invention, step 4-1 specifically includes:
[0121] A Support Vector Machine (SVM) classifier was constructed, with fused feature vectors as input and "empty" or "normal" as output labels, using radial basis function (RBF) as the kernel function. The SVM classifier was trained using a labeled dataset (containing 5000 normal cigarette images and 5000 empty cigarette images, of which slightly empty images accounted for 30%), and the model parameters were optimized using 5-fold cross-validation to achieve a classification accuracy of over 99%.
[0122] Step 4-2: Perform real-time classification and judgment.
[0123] In a preferred but non-limiting embodiment of the present invention, step 4-2 specifically includes:
[0124] The fused feature vector of the cigarette to be detected is input into the trained SVM classifier, which outputs the classification result. If the cigarette to be detected is determined to be "empty", the controller sends a signal to the rejection valve connected to it as a sorting execution device to reject the cigarette. At the same time, the detection results (time, location, classification label) are uploaded to the host computer connected to the controller for quality traceability and statistical analysis.
[0125] In a preferred but non-limiting embodiment of the present invention, in step 4-2, the air outlet of the rejection valve needs to be aligned with the center of the cigarette filter, and the rejection phase of the rejection valve needs to be after the detection phase. At the location.
[0126] For cigarettes to be properly rejected, they must be rejected during operation. The air outlet of the rejection valve must be aligned with the center of the cigarette filter, and the rejection phase must be about 1 millimeter after the detection phase.
[0127] ① If the cigarette is less than 1 mm, after it is removed, the next cigarette may fall on the platform again. In the next phase, the software will not detect it again, and the cigarette will be missed.
[0128] ② The difference should not be more than 1 mm. If it is more than 1 mm, the current cigarette to be removed may not be on the removal horizontal line, resulting in removal failure and cigarette jamming.
[0129] Therefore, the rejection phase is generally set to 60 seconds after the detection phase. For example, one revolution of the opening and closing mechanism is 1000 seconds, the leftmost phase is 300 seconds, and the rightmost phase is basically the leftmost phase plus 500 seconds, which is 800 seconds. Since the detection phase is on the far right, the detection phase is 800 seconds, and the rejection phase is at 860 seconds. Only at this phase can we avoid situations where cigarettes get stuck during rejection, or where the rejection phase is too late and the cigarette has already reached the lower cigarette storage area.
[0130] The beneficial effects of the present invention are as follows, compared with the prior art:
[0131] Improved accuracy in identifying minor gaps: By using multi-dimensional feature fusion (texture features + depth features), the problem that simple grayscale / contour analysis cannot capture the details of minor gaps (close to 1mm) is solved. Experimental results show that the accuracy of identifying minor gaps can reach over 98.5%, with a false negative rate of less than 0.5% and a false positive rate of less than 1%, which is far superior to existing technologies.
[0132] Enhanced robustness against complex backgrounds: Through adaptive median filtering and Retinex illumination equalization preprocessing, interference factors such as packaging reflection, uneven tobacco color, and conveyor line vibration are effectively suppressed. Even in complex production environments (illuminance fluctuation ±20%, background noise density ≤10%), the detection accuracy can still be maintained above 97%, and the robustness is significantly improved.
[0133] Balancing real-time performance and practicality: It adopts a lightweight CNN (≤1M parameters) and SVM classifier, with a single frame image detection time of ≤50ms, meeting the high-speed operation requirements of cigarette production lines (line speed ≤3m / s); at the same time, the detection results can be uploaded to the host computer in real time, supporting quality data traceability and statistical analysis, which facilitates production process control.
[0134] High compatibility: This method can be directly used with existing empty cigarette stick removal devices (such as the device described in patent publication number CN105852202A), without the need for large-scale modification of the hardware structure. Functional optimization can be achieved simply through software upgrades, reducing the equipment upgrade costs for enterprises.
[0135] This invention allows users to determine whether a cigarette is hollow or solid by acquiring an image of a single cigarette and then combining it with image processing technology, thus enabling them to classify and classify the cigarette and providing a basis for subsequent cigarette packaging.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention without departing from the spirit and scope of the present invention. Any modifications or equivalent substitutions should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for detecting and identifying a single empty cigarette tip, characterized in that, include: Step 1: The controller controls the camera to acquire and preprocess images of cigarette packaging boxes entering the detection area; The image is an image of a single cigarette; Step 2: The controller extracts the region of interest from the preprocessed top image of the cigarette packaging; Step 3: The controller performs multi-dimensional feature extraction on the circular ROI; Step 4: Classify and determine the type of empty cigarettes based on the fused feature vector.
2. The method for detecting and identifying a single empty cigarette according to claim 1, characterized in that, In step 1, the specific methods for image acquisition include: Dynamic trigger acquisition: Based on the photoelectric sensor connected to the controller, the system detects whether the cigarette packaging box has entered the detection area. When the photoelectric sensor outputs a low-level trigger signal to the controller, the controller controls the CMOS camera and LED light source connected to it to work synchronously, acquire the image of the top of the cigarette packaging box and transmit it to the controller.
3. The method for detecting and identifying a single empty cigarette according to claim 2, characterized in that, In step 1, the specific methods for preprocessing include: Noise Suppression: An improved adaptive median filtering algorithm is used to reduce noise in the acquired images of the top of cigarette packaging. The formula for the improved adaptive median filtering algorithm is as follows: ; in, The original image for the top of the cigarette pack. Pixel value at that location, The x-coordinate of the pixel in the top image of the cigarette packaging. The x-coordinate of the pixel in the top image of the cigarette packaging. The image on the top of the cigarette pack Filtered pixel values at the location , , These represent the minimum, median, and maximum pixel values within the filtering window, respectively. Illumination equalization: An improved Retinex algorithm is used to correct uneven illumination in the top image after noise suppression. This involves separating the illumination and reflection components of the noise-suppressed top image to highlight the concave and convex features of the tobacco surface. The calculation formula for the improved Retinex algorithm is as follows: ; in, The reflection component of the top image after noise suppression. It is a Gaussian filter kernel. This represents the convolution operation.
4. The method for detecting and identifying a single empty cigarette according to claim 3, characterized in that, In step 1, step 2 specifically includes: Step 2-1: The controller positions the cigarettes based on the pre-processed image of the top of the cigarette packaging; Step 2-2: The controller performs ROI clipping and normalization on the circular ROI corresponding to each cigarette.
5. The method for detecting and identifying a single empty cigarette according to claim 4, characterized in that, In step 1, step 2-1 specifically includes: The controller uses Hough circle transform to detect the circular region at the top of the cigarette in the preprocessed image of the cigarette packaging. Based on the standard dimensions of the cigarette packaging, a radius range is set, and the circular ROI corresponding to each cigarette is selected. The polar coordinate equation of the Hough circle transform is: ; in, Let the coordinates be the center of the circle. Let x be the x-coordinate of the center of the circle. Let be the ordinate of the center of the circle. Let be the radius of the circle; Step 2-2 specifically includes: The controller crops the circular ROI of each cigarette into a 224×224 pixel square image and normalizes the pixel values to the [0,1] range to obtain the desired image. Normalized pixel values at The formula is as follows: ; in, For the cropped circular ROI in Pixel value at that location, , These represent the minimum and maximum pixel values within the circular ROI, respectively. After normalization The pixel value at that location.
6. The method for detecting and identifying a single empty cigarette according to claim 5, characterized in that, In step 1, step 3 specifically includes: Step 3-1: The controller extracts texture features from the circular ROI; Step 3-2: Extract depth features from the normalized circular ROI image; Step 3-3: Perform feature fusion based on the texture feature vector and the depth feature vector.
7. The method for detecting and identifying a single empty cigarette according to claim 6, characterized in that, In step 1, step 3-1 specifically includes: Texture features of circular ROIs are extracted using gray-level co-occurrence matrix (GLCM), with gray levels set to 256 and distances set to [missing information]. =1, Angle =0°, 45°, 90°, or 135°, calculate the five texture feature parameters at these four angles, and take the average of each texture feature parameter at these four angles as the final texture feature vector. The five elements of the texture feature vector are the average values of the five texture feature parameters at these four angles. The five texture feature parameters include: Energy: Energy reflects the uniformity of the texture of a circular ROI. The formula for calculating Energy is: ,in The gray-level co-occurrence matrix is the first... Line 1 Column elements; Entropy: Entropy reflects the complexity of the texture of a circular ROI. The formula for calculating entropy is: ; Contrast: Contrast reflects the clarity of the texture of a circular ROI. The formula for calculating Contrast is: ; Correlation: Correlation reflects the similarity of textures among circular ROIs. The formula for calculating correlation is: ,in , These are the gray-level co-occurrence matrices of the th The mean gray level of the row and the gray-level co-occurrence matrix of the first row The average gray value of the row. , These are the gray-level co-occurrence matrices of the th The gray standard deviation of the row and the gray co-occurrence matrix of the first row The standard deviation of gray levels in the row; Inverse Gap IDM: Inverse Gap IDM reflects the smoothness of the texture of a circular ROI. The formula for calculating Inverse Gap IDM is: 。 8. The method for detecting and identifying a single empty cigarette according to claim 7, characterized in that, In step 1, step 3-2 specifically includes: A lightweight convolutional neural network is constructed to extract deep features from the normalized circular ROI image. The network structure of the lightweight convolutional neural network includes 3 convolutional layers, 2 max pooling layers, and 1 fully connected layer, and finally outputs a 128-dimensional deep feature vector. The convolutional layers use the ReLU activation function f(x1), with the formula: f(x1)=max(0,x1), where x1 is the input value of the ReLU activation function f(x1). Step 3-3 specifically includes: The texture feature vector obtained using the gray-level co-occurrence matrix is concatenated with the deep feature vector obtained using a lightweight convolutional neural network to obtain a 133-dimensional fused feature vector. The concatenated expression is: ,in For texture feature vectors, This is a depth feature vector.
9. The method for detecting and identifying a single empty cigarette according to claim 8, characterized in that, In step 1, step 4 specifically includes: Step 4-1: Train the classification model; Step 4-2: Perform real-time classification and judgment.
10. The method for detecting and identifying hollow cigarettes according to claim 9, characterized in that, In step 1, step 4-1 specifically includes: A support vector machine (SVM) classifier is constructed, taking the fused feature vector as input and "empty" or "normal" as the output label, and using the radial basis function as the kernel function. The SVM classifier is trained using a labeled dataset, and the model parameters are optimized using 5-fold cross-validation to achieve a classification accuracy of over 99%. Step 4-2 specifically includes: The fused feature vector of the cigarette to be detected is input into the trained SVM classifier, and the classification result is output. If the cigarette to be detected is determined to be "empty", the controller sends a signal to the rejection valve connected to it as a sorting execution device to reject the cigarette. At the same time, the detection result is uploaded to the host computer connected to the controller for quality traceability and statistical analysis. In step 4-2, the air outlet of the rejection valve must be aligned with the center of the cigarette filter, and the rejection phase of the rejection valve must be after the detection phase. At the location.
Citation Information
Patent Citations
Loose-end cigarette removing device
CN105852202A