System and method for checking cigarette brand based on two-dimensional code
Through the multi-lens collaborative imaging technology based on QR code and the cigarette brand verification system of improved convolutional neural network, the problem of insufficient accuracy and stability of the existing technology is solved, efficient and accurate cigarette brand verification is achieved, and the reliability and data security of the production process are improved.
Patent Information
- Application Number
- CN202510306846.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-15
- Publication Date
- 2025-08-01
AI Technical Summary
The existing cigarette brand verification technology has shortcomings in accuracy, efficiency, stability and adaptability to complex environments, and cannot meet the needs of modern cigarette production and sorting industries for efficient and accurate verification.
The QR code-based verification system is adopted, and the QR code information is read using multi-lens collaborative imaging technology, and the improved convolutional neural network and hash algorithm are used for rapid comparison, and combined with edge computing and adaptive learning engine optimization system to achieve efficient and accurate cigarette brand verification.
It improves the accuracy and efficiency of cigarette brand verification, enhances the stability and adaptability of the system, reduces error rates and production costs, and ensures data security and production process reliability.
Smart Images

Figure CN120409516A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cigarette verification, and particularly to a system and method for verifying cigarette brands based on two-dimensional codes. Background Art
[0002] In the process of cigarette production and sorting, accurately verifying cigarette brands is crucial. With the expansion of cigarette production scale and the increasing richness of product types, along with the development of technology, some simple automated devices have begun to be applied to cigarette brand verification. These devices usually adopt a single recognition technology, such as barcode recognition. However, barcodes are easily affected by factors such as smudging and deformation, resulting in a decrease in recognition accuracy. During the production and transportation of cigarettes, cigarette packages will inevitably be subject to friction, extrusion, etc., which increases the probability of barcode damage. Once the barcode is damaged, the device cannot accurately identify the cigarette brand information, affecting the accuracy of sorting and packaging, and may even lead to problems such as misdelivery and missing delivery, causing economic losses to the enterprise.
[0003] In the information age, although some enterprises have introduced database management systems to assist in the verification work, it is difficult to guarantee the accuracy and timeliness of the data. The data in the database may not match the actual production situation due to untimely updates. Moreover, during the data transmission process, it is easily interfered by factors such as network fluctuations, resulting in data loss or errors, and cannot meet the strict requirements of cigarette production and sorting for information accuracy and timeliness.
[0004] The current cigarette brand verification technology has deficiencies in terms of accuracy, efficiency, stability, and adaptability to complex environments, and cannot meet the requirements of modern cigarette production and sorting industries for efficient and accurate verification. This has become a key technical problem restricting the development of the industry. Therefore, we propose a system and method for verifying cigarette brands based on two-dimensional codes. Summary of the Invention
[0005] The object of the present invention is to address the problem that the current cigarette brand verification technology has deficiencies in terms of accuracy, efficiency, stability, and adaptability to complex environments in the background art, and to propose a system and method for verifying cigarette brands based on two-dimensional codes.
[0006] In a first aspect, the present application provides a system for verifying cigarette brands based on two-dimensional codes, including:
[0007] A two-dimensional code information reading device, which is arranged on the cigarette sorting line and is used to read the two-dimensional code information on the cigarette when the cigarette automatically passes through. The two-dimensional code information reading device uses multi-lens collaborative imaging technology to simultaneously collect two-dimensional code images from multiple angles;
[0008] Industrial control equipment, which is communicatively connected to the QR code information reading device through high-speed optical fiber, is used to receive and process QR code information;
[0009] A data processing module, integrated in the industrial control equipment, is used to extract the fixed product specification value in the QR code through an improved convolutional neural network algorithm and generate cigarette product specification information;
[0010] A verification module, integrated in the industrial control equipment, is used to quickly compare the cigarette product specification information with the product specification information of the packaging order based on the hash algorithm;
[0011] An alarm module, integrated in the industrial control equipment, is used to trigger an audible and visual alarm and send an alarm message to the mobile terminal when the product specification information is inconsistent;
[0012] A shutdown control module, connected to the alarm module, is used to control the shutdown of the sorting line according to the alarm instruction, and the shutdown control module adopts a redundant design;
[0013] An edge computing node, deployed at key positions on the sorting line, is used to preprocess QR code data in real time, screen out invalid or duplicate data through a lightweight AI model, and only transmit valid data to the industrial control equipment to reduce the load on the central node;
[0014] An adaptive learning engine, embedded in the industrial control equipment, dynamically optimizes the parameters of the convolutional neural network and the hash comparison threshold through online learning of the operating status of the sorting line and historical error data for system self-calibration.
[0015] Optionally, the multi-lens collaborative imaging technology in the QR code information reading device performs fusion processing on the images collected by multiple lenses, and its fusion algorithm formula is:
[0016] I final =α1I1+α2I2+…+α n I n
[0017] where, I final is the fused image, I i is the image collected by the i-th lens, α i is the weight coefficient of the i-th lens image, and
[0018]
[0019] The weight coefficient α i is dynamically adjusted through a machine learning algorithm according to factors such as the position of the lens, the imaging quality, and the relationship with the movement direction of the cigarette;
[0020] The multi-lens collaborative imaging technology further includes:
[0021] (a) 3D Pose Compensation Module Based on Depth Camera: The depth information of the cigarette surface is obtained through a Time-of-Flight (TOF) sensor. By combining multi-view images to reconstruct a 3D model and dynamically correcting the QR code distortion, the fusion formula is:
[0022]
[0023] Where Warp is the perspective transformation function based on the depth map D i to eliminate the image stretching caused by the tilt of the cigarette;
[0024] (b) Environment Adaptive Exposure Control: According to the light fluctuation on the sorting line, the lens aperture is dynamically adjusted by Pulse Width Modulation (PWM), and the exposure time TT satisfies:
[0025]
[0026] Where L max is the maximum allowable light intensity, L env is the real-time ambient light intensity, and k is the calibration coefficient to ensure that clear QR codes can still be captured under low light.
[0027] Optionally, in the improved convolutional neural network algorithm in the data processing module, an attention mechanism module is added on the basis of the traditional convolutional neural network. The calculation formula of the convolutional layer in the network structure is:
[0028]
[0029] Where is the j-th feature map of the (l + 1)-th layer, M j is the set of input feature maps related to the j-th feature map, is the convolution kernel from the i-th feature map to the j-th feature map of the l-th layer, is the bias term, * represents the convolution operation. The attention mechanism module calculates the importance weights of each part of the feature map and performs weighted processing on the feature map. The formula is:
[0030]
[0031] Where A(X) is the feature map processed by the attention mechanism, X i is different parts of the original feature map, w i is the corresponding weight, and σ is the activation function. In this way, the values (characters) corresponding to the fixed product specifications can be more accurately identified and extracted, adapting to the complex and diverse QR code data formats of different cigarette brands.
[0032] Optionally, the improved convolutional neural network algorithm further includes:
[0033] (a) Cross-modal feature fusion module: Input the visible light QR code image and the near-infrared reflection image into a dual-branch network, and improve the recognition robustness in occlusion scenarios through feature concatenation. The formula is:
[0034] F fusion =Conv(Concat(F visible ,F NIR ))
[0035] (b) Transfer learning framework: The pre-trained network simulates cigarette pack wear and stain noise on the synthetic dataset, and then adapts to the specific production line through small-sample fine-tuning. The loss function is:
[0036]
[0037] Among them, the KL divergence constrains the consistency of the feature distributions of the synthetic data and the real data.
[0038] Optionally, for the fast comparison technology based on the hash algorithm in the verification module, the Bloom Filter is used to preprocess the product specification information in the packaging order sequence to reduce unnecessary exact comparison operations. The construction formula of the Bloom Filter is:
[0039]
[0040] Among them, BF(x) is the mapping result of the Bloom Filter for the element x, and hash i (x) is the hash value of the element x by the i-th hash function, and k is the number of hash functions. When verifying the cigarette product specification information, first quickly judge whether the product specification information may exist in the product specification information of the packaging order sequence through the Bloom Filter. If not, it is directly determined to be inconsistent; if it may exist, further exact hash value comparison is performed. In this way, the verification work of a large amount of cigarette product specification information and the product specification information of the packaging order sequence can be completed in a short time, greatly improving the verification efficiency, especially when dealing with large-scale order data, the effect is remarkable.
[0041] Optionally, the hash algorithm of the verification module further includes:
[0042] (a) Quantum collision-resistant hash function: Adopt a hash algorithm based on lattice cryptography to generate a quantum-safe signature for the order product specification. The function definition is:
[0043]
[0044] Among them, a i is a random lattice basis vector, and q is an extremely large prime number to prevent hash cracking caused by future quantum computing attacks;
[0045] (b) Fault-tolerant recovery mechanism: When the Bloom filter determines "possibly exists", start the redundant verification channel, call the cloud historical order blockchain data for secondary hash comparison to ensure that the verification result cannot be tampered with.
[0046] In a second aspect, the present application provides a method for verifying cigarette brands based on two-dimensional codes, including the following steps:
[0047] Cigarettes automatically pass through a two-dimensional code information reading device provided on the cigarette sorting line, and the two-dimensional code information reading device reads the two-dimensional code information on the cigarettes by using multi-lens collaborative imaging technology;
[0048] The two-dimensional code information reading device sends the read two-dimensional code information to the industrial control device through high-speed optical fiber communication;
[0049] The data processing module in the industrial control device automatically intercepts the corresponding numerical values (characters) of fixed specifications by using a deep learning algorithm based on an improved convolutional neural network, and forms the passed cigarette specification information according to the numerical values;
[0050] The verification module in the industrial control device uses a fast comparison technology based on the hash algorithm to verify the cigarette specification information with the specification information of the packaging order sequence;
[0051] When the verification module detects that the cigarette specification information is inconsistent with the specification information of the packaging order sequence, the alarm module in the industrial control device generates an alarm instruction, and sends the alarm information to the mobile terminal of the relevant staff through wireless communication;
[0052] The stop control module controls the cigarette sorting line to stop according to the alarm instruction. The stop control module adopts a redundant design to ensure reliable stopping.
[0053] Optionally, in the step where the cigarettes automatically pass through the two-dimensional code information reading device, by establishing a cigarette motion model, combining the characteristics of multi-lens collaborative imaging technology, optimizing the transmission speed of the cigarette sorting line and the installation position of the two-dimensional code information reading device, the cigarette motion model uses Newton's mechanical equation to describe the motion state of the cigarettes on the sorting line, that is, F = ma, where F is the resultant force acting on the cigarettes, m is the mass of the cigarettes, and a is the acceleration. By solving this model, predict the position and posture of the cigarettes at different times, so as to adjust the transmission speed of the sorting line and the installation angle of the two-dimensional code information reading device, ensure that the cigarettes can pass through the two-dimensional code information reading device at a stable speed and posture, and improve the accuracy of two-dimensional code reading. At the same time, use real-time feedback control technology to dynamically fine-tune the transmission speed of the sorting line according to the actual quality of the read two-dimensional code, and further optimize the reading effect.
[0054] Optionally, in the step where the data processing module automatically intercepts the values (characters) corresponding to the fixed product specifications, by establishing a product specification information database containing a large amount of two-dimensional code information of cigarettes of different brands and batches, and using the Apriori algorithm for association rule mining to analyze and optimize the data in the database, the core steps of the Apriori algorithm include generating frequent item sets and mining association rules. In the process of generating frequent item sets, by setting a minimum support threshold σ, the item sets with higher frequencies are screened. The formula is:
[0055]
[0056] Among them, support(X) is the support of item set X, |T∩X| is the number of transactions in transaction set T that contain item set X, and |T| is the total number of transactions in transaction set T. When mining association rules, by setting a minimum confidence threshold θ, the rules with strong association relationships are found. The formula is:
[0057]
[0058] Among them, confidence(X→Y) is the confidence from item set X to item set Y, and support(X∪Y) is the support when item sets X and Y appear simultaneously. In this way, the potential rules in the two-dimensional code information can be deeply mined, and the accuracy and efficiency of intercepting the values (characters) corresponding to the fixed product specifications can be improved. Especially for some cases where the two-dimensional code data has noise or is not standardized, it can effectively identify and process them.
[0059] Optionally, in the step where the verification module verifies the cigarette product specification information with the product specification information of the packaging order sequence, a fuzzy matching algorithm based on the edit distance is adopted, which can handle the incomplete consistency caused by data errors or format differences. The edit distance, also known as the Levenshtein Distance, its calculation formula is:
[0060]
[0061] Among them, s1 and s2 are two strings to be compared, |s1| and |s2| are the lengths of strings s1 and s2 respectively, s1[0] represents the first character of string s1, and s1[1:] represents the substring of string s1 after removing the first character. In practical applications, by setting a maximum edit distance threshold d, when the edit distance between two strings is less than or equal to d, it is considered that the two strings match. Through this fuzzy matching algorithm, the reliability of verification can be improved, and the misjudgment cases caused by data errors or format differences can be effectively reduced, which has important application value in complex actual production environments.
[0062] Compared with the prior art, the present invention has the following beneficial technical effects:
[0063] The multi-lens collaborative imaging technology of the QR code information reading device in the system, combined with three-dimensional attitude compensation and environmental adaptive exposure control, can obtain high-quality QR code images. The improved convolutional neural network algorithm adds an attention mechanism, cross-modal feature fusion, and a transfer learning framework, improving the accuracy of fixed product specification value extraction. The fuzzy matching algorithm adopted by the verification module can handle data errors and format differences, ensuring the accuracy of the verification of cigarette product specification information and orders.
[0064] The edge computing node preprocesses data in real time, filters out invalid or duplicate data, reduces the data processing volume of industrial control devices, and speeds up data processing. The fast comparison technology based on the hash algorithm uses a Bloom filter for quick judgment, improving the verification efficiency.
[0065] The redundant design of the shutdown control module ensures that when shutdown is required due to inconsistent product specification information, the sorting line can stop reliably, preventing the equipment from continuing to run during a failure and causing more errors.
[0066] The adaptive learning engine dynamically optimizes the parameters of the convolutional neural network and the hash comparison threshold by learning the operating state of the sorting line and historical error data, realizing system self-calibration and continuously adapting to changes in the production environment.
[0067] The verification module adopts a quantum anti-collision hash function to prevent hash cracking caused by quantum computing attacks and ensure data security. The fault tolerance and recovery mechanism calls the blockchain data of historical orders in the cloud for secondary comparison to ensure that the verification results cannot be tampered with.
[0068] Based on the cigarette movement model, the transmission speed of the sorting line and the installation position of the QR code information reading device are optimized to improve the QR code reading effect. The association rule mining algorithm analyzes and optimizes the product specification information database, improving data processing efficiency and accuracy.
[0069] The present invention realizes high accuracy in cigarette brand verification, efficient data processing and quick verification, stable and reliable operation of the system, intelligent self-optimization and calibration, data security protection, and optimization of the production process, effectively improving the brand verification efficiency and accuracy in the cigarette sorting process, reducing the error rate and production cost, and enhancing the adaptability and stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 It is a schematic block diagram of a system for verifying cigarette brands based on QR codes. DETAILED DESCRIPTION OF THE INVENTION
[0071] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments.
[0072] Embodiment 1
[0073] As Figure 1 shown, a system for verifying cigarette brands based on two-dimensional codes includes a two-dimensional code information reading device, an industrial control device, a data processing module, a verification module, an alarm module, a shutdown control module, an edge computing node, and an adaptive learning engine. Each part will be described in detail below.
[0074] In this embodiment, the two-dimensional code information reading device is arranged on the cigarette sorting line and is used to read the two-dimensional code information on the cigarette when the cigarette automatically passes. The two-dimensional code information reading device uses a multi-lens collaborative imaging technology to simultaneously collect two-dimensional code images from multiple angles; the multi-lens collaborative imaging technology in the two-dimensional code information reading device performs fusion processing on the images collected by multiple lenses, and its fusion algorithm formula is:
[0075] I final = α1I1 + α2I2 + … + α n I n
[0076] where, I final is the fused image, I i is the image collected by the i-th lens, α i is the weight coefficient of the i-th lens image, and
[0077]
[0078] the weight coefficient α i is dynamically adjusted according to factors such as the position of the lens, the imaging quality, and the relationship with the movement direction of the cigarette through a machine learning algorithm;
[0079] The multi-lens collaborative imaging technology further includes:
[0080] (a) A three-dimensional pose compensation module based on a depth camera: obtaining the depth information on the cigarette surface through a TOF (Time-of-Flight) sensor, reconstructing a three-dimensional model in combination with multi-view images, and dynamically correcting the two-dimensional code distortion. The fusion formula is:
[0081]
[0082] where, Warp is a perspective transformation function based on the depth map D i to eliminate the image stretching caused by the inclination of the cigarette;
[0083] (b) Environment Adaptive Exposure Control: According to the light fluctuation on the sorting line, the lens aperture is dynamically adjusted using Pulse Width Modulation (PWM), and the exposure time TT satisfies:
[0084]
[0085] where L max is the maximum allowable light intensity, L env is the real-time ambient light intensity, and k is the calibration coefficient to ensure that clear QR code can still be captured under low light. The QR code information reading device of the system adopts multi-lens collaborative imaging technology to collect QR code images from multiple angles simultaneously. Combining with the three-dimensional pose compensation module based on a depth camera, the depth information of the cigarette surface is obtained using a Time-of-Flight (TOF) sensor, which can dynamically correct the QR code distortion. Even if the cigarette is tilted on the sorting line, the QR code information can be accurately collected, greatly improving the accuracy of information collection and reducing the recognition errors caused by the deformation of the QR code image.
[0086] Among them, the industrial control device and the QR code information reading device are connected through high-speed fiber optic communication, and are used to receive and process QR code information;
[0087] In addition, the data processing module is integrated into the industrial control device and is used to extract the fixed product specification value in the QR code and generate cigarette product specification information through an improved convolutional neural network algorithm; the improved convolutional neural network algorithm in the data processing module adds an attention mechanism module on the basis of the traditional convolutional neural network. The calculation formula of the convolutional layer in the network structure is:
[0088]
[0089] where is the j-th feature map of the l + 1 layer, M j is the set of input feature maps related to the j-th feature map, is the convolutional kernel from the i-th feature map to the j-th feature map of the l layer, is the bias term, * represents the convolution operation. The attention mechanism module calculates the importance weights of each part of the feature map and performs weighted processing on the feature map. The formula is:
[0090]
[0091] where A(X) is the feature map processed by the attention mechanism, X i is different parts of the original feature map, w i is the corresponding weight, and σ is the activation function. In this way, the value (character) corresponding to the fixed product specification can be more accurately recognized and extracted, adapting to the complex and diverse QR code data formats of different cigarette brands.
[0092] It should be noted that the improved convolutional neural network algorithm also includes:
[0093] (a) Cross-modal feature fusion module: Input the visible light QR code image and the near-infrared reflection image into a two-branch network to enhance the recognition robustness in occluded scenarios through feature concatenation. The formula is:
[0094] F fusion = Conv(Concat(F visible , F NIR ))
[0095] (b) Transfer learning framework: The pre-trained network simulates cigarette pack wear and stain noise on the synthetic dataset, and then adapts to the specific production line through small-sample fine-tuning. The loss function is:
[0096]
[0097] Among them, the KL divergence constrains the consistency of the feature distributions of the synthetic data and the real data. The data processing module integrates the improved convolutional neural network algorithm, adds an attention mechanism module, and also includes a cross-modal feature fusion module and a transfer learning framework. By weighting the feature map through the attention mechanism, key information can be highlighted; cross-modal feature fusion combines visible light and near-infrared reflection images to enable accurate recognition even in occluded scenarios; the transfer learning framework is pre-trained and fine-tuned to adapt to different production lines, comprehensively improving the extraction accuracy of the fixed product specifications in the QR code, and thus ensuring the accurate generation of cigarette product specification information.
[0098] In this embodiment, the verification module is integrated into the industrial control device and is used to quickly compare the cigarette product specification information with the product specification information of the packaging order based on the hash algorithm; the fast comparison technology based on the hash algorithm in the verification module preprocesses the product specification information in the packaging order sequence using a Bloom Filter to reduce unnecessary exact comparison operations. The construction formula of the Bloom Filter is:
[0099]
[0100] Among them, BF(x) is the mapping result of the Bloom Filter for element x, hash i (x) is the hash value of the i-th hash function for element x, and k is the number of hash functions. When verifying the cigarette product specification information, first quickly determine whether the product specification information may exist in the product specification information in the packaging order sequence through the Bloom Filter. If it does not exist, directly determine that they are inconsistent; if it may exist, further perform an exact hash value comparison. In this way, the verification work of a large amount of cigarette product specification information and the product specification information in the packaging order sequence can be completed in a short time, greatly improving the verification efficiency, especially when dealing with large-scale order data, the effect is remarkable.
[0101] The hash algorithm of the verification module further includes:
[0102] (a) Quantum collision-resistant hash function: Adopt a hash algorithm based on lattice cryptography to generate a quantum-secure signature for the order product specification. The function is defined as:
[0103]
[0104] where a i is a random lattice basis vector, and q is an extremely large prime number to prevent hash cracking caused by future quantum computing attacks;
[0105] (b) Fault-tolerant recovery mechanism: When the Bloom filter determines "possibly exists", start the redundant verification channel, call the historical order blockchain data in the cloud for secondary hash comparison to ensure that the verification result cannot be tampered with.
[0106] It should be noted that the alarm module is integrated into the industrial control device and is used to trigger an audible and visual alarm and send an alarm message to the mobile terminal when the product specification information is inconsistent; a high-brightness and high-decibel audible and visual alarm is selected to ensure that it can clearly attract the attention of the staff in the noisy cigarette sorting workshop. At the same time, a wireless communication module, such as a 4G or 5G module, is equipped for the industrial control device to ensure stable communication with the mobile terminal. Write the alarm trigger program logic in the software system of the industrial control device. When the verification module determines that the product specification information is inconsistent, send a signal to the alarm module. After receiving the signal, the alarm module immediately activates the audible and visual alarm, and at the same time sends an alarm instruction containing error information (such as the wrong cigarette product specification, order product specification, occurrence time, etc.) to the pre-bound staff mobile terminal according to the set communication protocol. The mobile terminal installs a dedicated APP for receiving alarm information and pops up a window in time to remind the staff after receiving the information.
[0107] Furthermore, the shutdown control module is connected to the alarm module and is used to control the sorting line to stop according to the alarm instruction. The shutdown control module adopts a redundant design; a dual-controller architecture is adopted, namely a main controller and a standby controller. Both controllers receive the alarm instruction from the alarm module simultaneously, but under normal circumstances, only the main controller executes the operation of controlling the sorting line to stop. When the main controller fails, the standby controller can automatically take over the work to ensure that the sorting line stops in time. In addition, the lines connecting the controller to the sorting line motors also adopt a redundant design, with multiple standby lines laid to prevent the inability to stop due to line failures. The shutdown control logic is programmed in the controller's program. After receiving the alarm instruction, the controller quickly sends a stop signal to the sorting line motors and closes the relevant material conveying valves at the same time to prevent the continuous conveyance of materials. Moreover, the controller will record information such as the shutdown time and reason, which is convenient for subsequent fault troubleshooting and production data statistics. The shutdown control module adopts a redundant design. When the alarm module issues an alarm instruction, even if the main control part fails, the redundant part can immediately take over the work and control the sorting line to stop, avoiding the continuous sorting of incorrect products due to equipment failures and ensuring the reliability and stability of the production process.
[0108] In this embodiment, the edge computing node is deployed at key positions on the sorting line and is used to preprocess the QR code data in real time. It screens out invalid or duplicate data through a lightweight AI model and only transmits the valid data to the industrial control device, reducing the load on the central node; at key positions on the sorting line, near the QR code information reading device, an edge computing device with powerful computing capabilities is installed, such as an industrial-grade edge computing gateway. This device is equipped with a high-performance processor, a large-capacity memory, and storage to meet the real-time data processing requirements. At the same time, it is connected to the QR code information reading device and the industrial control device through high-speed network interfaces to ensure the high efficiency of data transmission. A lightweight AI model, such as a lightweight model based on convolutional neural network (CNN), is deployed on the edge computing node. The model has been pre-trained and can identify invalid or duplicate QR code data. When the QR code information reading device collects data, the edge computing node immediately processes the data. By analyzing the characteristics of the data through the model, it determines whether the data is valid or duplicate. For invalid or duplicate data, it is directly discarded at the edge computing node, and only the valid data is transmitted to the industrial control device through the network, reducing the data processing pressure on the industrial control device. The edge computing node is deployed at key positions on the sorting line, using a lightweight AI model to preprocess the QR code data in real time, screening out invalid or duplicate data, and only transmitting the valid data to the industrial control device, effectively reducing the load on the central node (industrial control device), enabling the system to quickly process a large amount of data, improving the overall operation efficiency, and ensuring the stability of the system under high-load working conditions.
[0109] It should be noted that the adaptive learning engine is embedded in the industrial control device. By online learning the operation status of the sorting line and historical error data, it dynamically optimizes the parameters of the convolutional neural network and the hash comparison threshold to perform system self-calibration. A data acquisition module is set in the industrial control device to collect the operation status data of the sorting line in real time, including the device operation speed, temperature, voltage, and historical error data, including detailed records of inconsistent product specifications each time. These data are stored in a large-capacity local database for subsequent analysis. The adaptive learning engine runs continuously in the background and regularly reads data from the database. Using online learning algorithms such as the Stochastic Gradient Descent (SGD) algorithm, it dynamically optimizes the parameters of the convolutional neural network and the hash comparison threshold. According to the changes in the operation status of the sorting line, it adjusts the parameters of the convolutional neural network to better adapt to different working environments and improve the accuracy of QR code recognition. At the same time, according to the historical error data, it optimizes the hash comparison threshold to reduce the occurrence of misjudgment, realizes the self-calibration function of the system, and continuously improves the overall performance of the system. The adaptive learning engine is embedded in the industrial control device. By online learning the operation status of the sorting line and historical error data, it dynamically optimizes the parameters of the convolutional neural network and the hash comparison threshold. As the system operation time increases, it continuously adapts to changes in the production environment, such as equipment aging and slight changes in cigarette packaging, continuously improves the system performance, reduces the error rate, and lowers the manual maintenance cost.
[0110] In this embodiment, the verification module uses a quantum-resistant collision hash function based on lattice cryptography to generate a quantum-safe signature for the order product specification, which can effectively prevent hash cracking caused by future quantum computing attacks, ensure the security and integrity of the data, and ensure the credibility of the product specification information during the comparison process. When the Bloom filter determines "possibly exists", it activates the redundant verification channel and calls the blockchain data of historical orders in the cloud for secondary hash comparison. The immutable characteristic of the blockchain data ensures the accuracy and non-repudiation of the verification result, further improving the reliability of the verification.
[0111] Embodiment 2
[0112] This embodiment provides a method for verifying cigarette brands based on QR codes, including the following steps:
[0113] The cigarette automatically passes through a two-dimensional code information reading device arranged on the cigarette sorting line. The two-dimensional code information reading device uses multi-lens collaborative imaging technology to read the two-dimensional code information on the cigarette. By establishing a cigarette motion model and combining the characteristics of multi-lens collaborative imaging technology, the transmission speed of the cigarette sorting line and the installation position of the two-dimensional code information reading device are optimized. The cigarette motion model uses Newton's mechanical equation to describe the motion state of the cigarette on the sorting line, that is, F = ma, where F is the resultant force acting on the cigarette, m is the mass of the cigarette, and a is the acceleration. By solving this model, the position and posture of the cigarette at different times are predicted, so as to adjust the transmission speed of the sorting line and the installation angle of the two-dimensional code information reading device, ensuring that the cigarette can pass through the two-dimensional code information reading device at a stable speed and posture, and improving the accuracy of two-dimensional code reading. At the same time, using real-time feedback control technology, according to the actual quality of the read two-dimensional code, the transmission speed of the sorting line is dynamically fine-tuned to further optimize the reading effect. When the cigarette passes through the two-dimensional code information reading device, a cigarette motion model is established and combined with the characteristics of multi-lens collaborative imaging technology to optimize the transmission speed of the sorting line and the installation position of the device. By using Newton's mechanical equation to predict the position and posture of the cigarette, relevant parameters are adjusted to ensure that the cigarette passes through the reading device in a stable state, improving the accuracy of two-dimensional code reading and reducing reading errors caused by unstable motion.
[0114] The two-dimensional code information reading device sends the read two-dimensional code information to the industrial control device through high-speed optical fiber communication;
[0115] In the data processing module in the industrial control device, a deep learning algorithm based on an improved convolutional neural network is used to automatically intercept the numerical values (characters) corresponding to the fixed product specifications, and form the passed cigarette product specification information according to the numerical values. In the step of the data processing module automatically intercepting the numerical values (characters) corresponding to the fixed product specifications, by establishing a product specification information database containing a large amount of two-dimensional code information of different brands and different batches of cigarettes, and using the Apriori algorithm of association rule mining to analyze and optimize the data in the database. The core steps of the Apriori algorithm include generating frequent item sets and mining association rules. In the process of generating frequent item sets, by setting a minimum support threshold σ, item sets with higher frequencies are screened. The formula is:
[0116]
[0117] Among them, support(X) is the support of item set X, |T∩X| is the number of transactions containing item set X in transaction set T, |T| is the total number of transactions in transaction set T. When mining association rules, by setting a minimum confidence threshold θ, rules with strong association relationships are found. The formula is:
[0118]
[0119] Among them, confidence(X→Y) is the confidence from item set X to item set Y, and support(X∪Y) is the support for the simultaneous occurrence of item sets X and Y. In this way, the potential rules in the QR code information can be deeply mined, and the accuracy and efficiency of intercepting the corresponding values (characters) of fixed product specifications can be improved. Especially for some cases where there is noise or non-standard QR code data, it can effectively identify and process them.
[0120] The verification module in the industrial control device uses a fast comparison technology based on the hash algorithm to verify the cigarette product specification information with the product specification information in the packaging order sequence;
[0121] When the verification module detects that the cigarette product specification information is inconsistent with the product specification information in the packaging order sequence, the alarm module in the industrial control device generates an alarm instruction and sends the alarm information to the mobile terminal of the relevant staff through wireless communication; in the step of the verification module verifying the cigarette product specification information with the product specification information in the packaging order sequence, a fuzzy matching algorithm based on the edit distance is adopted, which can handle the incomplete consistency caused by data errors or format differences. The edit distance, also known as the Levenshtein Distance, has the following calculation formula:
[0122]
[0123] Among them, s1 and s2 are two strings to be compared, |s1| and |s2| are the lengths of strings s1 and s2 respectively, s1[0] represents the first character of string s1, and s1[1:] represents the substring of string s1 after removing the first character. In practical applications, by setting a maximum edit distance threshold d, when the edit distance between two strings is less than or equal to d, these two strings are considered to match. Through this fuzzy matching algorithm, the reliability of verification can be improved, and the misjudgment cases caused by data errors or format differences can be effectively reduced, which has important application value in complex actual production environments.
[0124] The stop control module controls the cigarette sorting line to stop according to the alarm instruction. This stop control module adopts a redundant design to ensure reliable stopping.
[0125] In this embodiment, the data processing module establishes a product specification information database containing a large amount of cigarette QR code information, and uses the Apriori algorithm of association rule mining to analyze and optimize the data. By setting the minimum support and confidence thresholds, the potential rules in the data are mined, and the accuracy and efficiency of intercepting the corresponding values of fixed product specifications are improved. Especially when dealing with noisy or non-standard QR code data, it can effectively identify and process them to ensure the accurate generation of cigarette product specification information.
[0126] Enhance verification reliability and adaptability: The verification module adopts a fuzzy matching algorithm based on the edit distance, which can handle incomplete consistency cases caused by data errors or format differences. By setting the maximum edit distance threshold, in a complex actual production environment, even if there are certain deviations in the data, it can accurately determine whether the cigarette product specification information matches the product specification information in the packaging order sequence, effectively reducing misjudgment cases and improving the reliability and adaptability of verification. When the verification module detects inconsistent product specification information, the alarm module promptly sends an alarm message to the staff's mobile terminal, and the stop control module quickly controls the sorting line to stop. This timely response mechanism can prevent incorrect products from entering the next production link, ensure product quality, reduce the economic losses of the enterprise caused by product errors, and at the same time facilitate the staff to quickly locate and solve problems, ensuring the accuracy and controllability of the production process.
[0127] The above specific embodiments are only several alternative embodiments of the present invention. Based on the technical solution of the present invention and the relevant revelations of the above embodiments, those skilled in the art can make various alternative improvements and combinations to the above specific embodiments.
Claims
1. A system for verifying cigarette brands based on QR codes, characterized in that, Including: A QR code information reading device, which is set on the cigarette sorting line and is used to read the QR code information on the cigarette when the cigarette automatically passes through. The QR code information reading device uses multi-lens collaborative imaging technology to simultaneously collect QR code images from multiple angles; An industrial control device, which is communicatively connected to the QR code information reading device through a high-speed optical fiber and is used to receive and process the QR code information; A data processing module, which is integrated into the industrial control device and is used to extract the fixed product specification value in the QR code through an improved convolutional neural network algorithm and generate cigarette product specification information; A verification module, which is integrated into the industrial control device and is used to quickly compare the cigarette product specification information with the product specification information of the packaging order based on the hash algorithm; An alarm module, which is integrated into the industrial control device and is used to trigger an audible and visual alarm and send an alarm message to the mobile terminal when the product specification information is inconsistent; A stop control module, which is connected to the alarm module and is used to control the sorting line to stop according to the alarm instruction. The stop control module adopts a redundant design; An edge computing node, which is deployed at key positions on the sorting line and is used to preprocess the QR code data in real time, screen out invalid or duplicate data through a lightweight AI model, and only transmit the valid data to the industrial control device to reduce the load of the central node; An adaptive learning engine, which is embedded in the industrial control device and dynamically optimizes the parameters of the convolutional neural network and the hash comparison threshold by online learning the operation status of the sorting line and historical error data for system self-calibration.
2. The system for verifying cigarette brands based on QR codes according to claim 1, characterized in that, The multi-lens collaborative imaging technology in the QR code information reading device performs fusion processing on the images collected by multiple lenses, and its fusion algorithm formula is: I final = α1I1 + α2I2 + … + α n I n Among them, I final is the fused image, I i is the image collected by the i-th camera shot, α i is the weight coefficient of the i-th camera shot image, and Weight coefficient α i Dynamically adjusted by a machine learning algorithm based on factors such as the position of the lens, imaging quality, and the relationship with the movement direction of the cigarette. The multi-lens collaborative imaging technology also includes: A three-dimensional pose compensation module based on a depth camera: obtaining the depth information on the cigarette surface through a time-of-flight sensor, reconstructing a three-dimensional model by combining multi-view images, dynamically correcting the QR code distortion, and the fusion formula is: Among them, Warp is a perspective transformation function based on the depth map D i to eliminate the image stretching caused by the tilt of the cigarette; Environment adaptive exposure control: According to the light fluctuation on the sorting line, the lens aperture is dynamically adjusted by pulse width modulation, and the exposure time T satisfies: Among them, L max is the maximum allowable light intensity, and L env is the real-time ambient light intensity. k is a calibration coefficient to ensure that a clear QR code can still be captured under low light conditions.
3. The system for verifying cigarette brands based on QR codes according to claim 1, wherein The improved convolutional neural network algorithm in the data processing module adds an attention mechanism module on the basis of the convolutional neural network. The calculation formula of the convolutional layer in the network structure is: Among them, is the j-th feature map of the (l + 1)-th layer, M j is the set of input feature maps related to the j-th feature map, is the convolution kernel from the i-th feature map to the j-th feature map of the l-th layer, is the bias term, * represents the convolution operation. The attention mechanism module calculates the importance weights of each part of the feature map and performs weighted processing on the feature map. The formula is: Among them, A(X) is the feature map processed by the attention mechanism, and X i is different parts of the original feature map, w i is the corresponding weight, and σ is the activation function.
4. The system for verifying cigarette brands based on QR codes according to claim 3, wherein, The improved convolutional neural network algorithm also includes: A cross-modal feature fusion module: inputting the visible light QR code image and the near-infrared reflection image into a dual-branch network, and improving the recognition robustness in the occlusion scenario through feature concatenation. The formula is: F fusion = Conv(Concat(F visible , F NIR )) A transfer learning framework: The pre-trained network simulates the wear and stain noise of the cigarette case on the synthetic dataset, and then adapts to the specific production line through small-sample fine-tuning. The loss function is: Among them, the KL divergence constrains the consistency of the feature distributions of the synthetic data and the real data.
5. The system for verifying cigarette brands based on QR codes according to claim 1, wherein The fast comparison technology based on the hash algorithm in the verification module preprocesses the product specification information in the packaging order sequence by using a Bloom filter. The construction formula of the Bloom filter is: Among them, BF(x) is the mapping result of the Bloom filter for element x, and hash i (x) is the hash value of the i-th hash function for element x, and k is the number of hash functions. When checking the cigarette product specification information, first quickly determine whether the product specification information may exist in the product specification information of the packaging order sequence through the Bloom filter. If it does not exist, directly determine that they are inconsistent; if it may exist, further perform an accurate hash value comparison.
6. The system for verifying cigarette brands based on QR codes according to claim 1, characterized in that, The hash algorithm of the verification module also includes: A quantum collision-resistant hash function: adopting a hash algorithm based on lattice cryptography to generate a quantum-safe signature for the order product specification. The function definition is: where a i is a random lattice basis vector, and q is a super large prime number to prevent hash cracking caused by future quantum computing attacks; Fault-tolerant recovery mechanism: When the Bloom filter determines that "it may exist", start the redundant verification channel, and call the cloud historical order blockchain data for secondary hash comparison to ensure that the verification result cannot be tampered with.
7. A method for verifying cigarette brands based on two-dimensional codes, characterized in that, Including the following steps: Cigarettes automatically pass through a two-dimensional code information reading device arranged on the cigarette sorting line, and the two-dimensional code information reading device reads the two-dimensional code information on the cigarettes by using multi-lens collaborative imaging technology; The two-dimensional code information reading device sends the read two-dimensional code information to the industrial control device through high-speed optical fiber communication; The data processing module in the industrial control device automatically intercepts the values corresponding to the fixed product specifications by using a deep learning algorithm based on an improved convolutional neural network, and forms the passed cigarette product specification information according to the values; The verification module in the industrial control device uses a fast comparison technology based on the hash algorithm to verify the cigarette product specification information with the product specification information in the packaging order sequence; When the verification module detects that the cigarette product specification information is inconsistent with the product specification information in the packaging order sequence, the alarm module in the industrial control device generates an alarm instruction, and sends the alarm information to the mobile terminal of the relevant staff through wireless communication; The shutdown control module controls the shutdown of the cigarette sorting line according to the alarm instruction, and the shutdown control module adopts redundant design.
8. A method for verifying cigarette brands based on QR codes according to claim 7, characterized in that In the step where the cigarettes automatically pass through the two-dimensional code information reading device, by establishing a cigarette movement model and combining the characteristics of multi-lens collaborative imaging technology, optimize the transmission speed of the cigarette sorting line and the installation position of the two-dimensional code information reading device. The cigarette movement model uses Newton's mechanical equation to describe the movement state of the cigarettes on the sorting line, that is, F = ma, where F is the resultant force acting on the cigarettes, m is the mass of the cigarettes, and a is the acceleration.
9. A method for verifying cigarette brands based on two-dimensional codes according to claim 7, characterized in that, In the step where the data processing module automatically intercepts the values corresponding to the fixed product specifications, by establishing a product specification information database containing a large amount of two-dimensional code information of different brands and different batches of cigarettes, and using the Apriori algorithm for association rule mining to analyze and optimize the data in the database. The core steps of the Apriori algorithm include generating frequent item sets and mining association rules. In the process of generating frequent item sets, by setting a minimum support threshold σ, filter out the item sets with higher frequencies. The formula is: Among them, support(X) is the support of item set X, |T∩X| is the number of transactions in transaction set T that contain item set X, |T| is the total number of transactions in transaction set T. When mining association rules, by setting a minimum confidence threshold θ, find the rules with strong association relationships. The formula is: Among them, confidence(X→Y) is the confidence from item set X to item set Y, and support(X∪Y) is the support of item sets X and Y appearing simultaneously.
10. A method for verifying cigarette brands based on QR codes according to claim 7, characterized in that, In the step where the verification module verifies the cigarette product specification information with the product specification information in the packaging order sequence, a fuzzy matching algorithm based on the edit distance is used to handle the incomplete consistency caused by data errors or format differences. The edit distance, also known as the Levenshtein distance, its calculation formula is: Among them, s1 and s2 are two strings to be compared, |s1| and |s2| are the lengths of strings s1 and s2 respectively, s1[0] represents the first character of string s1, and s1[1:] represents the substring of string s1 after removing the first character.