Method for identifying authenticity of cigarette

Through image preprocessing and multi-level feature extraction methods, combined with convolutional neural network and database feature extraction, similarity calculation and dynamic authenticity determination are carried out, which solves the bottleneck problem of deep learning models in cigarette recognition in the existing technology, and achieves more efficient and accurate cigarette authenticity recognition.

CN119810824APending Publication Date: 2025-04-11HENAN TOBACCO CO XINYANG BRANCH

Patent Information

Application Number
CN202411862007.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, the identification of cigarettes through deep learning models requires a large amount of labeled data for training, which requires high requirements for hardware equipment, and there is a bottleneck in the inference speed of deep learning models.

Method used

Image preprocessing technology is adopted, including grayscale, contrast enhancement and noise removal. Through multi-level feature extraction and refined selection, combined with convolutional neural network and database feature extraction, similarity calculation and dynamic authenticity determination are performed.

Benefits of technology

It improves the accuracy and efficiency of cigarette recognition, reduces the requirements for hardware equipment, enhances the ability to identify real and fake cigarettes, and makes the identification process more objective.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810824A_ABST
    Figure CN119810824A_ABST
Patent Text Reader

Abstract

The invention discloses a method for identifying authenticity of cigarettes. The method comprises the following steps: preprocessing an image; the extracted cigarette picture is preprocessed; extracting features; performing multi-stage feature extraction and fine selection on the preprocessed cigarette picture, and extracting key information of the image through a descriptor; similarity calculation is used for comparing descriptors of test samples with database descriptors, and averaging the maximum similarities of all test features to obtain overall similarity; performing dynamic authenticity judgment; and comparing the dynamic threshold value with the overall similarity, and judging whether the cigarette is true or false. According to the method, through image preprocessing, noise elimination and image quality enhancement, the characteristics of the cigarettes can be better extracted, so that the identification accuracy is improved. Through the application of the dynamic threshold function, cigarette image changes under different conditions can be adapted, so that the identification capability of true and false cigarettes is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of cigarette identification, and in particular relates to a method for identifying the authenticity of cigarettes. Background Art

[0002] At present, counterfeit cigarette manufacturers use advanced rolling and packaging equipment and have their own process formulas. The quality of their rolling and processing is almost indistinguishable from that of the "genuine" products, making it increasingly difficult to distinguish fake cigarettes from real ones in appearance, to the point where they are indistinguishable from the real ones, and consumers are often deceived.

[0003] In the prior art, for example, the technical solution described in the patent with publication number CN116030244A is: a method and system for cigarette authenticity identification based on deep learning, including: collecting positive sample data and negative sample data and performing labeling processing; constructing a sub-image block data set; constructing a cigarette authenticity identification model, and using the sub-image block data set to train the cigarette authenticity identification model until the model converges; inputting the scanned image of the cigarette to be identified into the trained cigarette authenticity identification model, and outputting the cigarette authenticity identification result.

[0004] In the prior art, distinguishing the authenticity of cigarettes based on deep learning models usually requires a large amount of labeled data for training, which has high requirements for hardware equipment. Deep learning models have bottlenecks in reasoning speed, affecting real-time performance. Summary of the invention

[0005] The purpose of the present invention is to provide a method for identifying the authenticity of cigarettes, so as to solve the problems in the prior art proposed in the background technology that cigarettes are identified through deep learning models, a large amount of labeled data is required for training, the hardware equipment requirements are high, and the deep learning model has a bottleneck in the reasoning speed.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A method for identifying the authenticity of cigarettes, comprising the following steps:

[0008] Step S1, image preprocessing: preprocessing the extracted cigarette image, the preprocessing includes graying the image, contrast enhancement and noise removal;

[0009] Step S2, feature extraction: performing multi-level feature extraction and refined selection on the pre-processed cigarette images, extracting key information of the images through descriptors for subsequent similarity calculation;

[0010] Step S3, similarity calculation; the similarity calculation is used to compare the descriptor of the test sample with the database descriptor, and the maximum similarities of all test features are averaged to obtain the overall similarity;

[0011] Step S4, dynamic authenticity determination; generate a dynamic threshold function through statistical analysis to obtain a dynamic threshold; and compare the dynamic threshold with the overall similarity to determine the authenticity of the cigarette.

[0012] According to the above technical solution, in step S1, the color image is converted into a grayscale image to simplify the calculation complexity, and only the intensity information is retained. The specific calculation is shown in the following formula:

[0013] I gray (x, y)=0.299·R(x,y)+0.587·G(x,y)+0.114·B(x,y)

[0014] Where R(x, y), G(x, y), and B(x, y) represent the red, green, and blue channel values ​​of the pixel position (x, y), respectively; gray (x, y) represents a grayscale image.

[0015] According to the above technical solution, in step S1, contrast enhancement uses adaptive histogram equalization (CLAHE) to enhance image details:

[0016] I cnhanced =CLAHE(I gray )

[0017] In the formula, I cnhanccd Represents an image with enhanced details. Adaptive histogram equalization evens out the distribution of pixel values ​​in local areas of the image to improve contrast.

[0018] According to the above technical solution, in step S1, Gaussian filtering is used to remove image noise to make the image clearer and reduce errors. The specific calculation is:

[0019]

[0020] Where G(i, j, σ) represents the Gaussian kernel function I preprocessed (x, y) represents the image features after filtering out noise; k represents the kernel radius; G(i, j, σ) represents the Gaussian kernel function; this function determines the weighting coefficient according to the spatial position (i, j) and the standard deviation σ, which is used to perform weighted averaging on the surrounding pixel values ​​of the central pixel; I cnhanced (x+i, y+i) represents the pixel value with an offset of (i, j) in the neighborhood of pixel (x, y). The above formula means using filtering to filter out the noise in the image. At each pixel position (x, y) in the image, a window centered at (x, y) is defined (the size is determined by k), and each pixel in the window is calculated based on its position offset (i, j). Each pixel value I in the window cnhanced(x+i, y+i) is weighted according to the Gaussian kernel function G(i, j, σ), and the calculation result is assigned to the filtered pixel value I preprocessed (x, y).

[0021] According to the above technical solution, in step S2, the multi-level feature extraction includes convolutional neural network extraction and database feature extraction, and the deep features of the image are extracted by the convolutional neural network, where each convolution layer l will generate a feature map F l , the specific calculation is shown as follows:

[0022]

[0023] In the formula, I preprocessed (x+i, y+i) represents the image feature after filtering out noise with an offset of (i, j) in the neighborhood of pixel (x, y); W l is the convolution kernel, b l is the bias term.

[0024] According to the above technical solution, the output of the convolutional layer is concatenated into a descriptor matrix D test , each descriptor d i test Corresponding to a local feature on the cigarette package, the descriptor matrix is ​​expressed as follows:

[0025]

[0026] Where D test represents the descriptor matrix of the convolutional layer output, Descriptor representing the output of the convolutional layer;

[0027] For each cigarette sample in the database Generate descriptor matrix The database characteristics are described as follows:

[0028]

[0029] In the formula, represents the descriptor matrix generated for each cigarette sample in the database; Represents the descriptors generated for each cigarette sample in the database.

[0030] According to the above technical solution, similarity calculation includes cosine similarity calculation, local sensitive hash accelerated matching, maximum similarity matching and average similarity calculation; wherein, cosine similarity calculation is specifically as follows:

[0031]

[0032] In the formula, The inner product of two vectors is calculated to reflect the relationship between the two eigenvectors in the feature space; and d db (k, j) represents the feature vector; and ||d db (k, j)|| represents the size of the two feature vectors, respectively, ensuring that the calculated similarity is not affected by the length of the feature vector.

[0033] According to the above technical solution, for each test feature, the feature with the maximum similarity in the feature set in the database is found to determine the cigarette image. The maximum similarity feature is calculated as:

[0034]

[0035] In the formula, for each test feature d test , by traversing the database feature set D db(k) , calculate the cosine similarity of the database feature set and record the maximum similarity value S maxi .

[0036] According to the above technical solution, the maximum similarities of all test features are averaged to obtain the overall similarity, and the overall similarity is used to determine whether the cigarette is genuine. The overall similarity is calculated by the following formula:

[0037]

[0038] In the formula, S avg Indicates the overall similarity; Smax indicates the maximum similarity.

[0039] According to the above technical solution, a dynamic threshold function is generated through statistical analysis, and the dynamic threshold is specifically:

[0040] τ dynamic =f(cigarette type, historical data)

[0041] In the formula, τ dynamic represents the dynamic threshold; f represents the dynamic threshold function;

[0042] The dynamic threshold is compared with the overall similarity to determine whether the cigarette is real or fake:

[0043]

[0044] In the formula, τ dynamic represents the dynamic threshold, S avg Indicates the overall similarity.

[0045] Compared with the prior art, the present invention has the following beneficial effects:

[0046] In the present invention, by image preprocessing, eliminating noise and enhancing image quality, the features of cigarettes can be better extracted, thereby improving recognition accuracy. By applying a dynamic threshold function, the method can adapt to changes in cigarette images under different conditions, thereby enhancing the ability to identify genuine and fake cigarettes; the automated processing and judgment process reduces the errors caused by human judgment, making the identification process more objective. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 The figure is a flow chart of the cigarette authenticity identification method of the present invention. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] Embodiment 1

[0050] like Figure 1 As shown, a method for identifying the authenticity of cigarettes comprises the following steps:

[0051] Step S1, image preprocessing: preprocessing the extracted cigarette image, the preprocessing includes graying the image, contrast enhancement and noise removal;

[0052] Step S2, feature extraction: performing multi-level feature extraction and refined selection on the pre-processed cigarette images, extracting key information of the images through descriptors for subsequent similarity calculation;

[0053] Step S3, similarity calculation; the similarity calculation is used to compare the descriptor of the test sample with the database descriptor, and the maximum similarities of all test features are averaged to obtain the overall similarity;

[0054] Step S4, dynamic authenticity determination; generate a dynamic threshold function through statistical analysis to obtain a dynamic threshold; and compare the dynamic threshold with the overall similarity to determine the authenticity of the cigarette.

[0055] In the present invention, by image preprocessing, eliminating noise and enhancing image quality, the features of cigarettes can be better extracted, thereby improving recognition accuracy. By applying a dynamic threshold function, the method can adapt to changes in cigarette images under different conditions, thereby enhancing the ability to identify genuine and fake cigarettes; the automated processing and judgment process reduces the errors caused by human judgment, making the identification process more objective.

[0056] Embodiment 2

[0057] This embodiment provides a specific implementation method, and the method for identifying the authenticity of cigarettes includes four steps, including: image preprocessing, feature extraction, similarity calculation and dynamic authenticity determination.

[0058] Step 1: Image preprocessing is used to standardize the input image to make feature extraction more robust. The main processing steps include grayscale, contrast enhancement, and noise removal.

[0059] Step 101, Grayscale Conversion: Converting a color image to a grayscale image can simplify the computational complexity and only retain the intensity information:

[0060] I gray (x, y)=0.299·R(x,y)+0.587·G(x,y)+0.114·B(x,y)

[0061] Where R(x, y), G(x, y), and B(x, y) represent the red, green, and blue channel values ​​of the pixel position (x, y), respectively; gray (x, y) represents a grayscale image.

[0062] Step 102: Contrast Enhancement

[0063] Adopting adaptive histogram equalization (CLAHE) to enhance image details:

[0064] I cnhanced =CLAHE(I gray )

[0065] In the formula, I cnhanccd Represents an image with enhanced details. Adaptive histogram equalization evens out the distribution of pixel values ​​in local areas of the image to improve contrast.

[0066] Here, CLAHE evens out the pixel value distribution in local areas of the image to improve the contrast.

[0067] Step 2: Feature extraction. In the process of cigarette authenticity identification, the feature extraction step is the key, because high-quality features can significantly improve the recognition and accuracy of the model.

[0068] In order to further optimize feature extraction, multi-level feature extraction and refined selection are adopted, and a hybrid feature scheme combining deep features and cigarette process features is used. The goal of feature extraction is to extract the key information of the image through descriptors to facilitate subsequent similarity calculation.

[0069] Step 201, convolutional neural network feature extraction; Input: preprocessed image I preprocessed; Output: feature descriptor matrix D test .

[0070] The deep features of the image are extracted through the convolutional layer, where each convolutional layer produces a feature map F l .

[0071] Convolutional layer feature extraction formula:

[0072]

[0073] In the formula, I preprocessed (x+i, y+i) represents the image feature after filtering out noise with an offset of (i, j) in the neighborhood of pixel (x, y); W l is the convolution kernel, b l is the bias term. l is the convolution kernel, b l is the bias term.

[0074] Step 202, feature descriptor generation: concatenate the output of the convolutional layer into a descriptor matrix D test , each descriptor Corresponding to a local feature on the cigarette packaging.

[0075] The descriptor matrix is ​​represented as:

[0076]

[0077] Where D test represents the descriptor matrix of the convolutional layer output, Descriptor representing the output of a convolutional layer.

[0078] Step 203: Database feature extraction: for each cigarette sample in the database Generate descriptor matrix

[0079] The database characteristics are described as follows:

[0080]

[0081] In the formula, represents the descriptor matrix generated for each cigarette sample in the database; Represents the descriptors generated for each cigarette sample in the database.

[0082] Step 3, similarity calculation; the purpose of similarity calculation is to compare the descriptors of the test sample with the database descriptors to find the most matching cigarette sample.

[0083] Step 301, cosine similarity; cosine similarity is a commonly used measurement method, especially in high-dimensional space, which can effectively quantify the similarity between two feature vectors.

[0084] Its value ranges from -1 to 1, where 1 indicates perfect similarity, 0 indicates no similarity, and -1 indicates the exact opposite.

[0085] For two eigenvectors and d db(k,j) , and the similarity calculation formula is:

[0086]

[0087] In the formula, The inner product of two vectors is calculated to reflect the relationship between the two eigenvectors in the feature space; and d db(k,j) represents the feature vector; and ||d db(k,j) || represents the size of the two feature vectors, ensuring that the calculated similarity is not affected by the length of the feature vector.

[0088] Step 302: Locality Sensitive Hashing (LSH) accelerates matching; Locality Sensitive Hashing is a data structure used to accelerate similarity search in high-dimensional space. It reduces the number of similarity calculations by mapping similar objects into the same hash bucket.

[0089] The hash function is defined as:

[0090]

[0091] Wherein, the feature vector v represents the features extracted from the cigarette image.

[0092] The random vector r is used to generate a random vector for hash values.

[0093] The hash bucket width w is used to determine the distribution range of the hash value.

[0094] When there is a new test feature d test When matching is required, first calculate its hash value, quickly retrieve the candidate features through the hash bucket, and then perform accurate similarity calculation.

[0095] Step 303, maximum similarity matching: for each test feature, find the feature with the maximum similarity with the feature set in the database to determine the most likely identity of the cigarette. The overall similarity is calculated by the following formula:

[0096]

[0097] Maximum: For each test feature d test ; By traversing the database feature set D db(k) , calculate the cosine similarity and record the maximum similarity value S max . Maximum similarity S max : Represents the current test feature and the most similar cigarette feature in the database, which is the key indicator of the recognition result.

[0098] Step 304, average similarity: In order to evaluate the overall recognition capability of the system, the maximum similarities of all test features are averaged.

[0099]

[0100] In the formula, S avg Represents the overall similarity; Smax represents the maximum similarity. The overall similarity S is obtained by averaging the maximum similarities of all test features. avg , used to evaluate the overall performance of the system.

[0101] If S avg If it is above a certain threshold, it can be judged as authentic; otherwise, it may be a fake.

[0102] Step 4: Dynamic authenticity determination: using dynamic threshold τ dynamic Different similarity thresholds are set according to cigarette types and historical data to increase judgment accuracy.

[0103] Step 401: Different cigarette types have different similarity thresholds for feature details. A dynamic threshold function (cigarette type) is generated through statistical analysis to obtain a threshold value τ dynamic .

[0104] Dynamic threshold function:

[0105] τ dynamic =f(cigarette type, historical data)

[0106] In the formula, τ dynamic represents the dynamic threshold; f represents the dynamic threshold function;

[0107] The dynamic threshold is compared with the overall similarity to determine whether the cigarette is real or fake:

[0108]

[0109] In the formula, τ dynamic represents the dynamic threshold, S avg Indicates the overall similarity.

[0110] It should be noted that, in this article, relational terms such as first and second, etc. are only used 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", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including 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.

[0111] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for identifying the authenticity of cigarettes, characterized in that: The following steps are involved: Step S1, image preprocessing: preprocessing the extracted cigarette image, the preprocessing includes graying the image, contrast enhancement and noise removal; Step S2, feature extraction: performing multi-level feature extraction and refined selection on the pre-processed cigarette images, extracting key information of the images through descriptors for subsequent similarity calculation; Step S3, similarity calculation; the similarity calculation is used to compare the descriptor of the test sample with the database descriptor, and the maximum similarities of all test features are averaged to obtain the overall similarity; Step S4, dynamic authenticity determination; generate a dynamic threshold function through statistical analysis to obtain a dynamic threshold; and compare the dynamic threshold with the overall similarity to determine the authenticity of the cigarette.

2. A method for identifying the authenticity of cigarettes according to claim 1, characterized in that: In step S1, the color image is converted into a grayscale image to simplify the calculation complexity and only retain the intensity information. The specific calculation is shown in the following formula: I gray (x,y)=0.299·R(x,y)+0.587·G(x,y)+0.114·B(x,y) Where R(x, y), G(x, y), and B(x, y) represent the red, green, and blue channel values ​​of the pixel position (x, y), respectively; gray (x, y) represents a grayscale image.

3. A method for identifying the authenticity of cigarettes according to claim 2, characterized in that: In step S1, contrast enhancement uses adaptive histogram equalization (CLAHE) to enhance image details: I enhanced =CLAHE(I gray ) In the formula, I cnhanccd Represents an image with enhanced details. Adaptive histogram equalization evens out the distribution of pixel values ​​in local areas of the image to improve contrast.

4. A method for identifying the authenticity of cigarettes according to claim 3, characterized in that: In step S1, Gaussian filtering is used to remove image noise to make the image clearer and reduce errors. The specific calculation is: Where G(i, j, σ) represents the Gaussian kernel function I preprocessed (x, y) represents the image features after filtering out noise; k represents the kernel radius; G(i, j, σ) represents the Gaussian kernel function; this function determines the weighting coefficient according to the spatial position (i, j) and the standard deviation σ, which is used to perform weighted averaging on the surrounding pixel values ​​of the central pixel; I cnhanced (x+i, y+i) represents the pixel value with an offset of (i, j) in the neighborhood of pixel (x, y).

5. A method for identifying the authenticity of cigarettes according to claim 4, characterized in that: In step S2, multi-level feature extraction includes convolutional neural network extraction and database feature extraction. The deep features of the image are extracted by convolutional neural network, where each convolution layer l generates a feature map F l , the specific calculation is shown as follows: In the formula, F l (x, y) represents the feature map at pixel (x, y); W l is the convolution kernel, b l is the bias term, I cnhanced (x+i, y+i) represents the pixel value with an offset of (i, j) in the neighborhood of pixel (x, y).

6. A method for identifying the authenticity of cigarettes according to claim 5, characterized in that: Concatenate the output of the convolutional layer into a descriptor matrix D test , each descriptor d i test Corresponding to a local feature on the cigarette package, the descriptor matrix is ​​expressed as follows: Where D test represents the descriptor matrix of the convolutional layer output, Descriptor representing the output of the convolutional layer; For each cigarette sample in the database Generate descriptor matrix The database characteristics are described as follows: In the formula, represents the descriptor matrix generated for each cigarette sample in the database; Represents the descriptors generated for each cigarette sample in the database.

7. A method for identifying the authenticity of cigarettes according to claim 6, characterized in that: Similarity calculation includes cosine similarity calculation, local sensitive hash accelerated matching, maximum similarity matching and average similarity calculation; among them, cosine similarity calculation is specifically as follows: In the formula, The inner product of two vectors is calculated to reflect the relationship between the two eigenvectors in the feature space; and d db(k,j) represents the feature vector; and ||d db(k,j) || represents the size of the two feature vectors, ensuring that the calculated similarity is not affected by the length of the feature vector.

8. A method for identifying the authenticity of cigarettes according to claim 7, characterized in that: For each test feature, find the feature with the maximum similarity in the feature set in the database to determine the cigarette image. The maximum similarity feature is calculated as: In the formula, for each test feature d test , by traversing the database feature set D db(k) , calculate the cosine similarity of the database feature set and record the maximum similarity value S maxi .

9. A method for identifying the authenticity of cigarettes according to claim 8, characterized in that: The maximum similarities of all test features are averaged to obtain the overall similarity, which is used to determine whether the cigarette is genuine. The overall similarity is calculated using the following formula: In the formula, S avg Indicates the overall similarity; Smax indicates the maximum similarity.

10. A method for identifying the authenticity of cigarettes according to claim 9, characterized in that: The dynamic threshold function is generated through statistical analysis, and the dynamic threshold is obtained as follows: τ dynamic =f(cigarette type, historical data) In the formula, τ dynamic represents the dynamic threshold; f represents the dynamic threshold function; The dynamic threshold is compared with the overall similarity to determine whether the cigarette is real or fake: In the formula, τ dynamic represents the dynamic threshold, S avg Indicates the overall similarity.

Citation Information

Patent Citations

  • Cigarette authenticity identification method and system based on deep learning

    CN116030244A

Cited By

  • Knowledge graph-based southern red agate authenticity intelligent discrimination method

    CN120410564A