A cigarette detection method, device, electronic device and storage medium
Through the multiple recognition model combined with the multiple characteristic values of cigarettes, the problem of low accuracy in authenticity detection of cigarettes in the prior art is solved, and a higher recognition accuracy and stronger resistance to fraud are achieved.
Patent Information
- Application Number
- CN202311296913.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-08
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2043-10-08
AI Technical Summary
The existing methods of authenticity detection of cigarettes rely on human-eye observation and single recognition methods, resulting in low identification accuracy and it is difficult to cope with the improvement of fraud methods.
By reading the cigarette barcode, the weight value, packaging size, appearance color value and appearance image feature value of the cigarette are obtained, and the real cigarette matching model, fake cigarette matching model and identification model are called for multiple identification to output the authenticity and false identification results of the cigarette.
It improves the accuracy of authenticity recognition of cigarettes, get rid of the dependence on individual technical capabilities, enhances the weight consideration of the impact of different identification factors, and avoids the limitations of a single identification model.
Smart Images

Figure CN117350313B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cigarette authenticity detection, and in particular, to a cigarette detection method, device, electronic device and storage medium. Background Art
[0002] Cigarettes are ubiquitous in our lives and are part of people's daily consumption. The price of cigarettes is also increasing with the development of the economy. Therefore, some counterfeiters take risks to produce fake cigarettes. At present, the way to check the authenticity of cigarettes is generally to observe the appearance with the naked eye or manually scan the anti-counterfeiting QR code of the cigarettes. The inspection method is single and requires high personal professional quality. As counterfeiters' methods emerge in an endless stream, the counterfeiting methods are becoming more and more sophisticated. Therefore, there is a problem of poor identification accuracy only through naked eye observation and single identification method. Summary of the invention
[0003] The preferred embodiment of the present application provides a cigarette detection method to solve the technical problem that the existing cigarette detection method has poor identification accuracy only through naked eye observation and single identification.
[0004] The technical solutions adopted in this application are as follows:
[0005] A cigarette testing method comprises the following steps:
[0006] S1, reading the barcode of the cigarette to be tested;
[0007] S2. If the cigarette barcode read is false, the cigarette to be tested is directly judged to be a fake cigarette; if the cigarette barcode read is true, the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarette to be tested are further obtained;
[0008] S3. When the barcode of the cigarette to be tested is genuine, a recognition model group corresponding to the specifications of the cigarette to be tested is called according to the cigarette barcode, wherein the recognition model group includes a genuine cigarette matching model, a fake cigarette matching model and a discrimination model. The genuine cigarette matching model, the fake cigarette matching model and the discrimination model perform multiple recognitions on the cigarette to be tested according to the weight value, the packaging size, the appearance color value of the corresponding part and the weight of the appearance image feature value of the cigarette to be tested, and output the authenticity recognition result of whether the cigarette to be tested is genuine or fake.
[0009] Furthermore, the step S3 specifically includes the steps of:
[0010] S31. When the barcode of the cigarette to be tested is true, the recognition model group corresponding to the specifications of the cigarette to be tested is called according to the cigarette barcode, and the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, wherein:
[0011] The real smoke matching model is:
[0012]
[0013] Among them, the packaging size accounts for 5%, the weight weight accounts for 10%, the appearance color weight accounts for 15%, and the appearance image features account for 70%. x1 is the probability of real cigarettes, e is the standard value of the packaging size of cigarettes of corresponding specifications in the real cigarette matching model, b is the standard value of the weight of cigarettes of corresponding specifications in the real cigarette matching model, c is the standard value of the appearance color of cigarettes of corresponding specifications in the real cigarette matching model, and d is the standard value of the appearance image features of cigarettes of corresponding specifications in the real cigarette matching model; η is the measured size of cigarettes of corresponding specifications: β is the measured weight value of cigarettes of corresponding specifications, ε is the measured appearance color value of cigarettes of corresponding specifications, and δ is the measured image feature value of cigarettes of corresponding specifications;
[0014] The fake cigarette matching model is:
[0015]
[0016] Among them, x2 is the probability of fake cigarettes, E is the standard value of the corresponding specification packaging size in the fake cigarette matching model, B is the standard value of the corresponding specification cigarette weight in the fake cigarette matching model, C is the standard value of the appearance color of the corresponding specification cigarette in the fake cigarette matching model, and D is the standard value of the appearance image feature of the corresponding specification cigarette in the fake cigarette matching model;
[0017] The identification model is:
[0018]
[0019] Wherein, P is the judgment value of the identification model. If P≥0, it is judged as real cigarette, and the probability of being real cigarette is x1. If P<0, it is judged as fake cigarette, and the probability of being fake cigarette is x2.
[0020] S32, substituting the measured size η, measured weight value β, measured appearance color value ε, and measured image feature value δ of the corresponding specification cigarette into the real cigarette matching model and the fake cigarette matching model to obtain the real cigarette probability x1 and the fake cigarette probability x2;
[0021] S33, substituting the obtained probability x1 of genuine cigarette and the probability x2 of fake cigarette into the identification model to calculate the judgment value P of the identification model, and outputting the authenticity identification result of the tested cigarette according to P.
[0022] Furthermore, in the real smoke matching model:
[0023] Collecting the package size data of a set number of samples of real cigarettes of corresponding specifications, and taking the average value of the package size data as the standard value e of the image size of cigarettes of corresponding specifications;
[0024] Collect the weight value data of the sample quantity of real cigarettes of the corresponding specification, take the average value of the weight value data as the standard value b of the packaging size of the cigarettes of the corresponding specification,
[0025] Collect the appearance color value data of the set number of samples of real cigarettes of corresponding specifications, and take the average value of the appearance color value data as the standard value c of the appearance color of the cigarettes of corresponding specifications,
[0026] Appearance image feature data of a set number of samples of real cigarettes of corresponding specifications are collected, and the average value of the appearance image features is taken as the standard value d of the appearance image features of cigarettes of corresponding specifications.
[0027] Furthermore, in the fake cigarette matching model:
[0028] Collecting the package size data of the counterfeit cigarettes of the set sample quantity of the corresponding specification, and taking the average value of the package size data as the standard value E of the image size of the cigarettes of the corresponding specification;
[0029] Collect the weight value data of the counterfeit cigarettes of the corresponding specification set sample number, take the average value of the weight value data as the standard value B of the corresponding specification cigarette packaging size,
[0030] Collect the appearance color value data of the counterfeit cigarettes of the corresponding specification and set the number of samples, and take the average value of the appearance color value data as the standard value C of the appearance color of the cigarettes of the corresponding specification,
[0031] The appearance image feature data of the counterfeit cigarettes of a set number of samples of corresponding specifications are collected, and the average value of the appearance image features is taken as the standard value D of the appearance image features of the cigarettes of corresponding specifications.
[0032] Furthermore, the method further comprises the steps of:
[0033] S4. Upload the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarettes of the corresponding specifications that are correctly identified in the pseudo-identification results to the host computer in the cloud as training samples, and optimize the training of the recognition model group of the corresponding specifications located in the host computer to improve the recognition accuracy of the recognition model group of the corresponding specifications.
[0034] Furthermore, the method further comprises the steps of:
[0035] S5. Regularly identify the authenticity of collected cigarette samples of corresponding specifications by optimizing the trained recognition model group of corresponding specifications. When the recognition accuracy of the recognition model group is improved by a set percentage, the upper computer publishes the recognition model group version update information to various cigarette inspection terminal devices, and each cigarette inspection terminal device chooses whether to update and upgrade the recognition model group version.
[0036] Further, the method further comprises the steps of:
[0037] S5. The cigarette detection terminal device autonomously initiates a request for updating and upgrading the recognition model group version of the corresponding specification to the upper computer, and the upper computer responds to the request for updating and upgrading the recognition model group version to confirm and upgrade the cigarette detection terminal device.
[0038] Another preferred embodiment of the present application further provides a cigarette detection device, comprising:
[0039] A barcode reading module, used to read the barcode of the cigarette to be tested;
[0040] The preliminary recognition module is used to directly determine that the cigarette to be tested is a fake cigarette if the cigarette barcode read is false; if the cigarette barcode read is true, further obtain the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarette to be tested;
[0041] The multiple recognition module is used to call the recognition model group corresponding to the specifications of the cigarette to be tested according to the cigarette barcode when the read barcode of the cigarette to be tested is true, the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, and the real cigarette matching model, the fake cigarette matching model and the discrimination model perform multiple recognitions on the cigarette to be tested according to the weight value, packaging size, appearance color value of the corresponding part and weight of the appearance image feature value of the cigarette to be tested, and output the authenticity recognition result of whether the cigarette to be tested is real or fake.
[0042] Another preferred embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the cigarette detection method are implemented when the processor executes the program.
[0043] Another preferred embodiment of the present application further provides a storage medium, which includes a stored program, and when the program is executed, controls the device where the storage medium is located to execute the steps of the cigarette detection method.
[0044] Compared with the prior art, this application has the following beneficial effects:
[0045] The present application provides a cigarette inspection method, device, electronic device and storage medium. The cigarette inspection method can, based on the preliminary identification through the cigarette barcode, call again the identification model group corresponding to the specifications of the cigarette to be inspected to perform multiple identification on the cigarette to be inspected according to the weight value, packaging size, appearance color value of the corresponding part and the weight of the appearance image feature value of the cigarette to be inspected on the basis of the barcode being true. Compared with the human eye identification and single identification method, the present application not only gets rid of the dependence on personal technical ability when identifying by observing the appearance by human eyes when identifying the authenticity of cigarettes, but also organically combines the multi-recognition model including the real cigarette matching model, the fake cigarette matching model and the identification model, and the multi-dimensional sample parameters (weight, packaging size, appearance color value of the corresponding part and appearance image feature value) with different weights, so as to consider the weight of the influence of different identification factors on the authenticity identification result, and avoid the problem that the identification model cannot achieve the expected effect due to the insufficient number of corresponding samples collected and the singleness problem during model training when using a single identification model for identification, thereby effectively improving the accuracy of cigarette authenticity identification.
[0046] In addition to the above-described purposes, features and advantages, the present application also has other purposes, features and advantages. The present application will be further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0048] Figure 1 It is a flow chart of the cigarette testing method according to the preferred embodiment of the present application.
[0049] Figure 2 It is a schematic diagram of the structure of the cigarette detection terminal device of the preferred embodiment of the present application.
[0050] Figure 3 It is a schematic diagram of the sub-step flow of step S3 of the preferred embodiment of the present application.
[0051] Figure 4 It is a flow chart of a cigarette testing method according to another preferred embodiment of the present application.
[0052] Figure 5 It is a flow chart of a cigarette testing method according to another preferred embodiment of the present application.
[0053] Figure 6 It is a flow chart of a cigarette testing method according to another preferred embodiment of the present application.
[0054] Figure 7It is a schematic diagram of the modular composition of the smoke detection device of the preferred embodiment of the present application.
[0055] Figure 8 It is a schematic diagram of the composition of the multiple identification modules of the preferred embodiment of the present application.
[0056] Fig. 9 It is a schematic diagram of the modular composition of a smoke detection device according to another preferred embodiment of the present application.
[0057] Fig.10 It is a schematic diagram of the modular composition of a smoke detection device according to another preferred embodiment of the present application.
[0058] Fig.11 It is a schematic diagram of the modular composition of a smoke detection device according to another preferred embodiment of the present application.
[0059] Fig.12 It is a schematic block diagram of an electronic device entity of a preferred embodiment of the present application.
[0060] Fig.13 It is a diagram of the internal structure of a computer device of a preferred embodiment of the present application.
[0061] As shown in the figure: 1. Display module; 2. Central control module; 3. Distance measurement module; 4. Scanning module; 5. Rotating table; 6. Motor drive module. DETAILED DESCRIPTION
[0062] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0063] like Figure 1 As shown, a preferred embodiment of the present application provides a cigarette detection method, comprising the steps of:
[0064] S1, reading the barcode of the cigarette to be tested;
[0065] S2. If the cigarette barcode read is false, the cigarette to be tested is directly judged to be a fake cigarette; if the cigarette barcode read is true, the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarette to be tested are further obtained;
[0066] S3. When the barcode of the cigarette to be tested is genuine, a recognition model group corresponding to the specifications of the cigarette to be tested is called according to the cigarette barcode, wherein the recognition model group includes a genuine cigarette matching model, a fake cigarette matching model and a discrimination model. The genuine cigarette matching model, the fake cigarette matching model and the discrimination model perform multiple recognitions on the cigarette to be tested according to the weight value, the packaging size, the appearance color value of the corresponding part and the weight of the appearance image feature value of the cigarette to be tested, and output the authenticity recognition result of whether the cigarette to be tested is genuine or fake.
[0067] The cigarette detection method of this embodiment is based on Figure 2 The cigarette inspection terminal device shown in the figure acquires and identifies the barcode, weight value, package size, appearance color value of the corresponding part and appearance image feature value. The cigarette inspection terminal device includes a display module 1, a central control module 2, a distance measurement module 3, a scanning module 4, a rotating round table 5, and a motor drive module 6, wherein:
[0068] The rotating round table 5 is used to place the cigarettes to be tested, including cigarette strips or packs, and drives the cigarettes to be tested to rotate accordingly under the drive of the motor drive module 6, so that each scanned surface of the cigarette to be tested can maintain a certain degree of parallelism with the scanning module 4 to obtain a better scanning image effect. The scanning module 4 is symmetrically arranged and installed on the vertical guide rail group (including the lead screw and the light rod), and can move up and down along the vertical guide rail group as needed to complete the image scanning of the corresponding surface of the entire cigarette to be tested. At the same time, a horizontal moving device is arranged at the bottom of the vertical guide rail group, and the position of the vertical guide rail group can be adjusted horizontally as needed, so as to adjust the scanning module 4 to maintain a suitable distance from the cigarette to be tested to obtain a better scanning image effect; the distance measuring module 3 includes two laser sensors installed on the scanning module 4 On the other hand, the distance measurement can be performed at different positions of the scanning surface of the cigarette to be inspected. When the distances measured by the two distance measuring modules 3 are inconsistent, the central control module 2 drives the motor driving module 6 to drive the rotating table 5 to rotate until the difference between the distance values measured by the two distance measuring modules 3 meets the set value, and the rotating table 5 stops rotating, so that the scanning module 4 can obtain a better scanning image effect. In addition, in view of the problem of black stripes and reflections in the original image after scanning, this embodiment adopts two methods to deal with the scanning module 4: using a polarizer, adjusting the direction of the transmitted light by rotating the filter, thereby eliminating or weakening the reflection; adding a circle of lamp beads emitting soft light around the light-emitting device of the scanning module 4, weakening the contrast of the scanning position irradiated by the light, and not forming black stripes and reflections. If a camera is added at the top, the original images of the five detection surfaces can be obtained. The central control module 2 is also used to identify the cigarette to be tested according to the process control; the display module 1 includes a micro operating system interface, which can display the information of the cigarette to be tested and the result after identification, that is, output the authenticity identification result of whether the cigarette to be tested is real or fake.
[0069] This embodiment collects sample parameters in multiple dimensions when identifying the cigarette to be inspected, including the barcode, weight value, packaging size, appearance color value of the corresponding part, and appearance image feature value of the cigarette, where:
[0070] The boxes and cartons of cigarettes circulating in the market have their own unique barcodes. The barcode is a crucial standard parameter in the matching model between real and fake cigarettes. During the sample collection process, the barcode is collected using CIS images, and the cigarette inspection terminal equipment processing tool is set up to timely cut the effective information of the collected samples, quickly and accurately match the barcode standard library (the internal standard library of the tobacco industry, unique and confidential), complete the barcode recognition, and add the barcode data to the barcode collection library to ensure the accuracy of the standard library.
[0071] The tobacco industry has high regulatory standards and is confidential. The packaging size of genuine cigarettes is produced according to the standard with a small error, and the maximum allowable error is ±0.1mm. Fake cigarettes cannot obtain the size standard and the production process cannot meet the standard. The packaging size information is collected by tracing points. The 8 vertices of the cigarette box are obtained to construct a cuboid as the cigarette box size. According to the optical resolution of the CIS scanning module of 2400dpi and its graphic signal, the size of the cigarette box is obtained. The measurement accuracy is ±0.02mm, and the standard data is matched to establish the basic indicator characteristics for the design of the model.
[0072] Industrial companies have very strict supply chain management for raw materials such as dyes and paper, and the confidentiality of information such as formulas, production equipment, and production processes is very high. Therefore, the authenticity of the appearance and color of cigarettes has a great significance for identification. Fake cigarette manufacturers cannot get the same raw materials from the dedicated supply chain. However, in order to deal with the production equipment eliminated by industrial companies flowing into the hands of fake cigarette manufacturers, the cigarette production plan and production requirements issued by the state every year will have slight differences in each batch. Even if fake cigarettes are produced using obsolete production lines to produce the appearance of real cigarettes, due to regular changes in the country, the circulation cycle of fake cigarette batches is not long. Therefore, it is very important to collect real and fake samples on the market, enrich the samples of real cigarettes with diverse printing standards and the expired appearance samples of fake cigarettes with high simulation, which is very important for the training of the real and fake models. During the collection process, the cigarette inspection terminal equipment will collect the color depth of different samples or positions according to the CIS graphics, and automatically adjust the LED light source to fill the light according to the color saturation and color warmth of the cigarettes to improve the printing restoration of the samples.
[0073] Appearance image features include standard fonts, font sizes, locations of important features, logo locations, logo patterns, etc. Tobacco industry companies will regularly fine-tune images and fonts during production, and a new image feature library will be formed for each batch, such as subtle adjustments to the font to make some strokes thicker and some strokes thinner. Fake cigarette production cannot obtain corresponding information, and the cost of simulated fake cigarette production is high and the process is difficult. Therefore, subtle anti-counterfeiting marks will appear blurred, deformed, and inconsistent in size. During the sample collection process, in order to improve the efficiency of sample collection and uploading at terminals in various places, during the scanning and collection process, the features are cropped while being collected to extract effective information to meet the needs of the sample library of the remote upload management end for large amounts of data.
[0074] The tobacco industry has strict production standards for the material, gram weight, thickness of paper, processing technology of tobacco shreds, and filter standards. The weight error value of each genuine cigarette shall not exceed ±0.02 grams, and it can be calculated that the error value of each pack of cigarettes shall not exceed ±0.4 grams. Fake cigarette production lines and raw materials cannot meet this standard. For example: the amount of tobacco stems in tobacco shreds is relatively large, and the tobacco stems are not puffed and softened. The tobacco stems of genuine cigarettes will be puffed and softened, resulting in fake cigarettes generally being heavier than genuine cigarettes. The cigarette inspection terminal collects the weight values of various cigarettes through high-precision weight sensors, and calculates a weight threshold of a box of cigarettes or a carton of cigarettes based on the standard value as a basis for judging authenticity.
[0075] The present embodiment provides a cigarette inspection method. The cigarette inspection method can, based on the preliminary identification through the cigarette barcode, call again the recognition model group corresponding to the specifications of the cigarette to be inspected to perform multiple identification on the cigarette to be inspected according to the weight value, packaging size, appearance color value of the corresponding part and the weight of the appearance image feature value of the cigarette to be inspected. Compared with the human eye recognition and single recognition methods, the present embodiment not only gets rid of the dependence on personal technical ability when the appearance is observed by the human eye when the authenticity of the cigarette is identified, but also organically combines the multi-recognition model including the real cigarette matching model, the fake cigarette matching model and the identification model, and the multi-dimensional sample parameters (weight, packaging size, appearance color value of the corresponding part and appearance image feature value) with different weights, so as to consider the weight of the influence of different recognition factors on the authenticity recognition result, and avoid the problem that the recognition model cannot achieve the expected effect due to the insufficient number of corresponding samples collected and the singleness problem during model training when a single recognition model is used for recognition, thereby effectively improving the accuracy of the authenticity recognition of cigarettes.
[0076] Preferably, if Figure 3 As shown, the step S3 specifically includes the steps of:
[0077] S31. When the barcode of the cigarette to be tested is true, the recognition model group corresponding to the specifications of the cigarette to be tested is called according to the cigarette barcode, and the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, wherein:
[0078] The real smoke matching model is:
[0079]
[0080] Among them, the packaging size accounts for 5%, the weight weight accounts for 10%, the appearance color weight accounts for 15%, and the appearance image features account for 70%. x1 is the probability of real cigarettes, e is the standard value of the packaging size of cigarettes of corresponding specifications in the real cigarette matching model, b is the standard value of the weight of cigarettes of corresponding specifications in the real cigarette matching model, c is the standard value of the appearance color of cigarettes of corresponding specifications in the real cigarette matching model, and d is the standard value of the appearance image features of cigarettes of corresponding specifications in the real cigarette matching model; η is the measured size of cigarettes of corresponding specifications: β is the measured weight value of cigarettes of corresponding specifications, ε is the measured appearance color value of cigarettes of corresponding specifications, and δ is the measured image feature value of cigarettes of corresponding specifications;
[0081] The fake cigarette matching model is:
[0082]
[0083] Among them, x2 is the probability of fake cigarettes, E is the standard value of the corresponding specification packaging size in the fake cigarette matching model, B is the standard value of the corresponding specification cigarette weight in the fake cigarette matching model, C is the standard value of the appearance color of the corresponding specification cigarette in the fake cigarette matching model, and D is the standard value of the appearance image feature of the corresponding specification cigarette in the fake cigarette matching model;
[0084] The identification model is:
[0085]
[0086] Wherein, P is the judgment value of the identification model. If P≥0, it is judged as real cigarette, and the probability of being real cigarette is x1. If P<0, it is judged as fake cigarette, and the probability of being fake cigarette is x2.
[0087] S32, substituting the measured size η, measured weight value β, measured appearance color value ε, and measured image feature value δ of the corresponding specification cigarette into the real cigarette matching model and the fake cigarette matching model to obtain the real cigarette probability x1 and the fake cigarette probability x2;
[0088] S33, the obtained probability of genuine cigarette x1 and probability of fake cigarette x2 are substituted into the identification model to calculate the judgment value P of the identification model, and the authenticity identification result of the tested cigarette is output according to P. If the probability of genuine cigarette output by the genuine cigarette matching model of the tested cigarette in this embodiment reaches 93%, but the probability of fake cigarette output by the fake cigarette matching model reaches 92%, the judgment value P of the identification model is calculated by substituting into the identification model:
[0089]
[0090] If P≥0, it is judged to be a genuine cigarette, and the probability that the tested cigarette is a genuine cigarette is 93%.
[0091] This embodiment builds multiple matching models for authenticity identification based on the weight, packaging size, appearance color value of corresponding parts, appearance image feature value and other sample weight data collected by the cigarette inspection terminal device, including real cigarette matching model, fake cigarette matching model and identification model. The barcode of the tobacco industry standard is unique. When the device recognizes that the barcode and specifications are inconsistent with the identification sample, the barcode can be used as a direct judgment that the tested cigarette is a fake cigarette. However, manufacturing technology is becoming more and more advanced. After real cigarettes are circulated in the market, fake cigarettes will also obtain real barcode data. Therefore, it is also necessary to collect information such as weight, packaging size, appearance color value of corresponding parts and appearance image feature value. However, none of these data can directly distinguish real cigarettes from fake cigarettes. Therefore, this embodiment uses a weight method to judge real cigarettes or fake cigarettes to improve the accuracy of detecting real cigarettes or fake cigarettes. According to a large number of experiments, when identifying real and fake cigarettes, the weight that affects the recognition result is 5% for packaging size, 10% for weight, 15% for appearance color, and 70% for appearance image features. The smaller the weight, the easier it is to be counterfeited. In other words, the larger the weight, the more difficult it is to counterfeit, and the greater the impact on the recognition result.
[0092] There are obvious differences in the appearance of cigarettes of different specifications. Sample standard libraries are established according to barcodes and specifications, and real cigarette matching models and fake cigarette matching models are trained. The data of real and fake cigarettes are uniformly stored. The production of cigarettes of various brands and specifications is uniformly planned by the National Bureau, and the production indicators of various industrial companies are coordinated. The same specification is produced by multiple production lines in multiple regions. There are also invisible subtle differences between different batches produced by each production line, which requires the equipment to continuously collect new samples to supplement the sample specification library. At the same time, the collected samples are used to train the real cigarette matching model. The larger the sample size, the more batches are involved, and the accuracy and effectiveness of the model will continue to improve. When the samples of a certain specification accumulate to 1,000 samples, deep learning is performed on the real cigarette matching model, the fake cigarette matching model, and the identification model.
[0093] If only the real cigarette matching model is used, authenticity identification can be achieved by continuously training through data collection. However, in order to correct the possible singleness of the collected weights and improve the accuracy of real cigarette matching and recognition speed, and because of the spillover of old tobacco equipment and other reasons, the production technology of fake cigarettes is also constantly improving. Therefore, it is necessary to establish a real cigarette matching model, a fake cigarette matching model and an identification model for comprehensive identification.
[0094] The real cigarette matching model obtains the real cigarette matching model result by matching multiple sample data and performing weight calculation, and then obtains the fake cigarette matching model result by matching sample data and performing weight calculation. Finally, through the identification model, the percentage value of the tested cigarettes being real or the percentage value of the tested cigarettes being fake is obtained.
[0095] Preferably, in the real smoke matching model:
[0096] Collecting the package size data of a set number of samples of real cigarettes of corresponding specifications, and taking the average value of the package size data as the standard value e of the image size of cigarettes of corresponding specifications;
[0097] Collect the weight value data of the sample quantity of real cigarettes of the corresponding specification, take the average value of the weight value data as the standard value b of the packaging size of the cigarettes of the corresponding specification,
[0098] Collect the appearance color value data of the set number of samples of real cigarettes of corresponding specifications, and take the average value of the appearance color value data as the standard value c of the appearance color of the cigarettes of corresponding specifications,
[0099] Appearance image feature data of a set number of samples of real cigarettes of corresponding specifications are collected, and the average value of the appearance image features is taken as the standard value d of the appearance image features of cigarettes of corresponding specifications.
[0100] Preferably, in the fake cigarette matching model:
[0101] Collecting the package size data of the counterfeit cigarettes of the set sample quantity of the corresponding specification, and taking the average value of the package size data as the standard value E of the image size of the cigarettes of the corresponding specification;
[0102] Collect the weight value data of the counterfeit cigarettes of the corresponding specification set sample number, take the average value of the weight value data as the standard value B of the corresponding specification cigarette packaging size,
[0103] Collect the appearance color value data of the counterfeit cigarettes of the corresponding specification and set the number of samples, and take the average value of the appearance color value data as the standard value C of the appearance color of the cigarettes of the corresponding specification,
[0104] The appearance image feature data of the counterfeit cigarettes of a set number of samples of corresponding specifications are collected, and the average value of the appearance image features is taken as the standard value D of the appearance image features of the cigarettes of corresponding specifications.
[0105] Preferably, if Figure 4 As shown, in another feasible embodiment of the present application, the cigarette detection method further includes the steps of:
[0106] S4. Upload the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarettes of the corresponding specifications that are correctly identified in the pseudo-identification results to the host computer in the cloud as training samples, and optimize the training of the recognition model group of the corresponding specifications located in the host computer to improve the recognition accuracy of the recognition model group of the corresponding specifications.
[0107] In this embodiment, the samples collected by the equipment and uploaded to the upper computer in the cloud will be verified by obtaining the sample code, querying the national bureau's authenticity identification sample library for authenticity verification, and matching the verified authenticity with the uploaded authenticity. Only samples with correct verification are taken for model training, and samples with incorrect verification are eliminated and do not participate in subsequent authenticity identification model training. By continuously collecting data from quality inspection stations, industrial companies, and tobacco markets, sample data is continuously accumulated, which will greatly improve the accuracy of the basic data for model training, reduce the error sample rate, and improve the efficiency of model use.
[0108] Preferably, if Figure 5 As shown, in another feasible embodiment of the present application, the cigarette detection method further includes the steps of:
[0109] S5. Regularly identify the authenticity of collected cigarette samples of corresponding specifications by optimizing the trained recognition model group of corresponding specifications. When the recognition accuracy of the recognition model group is improved by 5%, the upper computer will publish the recognition model group version update information to various cigarette inspection terminal devices, and each cigarette inspection terminal device will choose whether to update and upgrade the recognition model group version.
[0110] This embodiment automatically publishes the update information of the recognition model group version to the cigarette detection terminal devices across the country according to the improvement of the recognition accuracy of the trained recognition model group. Each cigarette detection terminal device chooses whether to update and upgrade the recognition model group version, thereby improving the automation of the version update of the recognition model group, which is conducive to timely updating and upgrading the recognition model group of cigarette detection terminal devices across the country to improve recognition accuracy.
[0111] Preferably, if Figure 6 As shown, in another feasible embodiment of the present application, the cigarette detection method further includes the steps of:
[0112] S5. The cigarette detection terminal device autonomously initiates a request for updating and upgrading the recognition model group version of the corresponding specification to the upper computer, and the upper computer responds to the request for updating and upgrading the recognition model group version to confirm and upgrade the cigarette detection terminal device.
[0113] Different from the above-mentioned embodiments, in this embodiment, the cigarette detection terminal device autonomously initiates a request for updating and upgrading the recognition model group version of the corresponding specifications to the host computer, thereby fully considering the different recognition requirements of each cigarette detection terminal device and performing targeted on-demand updates and upgrades, improving the matching of updates and upgrades, and reducing the bandwidth cost and time cost brought by large-scale updates and upgrades.
[0114] like Figure 7 As shown, another preferred embodiment of the present application further provides a smoking detection device, comprising:
[0115] A barcode reading module, used to read the barcode of the cigarette to be tested;
[0116] The preliminary recognition module is used to directly determine that the cigarette to be tested is a fake cigarette if the cigarette barcode read is false; if the cigarette barcode read is true, further obtain the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarette to be tested;
[0117] The multiple recognition module is used to call the recognition model group corresponding to the specifications of the cigarette to be tested according to the cigarette barcode when the read barcode of the cigarette to be tested is true, the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, and the real cigarette matching model, the fake cigarette matching model and the discrimination model perform multiple recognitions on the cigarette to be tested according to the weight value, packaging size, appearance color value of the corresponding part and weight of the appearance image feature value of the cigarette to be tested, and output the authenticity recognition result of whether the cigarette to be tested is real or fake.
[0118] like Figure 8 As shown, in another feasible embodiment of the present application, the multiple identification module includes:
[0119] The recognition model group calling module is used to call the recognition model group corresponding to the specifications of the cigarette to be tested according to the cigarette barcode when the read barcode of the cigarette to be tested is true, wherein the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, wherein:
[0120] The real smoke matching model is:
[0121]
[0122] Among them, the packaging size accounts for 5%, the weight weight accounts for 10%, the appearance color weight accounts for 15%, and the appearance image features account for 70%. x1 is the probability of real cigarettes, e is the standard value of the packaging size of cigarettes of corresponding specifications in the real cigarette matching model, b is the standard value of the weight of cigarettes of corresponding specifications in the real cigarette matching model, c is the standard value of the appearance color of cigarettes of corresponding specifications in the real cigarette matching model, and d is the standard value of the appearance image features of cigarettes of corresponding specifications in the real cigarette matching model; η is the measured size of cigarettes of corresponding specifications: β is the measured weight value of cigarettes of corresponding specifications, ε is the measured appearance color value of cigarettes of corresponding specifications, and δ is the measured image feature value of cigarettes of corresponding specifications;
[0123] The fake cigarette matching model is:
[0124]
[0125] Among them, x2 is the probability of fake cigarettes, E is the standard value of the corresponding specification packaging size in the fake cigarette matching model, B is the standard value of the corresponding specification cigarette weight in the fake cigarette matching model, C is the standard value of the appearance color of the corresponding specification cigarette in the fake cigarette matching model, and D is the standard value of the appearance image feature of the corresponding specification cigarette in the fake cigarette matching model;
[0126] The identification model is:
[0127]
[0128] Wherein, P is the judgment value of the identification model. If P≥0, it is judged as real cigarette, and the probability of being real cigarette is x1. If P<0, it is judged as fake cigarette, and the probability of being fake cigarette is x2.
[0129] A true-false probability calculation module is used to substitute the measured size η, measured weight value β, measured appearance color value ε, and measured image feature value δ of the corresponding specification cigarettes into the real cigarette matching model and the fake cigarette matching model to obtain the real cigarette probability x1 and the fake cigarette probability x2;
[0130] The authenticity identification module is used to substitute the obtained true cigarette probability x1 and false cigarette probability x2 into the identification model to calculate the judgment value P of the identification model, and output the authenticity identification result of the cigarette to be tested according to P.
[0131] like Fig. 9 As shown, in another feasible embodiment of the present application, the smoke detection device further includes:
[0132] The recognition model group optimization training module is used to upload the cigarette weight values, packaging sizes, appearance color values of corresponding parts and appearance image feature values of corresponding specifications correctly identified in the pseudo-recognition results as training samples to the host computer in the cloud, and optimize the training of the recognition model group of corresponding specifications located in the host computer to improve the recognition accuracy of the recognition model group of corresponding specifications.
[0133] like Fig.10 As shown, in another feasible embodiment of the present application, the smoke detection device further includes:
[0134] The update and upgrade information release module is used to regularly identify the authenticity of collected cigarette samples of corresponding specifications by optimizing the recognition model group of corresponding specifications after training. When the recognition accuracy of the recognition model group is improved by a set percentage, the upper computer will release the recognition model group version update and upgrade information to various cigarette inspection terminal devices, and each cigarette inspection terminal device will choose whether to update and upgrade the recognition model group version.
[0135] like Fig.11 As shown, in another feasible embodiment of the present application, the smoke detection device further includes:
[0136] The update and upgrade information request module is used for the cigarette detection terminal device to autonomously initiate a recognition model group version update and upgrade request of corresponding specifications to the upper computer, and the upper computer responds to the recognition model group version update and upgrade request to confirm the upgrade of the cigarette detection terminal device.
[0137] like Fig.12 As shown, a preferred embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the cigarette detection method in the above embodiment when executing the program.
[0138] The preferred embodiment of the present application also provides a computer device, which can be a terminal or a liveness detection server, and its internal structure diagram can be as follows: Fig.13 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with other external computer devices through a network connection. When the computer program is executed by the processor, the steps of the above-mentioned cigarette detection method are implemented.
[0139] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0140] A preferred embodiment of the present application further provides a storage medium, which includes a stored program, and when the program is executed, controls the device where the storage medium is located to execute the steps of the cigarette detection method in the above embodiment.
[0141] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0142] If the functions described in the method of this embodiment are implemented in the form of software functional units and sold or used as independent products, they can be stored in one or more computing devices readable storage media. Based on this understanding, the part of the embodiment of the present application that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computing device (which can be a personal computer, server, mobile computing device or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0143] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0144] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0145] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0146] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0147] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0148] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A cigarette testing method, characterized in that: Includes steps: S1, reading the barcode of the cigarette to be tested; S2. If the cigarette barcode read is false, the cigarette to be tested is directly judged to be a fake cigarette; if the cigarette barcode read is true, the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarette to be tested are further obtained; S3. When the barcode of the cigarette to be tested is true, the identification model group corresponding to the specifications of the cigarette to be tested is called according to the cigarette barcode, the identification model group includes a genuine cigarette matching model, a fake cigarette matching model and a discrimination model, the genuine cigarette matching model, the fake cigarette matching model and the discrimination model perform multiple identifications on the cigarette to be tested according to the weight value, packaging size, appearance color value of the corresponding part and weight of the appearance image feature value of the cigarette to be tested, and output the authenticity identification result of whether the cigarette to be tested is genuine or fake; The step S3 specifically comprises the following steps: S31. When the barcode of the cigarette to be tested is true, the recognition model group corresponding to the specifications of the cigarette to be tested is called according to the cigarette barcode, and the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, wherein: The real smoke matching model is: Among them, the packaging size accounts for 5%, the weight weight accounts for 10%, the appearance color weight accounts for 15%, and the appearance image features account for 70%. x1 is the probability of real cigarettes, e is the standard value of the packaging size of cigarettes of corresponding specifications in the real cigarette matching model, b is the standard value of the weight of cigarettes of corresponding specifications in the real cigarette matching model, c is the standard value of the appearance color of cigarettes of corresponding specifications in the real cigarette matching model, and d is the standard value of the appearance image features of cigarettes of corresponding specifications in the real cigarette matching model; η is the measured size of cigarettes of corresponding specifications: β is the measured weight value of cigarettes of corresponding specifications, ε is the measured appearance color value of cigarettes of corresponding specifications, and δ is the measured image feature value of cigarettes of corresponding specifications; The fake cigarette matching model is: Among them, x2 is the probability of fake cigarettes, E is the standard value of the corresponding specification packaging size in the fake cigarette matching model, B is the standard value of the corresponding specification cigarette weight in the fake cigarette matching model, C is the standard value of the appearance color of the corresponding specification cigarette in the fake cigarette matching model, and D is the standard value of the appearance image feature of the corresponding specification cigarette in the fake cigarette matching model; The identification model is: Wherein, P is the judgment value of the identification model. If P≥0, it is judged as real cigarette, and the probability of being real cigarette is x1. If P<0, it is judged as fake cigarette, and the probability of being fake cigarette is x2. S32, substituting the measured size η, measured weight value β, measured appearance color value ε, and measured image feature value δ of the corresponding specification cigarette into the real cigarette matching model and the fake cigarette matching model to obtain the real cigarette probability x1 and the fake cigarette probability x2; S33, substituting the obtained probability x1 of genuine cigarette and the probability x2 of fake cigarette into the identification model to calculate the judgment value P of the identification model, and outputting the authenticity identification result of the tested cigarette according to P.
2. The cigarette detection method according to claim 1, characterized in that: In the real smoke matching model: Collecting the package size data of a set number of samples of real cigarettes of corresponding specifications, and taking the average value of the package size data as the standard value e of the image size of cigarettes of corresponding specifications; Collect the weight value data of the sample quantity of real cigarettes of the corresponding specification, take the average value of the weight value data as the standard value b of the packaging size of the cigarettes of the corresponding specification, Collect the appearance color value data of the set number of samples of real cigarettes of corresponding specifications, and take the average value of the appearance color value data as the standard value c of the appearance color of the cigarettes of corresponding specifications, Appearance image feature data of a set number of samples of real cigarettes of corresponding specifications are collected, and the average value of the appearance image features is taken as the standard value d of the appearance image features of cigarettes of corresponding specifications.
3. The cigarette detection method according to claim 1, characterized in that: In the fake cigarette matching model: Collecting the package size data of the counterfeit cigarettes of the set sample quantity of the corresponding specification, and taking the average value of the package size data as the standard value E of the image size of the cigarettes of the corresponding specification; Collect the weight value data of the counterfeit cigarettes of the corresponding specification set sample number, take the average value of the weight value data as the standard value B of the corresponding specification cigarette packaging size, Collect the appearance color value data of the counterfeit cigarettes of the corresponding specification and set the number of samples, and take the average value of the appearance color value data as the standard value C of the appearance color of the cigarettes of the corresponding specification, The appearance image feature data of the counterfeit cigarettes of a set number of samples of corresponding specifications are collected, and the average value of the appearance image features is taken as the standard value D of the appearance image features of the cigarettes of corresponding specifications.
4. The cigarette detection method according to claim 1, characterized in that: Also includes the steps: S4. Upload the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarettes of the corresponding specifications that are correctly identified in the pseudo-identification results to the host computer in the cloud as training samples, and optimize the training of the recognition model group of the corresponding specifications located in the host computer to improve the recognition accuracy of the recognition model group of the corresponding specifications.
5. The cigarette detection method according to claim 4, characterized in that: Also includes the steps: S5. Regularly identify the authenticity of collected cigarette samples of corresponding specifications by optimizing the trained recognition model group of corresponding specifications. When the recognition accuracy of the recognition model group is improved by a set percentage, the upper computer publishes the recognition model group version update information to various cigarette inspection terminal devices, and each cigarette inspection terminal device chooses whether to update and upgrade the recognition model group version.
6. The cigarette testing method according to claim 4, characterized in that: Also includes the steps: S5. The cigarette detection terminal device autonomously initiates a request for updating and upgrading the recognition model group version of the corresponding specification to the upper computer, and the upper computer responds to the request for updating and upgrading the recognition model group version to confirm and upgrade the cigarette detection terminal device.
7. A cigarette detection device, characterized in that: include: A barcode reading module, used to read the barcode of the cigarette to be tested; The preliminary recognition module is used to directly determine that the cigarette to be tested is a fake cigarette if the cigarette barcode read is false; if the cigarette barcode read is true, further obtain the weight value, packaging size, appearance color value of the corresponding part and appearance image feature value of the cigarette to be tested; A multiple recognition module is used to call a recognition model group corresponding to the specifications of the cigarette to be tested according to the cigarette barcode when the read barcode of the cigarette to be tested is true, the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, the real cigarette matching model, the fake cigarette matching model and the discrimination model perform multiple recognition on the cigarette to be tested according to the weight value, packaging size, appearance color value of the corresponding part and weight of the appearance image feature value of the cigarette to be tested, and output the authenticity recognition result of whether the cigarette to be tested is real or fake; Specifically used for: When the barcode of the cigarette to be tested is true, the recognition model group corresponding to the specifications of the cigarette to be tested is called according to the cigarette barcode, and the recognition model group includes a real cigarette matching model, a fake cigarette matching model and a discrimination model, wherein: The real smoke matching model is: Among them, the packaging size accounts for 5%, the weight weight accounts for 10%, the appearance color weight accounts for 15%, and the appearance image features account for 70%. x1 is the probability of real cigarettes, e is the standard value of the packaging size of cigarettes of corresponding specifications in the real cigarette matching model, b is the standard value of the weight of cigarettes of corresponding specifications in the real cigarette matching model, c is the standard value of the appearance color of cigarettes of corresponding specifications in the real cigarette matching model, and d is the standard value of the appearance image features of cigarettes of corresponding specifications in the real cigarette matching model; η is the measured size of cigarettes of corresponding specifications: β is the measured weight value of cigarettes of corresponding specifications, ε is the measured appearance color value of cigarettes of corresponding specifications, and δ is the measured image feature value of cigarettes of corresponding specifications; The fake cigarette matching model is: Among them, x2 is the probability of fake cigarettes, E is the standard value of the corresponding specification packaging size in the fake cigarette matching model, B is the standard value of the corresponding specification cigarette weight in the fake cigarette matching model, C is the standard value of the appearance color of the corresponding specification cigarette in the fake cigarette matching model, and D is the standard value of the appearance image feature of the corresponding specification cigarette in the fake cigarette matching model; The identification model is: Wherein, P is the judgment value of the identification model. If P≥0, it is judged as real cigarette, and the probability of being real cigarette is x1. If P<0, it is judged as fake cigarette, and the probability of being fake cigarette is x2. Substitute the measured size η, measured weight value β, measured appearance color value ε, and measured image feature value δ of the corresponding specifications of cigarettes into the real cigarette matching model and the fake cigarette matching model to obtain the real cigarette probability x1 and the fake cigarette probability x2; Substitute the obtained true cigarette probability x1 and false cigarette probability x2 into the identification model to calculate the judgment value P of the identification model, and output the authenticity identification result of the tested cigarette according to P.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the cigarette detection method according to any one of claims 1 to 6 when executing the program.
9. A storage medium, comprising a stored program, which controls a device where the storage medium is located to execute the steps of the cigarette detection method according to any one of claims 1 to 6 when the program is executed.
Citation Information
Patent Citations
Color identification method-based portable cigarette authenticity identification system, instrument and method
CN110286095A
Cigarette authenticity identification instrument based on appearance scanning
CN114152611A
Tracking device for real cigarette sales
CN115952820A