Production date anti-counterfeiting tracing system based on font encryption
The production date anti-counterfeiting and traceability system with font encryption uses a pseudo-random function to generate a unique font coding table for each day, converts digital characters into font sequences, and embeds them into the production date. This solves the problem of existing traceability identification being easily tampered with, and achieves high-precision automatic identification and full-process verification.
Patent Information
- Application Number
- CN202510762867.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-06-09
AI Technical Summary
Existing traceability labels are easily tampered with, covered or erased, making product traceability and verification difficult. Some anti-counterfeiting code solutions are complex and easily destroyed by channel diversion.
A production date anti-counterfeiting and traceability system based on font encryption is used. A unique font coding table is generated every day through a pseudo-random function, and digital characters are converted into font sequences, embedded in the production date, and automatically identified and verified in combination with an image recognition and decoding module.
It realizes the hidden carrying and dynamic generation of traceability information, improves anti-destruction and recognition accuracy, supports multi-scenario verification, and ensures full-process verification of product source and flow.
Smart Images

Figure CN120672357A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of anti-counterfeiting and tracing technology, in particular to an anti-counterfeiting and tracing system for production dates based on font encryption. Background Art
[0002] Anti-counterfeiting and traceability technology has been widely used in a variety of industries, including food, pharmaceuticals, cosmetics, and electronics. By placing unique traceability marks on product packaging, companies can record and verify the authenticity of products throughout the entire process, from production and distribution to end-of-sale, providing technical support for combating counterfeit products and preventing channel diversion.
[0003] Common traceability identification methods in existing technologies include QR codes, anti-counterfeiting codes, and digital inkjet codes. While these anti-counterfeiting methods have achieved some success in some scenarios, they still present several challenges: QR codes or inkjet codes are typically attached to the packaging surface and are susceptible to tampering, obscuration, replacement, or erasure. Once damaged, product traceability verification becomes difficult. Some anti-counterfeiting code solutions rely on independent coding systems, disconnected from the original product identification information, increasing the complexity of label management and printing. Furthermore, these codes can be easily removed or replaced during cross-selling, rendering anti-counterfeiting and cross-selling ineffective. Summary of the Invention
[0004] In order to solve the above problems, the present invention provides an anti-counterfeiting and tracing system for production date based on font encryption.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] An anti-counterfeiting and tracing system for production date based on font encryption, comprising:
[0007] Anti-counterfeiting traceability code module, used to generate anti-counterfeiting traceability code based on product information;
[0008] A font encoding module is used to match the font encoding table corresponding to the production date according to the production date of the product, traverse the font encoding table through the anti-counterfeiting traceability code, generate a font sequence, convert the digital characters of the production date to be printed into the corresponding font according to the font sequence, and output the production date code;
[0009] Image recognition and decoding module, used to identify the production date code on the product packaging through image recognition algorithm, extract the date data and the font identification ID of each number in the production date code;
[0010] The traceability verification module is used to match the font coding table according to the identified date data, and restore the anti-counterfeiting traceability code through the font coding table according to the font identification ID, and obtain product batch, authenticity and circulation source information through anti-counterfeiting traceability code database query.
[0011] Furthermore, generating an anti-counterfeiting traceability code based on product information includes the following steps:
[0012] Collect basic product information, including product number, batch number and production plant code;
[0013] Generate a product ID based on the basic information of the product as an anti-counterfeiting traceability code.
[0014] Furthermore, the font encoding table is constructed by the following steps:
[0015] Based on the production date of the current product, a unique date seed parameter is generated by converting the date into a standard format value and concatenating it with the preset key and performing a hash process.
[0016] Initialize the pseudo-random function by the date seed parameter;
[0017] Input the preset font identification ID set and the digital set into the initialized pseudo-random function for mapping calculation to obtain the font code mapping relationship corresponding to the production date of the current product;
[0018] Based on the font code mapping relationship, a font code table corresponding to the current production date is constructed.
[0019] Furthermore, the pseudo-random function is as follows:
[0020] g(k)=(λ·k+μ·h(t)+θ)mod M;
[0021] Among them, g(k) represents the index position of the font identification ID corresponding to the digital code value k after mapping; λ, μ, and θ are preset security perturbation parameters; t is the production date of the product; h(t) is the integer value obtained by hashing the production date t; and M is the total number of font identification ID sets.
[0022] Furthermore, the image recognition and decoding module includes a date recognition unit and a font recognition unit;
[0023] The date recognition unit is used to perform image segmentation and region positioning on the collected product packaging image, extract and recognize the character area containing the production date, and restore the production date text information;
[0024] The font recognition unit is used to perform font recognition on the character area containing the production date based on a convolutional neural network, and generate a font identification ID for each number.
[0025] Furthermore, the image segmentation and region positioning of the collected product packaging image, and the extraction and recognition of the character region containing the production date include the following steps:
[0026] Perform image preprocessing on the collected product packaging images, including grayscale conversion, edge detection, and noise filtering to enhance character boundary features;
[0027] Based on the character morphological features and arrangement rules, contour extraction and connected domain analysis are performed on the suspected text area in the image to locate the character area containing the production date.
[0028] Furthermore, the convolutional neural network is constructed by the following steps:
[0029] Based on the collected font image samples, each font image sample is labeled with a corresponding digital character and font identification ID, and a training sample data set including font images and target font identification IDs is constructed;
[0030] Performing size normalization and grayscale normalization on the font image samples in the training sample data set to obtain standardized font image data with a unified structure;
[0031] Inputting the standardized font image data into a convolutional neural network structure comprising a convolutional layer, a pooling layer, and a nonlinear activation function, extracting local edge features and texture features of each image, and generating a corresponding feature representation vector;
[0032] Input the feature representation vector into the fully connected layer for classification operation, and output the predicted label of the font ID;
[0033] The error between the predicted label of the font identification ID and the target font identification ID is calculated based on the cross entropy loss function. The network parameters are updated through the back propagation algorithm, and the training is repeated until the loss function converges and the set recognition accuracy threshold is reached on the validation set.
[0034] Furthermore, the formula of the cross entropy loss function is as follows:
[0035]
[0036] Among them, L is the loss value of the sample; α i Weight factor for each category; is the predicted probability of the model for the i-th category; y i Whether the i-th category is the correct answer; N is the total number of categories.
[0037] Furthermore, the method of restoring the anti-counterfeiting traceability code through the font coding table includes the following steps:
[0038] Retrieving a font encoding table corresponding to the production date based on the production date text information extracted by the image recognition decoding module;
[0039] The font identification ID sequence extracted from the image recognition result is input into the font coding table, and the digital coding sequence is restored bit by bit by looking up the corresponding relationship between the font identification ID and the digital code.
[0040] Furthermore, the anti-counterfeiting traceability code database is constructed by the following steps:
[0041] Build product information files, including product number, production batch, factory code, production date and logistics acceptance nodes;
[0042] Use the anti-counterfeiting traceability code as an index to link product information files.
[0043] The beneficial effects of the present invention are as follows: unlike the traditional solution of attaching anti-counterfeiting codes to packaging in the form of QR codes, labels, etc., the present invention highly binds the traceability code to the production date through a font encoding module, so that the anti-counterfeiting mark is deeply integrated into the date field itself. The production date is a mandatory labeling content in various industry products and is difficult to be covered or removed. Therefore, the traceability information is embedded in the font variant embedding method, so that even if the packaging surface is subject to human interference, the anti-counterfeiting information is still readable and verifiable, which greatly improves the anti-destruction ability and stability of the traceability code. Further, through a pseudo-random mapping function driven by the production date as a seed parameter, a font encoding table matching each day is automatically generated in the system. The encoding table establishes a one-to-one mapping relationship between digital characters (such as 0-9) and multiple font identification IDs to ensure that the font sequences corresponding to the same traceability code on different dates are completely different, thereby realizing that the traceability information changes dynamically with the date, cannot be speculated or reused by the outside, and effectively prevents malicious imitation or batch counterfeiting. The image recognition and decoding module adopts a separate architecture, including a date recognition unit and a font recognition unit. The former can accurately locate the production date character area, and the latter classifies and judges the font details of each digit through a neural network, outputs a font identification ID sequence, and combines the date field to call the coding table of the day to restore the code. This design effectively supports automated recognition tasks under large-scale image acquisition, has high robustness and high-precision recognition performance, and is suitable for multi-scenario verification needs at the production, channel and consumer ends. The traceability code is restored by font decoding, and the product batch, factory information and circulation records are obtained in the database based on the traceability code to achieve full-process verification of the product source and flow. The present invention realizes the hidden carrying, dynamic generation and safe identification of the traceability code through the integration of font encryption and production date, effectively improving the preservation and tamper resistance of the anti-counterfeiting traceability on the product packaging. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 The present invention is a structural diagram of an anti-counterfeiting and tracing system for production dates based on font encryption.
[0045] Figure 2It is a flow chart of the steps for constructing the convolutional neural network in the present invention. DETAILED DESCRIPTION
[0046] See also Figure 1-2 As shown, the present invention relates to an anti-counterfeiting and tracing system for production date based on font encryption, comprising:
[0047] Anti-counterfeiting traceability code module, used to generate anti-counterfeiting traceability code based on product information;
[0048] A font encoding module is used to match the font encoding table corresponding to the production date according to the production date of the product, traverse the font encoding table through the anti-counterfeiting traceability code, generate a font sequence, convert the digital characters of the production date to be printed into the corresponding font according to the font sequence, and output the production date code;
[0049] Image recognition and decoding module, used to identify the production date code on the product packaging through image recognition algorithm, extract the date data and the font identification ID of each number in the production date code;
[0050] The traceability verification module is used to match the font coding table according to the identified date data, and restore the anti-counterfeiting traceability code through the font coding table according to the font identification ID, and obtain product batch, authenticity and circulation source information through anti-counterfeiting traceability code database query.
[0051] In some embodiments, the anti-counterfeiting traceability code module first generates a unique anti-counterfeiting traceability code based on the core attribute information of the product (including product number, production batch, factory identification, channel information, etc.). The traceability code itself does not directly expose the product attributes and is only used as a database index to ensure data desensitization and structural security. Subsequently, the font encoding module receives the anti-counterfeiting traceability code and dynamically generates a font encoding table corresponding to the date based on the production date of the product as the input seed of the pseudo-random function. The font encoding table defines a nonlinear mapping relationship between the numbers 0 to 9 and multiple font variants (font identification IDs). By traversing the encoding table, the traceability code is converted into a set of font sequences, that is, the production date of the font version corresponding to the anti-counterfeiting traceability code is generated. The font production date is visually no different from a regular number, and it is difficult for ordinary users to perceive the difference, but the font used for each digit actually carries a unique identifier, thereby achieving implicit embedding of anti-counterfeiting information and compatibility with visual readability. During the packaging coding process, the system calls the font sequence output by the font encoding module and completes the printing of the production date through the coding equipment, ensuring that different batches of products have different traceability code data embedded under the visually consistent production date, and no additional anti-counterfeiting labels are added. On the identification and verification side, the image recognition and decoding module is responsible for image acquisition and pre-processing of the production date area on the product packaging, including grayscale normalization, edge enhancement, character area segmentation, etc., and further uses the pre-trained font recognition model to identify the specific font identification ID used for each digit, and combines the identified production date text data to call the font encoding table corresponding to the day to complete the reverse mapping and restore the original anti-counterfeiting traceability code. Through the traceability verification module, the system submits the anti-counterfeiting traceability code to the cloud traceability database for index query, obtains the corresponding product full process information, including production plant, production time, circulation path and channel information, etc., and at the same time determines whether the current query behavior is consistent with the record, and automatically determines the authenticity of the product. Different from the existing technology, the traceability information of the present invention is not carried by an additional graphic code, but is embedded in the original production date field through font variant encoding, which has extremely high concealment and preservation. The system constructs a daily changing font coding table through a dynamic pseudo-random mapping function driven by the production date to achieve the non-repetitiveness and non-replicability of the traceability code, and completely solves the problem of traditional static labels being reused and forged. The recognition process combines a deep learning font classification network with a traceable database to realize an automated closed loop of anti-counterfeiting verification from data collection to traceability query, thereby improving the overall recognition accuracy and real-time performance of the system.
[0052] Furthermore, generating an anti-counterfeiting traceability code based on product information includes the following steps:
[0053] Collect basic product information, including product number, batch number and production plant code;
[0054] Generate a product ID based on the basic information of the product as an anti-counterfeiting traceability code.
[0055] It should be noted that the anti-counterfeiting traceability code production module in the system is used to generate a globally unique anti-counterfeiting traceability code for each product to be packaged. The generation process uses basic product information as input and combines a unified coding logic to achieve standardization and non-tampering of the traceability identification. Specifically, the system first automatically collects the basic attribute information corresponding to the product at the production end or before the packaging goes online. The information includes but is not limited to the product number (such as SKU code), the production batch number (such as the batch identification defined by the production line + time period combination) and the production factory code (such as the registered factory ID or regional number). This information constitutes a static identification set that can be uniquely identified during the product life cycle and has a clear traceability dimension. In addition, the generation of anti-counterfeiting traceability codes is non-replicable and non-reproducible. Even if different products have the same number or batch, if their production factory code or splicing logic is different, the traceability codes generated by the system are also different, effectively avoiding code value conflicts or reuse. Compared with the traditional method of generating by accumulating serial numbers, this embodiment improves the complexity and security of the encoding by combining the product's multi-field identity information for summary calculation, ensuring that each code value has a clear unique directionality. Ultimately, the generated anti-counterfeiting and traceability code is not only used by the font encoding module to perform font sequence mapping but is also written to the system database for subsequent anti-counterfeiting verification after image recognition and decoding, forming the core data foundation for full-process product traceability management. The generation process of this anti-counterfeiting and traceability code fully demonstrates the collaborative design between data structure standardization, mapping logic determinism, and system security and anti-counterfeiting capabilities. Unlike existing methods that rely on external code labeling, it offers a high degree of controllability and integration. After data collection, the system performs a structured concatenation of the above fields according to a predefined format, for example, using the "product number - factory code - batch number" concatenation rule to form an initial data string. This data string preserves the product's original identity while maintaining stability and consistency. To ensure data security, desensitization, and irreversibility during transmission and storage, the system further applies a hash function to the data string, using algorithms such as SHA-256 or HMAC-SHA1, to generate a fixed-length, uniformly distributed, and irreversible identification code, the anti-counterfeiting and traceability code.
[0056] Furthermore, the font encoding table is constructed by the following steps:
[0057] Based on the production date of the current product, a unique date seed parameter is generated by converting the date into a standard format value and concatenating it with the preset key and performing a hash process.
[0058] Initialize the pseudo-random function by the date seed parameter;
[0059] Input the preset font identification ID set and the digital set into the initialized pseudo-random function for mapping calculation to obtain the font code mapping relationship corresponding to the production date of the current product;
[0060] Based on the font code mapping relationship, a font code table corresponding to the current production date is constructed.
[0061] Specifically, the production date of the current product is first standardized and uniformly converted into a digital format without separators, such as "April 22, 2025" is converted into "20250422". In order to introduce a system perturbation factor to improve anti-counterfeiting security, the standardized date is spliced with the private key preset in the system, which can be "20250422#MACHINE-A01", to form a set of original input information for generating a perturbation seed. Subsequently, the system performs a hash process on the spliced string. This process can use a secure hash algorithm to convert the input string into a fixed-length, uniformly distributed, and irreversible integer value as the perturbation seed parameter for this date. The seed parameter is unique daily, ensuring that even if the same traceability code is used on different dates, the font sequence it generates will be completely different, fundamentally preventing copying and forgery. Based on the date seed parameter, the system performs a mapping calculation between a preset set of numbers (such as 0 to 9) and a font identification ID set. Each numeric character corresponds to multiple available font IDs. For example, the digit "3" may have fonts with slightly different stroke styles, such as A31, A32, and A33. The system matches the digits with the font ID set according to the order of the perturbation seed results, generating a one-to-one mapping table. This mapping is valid only for the current date and is stored encrypted, serving as the basis for subsequent encoding and decoding. The constructed font encoding table is used during the printing process to replace each numeric character in the production date with the corresponding encrypted font. For example, if the font encoding table generated for "20250422" maps "2" to A21, "0" to A08, and "5" to A15, the entire date will be rendered as a numeric string using a specific font combination. While the date appears to be a regular number, each font has been encrypted, providing an anti-counterfeiting feature. The font encoding table implemented in this step is not a fixed preset, but is dynamically generated based on the product production date and the system perturbation key, so that the mapping relationship changes daily. The mapping path is made unpredictable through the hash perturbation mechanism. Even if an attacker knows the encoding table on a certain day, they cannot forge the corresponding font on another day.
[0062] Furthermore, the pseudo-random function is as follows:
[0063] g(k)=(λ·k+μ·h(t)+θ)mod M;
[0064] Among them, g(k) represents the index position of the font identification ID corresponding to the digital code value k after mapping; λ, μ, and θ are preset security perturbation parameters; t is the production date of the product; h(t) is the integer value obtained by hashing the production date t; and M is the total number of font identification ID sets.
[0065] Specifically, for each digital code value to be mapped, the system calculates three system parameters: first, the perturbation parameters λ, μ, and θ. These three perturbation parameters are confidential and set internally to disrupt the mapping pattern, preventing the mapping relationship from being reversed or modeled. Second, the production date. After normalizing the production date, the system hashes it using a highly secure hash function (such as SHA-256 or SM3), generating an irreversible, unique hash integer value that serves as a time-sensitive seed factor in the perturbation function. Finally, the total number of font ID sets is calculated. This set contains all possible font variants for encoding, with each font ID representing a visual variant of a numeric character. For example, when mapping the number "4," the system inputs "4" along with the perturbation parameters and the date hash value into a pseudorandom function to calculate the index of the corresponding position in the font ID set. If the total number of font ID sets is 30, the function ensures that the final output index value is always between 0 and 29, ensuring the validity of the mapping. Due to the combined effects of the perturbation parameters and the date seed, even the same number entered into the function on different dates will yield different index results, thereby mapping to different font IDs. For example, the number "4" maps to font A12 on April 22, 2025, and to font A25 on April 23, 2025. These two mappings differ in structural details but maintain semantic consistency, making them indistinguishable to the human eye, thus achieving implicit encryption. Unlike traditional fixed mapping tables, the mapping results generated by this function exhibit high temporal correlation and nonlinear perturbation characteristics. Even if an attacker possesses the mapping relationship for a particular date, without the system's perturbation parameters and seed construction logic, they cannot infer the mapping path for other dates. This ensures the unreplicability and robustness of the traceability code font embedding sequence. Furthermore, this pseudo-random function boasts a lightweight structure and efficient computation, making it suitable for embedded deployment and batch processing scenarios. It supports setting different perturbation parameters by production line, shift, or factory location, enabling multi-dimensional differentiation of anti-counterfeiting strategies.
[0066] Furthermore, the image recognition and decoding module includes a date recognition unit and a font recognition unit;
[0067] The date recognition unit is used to perform image segmentation and region positioning on the collected product packaging image, extract and recognize the character area containing the production date, and restore the production date text information;
[0068] The font recognition unit is used to perform font recognition on the character area containing the production date based on a convolutional neural network, and generate a font identification ID for each number.
[0069] In some embodiments, first, after the image acquisition device obtains the image of the product packaging, the image data enters the date recognition unit for processing. This unit mainly performs two tasks: image preprocessing and target area positioning. The image preprocessing part includes operations such as grayscale, edge enhancement, and noise filtering, which aim to improve the clarity of character boundaries and reduce image interference caused by packaging materials, lighting changes, or inconsistent inkjet coding quality. After preprocessing, the system performs region positioning based on character arrangement rules and morphological features, and separates the character area containing the complete production date from the entire packaging image through methods such as connected domain analysis and candidate area screening. The system then calls the OCR (optical character recognition) model to digitally recognize the characters in the area and restore the standardized date text information, such as parsing the inkjet coding area image as "20250422" for subsequent font coding table matching and time indexing. After successfully extracting the character area of the production date, the image of the area is input into the font recognition unit for more fine-grained font classification and recognition. The unit built a multi-class image recognition model based on a convolutional neural network (CNN). It segments each numeric character bit by bit and extracts its corresponding image fragment. Unlike traditional OCR, which focuses solely on character content, this recognition network focuses on the detailed structural features of each character, such as stroke thickness, curvature, angle ratio, and endpoint shape. The model extracts local texture features from the character image through convolutional layers, enhances robustness to small-scale deformations through pooling layers, and outputs classification predictions for font IDs through fully connected layers. For example, for a recognized character "5," the system not only confirms it as the number "5," but also determines whether it uses a specific font variant identifier, such as A15, A18, or A23, thereby extracting embedded traceability information. The system's training phase uses supervised learning based on a dataset of labeled font images covering all numeric characters and their variants, ensuring the model fully learns the characteristics of different fonts and characters. During the recognition process, the model outputs a font ID prediction sequence, which forms a one-to-one correspondence with the recognized date text and serves as the input basis for restoring the traceability code in the decoding stage.
[0070] Furthermore, the image segmentation and region positioning of the collected product packaging image, and the extraction and recognition of the character region containing the production date include the following steps:
[0071] Perform image preprocessing on the collected product packaging images, including grayscale conversion, edge detection, and noise filtering to enhance character boundary features;
[0072] Based on the character morphological features and arrangement rules, contour extraction and connected domain analysis are performed on the suspected text area in the image to locate the character area containing the production date.
[0073] It should be noted that the image preprocessing and region localization process in the image recognition and decoding module is designed as a stable and scalable visual perception process. The core is to convert character information in a high-dimensional complex background into a target area image with clear boundaries and structural rules for subsequent date recognition and font recognition modules to call. The entire process not only emphasizes the enhanced processing of character boundary features, but also fully integrates character arrangement patterns and morphological rules, making the system more robust and accurate when processing actual complex industrial inkjet coding images. During the image preprocessing stage, the system first grayscales the collected original packaging image. By converting the color image into a single-channel grayscale image, this operation significantly reduces the interference of redundant color information on character structure analysis, making the subsequent image edge feature extraction more focused. Next, the system performs edge detection based on operators such as Sobel or Canny, extracting areas of pixel gradient mutation in the image, and using them as preliminary candidate areas for character boundaries. To mitigate image noise caused by issues like aging printheads and ink splatter, the system applies algorithms such as median filtering or Gaussian filtering for denoising. This ensures the continuity and clarity of character outlines in the image space, laying the foundation for subsequent region localization. After preprocessing, the system enters the region localization phase. This phase primarily analyzes the geometric characteristics and arrangement patterns of the character structure. In packaging design specifications, the production date is typically presented as a horizontally evenly spaced sequence of numbers. The system leverages this prior knowledge to perform a geometric analysis of all connected regions in the image. Using a contour extraction algorithm, the system detects pixel clusters with closed boundaries within the image. Based on contour features such as aspect ratio, area, and major axis, the system removes non-text regions that do not correspond to the characters, such as background patterns, icons, and production batch numbers. The system then uses connected domain analysis to cluster adjacent characters into text lines and, based on character spacing, determines whether they form a complete production date field. If a numeric combination that meets the date format is found, such as the eight consecutive digits "20250422," the system extracts the region containing it and uses it as input for the character recognition module. In real-world deployments, this image segmentation and region localization process demonstrates strong adaptability. For example, a food packaging sample features an inkjet-printed production date on a colorful, slightly wrinkled background. The system successfully extracts character boundaries through edge enhancement during preprocessing. During region localization, it eliminates non-target areas similar to QR codes and other batch markings, ultimately accurately capturing the image block containing the production date for subsequent recognition modules to perform text recognition and font classification.
[0074] Furthermore, the convolutional neural network is constructed by the following steps:
[0075] Based on the collected font image samples, each font image sample is labeled with a corresponding digital character and font identification ID, and a training sample data set including font images and target font identification IDs is constructed;
[0076] Performing size normalization and grayscale normalization on the font image samples in the training sample data set to obtain standardized font image data with a unified structure;
[0077] Inputting the standardized font image data into a convolutional neural network structure comprising a convolutional layer, a pooling layer, and a nonlinear activation function, extracting local edge features and texture features of each image, and generating a corresponding feature representation vector;
[0078] Input the feature representation vector into the fully connected layer for classification operation, and output the predicted label of the font ID;
[0079] The error between the predicted label of the font identification ID and the target font identification ID is calculated based on the cross entropy loss function. The network parameters are updated through the back propagation algorithm, and the training is repeated until the loss function converges and the set recognition accuracy threshold is reached on the validation set.
[0080] It should be noted that a convolutional neural network model is constructed and trained to automatically identify the font style of the production date characters, thereby providing the basic font ID sequence output for traceability code restoration. The convolutional neural network training process strictly adheres to the task-oriented feature learning paradigm of deep learning, focusing on distinguishing subtle differences in fonts from structural details, improving classification accuracy and generalization in complex environments with mixed font styles. The entire construction process includes five core stages: data construction, standardization, feature extraction, classification output, and training optimization to ensure the model's reliability and engineering deployment capabilities. During the data construction stage, the system first collects a large number of actual printed production date images from different product packaging. Using image segmentation and character separation algorithms, the complete date images are split into independent single-character image samples. Each sample image corresponds to a numeric character (such as "3" or "8") and the font ID used in its actual printing (such as A31, A85, etc.). Based on manual review, images and labels are paired and annotated to form a training dataset covering all digits (0-9) and their commonly used font variants (e.g., each digit category includes at least 10 font styles), ensuring balanced category distribution and sample diversity in the training set. During the data preprocessing phase, the system converts sample images to a unified format. Given that convolutional neural networks are sensitive to input size and pixel distribution when perceiving structural features, all font images are normalized (e.g., to 28×28 or 32×32 pixels) and grayscale normalized to ensure consistent representation of character boundaries and stroke structure in pixel space, eliminating interference from differences in brightness, scale, or ink thickness between fonts on model training. The normalized image data is then fed into a convolutional neural network for feature extraction. This system employs a classic CNN architecture, comprising several convolutional and pooling layers. The convolutional layers extract local perceptual features such as stroke direction, edge structure, and connections, while the pooling layers reduce dimensionality and enhance robustness to deformation. The feature map obtained by convolution extraction is flattened and then enters the fully connected layer for feature fusion and classification calculation, and finally outputs a prediction result that corresponds one-to-one with the preset font identification ID. Taking the number "5" as an example, the system will recognize that the font it uses is A51 rather than A52 or A54, thereby completing the font-level recognition task. During the training process, the system uses cross entropy as the loss function to measure the difference between the model output result and the true label, and uses the loss value as the target to continuously optimize the network parameters through the backpropagation algorithm. The training process adopts batch gradient descent and learning rate scheduling mechanism to strictly control the convergence of the model based on sufficient iterations. After the model reaches the set accuracy (such as above 95%) on the validation set, it is solidified for the deployment stage to ensure its availability and stability in actual recognition tasks.It is worth noting that unlike traditional OCR models that only focus on character semantics, the neural network in this invention focuses on the differences in character glyph styles. It can visually distinguish subtle structural changes in the same number under different font conditions, such as the degree of opening of the tail arc, the central bending angle, and the sharp and blunt features of the corners in different fonts of "3".
[0081] Furthermore, the formula of the cross entropy loss function is as follows:
[0082]
[0083] Among them, L is the loss value of the sample; α i Weight factor for each category; is the predicted probability of the model for the i-th category; y i Whether the i-th category is the correct answer; N is the total number of categories.
[0084] It should be noted that when constructing the training sample dataset, the system includes all target numeric characters (0-9) and their corresponding multiple font variants, with each font ID serving as a separate classification label. In terms of sample quantity, some commonly used fonts have ample samples due to their high actual coding frequency, while some marginal fonts or fonts with unique designs have relatively few samples, resulting in an imbalanced class distribution. If a standard cross-entropy loss function is used, the network will favor categories with a large sample share during training, resulting in reduced recognition accuracy for fonts with small sample sizes and insufficient model generalization. To address these issues, the system introduces a category weighting factor to weight the cross-entropy loss function. In the loss calculation, a higher weight is assigned to easily confused or low-sample font categories, forcing the model to bear a higher penalty for misclassifications of these types during training, thereby encouraging the network to focus on distinguishing between detailed features. For example, the two variants of the font "3," A31 and A33, have subtle differences in stroke closure, making them prone to misclassification in low-resolution images. The system sets the weight factor for this type of high-confusion category to 1.5 times that of the general category, significantly reducing the model's tolerance threshold for its output during training, thereby strengthening its feature separation capabilities. During the actual training process, the system performs the following operations on the predicted output of each training sample: first, based on the prediction probabilities of each category currently output by the model, combined with the true label information, the prediction error of the current sample is determined. Then, a weight coefficient is introduced to weightedly accumulate the error and ultimately form a loss value. This loss value serves as the input signal for backpropagation and is used to perform gradient updates on the parameters of the convolutional layer and the fully connected layer. Continuous iterative optimization is performed until the model reaches the set recognition accuracy threshold in the validation set and the loss function converges and stabilizes.
[0085] Furthermore, the method of restoring the anti-counterfeiting traceability code through the font coding table includes the following steps:
[0086] Retrieving a font encoding table corresponding to the production date based on the production date text information extracted by the image recognition decoding module;
[0087] The font identification ID sequence extracted from the image recognition result is input into the font coding table, and the digital coding sequence is restored bit by bit by looking up the corresponding relationship between the font identification ID and the digital code.
[0088] In some embodiments, the anti-counterfeiting traceability code is restored by decoding the font identification ID sequence extracted from the product packaging image using the font encoding table corresponding to the production date. This decoding process constitutes a key step in the anti-counterfeiting verification logic, accurately interpreting the encrypted information embedded in the production date via font variations into the original traceability code, thereby restoring the product's identity and verifying its authenticity. The specific process is as follows: The image recognition and decoding module first extracts the character content of the production date and its corresponding font identification ID sequence from the packaging image. Taking "20250422" as an example, the numeric characters "2," "0," "2," "5," "0," "4," "2," and "2" contained in this date are converted by the system into a set of specific font variants, such as A12, A07, A13, and A25, during the coding process. The font recognition unit classifies and recognizes each character image and outputs a font identification ID sequence corresponding to each character position. Simultaneously, the system also uses the character region recognition module to obtain the standard text value "20250422" of the date field, which serves as a time index for querying the font encoding table. Subsequently, the system calls the encoding table pre-generated and stored in the font encoding module, and locates the font encoding table version corresponding to the date through the extracted production date information. The font encoding table records the mapping relationship between each digital character and the specific font identification ID under the production date. The system uses the identified font identification ID sequence as input and searches for its corresponding digital code in the encoding table one by one. For example, if the corresponding encoding number of a font identification ID A25 is "3", the system will restore the position to "3" during decoding. In this way, the system performs a mapping table lookup operation on the entire set of font identification IDs, and finally recovers a complete digital code sequence, such as "84319756", which is the anti-counterfeiting traceability code corresponding to the current product. The advantage of this decoding method is that the encoding table it relies on is unique daily, and the decoding process must meet two conditions at the same time: one is to identify the accurate font identification ID, and the other is to match the correct production date encoding table. This dual-condition constraint makes it difficult for attackers to accurately restore the traceability code without date parameters, even if they possess partial access to the font style or forge the font pattern, significantly enhancing the overall anti-counterfeiting security of the system. Furthermore, the system supports batch decoding, enabling rapid restoration of anti-counterfeiting information during factory re-inspections, channel spot checks, and terminal code scanning verification, providing reliable technical support for authenticity traceability throughout the product's entire lifecycle.
[0089] Furthermore, the anti-counterfeiting traceability code database is constructed by the following steps:
[0090] Build product information files, including product number, production batch, factory code, production date and logistics acceptance nodes;
[0091] Use the anti-counterfeiting traceability code as an index to link product information files.
[0092] It should be noted that a product information archive is first established during the production process before a product goes online. This archive includes multiple dimensional fields that comprehensively record the product's core identity information and distribution nodes. Key fields include product number (such as SKU or product series code), production batch (a batch identifier formed by combining the production date and shift number), factory code (used to identify the specific manufacturing plant or production line), production date (which serves as a time index for generating font encoding tables and pseudo-random mapping parameters), and logistics acceptance node information (such as warehouse entry and exit, channel entry, and transportation tracking). After standardization and structured processing, this information is stored as a data structure with field labels, supporting field-based indexing, combined queries, and multi-source verification in the database. After the information archive is established, the system calls the traceability code generation module to generate a unique anti-counterfeiting traceability code for each product. This traceability code is generated through hashing based on fields such as the product number, batch, and factory. It does not directly contain plaintext product information and is characterized by data desensitization, secure transmission, and irreversibility. The system then uses the anti-counterfeiting traceability code as the database's primary index key, binds it to the corresponding product information archive, and writes it as a complete record entry into the traceability database. For example, the archival fields for a particular product are: product number "PRD-3501," batch number "B0422A," factory code "FCT-02," production date "20250422," and logistics node "WH01→RT03→CH05." The system generates a traceability code "9f2a37c4e5...", and the corresponding data row in the database contains the aforementioned fields. When a user or the system subsequently identifies the product's traceability code and submits a query request, it can quickly locate and restore its production source, time, batch, and distribution path through primary key retrieval, verifying the product's authenticity and distribution compliance. Compared to the traditional approach of managing traceability codes separately from product information, this database construction method offers greater consistency and tamper-resistance. Furthermore, the structure supports multi-dimensional cross-queries, allowing regulatory or consumer interfaces to reverse-check product attributes in any dimension through traceability codes, enabling efficient information verification and violation tracing.
[0093] The above embodiments are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary engineering technicians in this field should fall within the scope of protection determined by the claims of the present invention.
Claims
1. An anti-counterfeiting and tracing system for production date based on font encryption, characterized in that: include: Anti-counterfeiting traceability code module, used to generate anti-counterfeiting traceability code based on product information; A font encoding module is used to match the font encoding table corresponding to the production date according to the production date of the product, traverse the font encoding table through the anti-counterfeiting traceability code, generate a font sequence, convert the digital characters of the production date to be printed into the corresponding font according to the font sequence, and output the production date code; Image recognition and decoding module, used to identify the production date code on the product packaging through image recognition algorithm, extract the date data and the font identification ID of each number in the production date code; The traceability verification module is used to match the font coding table according to the identified date data, and restore the anti-counterfeiting traceability code through the font coding table according to the font identification ID, and obtain product batch, authenticity and circulation source information through anti-counterfeiting traceability code database query.
2. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 1, characterized in that: Generating an anti-counterfeiting traceability code based on product information includes the following steps: Collect basic product information, including product number, batch number and production plant code; Generate a product ID based on the basic information of the product as an anti-counterfeiting traceability code.
3. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 1, characterized in that: The font encoding table is constructed by the following steps: Based on the production date of the current product, a unique date seed parameter is generated by converting the date into a standard format value and concatenating it with the preset key and performing a hash process. Initialize the pseudo-random function by the date seed parameter; Input the preset font identification ID set and the digital set into the initialized pseudo-random function for mapping calculation to obtain the font code mapping relationship corresponding to the production date of the current product; Based on the font code mapping relationship, a font code table corresponding to the current production date is constructed.
4. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 3, characterized in that: The pseudo-random function is as follows: g(k)=(λ·k+μ·h(t)+θ)mod M; Among them, g(k) represents the index position of the font identification ID corresponding to the digital code value k after mapping; λ, μ, and θ are preset security perturbation parameters; t is the production date of the product; h(t) is the integer value obtained by hashing the production date t; and M is the total number of font identification ID sets.
5. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 1, characterized in that: The image recognition and decoding module includes a date recognition unit and a font recognition unit; The date recognition unit is used to perform image segmentation and region positioning on the collected product packaging image, extract and recognize the character area containing the production date, and restore the production date text information; The font recognition unit is used to perform font recognition on the character area containing the production date based on a convolutional neural network, and generate a font identification ID for each number.
6. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 5, characterized in that: The image segmentation and region positioning of the collected product packaging image, and the extraction and recognition of the character region containing the production date include the following steps: Perform image preprocessing on the collected product packaging images, including grayscale conversion, edge detection, and noise filtering to enhance character boundary features; Based on the character morphological features and arrangement rules, contour extraction and connected domain analysis are performed on the suspected text area in the image to locate the character area containing the production date.
7. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 5, characterized in that: The convolutional neural network is constructed by the following steps: Based on the collected font image samples, each font image sample is labeled with a corresponding digital character and font identification ID, and a training sample data set including font images and target font identification IDs is constructed; Performing size normalization and grayscale normalization on the font image samples in the training sample data set to obtain standardized font image data with a unified structure; Inputting the standardized font image data into a convolutional neural network structure comprising a convolutional layer, a pooling layer, and a nonlinear activation function, extracting local edge features and texture features of each image, and generating a corresponding feature representation vector; Input the feature representation vector into the fully connected layer for classification operation, and output the predicted label of the font ID; The error between the predicted label of the font identification ID and the target font identification ID is calculated based on the cross entropy loss function. The network parameters are updated through the back propagation algorithm, and the training is repeated until the loss function converges and the set recognition accuracy threshold is reached on the validation set.
8. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 7, characterized in that: The formula of the cross entropy loss function is as follows: Among them, L is the loss value of the sample; α i Weight factor for each category; is the predicted probability of the model for the i-th category; y i Whether the i-th category is the correct answer; N is the total number of categories.
9. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 1, characterized in that: The method of restoring the anti-counterfeiting traceability code by using the font coding table includes the following steps: Retrieving a font encoding table corresponding to the production date based on the production date text information extracted by the image recognition decoding module; The font identification ID sequence extracted from the image recognition result is input into the font coding table, and the digital coding sequence is restored bit by bit by looking up the corresponding relationship between the font identification ID and the digital code.
10. The anti-counterfeiting and tracing system for production date based on font encryption according to claim 1, characterized in that: The anti-counterfeiting traceability code database is constructed by the following steps: Build product information files, including product number, production batch, factory code, production date and logistics acceptance nodes; Use the anti-counterfeiting traceability code as an index to link product information files.
Citation Information
Patent Citations
Program control variable two-dimension code-based anti-counterfeiting license plate and application method thereof
CN104816685A
Method and system for pseudo-random batch code printing and product authentication
CN117313765A
Handwritten form automatic identification method and system based on deep learning
CN118135584A
Defect type anti-counterfeiting character code spraying system and method
CN119142040A
Braille and constellation-based anti-counterfeiting traceability system and method
CN119863253A
Cited By
Anti-counterfeiting tracing method and system based on font steganography coding and enterprise production center data center
CN121544276A
A font-based steganographic encoding anti-counterfeiting tracing method and system and enterprise production center data platform
CN121544276B