Automatic identification device and method for scattered cigarette trays
Through high-resolution cameras and automatic visual recognition systems, combined with OCR technology and deep learning models, the problem of quantity and brand identification of loose cigarettes is solved, damaged cigarette boxes are discovered in a timely manner, production efficiency and quality control are improved, and costs and safety risks are reduced. .
Patent Information
- Application Number
- CN202410696579.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-09-06
AI Technical Summary
During the cigarette production process, existing technology is difficult to quickly and accurately identify the quantity and brand of loose cigarettes, resulting in low production efficiency and poor quality control. It is also difficult to detect damaged cigarette boxes in time, which may lead to product damage or safety accidents, increasing costs.
Using a high-resolution camera set and an automatic visual recognition system, through image acquisition, processing and recognition technology, automatic recognition of the number of loose discs, brand and damage to the outer surface of the cigarette box is achieved, including the combination of OCR technology and deep learning models for data comparison. Verify and evaluate.
It realizes the automatic identification of the quantity, brand and damage of the cigarette box, improves production efficiency and quality control, reduces manual errors and costs, and ensures product quality and safety.
Smart Images

Figure CN118608474A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cigarette processing, and in particular to an automatic identification device and method for cigarette loose trays. Background Art
[0002] Cigarettes are cylindrical tobacco products made of tobacco for people to smoke. They are mainly composed of tobacco leaves, cigarette paper, filters, etc., and cigarette trays refer to placing a certain number of cigarettes in a scattered state on a plate or container to facilitate cigarette rolling machines. This loose tray method can improve the production efficiency of cigarettes and reduce damage to cigarettes during transportation and storage.
[0003] In the cigarette production process, it is very important to automatically identify loose cigarette trays. The existing identification is basically through naked eye identification, and it is difficult to quickly and accurately know how many loose trays are used for production, so it is difficult to effectively arrange production plans, which reduces production efficiency. Manual counting of the number of loose trays may result in errors, and the quality control effect is low, which is prone to production errors and brand confusion. At the same time, damaged cigarette boxes may cause cigarettes to become damp, deformed or contaminated, thereby affecting product quality. Automatic identification of damaged cigarette boxes can detect problems in time and avoid sending damaged products to the market, while manual identification is difficult to do this. In addition, damaged cigarette boxes may be further damaged during transportation, and even cause safety accidents. Damaged cigarette boxes need to be repaired or replaced, which increases costs. Automatic identification of damage can help companies detect and deal with problems in time, thereby reducing costs. In view of this, an automatic identification device for loose cigarette trays is provided to overcome the above problems. Summary of the invention
[0004] In order to solve or partially solve the problems existing in the related art, the present application provides a device and method for automatically identifying loose trays of cigarettes, which can realize the purpose of automatic identification of the number of loose trays, automatic identification of brands and automatic identification of damage on the outer surface of cigarette boxes.
[0005] The present application provides an automatic identification device for loose trays of cigarettes, including a high-resolution camera group for automatically identifying the number of loose trays, automatically identifying the brand, and automatically identifying damage on the outer surface of a cigarette box, and a computer with a preset automatic visual recognition system, wherein the high-resolution camera group and the computer are electrically connected.
[0006] The steps of the method for automatically identifying loose trays of cigarettes are as follows:
[0007] Automatic identification of the number of loose discs;
[0008] Automatic identification of loose disk brands;
[0009] Automatic identification of damage on the outer surface of the smoke box.
[0010] Optionally, in some solutions, the step of automatically identifying the number of loose discs is:
[0011] S1. Loose disk image acquisition: Use a high-resolution camera to capture the image of the cigarette loose disk and distinguish each loose disk;
[0012] S2, scattered disk image processing: the collected image is transmitted to the automatic visual recognition system for processing, and the image is segmented to separate the scattered disk from the background;
[0013] S3. Counting the number of loose disks: Count the divided loose disks through an automatic visual recognition system to obtain the number of loose disks.
[0014] Optionally, in some solutions, the steps of automatically identifying the brand of the loose disk are:
[0015] Step 1: Brand logo image acquisition: Use a camera to capture the brand logo on the cigarette tray;
[0016] Step 2: Brand image processing: pre-process the collected brand logo images and improve recognition accuracy through denoising;
[0017] Step 3: Brand identification:
[0018] A: Input the pre-processed image into the OCR device and use OCR technology to recognize the text information in the image, i.e. the brand name;
[0019] B: Input the preprocessed image into the trained deep learning model, and the model will automatically recognize the brand name;
[0020] Use the test set to test methods A and B. That is, input the preprocessed images into the OCR device and the deep learning model respectively, record the brand recognition results of each image, compare the recognition results of the two methods with the real brand names annotated manually, and calculate the three indicators of accuracy, recall rate and F1 score;
[0021] Step 4: Database comparison: Compare the identified brand name with the brand information in the database to confirm the brand identity.
[0022] Optionally, in some schemes, the brand recognition process also includes preparing data sets, annotating data sets, experimental settings, model training and deployment, performance evaluation, optimization and iteration, and continuous monitoring and feedback, comparing and verifying brand recognition methods using OCR technology and deep learning models, so as to select a solution that is more suitable for brand recognition of loose cigarette trays.
[0023] Optionally, in some schemes, in S2, segmenting the image includes preprocessing the image by graying, removing noise in the image by filtering, and enhancing contrast, and the graying conversion formula is: [G = 0.299\times R + 0.587\times G + 0.114\times B], where (G) is the grayscale value, (R, G, B) are the values of the red, green, and blue color channels respectively; the filtering algorithm is: [G(x,y)=\frac{1}{2\pi\sigma^2}\sum_{s=-\infty}^{\infty}\sum_{t=-\infty}^{\infty}f(xs,yt)e^{-\frac{(s^2+t^2)}{2\sigma^2}}], where (f(x,y)) is the input image, (G(x,y)) is the filtered image, (\sigma) is the standard deviation of the Gaussian function, and the segmentation results can also be cleaned and improved by dilation and erosion in morphological operations, that is, removing small noise points, connecting broken edges, or separating contacting loose disks. The dilation algorithm is: (A\oplus B={z|(\hat{B})_z\cap A\neq\emptyset}), where (\hat{B}) is the reflection of the structural element (B), and the erosion algorithm is: (A\ominus B={z|B_z\subseteq A}), where (B_z) is the result of the translation (z) of the structural element (B).
[0024] Optionally, in some schemes, in S2, if the color or brightness difference between the scattered disk and the background is obvious, that is, contrast enhancement is required, the threshold is dynamically selected according to the local characteristics of the image, that is: first calculate the grayscale histogram of the image, that is, let the image grayscale level be L, n be the number of pixels of grayscale level i, and N be the total number of pixels in the image, then the grayscale histogram can be expressed as: [P(i)=\frac{n_i}{N},\quad 0\leq i\leq L-1], where P(i) is the probability of gray level i appearing, and then calculate the inter-class variance, that is, traverse all possible thresholds T, for each threshold T, divide the image into two categories: one is all pixels with gray values less than or equal to T, and the other is all pixels with gray values greater than T. Calculate the weights and average grayscale of the two categories, and use these values to calculate the inter-class variance σ2(T), which measures the difference in the average grayscale of the two categories of pixels, and select the optimal threshold, that is, select the threshold T that maximizes the inter-class variance σ2(T) as the optimal threshold, and finally apply the threshold for segmentation, that is, use the selected optimal threshold T to segment the image into foreground and background. Background, pixels with grayscale values less than or equal to T are foreground, and pixels with grayscale values greater than T are background. In calculating the inter-class variance, for the threshold T, the weights of the foreground and background are: [\omega_0(T)=\sum_{i=0}^{T}P(i)], [\omega_1(T)=\sum_{i=T+1}^{L-1}P(i)], where ω_0(T) and ω_1(T) are the pixel ratios of the foreground and background, respectively, and the average grayscales of the foreground and background are: [\mu_0(T)=\sum_{i=0}^{T}\frac{i P(i)}{\omega_0(T)}], [\mu_1(T)=\sum_{i=T+1}^{L-1}\frac{iP(i)}{\omega_1(T)}] , the inter-class variance is: [\sigma^2(T)=\omega_0(T)\omega_1(T)\left[\mu_0(T)-\mu_1(T)\right]^2.
[0025] Optionally, in some solutions, the steps of automatically identifying damage to the outer surface of the cigarette box are:
[0026] Ⅰ. Cigarette box image acquisition: Use a high-resolution camera to capture the outer surface of the cigarette box and capture possible damaged areas;
[0027] II. Smoke box image processing: The collected images are transmitted to the automatic visual recognition system for processing. Through image enhancement technology, the damaged areas are highlighted and the damaged edges are identified;
[0028] III. Damage detection: The automatic visual recognition system will automatically detect whether there are damaged areas, such as dents, cracks, and stains based on the processed images;
[0029] IV. Damage degree assessment: Based on the size, location and other information of the detected damaged area, the automatic visual recognition system can further assess the damage degree of the smoke box and provide corresponding reports or alarms.
[0030] Optionally, in some schemes, in step II, the specific steps of identifying the damaged edge are:
[0031] ① Gradient calculation: Calculate the gradient strength and direction of each pixel in the image. The gradient strength indicates the strength of the edge at the pixel, while the direction indicates the direction of the edge:
[0032] Gradient strength (G): (G = \sqrt{G_x^2+G_y^2})
[0033] Gradient direction ((\theta)): (\theta = \arctan\left(\frac{G_y}{G_x}\right))
[0034] Where (G_x) and (G_y) are the gradient components of the image in the (x) and (y) directions, respectively, which can be obtained by convolving the image with operators such as Sobel, Prewitt, and Roberts;
[0035] ②Threshold processing: Set a threshold. Only pixels whose gradient intensity exceeds this threshold are considered edge points. That is, edge point judgment: if (G>T), then the point is an edge point, where (T) is the set threshold.
[0036] ③. Edge connection: connect the detected edge points to form continuous edge lines;
[0037] ④. Remove short edges: Remove short edges whose length is less than a certain threshold, as these are usually caused by noise. By applying edge detection algorithms, we can effectively identify the damaged edges on the outer surface of the cigarette box, thereby determining whether the cigarette box is damaged and the degree of damage, which is of great significance for quality control and safety management in the cigarette production and logistics process.
[0038] Optionally, in some solutions, the grayscale value of a pixel point is replaced by the median of the grayscale values of the pixel point's neighborhood, i.e., denoising is used to improve the recognition accuracy during brand image processing. The specific steps are:
[0039] 1) Define the neighborhood: Choose an odd-sized filter window, 3x3 or 5x5, to ensure that there is a unique center pixel. This window defines the neighborhood of each pixel.
[0040] 2) Sort neighborhood pixel values: For each pixel in the image, obtain all pixel values in its neighborhood and sort these values by size;
[0041] 3) Replace the central pixel value: replace the current central pixel value with the median of the sorted neighboring pixel values. The median is the number in the middle of the sorted list. If the number of pixels is an odd number, the median is the number in the middle; if it is an even number, the median is the average of the two numbers in the middle.
[0042] 4) Traverse the entire image: Apply 1), 2) and 3) processes to each pixel in the image until the entire image has been processed;
[0043] 5) Formula: For each pixel (f(x,y)) in the image, its filtered value (g(x,y)) is the output of the median filter, that is: (g(x,y)=\text{median}{f(xk,yl),(k,l\in W)}), where (W) is the filter window, which includes the center pixel and all pixels in its neighborhood, and (\text{median}) represents the median operation.
[0044] The technical solution provided by this application may have the following beneficial effects:
[0045] 1. The present application uses a high-resolution camera group and a computer with a preset automatic visual recognition system to collect, process and count the number of scattered disk images, and in the process of processing, transmits the collected images to the automatic visual recognition system for processing, and segments the images to separate the scattered disks from the background. At the same time, the automatic visual recognition system counts the segmented scattered disks to obtain the number of scattered disks, thereby ensuring the effect of automatic recognition of the number of scattered disks and avoiding the problem that errors may occur in manual counting of the number of scattered disks;
[0046] 2. This application uses a camera to shoot the brand logo on a cigarette tray, pre-processes the collected brand logo image, and replaces the grayscale value of the pixel point with the median of the grayscale value of the pixel neighborhood in the process, that is, denoising to improve the recognition accuracy in the brand image processing process. The application also compares and verifies the brand recognition method using OCR technology and deep learning models by preparing data sets, annotating data sets, experimental settings, model training and deployment, testing and comparison, performance evaluation, optimization and iteration, and continuous monitoring and feedback. The existing image processing is single, and a more suitable solution for cigarette tray brand recognition is selected through new application methods, combination methods, and optimization methods, thereby ensuring the accuracy of automatic brand recognition and avoiding production errors and brand confusion.
[0047] 3. The present application uses a high-resolution camera to photograph the outer surface of the cigarette box, captures possible damaged areas, and transmits the collected images to an automatic visual recognition system for processing. Through image enhancement technology, the damaged areas are highlighted and the damaged edges are identified. At the same time, the automatic visual recognition system will automatically detect whether there are damaged areas, such as dents, cracks, and stains based on the processed images. Finally, based on the size, location and other information of the detected damaged areas, the automatic visual recognition system can further evaluate the degree of damage to the cigarette box and provide corresponding reports or alarms to ensure the accuracy of automatic identification of damage on the outer surface of the cigarette box, thereby ensuring the quality of cigarettes after production and avoiding sending damaged products to the market.
[0048] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The above and other objects, features and advantages of the present application will become more apparent through a more detailed description of exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present application.
[0050] Figure 1 It is a flow chart of this application. DETAILED DESCRIPTION
[0051] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.
[0052] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0053] In the description of the present application, it should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0054] Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0055] In view of the above problems, the embodiments of the present application provide a device and method for automatically identifying loose trays of cigarettes, which can realize the purpose of automatically identifying the number of loose trays, automatically identifying the brand, and automatically identifying the damage on the outer surface of the cigarette box.
[0056] The technical solution of the embodiments of the present application is described in detail below with reference to the accompanying drawings.
[0057] See also Figure 1 The automatic identification device for loose trays of cigarettes includes a high-resolution camera group for automatically identifying the number of loose trays, automatically identifying the brand, and automatically identifying damage on the outer surface of the cigarette box, and a computer with a preset automatic visual recognition system. The high-resolution camera group and the computer are electrically connected.
[0058] The steps of the method for automatically identifying loose trays of cigarettes are as follows:
[0059] Automatic identification of the number of loose discs;
[0060] Automatic identification of loose disk brands;
[0061] Automatic identification of damage on the outer surface of the smoke box.
[0062] In some embodiments, the step of automatically identifying the number of loose discs is:
[0063] S1. Loose disk image acquisition: Use a high-resolution camera to capture the image of the cigarette loose disk and distinguish each loose disk;
[0064] S2, scattered disk image processing: the collected image is transmitted to the automatic visual recognition system for processing, and the image is segmented to separate the scattered disk from the background;
[0065] S3. Counting the number of loose disks: Count the divided loose disks through an automatic visual recognition system to obtain the number of loose disks.
[0066] In some embodiments, the steps of automatically identifying the brand of the loose disk are:
[0067] Step 1: Brand logo image acquisition: Use a camera to capture the brand logo on the cigarette tray;
[0068] Step 2: Brand image processing: pre-process the collected brand logo images and improve recognition accuracy through denoising;
[0069] Step 3: Brand identification:
[0070] A: Input the pre-processed image into the OCR device and use OCR technology to recognize the text information in the image, i.e. the brand name;
[0071] B: Input the preprocessed image into the trained deep learning model, and the model will automatically recognize the brand name;
[0072] Use the test set to test methods A and B. That is, input the preprocessed images into the OCR device and the deep learning model respectively, record the brand recognition results of each image, compare the recognition results of the two methods with the real brand names annotated manually, and calculate the three indicators of accuracy, recall rate and F1 score;
[0073] Step 4: Database comparison: Compare the identified brand name with the brand information in the database to confirm the brand identity.
[0074] In some embodiments, the brand recognition process also includes preparing data sets, annotating data sets, experimental settings, model training and deployment, performance evaluation, optimization and iteration, and continuous monitoring and feedback, comparing and verifying brand recognition methods using OCR technology and deep learning models, so as to select a solution that is more suitable for brand recognition of loose cigarette trays.
[0075] Prepare the dataset to collect a series of brand logo images of loose cigarette trays. These images should cover different lighting conditions, background interference, font styles, and brand logo complexity factors to ensure that the dataset is diverse and comprehensive enough to reflect various situations in real production environments; Annotate the dataset to manually annotate the collected images to ensure that the brand name of each image is correctly labeled, which will serve as a benchmark for subsequent evaluation of model accuracy; The experiment is set up to divide the dataset into training set, validation set, and test set. For deep learning models, use the training set and validation set to train and adjust the model. OCR equipment does not require additional training steps, but ensure that the equipment is configured correctly and updated with the latest technology; Model training and deployment For deep learning models, use the training set and validation set to train the model, and adjust the model parameters on the validation set to optimize performance. After training, use the test set to evaluate the performance of the model. For OCR equipment, ensure that its software and hardware are in optimal condition and calibrate as needed; performance evaluation is to evaluate the accuracy of the two methods based on the test results, and compare their performance in terms of accuracy, processing speed, stability, etc. In addition, it is also possible to analyze which factors affect the recognition accuracy, such as lighting conditions, clarity of brand logos, and background interference; optimization and iteration is to optimize the methods with low recognition accuracy based on the evaluation results. For deep learning models, adjust the network structure, increase training data, and improve data preprocessing steps. For OCR equipment, you can adjust the device settings, update the software version, or consider using more advanced OCR technology; continuous monitoring and feedback is to continuously monitor the performance of the brand recognition system after it is deployed in the production environment, and regularly collect user feedback. According to the monitoring results and user feedback, the system is optimized and updated in a timely manner to ensure continuous improvement in recognition accuracy.
[0076] In some embodiments, in S2, segmenting the image includes preprocessing the image by graying, removing noise in the image by filtering, and enhancing contrast. The graying conversion formula is: [G = 0.299\times R + 0.587\timesG + 0.114\times B], where (G) is the grayscale value, (R, G, B) are the values of the red, green, and blue color channels respectively; the filtering algorithm is: [G(x,y)=\frac{1}{2\pi\sigma^2}\sum_{s=-\infty}^{\infty}\sum_{t=-\infty}^{\infty}f(xs,yt)e^{-\frac{(s^2+t^2)}{2\sigma^2}}], where (f(x,y)) is the input image, (G(x,y)) is the filtered image, (\sigma) is the standard deviation of the Gaussian function, and the segmentation results can also be cleaned and improved by dilation and erosion in morphological operations, that is, removing small noise points, connecting broken edges, or separating contacting loose disks. The dilation algorithm is: (A\oplus B={z|(\hat{B})_z\cap A\neq\emptyset}), where (\hat{B}) is the reflection of the structural element (B), and the erosion algorithm is: (A\ominus B={z|B_z\subseteq A}), where (B_z) is the result of the translation (z) of the structural element (B).
[0077] In some embodiments, in S2, if the color or brightness difference between the scattered disk and the background is obvious, that is, contrast enhancement is required, the threshold is dynamically selected according to the local characteristics of the image, that is: first calculate the grayscale histogram of the image, that is, let the image grayscale level be L, n be the number of pixels of grayscale level i, and N be the total number of pixels in the image, then the grayscale histogram can be expressed as: [P(i)=\frac{n_i}{N},\quad 0\leq i\leq L-1], where P(i) is the probability of gray level i appearing, and then calculate the inter-class variance, that is, traverse all possible thresholds T, for each threshold T, divide the image into two categories: one is all pixels with gray values less than or equal to T, and the other is all pixels with gray values greater than T. Calculate the weights and average grayscale of the two categories, and use these values to calculate the inter-class variance σ2(T), which measures the difference in the average grayscale of the two categories of pixels, and select the optimal threshold, that is, select the threshold T that maximizes the inter-class variance σ2(T) as the optimal threshold. Finally, apply the threshold for segmentation, that is, use the selected optimal threshold T to segment the image into foreground and background. Pixels with gray values less than or equal to T are foregrounds, and pixels with gray values greater than T are backgrounds. In calculating the inter-class variance, for threshold T, the weights of foreground and background are: [\omega_0(T)=\ sum_{i=0}^{T}P(i)], [\omega_1(T)=\sum_{i=T+1}^{L-1}P(i)], where ω_0(T) and ω_1(T) are the pixel ratios of foreground and background respectively, and the average grayscale of foreground and background are: [\mu_0(T)=\sum_{i=0}^{T}\frac{iP(i)}{\omega_0(T)}], [\mu_1(T)=\sum_{i=T+1}^{L-1}\frac{iP(i)}{\omega_1(T)}], and the between-class variance is: [\sigma^2(T)=\omega_0(T)\omega_1(T)\left[\mu_0(T)-\mu_1(T)\right]^2.
[0078] In some embodiments, the steps of automatically identifying damage to the outer surface of the cigarette box are:
[0079] Ⅰ. Cigarette box image acquisition: Use a high-resolution camera to capture the outer surface of the cigarette box and capture possible damaged areas;
[0080] II. Smoke box image processing: The collected images are transmitted to the automatic visual recognition system for processing. Through image enhancement technology, the damaged areas are highlighted and the damaged edges are identified;
[0081] III. Damage detection: The automatic visual recognition system will automatically detect whether there are damaged areas, such as dents, cracks, and stains based on the processed images;
[0082] IV. Damage degree assessment: Based on the size, location and other information of the detected damaged area, the automatic visual recognition system can further assess the damage degree of the smoke box and provide corresponding reports or alarms.
[0083] In some embodiments, in step II, the specific steps of identifying the damaged edge are:
[0084] ① Gradient calculation: Calculate the gradient strength and direction of each pixel in the image. The gradient strength indicates the strength of the edge at the pixel, while the direction indicates the direction of the edge:
[0085] Gradient strength (G): (G = \sqrt{G_x^2+G_y^2})
[0086] Gradient direction ((\theta)): (\theta = \arctan\left(\frac{G_y}{G_x}\right))
[0087] Where (G_x) and (G_y) are the gradient components of the image in the (x) and (y) directions, respectively, which can be obtained by convolving the image with operators such as Sobel, Prewitt, and Roberts;
[0088] ②Threshold processing: Set a threshold. Only pixels whose gradient intensity exceeds this threshold are considered edge points. That is, edge point judgment: if (G>T), then the point is an edge point, where (T) is the set threshold.
[0089] ③. Edge connection: connect the detected edge points to form continuous edge lines;
[0090] ④. Remove short edges: Remove short edges whose length is less than a certain threshold, as these are usually caused by noise. By applying edge detection algorithms, we can effectively identify the damaged edges on the outer surface of the cigarette box, thereby determining whether the cigarette box is damaged and the degree of damage, which is of great significance for quality control and safety management in the cigarette production and logistics process.
[0091] In some implementations, the grayscale value of a pixel point is replaced by the median of the grayscale values of the pixel point's neighborhood, i.e., denoising improves the recognition accuracy in the brand image processing process. The specific steps are:
[0092] 1) Define the neighborhood: Choose an odd-sized filter window, 3x3 or 5x5, to ensure that there is a unique center pixel. This window defines the neighborhood of each pixel.
[0093] 2) Sort neighborhood pixel values: For each pixel in the image, obtain all pixel values in its neighborhood and sort these values by size;
[0094] 3) Replace the central pixel value: replace the current central pixel value with the median of the sorted neighboring pixel values. The median is the number in the middle of the sorted list. If the number of pixels is an odd number, the median is the number in the middle; if it is an even number, the median is the average of the two numbers in the middle.
[0095] 4) Traverse the entire image: Apply 1), 2) and 3) processes to each pixel in the image until the entire image has been processed;
[0096] 5) Formula: For each pixel (f(x,y)) in the image, its filtered value (g(x,y)) is the output of the median filter, that is: (g(x,y)=\text{median}{f(xk,yl),(k,l\in W)}), where (W) is the filter window, which includes the center pixel and all pixels in its neighborhood, and (\text{median}) represents the median operation.
[0097] The automatic identification of the number of cigarette trays, the brand and the damage on the outer surface of the cigarette box can greatly improve the efficiency and accuracy of the cigarette production and logistics process.
[0098] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms include, include or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0099] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0100] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. An automatic identification device and method for bulk cigarette trays, characterized in that: The automatic identification device for cigarette trays includes a high-resolution camera group for automatically identifying the number of trays, the brand, and the damage on the outer surface of the cigarette box, and a computer with a preset automatic visual recognition system. The high-resolution camera group and the computer are electrically connected.
2. The identification method for the automatic identification device for cigarette trays according to claim 1, characterized in that: The steps of the method for automatically identifying loose trays of cigarettes are as follows: Automatic identification of the number of loose discs; Automatic identification of loose disk brands; Automatic identification of damage on the outer surface of the smoke box.
3. The method for automatically identifying loose trays of cigarettes according to claim 2, characterized in that: The steps for automatically identifying the number of loose discs are as follows: S1. Loose disk image acquisition: Use a high-resolution camera to capture the image of the cigarette loose disk and distinguish each loose disk; S2, scattered disk image processing: the collected image is transmitted to the automatic visual recognition system for processing, and the image is segmented to separate the scattered disk from the background; S3. Counting the number of loose disks: Count the divided loose disks through an automatic visual recognition system to obtain the number of loose disks.
4. The method for automatically identifying loose trays of cigarettes according to claim 2 or 3, characterized in that: The steps for automatically identifying the brand of the loose disk are as follows: Step 1: Brand logo image acquisition: Use a camera to capture the brand logo on the cigarette tray; Step 2: Brand image processing: pre-process the collected brand logo images and improve recognition accuracy through denoising; Step 3: Brand identification: A: Input the pre-processed image into the OCR device and use OCR technology to recognize the text information in the image, i.e. the brand name; B: Input the preprocessed image into the trained deep learning model, and the model will automatically recognize the brand name; Use the test set to test methods A and B. That is, input the preprocessed images into the OCR device and the deep learning model respectively, record the brand recognition results of each image, compare the recognition results of the two methods with the real brand names annotated manually, and calculate the three indicators of accuracy, recall rate and F1 score; Step 4: Database comparison: Compare the identified brand name with the brand information in the database to confirm the brand identity.
5. The method for automatically identifying loose trays of cigarettes according to claim 4, characterized in that: The brand recognition process also includes preparing data sets, annotating data sets, experimental settings, model training and deployment, performance evaluation, optimization and iteration, and continuous monitoring and feedback. The brand recognition methods using OCR technology and deep learning models are compared and verified to select a solution that is more suitable for brand recognition of loose cigarette trays.
6. The method for automatically identifying loose trays of cigarettes according to claim 3 or 5, characterized in that: In S2, the image segmentation includes image preprocessing by graying, removing noise in the image by filtering, and contrast enhancement. The graying conversion formula is: [G = 0.299\times R + 0.587\times G + 0.114\times B], where (G) is the grayscale value, (R, G, B) are the values of the red, green, and blue color channels respectively; the filtering algorithm is: [G(x,y)=\frac{1}{2\pi\sigma^2}\sum_{s=-\infty}^{\infty}\sum_{t=-\infty}^{\infty}f(xs,yt)e^{-\frac{(s^2+t^2)}{2\sigma^2}}], where (f(x,y)) is the input image, (G(x,y)) is the filtered image, (\sigma) is the standard deviation of the Gaussian function, and the segmentation results can also be cleaned and improved by dilation and erosion in morphological operations, that is, removing small noise points, connecting broken edges, or separating contacting loose disks. The dilation algorithm is: (A\oplus B={z|(\hat{B})_z\cap A\neq\emptyset}), where (\hat{B}) is the reflection of the structural element (B), and the erosion algorithm is: (A\ominus B={z|B_z\subseteq A}), where (B_z) is the result of the translation (z) of the structural element (B).
7. The method for automatically identifying loose trays of cigarettes according to claim 6, characterized in that: In S2, if the color or brightness difference between the scattered disk and the background is obvious, that is, contrast enhancement is required, the threshold is dynamically selected according to the local characteristics of the image, that is: first calculate the grayscale histogram of the image, that is, let the image grayscale level be L, n be the number of pixels of grayscale level i, and N be the total number of pixels in the image, then the grayscale histogram can be expressed as: [P(i)=\frac{n_i}{N},\quad 0\leq i\leqL-1], where P(i) is the probability of gray level i appearing, and then calculate the inter-class variance, that is, traverse all possible thresholds T, for each threshold T, divide the image into two categories: one is all pixels with gray values less than or equal to T, and the other is all pixels with gray values greater than T. Calculate the weights and average grayscale of the two categories, and use these values to calculate the inter-class variance σ2(T), which measures the difference in the average grayscale of the two categories of pixels, and select the optimal threshold, that is, select the threshold T that maximizes the inter-class variance σ2(T) as the optimal threshold, and finally apply the threshold for segmentation, that is, use the selected optimal threshold T to segment the image into the previous The pixels with grayscale values less than or equal to T are foreground, and the pixels with grayscale values greater than T are background. In calculating the inter-class variance, for the threshold T, the weights of foreground and background are: [\omega_0(T)=\sum_{i=0}^{T}P(i)], [\omega_1(T)=\sum_{i=T+1}^{L-1}P(i)], where ω_0(T) and ω_1(T) are the pixel ratios of foreground and background, respectively. The average grayscales of foreground and background are: [\mu_0(T)=\sum_{i=0}^{T}\frac{i P(i)}{\omega_0(T)}], [\mu_1(T)=\sum_{i=T+1}^{L-1}\frac{i P(i)}{\omega_1(T)}], the inter-class variance is: [\sigma^2(T)=\omega_0(T)\omega_1(T)\left[\mu_0(T)-\mu_1(T)\right]^2.
8. The method for automatically identifying loose trays of cigarettes according to claim 7, characterized in that: The steps for automatically identifying damage on the outer surface of the smoke box are as follows: Ⅰ. Cigarette box image acquisition: Use a high-resolution camera to capture the outer surface of the cigarette box and capture possible damaged areas; II. Smoke box image processing: The collected images are transmitted to the automatic visual recognition system for processing. Through image enhancement technology, the damaged areas are highlighted and the damaged edges are identified; III. Damage detection: The automatic visual recognition system will automatically detect whether there are damaged areas, such as dents, cracks, and stains based on the processed images; IV. Damage degree assessment: Based on the size, location and other information of the detected damaged area, the automatic visual recognition system can further assess the damage degree of the smoke box and provide corresponding reports or alarms.
9. The method for automatically identifying loose trays of cigarettes according to claim 8, characterized in that: In step II, the specific steps for identifying the damaged edge are: ① Gradient calculation: Calculate the gradient strength and direction of each pixel in the image. The gradient strength indicates the strength of the edge at the pixel, while the direction indicates the direction of the edge: Gradient strength (G): (G = \sqrt{G_x^2+G_y^2}) Gradient direction ((\theta)): (\theta = \arctan\left(\frac{G_y}{G_x}\right)) Where (G_x) and (G_y) are the gradient components of the image in the (x) and (y) directions, respectively, which can be obtained by convolving the image with operators such as Sobel, Prewitt, and Roberts; ②Threshold processing: Set a threshold. Only pixels whose gradient intensity exceeds this threshold are considered edge points. That is, edge point judgment: if (G>T), then the point is an edge point, where (T) is the set threshold. ③. Edge connection: connect the detected edge points to form continuous edge lines; ④. Remove short edges: Remove short edges whose length is less than a certain threshold, as these are usually caused by noise. By applying edge detection algorithms, we can effectively identify the damaged edges on the outer surface of the cigarette box, thereby determining whether the cigarette box is damaged and the degree of damage, which is of great significance for quality control and safety management in the cigarette production and logistics process.
10. The method for automatically identifying loose trays of cigarettes according to claim 9, characterized in that: The gray value of the pixel point is replaced by the median of the gray value of the pixel point's neighborhood, that is, denoising improves the recognition accuracy in the brand image processing process. The specific steps are: 1) Define the neighborhood: Choose an odd-sized filter window, 3x3 or 5x5, to ensure that there is a unique center pixel. This window defines the neighborhood of each pixel. 2) Sort neighborhood pixel values: For each pixel in the image, obtain all pixel values in its neighborhood and sort these values by size; 3) Replace the central pixel value: replace the current central pixel value with the median of the sorted neighboring pixel values. The median is the number in the middle of the sorted list. If the number of pixels is an odd number, the median is the number in the middle; if it is an even number, the median is the average of the two numbers in the middle. 4) Traverse the entire image: Apply 1), 2) and 3) processes to each pixel in the image until the entire image has been processed; 5) Formula: For each pixel (f(x,y)) in the image, its filtered value (g(x,y)) is the output of the median filter, that is: (g(x,y)=\text{median}{f(xk,yl),(k,l\in W)}), where (W) is the filter window, which includes the center pixel and all pixels in its neighborhood, and (\text{median}) represents the median operation.
