Printing source identification method based on two-dimensional code anti-counterfeit label and related device

By building a CBAM-ConvNeXt network model and applying label smoothing technology, the problem of poor identification accuracy of QR code anti-counterfeiting tags on smartphones is solved, and efficient and accurate identification on mobile devices is achieved.

CN120471080APending Publication Date: 2025-08-12CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing QR code anti-counterfeiting label recognition method relies on high-resolution scanning equipment and cannot adapt to the image acquisition conditions of smartphones, resulting in poor recognition accuracy and robustness, especially in light changes, noise interference and similar printer models.

Method used

Build a CBAM-ConvNeXt network model, combines the channel attention module and the spatial attention module, trains through label smoothing technology, adapts to mobile device acquisition conditions, and improves recognition accuracy.

Benefits of technology

It realizes accurate identification of QR code anti-counterfeiting tags on mobile devices, get rid of the dependence on high-resolution devices, improves recognition accuracy and robustness, and adapts to complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120471080A_ABST
    Figure CN120471080A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of image recognition, deep learning and anti-counterfeiting, and provides a printing source recognition method based on a two-dimensional code anti-counterfeiting label and a related device, and the method comprises the steps: constructing sample data for training a printing source recognition model; constructing an initial printing source identification model, wherein the initial printing source identification model is a CBAM-ConvNeXt network model; training the initial printing source identification model by adopting the sample data based on a label smoothing technology to obtain a target printing source identification model; receiving two-dimensional code image data to be identified; the target printing source recognition model is adopted to recognize the two-dimensional code image data to be recognized, a printing source recognition result is obtained, the target printing source recognition model obtained through training on the basis of the constructed initial printing source recognition model can adapt to mobile equipment collection conditions, dependence on high-resolution equipment is eliminated, and the printing source recognition efficiency is improved. And the identification accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of image recognition, deep learning, and anti-counterfeiting technology, and specifically to a printing source identification method and related devices based on a QR code anti-counterfeiting label. Background Art

[0002] With the rapid development of information technology and the internet, QR codes, as efficient information carriers, are widely used on all kinds of product packaging. They store key product information, allowing consumers to quickly access product details by scanning with their smartphones, significantly improving the efficiency of product authenticity verification.

[0003] However, QR codes lack physical anti-counterfeiting properties, making them easily copied and used to counterfeit goods, seriously disrupting market order and threatening public safety. Counterfeit and shoddy products in my country cause enormous economic losses annually, with an average annual output value of approximately 130 billion yuan, resulting in a loss of 25 billion yuan in national tax revenue, and direct economic losses exceeding 200 billion yuan per year to consumers, businesses, and public safety. Against this backdrop, identifying the printed source of QR code anti-counterfeiting labels has become a crucial tool in combating counterfeiting, but existing technologies suffer from numerous drawbacks.

[0004] Existing methods for identifying printed sources rely on high-resolution scanning devices, which are not suitable for smartphone image acquisition. Smartphone imaging is affected by factors such as lighting, jitter, and shooting angle, resulting in unstable quality of the acquired QR code images, making it difficult for existing methods to accurately identify them. Summary of the Invention

[0005] The embodiment of the present application provides a print source identification method and related device based on a QR code anti-counterfeiting label, which can be based on the target print source identification model obtained by training the constructed CBAM-ConvNeXt network model, can adapt to the collection conditions of mobile devices, get rid of the dependence on high-resolution devices, and improve the accuracy of recognition.

[0006] A first aspect of an embodiment of the present application provides a method for identifying a print source based on a QR code anti-counterfeiting label, the method comprising:

[0007] Construct sample data for training the print source recognition model;

[0008] Constructing an initial print source identification model, wherein the initial print source identification model is a CBAM-ConvNeXt network model combining CBAM and ConvNeXt;

[0009] Based on label smoothing technology, the sample data is used to train the initial print source recognition model to obtain the target print source recognition model;

[0010] Receive the QR code image data to be identified;

[0011] The target print source identification model is used to identify the two-dimensional code image data to be identified, and a print source identification result is obtained.

[0012] In one possible implementation, the CBAM-ConvNeXt network model includes an input layer, a CBAM-ConvNeXt Block, a backbone network layer, a downsampling layer, and an output layer, as follows:

[0013] The input layer consists of a convolutional layer and a normalization layer (Layer Norm). The convolutional layer parameters are a convolution kernel size of 4×4, a stride of 4, a number of input channels of 3, and a number of output channels of 128. The convolutional layer is used to reduce the spatial resolution of the image and extract preliminary features to obtain a preliminary feature map. The preliminary feature map is passed through the normalization layer to alleviate the gradient vanishing problem of the deep network, and then the input feature map is obtained.

[0014] CBAM-ConvNeXt Block: The input feature map passes through the channel attention module and the spatial attention module in sequence. The channel attention module generates channel attention weights through global maximum pooling, global average pooling, and fully connected layer operations. The spatial attention module generates spatial attention weights through global maximum pooling, global average pooling, channel splicing, convolution, and activation function operations. The processed input feature map then undergoes depthwise convolution, layer normalization, 2D convolution, GELU activation, 2D convolution, layer scaling, and random depth operations before being input into the backbone network layer.

[0015] Backbone network layer: consists of four stages, with the number of CBAM-ConvNeXt blocks in each stage being 3, 3, 27, and 3, respectively, used to gradually extract features at different levels;

[0016] Downsampling layer: Located between adjacent stages, it uses a convolution operation with a convolution step of 2 and a convolution kernel size of 2×2 to reduce the feature map resolution and increase the number of channels;

[0017] Output layer: The feature map is first compressed into a fixed-length vector through global average pooling, then mapped to the category space through a fully connected layer, and the print source recognition result is output.

[0018] In one possible implementation, the method for calculating the feature map by the channel attention module is characterized by the following formula:

[0019] M C (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)));

[0020] Where F is the input feature map, Mc is the final channel attention map, σ is the sigmoid activation function, MLP is the fully connected layer, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0021] In one possible implementation, the method for calculating the feature map by the spatial attention module is represented by the following formula:

[0022] M s (F)=σ(f (7×7) ([AvgPool(F);MaxPool(F)]));

[0023] Where F' is the input feature map, Ms is the final spatial attention map, σ is the sigmoid activation function, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0024] In one possible implementation, the label smoothing technique processes labels using the following formula:

[0025]

[0026] where y c is the label value after label smoothing, ε is the label smoothing coefficient, and C is the number of categories.

[0027] A second aspect of an embodiment of the present application provides a print source identification device based on a QR code anti-counterfeiting label, the device comprising:

[0028] A construction unit is used to construct sample data for training a print source identification model; construct an initial print source identification model, wherein the initial print source identification model is a CBAM-ConvNeXt network model combining CBAM and ConvNeXt;

[0029] A training unit, configured to train an initial print source recognition model using sample data based on a label smoothing technique to obtain a target print source recognition model;

[0030] A receiving unit, configured to receive the QR code image data to be identified;

[0031] The recognition unit is used to recognize the two-dimensional code image data to be recognized by using the target print source recognition model to obtain a print source recognition result.

[0032] In one possible implementation, the CBAM-ConvNeXt network model includes an input layer, a CBAM-ConvNeXt Block, a backbone network layer, a downsampling layer, and an output layer, as follows:

[0033] The input layer consists of a convolutional layer and a normalization layer (Layer Norm). The convolutional layer parameters are a convolution kernel size of 4×4, a stride of 4, a number of input channels of 3, and a number of output channels of 128. The convolutional layer is used to reduce the spatial resolution of the image and extract preliminary features to obtain a preliminary feature map. The preliminary feature map is passed through the normalization layer to alleviate the gradient vanishing problem of the deep network, and then the input feature map is obtained.

[0034] CBAM-ConvNeXt Block: The input feature map passes through the channel attention module and the spatial attention module in sequence. The channel attention module generates channel attention weights through global maximum pooling, global average pooling, and fully connected layer operations. The spatial attention module generates spatial attention weights through global maximum pooling, global average pooling, channel splicing, convolution, and activation function operations. The processed input feature map then undergoes depthwise convolution, layer normalization, 2D convolution, GELU activation, 2D convolution, layer scaling, and random depth operations before being input into the backbone network layer.

[0035] Backbone network layer: consists of four stages, with the number of CBAM-ConvNeXt blocks in each stage being 3, 3, 27, and 3, respectively, used to gradually extract features at different levels;

[0036] Downsampling layer: Located between adjacent stages, it uses a convolution operation with a convolution step of 2 and a convolution kernel size of 2×2 to reduce the feature map resolution and increase the number of channels;

[0037] Output layer: The feature map is first compressed into a fixed-length vector through global average pooling, then mapped to the category space through a fully connected layer, and the print source recognition result is output.

[0038] In one possible implementation, the method for calculating the feature map by the channel attention module is characterized by the following formula:

[0039] M C (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)));

[0040] Where F is the input feature map, Mc is the final channel attention map, σ is the sigmoid activation function, MLP is the fully connected layer, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0041] In one possible implementation, the method for calculating the feature map by the spatial attention module is represented by the following formula:

[0042] M s (F)=σ(f (7×7) ([AvgPool(F);MaxPool(F)]));

[0043] Where F' is the input feature map, Ms is the final spatial attention map, σ is the sigmoid activation function, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0044] In one possible implementation, the label smoothing technique processes labels using the following formula:

[0045]

[0046] where y c is the label value after label smoothing, ε is the label smoothing coefficient, and C is the number of categories.

[0047] A third aspect of an embodiment of the present application provides a terminal, comprising a processor, an input device, an output device, and a memory, wherein the processor, input device, output device, and memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions and execute the step instructions in the first aspect of the embodiment of the present application.

[0048] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute some or all of the steps described in the first aspect of the embodiments of the present application.

[0049] A fifth aspect of the embodiments of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.

[0050] The implementation of the embodiments of the present application has the following beneficial effects:

[0051] An initial print source recognition model is constructed by constructing sample data for training a print source recognition model. The initial print source recognition model is a CBAM-ConvNeXt network model that combines CBAM and ConvNeXt. The sample data is used to train the initial print source recognition model based on label smoothing technology to obtain a target print source recognition model. The two-dimensional code image data to be recognized is received, and the two-dimensional code image data to be recognized is recognized using the target print source recognition model to obtain a print source recognition result. Therefore, the target print source recognition model obtained by training based on the constructed CBAM-ConvNeXt network model can adapt to the acquisition conditions of mobile devices, get rid of dependence on high-resolution devices, and improve the accuracy of recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0053] Figure 1 The present invention provides a flowchart of a method for identifying the source of a printout based on a QR code anti-counterfeiting label.

[0054] Figure 2 A schematic diagram of the CBAM attention mechanism is provided for the embodiments of this application;

[0055] Figure 3 A schematic diagram of a channel attention module is provided for an embodiment of the present application;

[0056] Figure 4 A schematic diagram of a spatial attention module is provided for an embodiment of the present application;

[0057] Figure 5 A schematic diagram of the CBAM-ConvNeXt network model structure is provided for the embodiment of this application;

[0058] Figure 6 A detailed diagram of the QR code anti-counterfeiting label printing source identification process is provided for the embodiment of this application

[0059] Figure 7 A schematic diagram of the structure of a terminal provided in an embodiment of the present application;

[0060] Figure 8 A structural schematic diagram of a printing source identification device based on a QR code anti-counterfeiting label is provided for an embodiment of the present application. DETAILED DESCRIPTION

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

[0062] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0063] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0064] In order to better understand the method for identifying the source of a print based on a QR code anti-counterfeiting label provided in an embodiment of the present application, the following first briefly introduces the method for identifying the source of a print for a QR code anti-counterfeiting label in the existing solution. In the existing solution, it relies on high-resolution scanning equipment, which cannot adapt to the image acquisition conditions of smartphones. Smartphone imaging is interfered with by factors such as lighting, jitter, and shooting angle. The quality of the acquired QR code image is unstable, which makes it difficult for the existing method to accurately identify it. In addition, the existing technology performs poorly in terms of recognition accuracy and robustness. When faced with similar printer models or complex environments, the recognition effect is greatly reduced. For example, the QR codes printed by similar model printers have very little difference in subtle texture features, and the existing technology is difficult to distinguish accurately; in an environment with changing lighting and noise interference, its recognition accuracy will drop significantly.

[0065] In order to solve the above technical problems, the embodiment of the present application provides a print source identification method based on a QR code anti-counterfeiting label. It can obtain a target print source identification model based on the constructed CBAM-ConvNeXt network model training, adapt to the collection conditions of mobile devices, get rid of the dependence on high-resolution devices, and improve the accuracy of recognition.

[0066] See also Figure 1, Figure 1 The present invention provides a flowchart of a method for identifying the source of a printout based on a QR code anti-counterfeiting label. Figure 1 As shown, the method includes:

[0067] 101. Construct sample data for training a print source recognition model.

[0068] The sample data includes a training set and a test set.

[0069] Data collection was conducted by collecting images of QR code anti-counterfeiting labels printed by printers of different brands and models, and using a variety of smartphones to collect data to simulate actual consumer usage scenarios. This ensured that the collected images covered the printing characteristics of different printers and the differences brought about by different mobile phone collections, thereby constructing a broadly representative dataset. Secondly, the images collected by smartphones were resized, and the QR code images collected by smartphone cameras were uniformly scaled to 512×512 pixels so that all images had consistent size specifications, reducing the impact of different device collection resolutions and improving the stability and accuracy of model training. Next, image segmentation was performed, and the 512×512 pixel QR code image was divided into 64×64 pixel image blocks, so that the model could learn more local area features, while reducing the amount of data in a single image block, reducing computational complexity, and improving training efficiency.

[0070] Each 512×512 pixel QR code image is segmented into multiple 64×64 pixel blocks, which serve as the basic data units for subsequent model training and testing. Finally, the dataset is partitioned, with the segmented QR code images divided into a training set and a test set (to obtain sample data) in a 3:1 ratio. The training set is used to train the CBAM-ConvNeXt network model, enabling it to learn the characteristic patterns of QR code images printed by different printers. The test set is used to evaluate the model's performance on unseen data. The training set is further divided into a training subset and a validation subset in a 4:1 ratio. The training subset is used to update and optimize model parameters, while the validation subset is used to monitor model performance during training and prevent overfitting. This reasonable dataset partitioning ensures that the model can fully learn effective features while obtaining accurate performance evaluations during the testing and validation phases.

[0071] 102. Construct an initial print source identification model, wherein the initial print source identification model is a CBAM-ConvNeXt network model that combines CBAM and ConvNeXt.

[0072] Specifically, a CBAM-ConvNeXt network model combining CBAM and ConvNeXt is constructed.

[0073] The CBAM-ConvNeXt network model includes the input layer, CBAM-ConvNeXt Block, backbone network layer, downsampling layer and output layer, among which,

[0074] The input layer consists of a convolutional layer and a normalization layer (Layer Norm). The convolutional layer parameters are a convolution kernel size of 4×4, a stride of 4, a number of input channels of 3, and a number of output channels of 128. The convolutional layer is used to reduce the spatial resolution of the image and extract preliminary features to obtain a preliminary feature map. The preliminary feature map is passed through the normalization layer to alleviate the gradient vanishing problem of the deep network, and then the input feature map is obtained.

[0075] CBAM-ConvNeXt Block: The input feature map passes through the channel attention module and the spatial attention module in sequence. The channel attention module generates channel attention weights through global maximum pooling, global average pooling, and fully connected layer operations. The spatial attention module generates spatial attention weights through global maximum pooling, global average pooling, channel splicing, convolution, and activation function operations. The processed input feature map then undergoes depthwise convolution, layer normalization, 2D convolution, GELU activation, 2D convolution, layer scaling, and random depth operations before being input into the backbone network layer.

[0076] Backbone network layer: consists of four stages, with the number of CBAM-ConvNeXt blocks in each stage being 3, 3, 27, and 3, respectively, used to gradually extract features at different levels;

[0077] Downsampling layer: Located between adjacent stages, it uses a convolution operation with a convolution step of 2 and a convolution kernel size of 2×2 to reduce the feature map resolution and increase the number of channels;

[0078] Output layer: The feature map is first compressed into a fixed-length vector through global average pooling, then mapped to the category space through a fully connected layer, and the print source recognition result is output.

[0079] CBAM is a lightweight and easy-to-integrate attention mechanism designed to improve the feature representation capabilities of convolutional neural networks (CNNs). It helps the model significantly improve the performance of visual tasks such as classification and detection by applying attention modules in two dimensions (channels and space), and has extremely low computational overhead. It can be seamlessly integrated into various CNN architectures with almost no additional computational burden. Experiments show that CBAM performs significantly better than traditional models on multiple large-scale datasets such as ImageNet-1K, MS COCO, and VOC 2007, demonstrating its wide applicability and high efficiency. Therefore, the present invention introduces CBAM in ConvNext to improve the feature extraction capability of the model. The core idea of the CBAM module is to refine the input feature map through a two-stage attention mechanism. As Figure 2As shown in the figure, the original feature map is first input, and then it passes through the channel attention module and the spatial attention module in sequence, finally obtaining the refined feature map. This gradual refinement process helps the model better focus on important features while suppressing irrelevant information, thereby improving feature representation capabilities.

[0080] The working principle of Channel Attention Module is Figure 3 As shown in the figure, first, the input feature map F is subjected to global maximum pooling and global average pooling operations respectively, thereby converting F from the original H×W×C into two 1×1×C feature maps, where H is the height of the feature map, W is the width of the feature map, and C is the number of channels of the feature map. Then, these two feature maps will pass through two fully connected layers (MLP) respectively, and finally output two 1×1×C feature maps. After obtaining these two 1×1×C feature maps, they are added together and the values are limited between 0 and 1 through the sigmoid activation function, and finally the channel attention map is obtained, that is, Figure 3 M in C .

[0081] The method for calculating the feature map of the channel attention module is characterized by the following formula:

[0082] M C (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)));

[0083] Where F is the input feature map, σ is the sigmoid activation function, MLP is the fully connected layer, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0084] The working principle diagram of Spatial Attention Module is as follows Figure 4 As shown in the figure, on the feature map F' of size H×W×C obtained in the previous step, global maximum pooling (MaxPool) and global average pooling (AvgPool) operations are first performed. The feature map obtained by maximum pooling is the blue part in the figure, and its size is H×W×1, while the feature map obtained by global average pooling is the orange part in the figure, and its size is also H×W×1. Next, these two feature maps are spliced in the channel dimension to obtain a feature map of H×W×2. Then, a convolution operation is performed to convert the spliced H×W×2 feature map into a feature map of H×W×1. Finally, the sigmoid activation function is applied to limit the value of the feature map to between 0 and 1, thereby obtaining the final spatial attention map M s .

[0085] The method for calculating the feature map of the spatial attention module is characterized by the following formula:

[0086] M s (F)=σ(f (7×7) ([AvgPool(F);MaxPool(F)]));

[0087] Where F' is the input feature map, σ is the sigmoid activation function, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0088] ConvNeXt is built from standard ConvNet modules and is comparable to Transformer in terms of accuracy and scalability, achieving 87.8% ImageNet top-1 accuracy and outperforming SwinTransformer in COCO detection and ADE20K segmentation, while maintaining the simplicity and efficiency of standard ConvNet. Therefore, the present invention makes innovative adjustments based on ConvNeXt and constructs a CBAM-ConvNeXt network model, aiming to improve the model's feature extraction capabilities and accuracy. Specifically, the CBAM module is pre-placed in the ConvNeXt Block to form a CBAM-ConvNeXt Block, thereby achieving dynamic weighting of image features in both channel and spatial dimensions. This innovative design enables the network to better focus on key features and suppress irrelevant information, effectively improving the performance of the model in complex image recognition tasks. To optimize the model structure, the present invention sets up four stages of CBAM-ConvNeXt Block, where the number of input channels is C = (128, 256, 512, 1024) in sequence, and the number of CBAM-ConvNeXt Block stacks in each stage is B = (3, 3, 27, 3). This design facilitates feature extraction at different levels, making the model more robust when processing high-dimensional complex data. The model parameters, such as convolution kernel size (k), stride (s), padding (p), number of input channels (In_channels), and number of output channels (Out_channels), are also carefully set and optimized to improve the efficiency and stability of the entire network. Through these innovative adjustments, CBAM-ConvNeXt significantly improves the performance of the model while maintaining the high efficiency of ConvNeXt, especially showing higher recognition accuracy and robustness in complex tasks such as printing source identification of QR code anti-counterfeiting labels.

[0089] Figure 5This is the overall network structure of CBAM-ConvNeXt, which shows in detail the location where the CBAM module is introduced and some parameter settings. CBAM-ConvNeXt can be divided into five parts: input layer structure, CBAM-ConvNeXtBlock, backbone network layer, downsampling layer, and output layer structure. In the input layer structure of the CBAM-ConvNeXt network, the Stem layer can convert the input image into a form suitable for subsequent processing. The Stem layer consists of a convolution layer and a normalization layer. Convolution layer parameters, by using a larger convolution kernel and stride, the initial convolution operation can reduce the spatial resolution of the input image by 4 times at one time, while extracting preliminary features. The introduction of the normalization layer helps alleviate the gradient vanishing problem in deep networks and promotes the stability and efficiency of the training process.

[0090] The structure of CBAM-ConvNeXt Block is as follows Figure 5 As shown in the middle section, the input to the CBAM-ConvNeXt Block structure is a feature map of size h×w×dim, where h is the height of the feature map, w is the width of the feature map, and dim is the number of channels. First, the feature map enters the channel attention module, where it undergoes max pooling and average pooling to extract channel information. It is then processed by a shared MLP and then applied to the sigmoid function to generate channel attention weights, thereby emphasizing or suppressing different channel features. It then enters the spatial attention module, where max pooling and average pooling are performed on the feature map in the spatial dimension. This is followed by a 1×1 convolution fusion transformation, and a sigmoid function to generate spatial attention weights to emphasize or deemphasize information at different spatial locations. The processed feature map then enters the subsequent Block structure. Within the Block structure, a depthwise convolution operation is first performed with a kernel size of 7, a stride of 1, and padding of 3. Convolution operations are performed on each channel separately to extract spatial features. Training is then stabilized by a batch normalization layer. The first 2D convolutional layer, with a kernel and stride of 1, quadruples the data dimension. A GELU activation function then introduces nonlinearity. A second 2D convolutional layer with the same parameters continues feature processing, followed by layer scaling and final random depth regularization to prevent overfitting. The final processed features are output.

[0091] The CBAM-ConvNeXt backbone network layer has four stages, each responsible for a specific feature extraction task. The number of CBAM-ConvNeXt blocks in the four stages is configured as (3, 3, 27, 3). The third stage contains the largest number of CBAM-ConvNeXt blocks, a structure that facilitates deep feature extraction. The first and fourth stages have fewer CBAM-ConvNeXt blocks, each with three. This design allows the network to quickly establish basic feature representations in the early stages, while focusing on subtle adjustments in the later stages. The second stage also has three CBAM-ConvNeXt blocks, serving as a bridge between the previous and the next stages, consolidating the features of the early stages and preparing for subsequent complex feature combinations.

[0092] The downsampling layer in CBAM-ConvNeXt is located between adjacent stages of the CBAM-ConvNeXt network model. It is mainly used to reduce the resolution of the feature map while increasing the number of channels. The convolution stride used is 2 and the convolution kernel size is 2x2.

[0093] At the output layer of CBAM-ConvNeXt, the Global Average Pooling (GAP) operation receives the feature map from the last stage as input and is responsible for compressing the final feature map into a fixed-length vector. A fully connected layer is added after GAP to map the fixed-length vector output by GAP to the category space.

[0094] 103. Based on the label smoothing technology, the sample data is used to train the initial print source recognition model to obtain the target print source recognition model.

[0095] During the training process, the present invention introduces label smoothing as an innovative technology to replace the traditional cross-entropy loss function. This technology can effectively alleviate the overfitting of the model to the training data and enhance its generalization ability in complex scenarios. Label smoothing modifies the probability distribution of the true label, reducing the probability of the true label from 1 and assigning it to other categories, thereby avoiding the model's overconfidence in a single label. Specifically, the goal of label smoothing is to convert the traditional one-hot label into a soft label through a smoothing coefficient ε. The specific formula is as follows:

[0096]

[0097] where y cis the label value after label smoothing, ε is the label smoothing coefficient, and C is the number of categories. Compared with traditional cross-entropy, label smoothing has significant advantages. It not only reduces over-reliance on a single label, but also prevents overfitting, improves the model's generalization ability, and makes the model more robust when facing complex and noisy data. Compared with the traditional cross-entropy loss function, label smoothing can reduce overfitting: By reducing overconfidence in a single label, label smoothing effectively reduces the model's overfitting to the training data, especially when the data is complex or noisy. It can improve the generalization ability of the model: Label smoothing allows the model to learn the relationship between multiple categories more gently, rather than focusing solely on the accuracy of the optimal solution, which can improve the model's performance on unknown data. It can improve the robustness of the model: When dealing with situations with ambiguous labels or low-quality input data, label smoothing can help the model avoid over-reliance on a single label, thereby providing more stable performance in complex environments.

[0098] Figure 6 This paper explains the process of identifying the printing source of QR code anti-counterfeiting labels in detail. In this paper, label smoothing is applied to the training process of the CBAM-ConvNeXt network. During training, label smoothing technology effectively reduces the overfitting problem of the cross entropy loss function, making the model more stable and accurate when learning the fingerprint features of the printing source of the QR code image. In the specific training process, label smoothing replaces the traditional cross entropy calculation method, reducing the model's dependence on specific labels, so that the model can learn more generalized features and enhance the recognition ability of unknown samples. This paper uses a powerful The Xeon(R) Silver 4215 CPU and CUDA 10.2 are used for deep learning acceleration, fully leveraging the advantages of GPU parallel computing to improve training speed. In terms of software, Pytorch 1.10.0 is used as the deep learning framework, and Torchvision 0.11.0 and Torchaudio 0.10.0 are used for model building and training. In the loss function calculation, label smoothing is used instead of the cross-entropy loss function to adjust the probability distribution of the true labels, reducing the model's dependence on the training data and avoiding overfitting. This innovation enables the model to more accurately process different types of image features in the task of identifying the printed source of QR code images, enhancing the model's robustness.

[0099] The trained CBAM-ConvNeXt model (the target print source identification model) was used to identify the test set. The QR code image blocks in the test set were sequentially fed into the model, and the model used the feature patterns learned during training to determine the print source of each block. The model, through its layers and modules, worked together to extract features from the input image blocks and mapped them to specific print source categories through the output layer. The model's accuracy and performance were evaluated using the test set.

[0100] 104. Receive the QR code image data to be identified.

[0101] The two-dimensional code image data to be identified can be received from the user terminal by taking a picture and receiving the transmitted image.

[0102] 105. Use the target print source recognition model to recognize the two-dimensional code image data to obtain a print source recognition result.

[0103] In practical applications, the newly acquired QR code image can be processed in the same way and input into the target printing source recognition model. The learned knowledge can be used to determine the printing source of the QR code anti-counterfeiting label, achieve accurate identification, and provide reliable technical support for product anti-counterfeiting.

[0104] In a specific implementation, a print source identification system based on a QR code anti-counterfeiting label is also provided. The system realizes data acquisition, model training and final print source identification through the collaborative work of multiple units.

[0105] First, the data processing unit is responsible for acquiring QR code image data from multiple sources, including anti-counterfeiting labels generated during product production and QR code samples collected during market research and data collection activities. All images are resized to 512×512 pixels and further divided into 64×64 pixel blocks to ensure a uniform data format and facilitate subsequent processing. The data is then divided into training and test sets in a 3:1 ratio. Within the training set, the training and validation subsets are further divided in a 4:1 ratio to ensure balanced and representative data distribution.

[0106] During model training, the constructed CBAM-ConvNeXt network model was used, label smoothing was employed to calculate errors, and model parameters were adjusted to optimize classification performance. Training was performed with a batch size of 16 and 40 epochs. During each epoch, the model performed forward propagation on image patches, calculated loss, and updated parameters using backpropagation. During training, training loss, validation loss, and accuracy were monitored in real time to prevent overfitting or underfitting. Regularization parameters and model complexity were adjusted as necessary to optimize training results.

[0107] After training, the recognition unit applies the trained model to the test set, extracting features and performing classification predictions on each QR code image block for final evaluation. The application unit receives the actual input QR code anti-counterfeiting label image, invokes the trained model to process the input image, identifies and outputs the print source results, and displays them on the user interface, providing anti-counterfeiting recognition services.

[0108] The model utilizes channel and spatial attention modules to enhance key features. It then outputs the printer source category through global average pooling and fully connected layers, using label smoothing instead of the cross-entropy loss function. This method can effectively identify the printing source of QR code anti-counterfeiting labels, providing technical support for product anti-counterfeiting, helping to combat counterfeit and shoddy goods and maintain market order.

[0109] For the same example as above, please refer to Figure 7 , Figure 7 A schematic diagram of the structure of a terminal provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the system comprises a processor, an input device, an output device and a memory, which are connected to each other, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions, and the program includes instructions for executing the following steps;

[0110] Construct sample data for training the print source recognition model;

[0111] Constructing an initial print source identification model, wherein the initial print source identification model is a CBAM-ConvNeXt network model combining CBAM and ConvNeXt;

[0112] Based on label smoothing technology, the sample data is used to train the initial print source recognition model to obtain the target print source recognition model;

[0113] Receive the QR code image data to be identified;

[0114] The target print source identification model is used to identify the two-dimensional code image data to be identified, and a print source identification result is obtained.

[0115] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to implement the above functions, the terminal includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of the various examples described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0116] The embodiment of the present application can divide the terminal into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0117] In line with the above, please see Figure 8 , Figure 8 The present invention provides a schematic diagram of a structure of a printing source identification device based on a QR code anti-counterfeiting label. Figure 8 As shown, the device includes:

[0118] The construction unit 501 is used to construct sample data for training a print source identification model; construct an initial print source identification model, wherein the initial print source identification model is a CBAM-ConvNeXt network model combining CBAM and ConvNeXt;

[0119] A training unit 502 is configured to train the initial print source recognition model using sample data based on a label smoothing technique to obtain a target print source recognition model;

[0120] The receiving unit 503 is used to receive the two-dimensional code image data to be identified;

[0121] The recognition unit 504 is configured to recognize the to-be-recognized two-dimensional code image data using the target print source recognition model to obtain a print source recognition result.

[0122] In one possible implementation, the CBAM-ConvNeXt network model includes an input layer, a CBAM-ConvNeXt Block, a backbone network layer, a downsampling layer, and an output layer, wherein:

[0123] The input layer consists of a convolutional layer and a normalization layer (Layer Norm). The convolutional layer parameters are a convolution kernel size of 4×4, a stride of 4, a number of input channels of 3, and a number of output channels of 128. The convolutional layer is used to reduce the spatial resolution of the image and extract preliminary features to obtain a preliminary feature map. The preliminary feature map is passed through the normalization layer to alleviate the gradient vanishing problem of the deep network, and then the input feature map is obtained.

[0124] CBAM-ConvNeXt Block: The input feature map passes through the channel attention module and the spatial attention module in sequence. The channel attention module generates channel attention weights through global maximum pooling, global average pooling, and fully connected layer operations. The spatial attention module generates spatial attention weights through global maximum pooling, global average pooling, channel splicing, convolution, and activation function operations. The processed input feature map then undergoes depthwise convolution, layer normalization, 2D convolution, GELU activation, 2D convolution, layer scaling, and random depth operations before being input into the backbone network layer.

[0125] Backbone network layer: consists of four stages, with the number of CBAM-ConvNeXt blocks in each stage being 3, 3, 27, and 3, respectively, used to gradually extract features at different levels;

[0126] Downsampling layer: Located between adjacent stages, it uses a convolution operation with a convolution step of 2 and a convolution kernel size of 2×2 to reduce the feature map resolution and increase the number of channels;

[0127] Output layer: The feature map is first compressed into a fixed-length vector through global average pooling, then mapped to the category space through a fully connected layer, and the print source recognition result is output.

[0128] In one possible implementation, the method for calculating the feature map by the channel attention module is characterized by the following formula:

[0129] M C (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)));

[0130] Where F is the input feature map, Mc is the final channel attention map, σ is the sigmoid activation function, MLP is the fully connected layer, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0131] In one possible implementation, the method for calculating the feature map by the spatial attention module is represented by the following formula:

[0132] M s (F)=σ(f (7×7) ([AvgPool(F);MaxPool(F)]));

[0133] Where F' is the input feature map, Ms is the final spatial attention map, σ is the sigmoid activation function, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

[0134] In one possible implementation, the label smoothing technique processes labels using the following formula:

[0135]

[0136] where y c is the label value after label smoothing, ε is the label smoothing coefficient, and C is the number of categories.

[0137] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any one of the printing source identification methods based on QR code anti-counterfeiting labels as described in the above method embodiments.

[0138] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program enables a computer to execute part or all of the steps of any one of the printing source identification methods based on QR code anti-counterfeiting labels recorded in the above method embodiments.

[0139] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0140] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0141] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0142] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0143] In addition, the functional units in the various embodiments of the application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software program modules.

[0144] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: various media that can store program codes, such as a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0145] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which may include: a flash drive, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.

[0146] The above is a detailed introduction to the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for identifying the printing source of a QR code anti-counterfeiting label, characterized in that: The method comprises: Construct sample data for training the print source recognition model; Constructing an initial print source identification model, wherein the initial print source identification model is a CBAM-ConvNeXt network model combining CBAM and ConvNeXt; Based on label smoothing technology, the sample data is used to train the initial print source recognition model to obtain the target print source recognition model; Receive the QR code image data to be identified; The target print source identification model is used to identify the two-dimensional code image data to be identified, and a print source identification result is obtained.

2. The printing source identification method based on the QR code anti-counterfeiting label according to claim 1, characterized in that: The CBAM-ConvNeXt network model includes an input layer, a CBAM-ConvNeXt Block, a backbone network layer, a downsampling layer, and an output layer, as follows: The input layer consists of a convolutional layer and a normalization layer (Layer Norm). The convolutional layer parameters are a convolution kernel size of 4×4, a stride of 4, a number of input channels of 3, and a number of output channels of 128. The convolutional layer is used to reduce the spatial resolution of the image and extract preliminary features to obtain a preliminary feature map. The preliminary feature map is passed through the normalization layer to alleviate the gradient vanishing problem of the deep network, and then the input feature map is obtained. CBAM-ConvNeXt Block: The input feature map passes through the channel attention module and the spatial attention module in sequence. The channel attention module generates channel attention weights through global maximum pooling, global average pooling, and fully connected layer operations. The spatial attention module generates spatial attention weights through global maximum pooling, global average pooling, channel splicing, convolution, and activation function operations. The processed input feature map then undergoes depthwise convolution, layer normalization, 2D convolution, GELU activation, 2D convolution, layer scaling, and random depth operations before being input into the backbone network layer. Backbone network layer: consists of four stages, with the number of CBAM-ConvNeXt blocks in each stage being 3, 3, 27, and 3, respectively, used to gradually extract features at different levels; Downsampling layer: Located between adjacent stages, it uses a convolution operation with a convolution step of 2 and a convolution kernel size of 2×2 to reduce the feature map resolution and increase the number of channels; Output layer: The feature map is first compressed into a fixed-length vector through global average pooling, then mapped to the category space through a fully connected layer, and the print source recognition result is output.

3. The printing source identification method based on the QR code anti-counterfeiting label according to claim 2, characterized in that: The method for calculating the feature map of the channel attention module is characterized by the following formula: M C (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F))); Where F is the input feature map, Mc is the final channel attention map, σ is the sigmoid activation function, MLP is the fully connected layer, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

4. The printing source identification method based on the QR code anti-counterfeiting label according to claim 2 or 3, characterized in that: The method for calculating the feature map of the spatial attention module is characterized by the following formula: M s (F)=σ(f (7×7) ([AvgPool(F);MaxPool(F)])); Where F' is the input feature map, Ms is the final spatial attention map, σ is the sigmoid activation function, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

5. The method for identifying the printing source based on the QR code anti-counterfeiting label according to claim 4, characterized in that: Label smoothing technology processes labels using the following formula: where y c is the label value after label smoothing, ε is the label smoothing coefficient, and C is the number of categories.

6. A printing source identification device based on a QR code anti-counterfeiting label, characterized in that: The device comprises: A construction unit is used to construct sample data for training a print source identification model; construct an initial print source identification model, wherein the initial print source identification model is a CBAM-ConvNeXt network model combining CBAM and ConvNeXt; A training unit, configured to train an initial print source recognition model using sample data based on a label smoothing technique to obtain a target print source recognition model; A receiving unit, configured to receive the QR code image data to be identified; The recognition unit is used to recognize the two-dimensional code image data to be recognized by using the target print source recognition model to obtain a print source recognition result.

7. The printing source identification device based on the QR code anti-counterfeiting label according to claim 6, characterized in that: The CBAM-ConvNeXt network model includes an input layer, a CBAM-ConvNeXt Block, a backbone network layer, a downsampling layer, and an output layer, as follows: The input layer consists of a convolutional layer and a normalization layer (Layer Norm). The convolutional layer parameters are a convolution kernel size of 4×4, a stride of 4, a number of input channels of 3, and a number of output channels of 128. The convolutional layer is used to reduce the spatial resolution of the image and extract preliminary features to obtain a preliminary feature map. The preliminary feature map is passed through the normalization layer to alleviate the gradient vanishing problem of the deep network, and then the input feature map is obtained. CBAM-ConvNeXt Block: The input feature map passes through the channel attention module and the spatial attention module in sequence. The channel attention module generates channel attention weights through global maximum pooling, global average pooling, and fully connected layer operations. The spatial attention module generates spatial attention weights through global maximum pooling, global average pooling, channel splicing, convolution, and activation function operations. The processed input feature map then undergoes depthwise convolution, layer normalization, 2D convolution, GELU activation, 2D convolution, layer scaling, and random depth operations before being input into the backbone network layer. Backbone network layer: consists of four stages, with the number of CBAM-ConvNeXt blocks in each stage being 3, 3, 27, and 3, respectively, used to gradually extract features at different levels; Downsampling layer: Located between adjacent stages, it uses a convolution operation with a convolution step of 2 and a convolution kernel size of 2×2 to reduce the feature map resolution and increase the number of channels; Output layer: The feature map is first compressed into a fixed-length vector through global average pooling, then mapped to the category space through a fully connected layer, and the print source recognition result is output.

8. The printing source identification device based on the QR code anti-counterfeiting label according to claim 7, characterized in that: The method for calculating the feature map of the channel attention module is characterized by the following formula: M C (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F))); Where F is the input feature map, Mc is the final channel attention map, σ is the sigmoid activation function, MLP is the fully connected layer, AvgPool is the global average pooling, and MaxPool is the maximum pooling.

9. A terminal, characterized in that: The method comprises a processor, an input device, an output device and a memory, wherein the processor, the input device, the output device and the memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the printing source identification method based on the QR code anti-counterfeiting label as described in any one of claims 1 to 5.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions enable the processor to execute the printing source identification method based on the two-dimensional code anti-counterfeiting label according to any one of claims 1 to 5.