A font-based encryption production date anti-counterfeiting traceability system
The anti-counterfeiting traceability system based on font-encrypted production dates solves the problem that traceability identifiers are easily tampered with, covered, or erased in existing technologies. It achieves the concealed carrying and dynamic generation of traceability information, thereby improving its resistance to damage and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU LIREN DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2025-06-09
- Publication Date
- 2026-06-23
Smart Images

Figure CN120672357B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of anti-counterfeiting and traceability technology, and more particularly to an anti-counterfeiting and traceability system based on character-encrypted production dates. Background Technology
[0002] Anti-counterfeiting and traceability technologies have been widely applied in various industries, including food, pharmaceuticals, cosmetics, and electronics. By setting unique traceability identifiers on product packaging, companies can record and verify the authenticity of products throughout the entire process from production and distribution to final sales, providing technical support for combating counterfeit products and preventing cross-channel sales.
[0003] In existing technologies, common traceability labels include QR codes, anti-counterfeiting codes, and digital inkjet printing. While these anti-counterfeiting measures have achieved some success in certain scenarios, they still have the following problems: QR codes or inkjet printing labels are usually attached to the surface of packaging and are easily tampered with, covered, replaced, or erased. Once the label is damaged, it is difficult to complete product traceability verification; some anti-counterfeiting code schemes rely on independent coding systems, which are decoupled from the original product labeling information, increasing the complexity of label management and printing, and are easily removed or replaced in cross-selling activities, causing anti-counterfeiting and anti-cross-selling to fail. Summary of the Invention
[0004] To address the aforementioned issues, this invention provides an anti-counterfeiting traceability system for production dates based on character encryption.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] A production date anti-counterfeiting traceability system based on character encryption includes:
[0007] The anti-counterfeiting traceability code module is used to generate anti-counterfeiting traceability codes based on product information;
[0008] The font encoding module is used to match the font encoding table corresponding to the production date of the product, traverse the font encoding table through the anti-counterfeiting traceability code to generate a font sequence, convert the production date numeric characters to be printed into the corresponding font according to the font sequence, and output the production date code.
[0009] The image recognition and decoding module is used to identify the production date code on the product packaging through image recognition algorithms, and extract the date data and the font identifier ID of each digit in the production date code;
[0010] The traceability verification module is used to match the identified date data with the font encoding table, and restore the anti-counterfeiting traceability code through the font encoding table based on the font identifier ID. It also retrieves product batch, authenticity, and circulation source information by querying the anti-counterfeiting traceability code database.
[0011] Furthermore, the process of 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 manufacturing plant code;
[0013] A product ID is generated based on the product's basic information, serving as an anti-counterfeiting and traceability code.
[0014] Furthermore, the character encoding table is constructed through the following steps:
[0015] Based on the current product's production date, a unique date seed parameter is generated by converting the date into a standard format value, concatenating it with a preset key, and then hashing it.
[0016] Initialize the pseudo-random function using the date seed parameter;
[0017] The preset set of font identifier IDs and the set of numbers are input into the initialized pseudo-random function for mapping calculation to obtain the font encoding mapping relationship corresponding to the production date of the current product;
[0018] Based on the character encoding mapping relationship, construct the character encoding table corresponding to the current production date.
[0019] Furthermore, the pseudo-random function is as follows:
[0020] g(k)=(λ·k+μ·h(t)+θ)mod M;
[0021] Where g(k) represents the index position of the character identifier ID corresponding to the digital encoding value k after mapping; λ, μ, and θ are preset security disturbance parameters; t is the production date of the product; h(t) is the integer value obtained after hashing the production date t; and M is the total number of character identifier ID sets.
[0022] Furthermore, the image recognition decoding module includes a date recognition unit and a character recognition unit;
[0023] The date recognition unit is used to perform image segmentation and region localization on the acquired product packaging image, extract and recognize the character region containing the production date, and restore the production date text information;
[0024] The character recognition unit is used to perform character recognition on the character region containing the production date based on a convolutional neural network, and generate a character identifier ID for each number.
[0025] Furthermore, the step of performing image segmentation and region localization on the acquired product packaging image, and extracting and identifying the character region containing the production date, includes the following steps:
[0026] Image preprocessing is performed on the acquired product packaging images, including grayscale conversion, edge detection and noise filtering, and enhancement of character boundary features;
[0027] Based on character morphological features and arrangement rules, contour extraction and connected component analysis are performed on suspected text regions in the image to locate character regions containing production dates.
[0028] Furthermore, the convolutional neural network is constructed through the following steps:
[0029] Based on the collected character image samples, each character image sample is labeled with the corresponding numeric character and character identifier ID, and a training sample dataset containing character images and target character identifier IDs is constructed.
[0030] The font image samples in the training sample dataset are subjected to size normalization and grayscale standardization to obtain standardized font image data with uniform structure.
[0031] The standardized character image data is input into a convolutional neural network structure containing convolutional layers, pooling layers, and nonlinear activation functions to extract local edge features and texture features of each image and generate corresponding feature representation vectors.
[0032] The feature representation vector is input into a fully connected layer for classification, and the predicted label of the character identifier ID is output.
[0033] The error between the predicted label of the character identifier ID and the target character identifier ID is calculated based on the cross-entropy loss function. The network parameters are updated through the backpropagation 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 for the cross-entropy loss function is as follows:
[0035]
[0036] Where L is the loss value of the sample; α i Weighting factors for each category; Let y be the predicted probability of the model for the i-th class; i Is the i-th category the correct answer? N is the total number of categories.
[0037] Furthermore, the process of restoring the anti-counterfeiting traceability code through the character encoding table includes the following steps:
[0038] Based on the production date text information extracted by the image recognition decoding module, the character encoding table corresponding to the production date is retrieved;
[0039] The character identifier ID sequence extracted from the image recognition result is input into the character encoding table. By finding the correspondence between the character identifier ID and the numerical code, the numerical code sequence is restored bit by bit.
[0040] Furthermore, the anti-counterfeiting traceability code database is constructed through the following steps:
[0041] Build product information files, including product number, production batch, factory code, production date, and logistics acceptance points;
[0042] Use anti-counterfeiting traceability codes as an index to link product information files.
[0043] The beneficial effects of this invention are as follows: Unlike traditional methods that attach anti-counterfeiting codes to packaging in the form of QR codes or labels, this invention highly binds the traceability code to the production date through a font encoding module, deeply integrating the anti-counterfeiting label into the date field itself. The production date is mandatory labeling content in various industries and is difficult to cover or remove. Therefore, by embedding traceability information through font variant encoding, even if the packaging surface is subjected to human interference, the anti-counterfeiting information remains readable and verifiable, greatly improving the traceability code's resistance to damage and stability. Furthermore, 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 within the system. This encoding table establishes a one-to-one mapping relationship between numeric characters (such as 0-9) and multiple font identifier IDs, ensuring that the font sequence corresponding to the same traceability code is completely different on different dates. This allows the traceability information to dynamically change with the date, preventing external speculation or reuse and effectively preventing malicious counterfeiting or mass forgery. The image recognition decoding module adopts a separate architecture, including a date recognition unit and a font recognition unit. The former can accurately locate the character area of the production date, while the latter uses a neural network to classify and judge the font details of each digit, outputting a font identifier ID sequence, and combining it with the date field to call the encoding table for that day to restore the traceability code. This design effectively supports automated recognition tasks under large-scale image acquisition, possesses high robustness and high-precision recognition performance, and is suitable for verification needs in multiple scenarios at the production, distribution, and consumer ends. By decoding the font, the traceability code is recovered, and based on the traceability code, product batch, factory information, and circulation records are obtained from the database, realizing full-process verification of the product's origin and flow. This invention, through the fusion of font encryption and production date, achieves the concealed carrying, dynamic generation, and secure identification of the traceability code, effectively improving the integrity and tamper resistance of anti-counterfeiting traceability on product packaging. Attached Figure Description
[0044] Figure 1 This is a schematic diagram of the structure of an anti-counterfeiting traceability system for production dates based on character encryption, as described in this invention.
[0045] Figure 2This is a flowchart of the construction steps of the convolutional neural network in this invention. Detailed Implementation
[0046] Please see Figure 1-2 As shown, the present invention relates to an anti-counterfeiting traceability system for production dates based on character encryption, comprising:
[0047] The anti-counterfeiting traceability code module is used to generate anti-counterfeiting traceability codes based on product information;
[0048] The font encoding module is used to match the font encoding table corresponding to the production date of the product, traverse the font encoding table through the anti-counterfeiting traceability code to generate a font sequence, convert the production date numeric characters to be printed into the corresponding font according to the font sequence, and output the production date code.
[0049] The image recognition and decoding module is used to identify the production date code on the product packaging through image recognition algorithms, and extract the date data and the font identifier ID of each digit in the production date code;
[0050] The traceability verification module is used to match the identified date data with the font encoding table, and restore the anti-counterfeiting traceability code through the font encoding table based on the font identifier ID. It also retrieves product batch, authenticity, and circulation source information by querying the anti-counterfeiting traceability code database.
[0051] In some embodiments, the anti-counterfeiting traceability code module first generates a unique anti-counterfeiting traceability code based on the product's core attribute information (including product number, production batch, factory identification, channel information, etc.). This traceability code itself does not directly expose product attributes but is only used as a database index, ensuring data anonymization and structural security. Subsequently, the font encoding module receives the anti-counterfeiting traceability code and dynamically generates a font encoding table corresponding to the product's production date, using the production date as the input seed for a pseudo-random function. This font encoding table defines a non-linear mapping relationship between the numbers 0-9 and multiple font variants (font identifier IDs). By traversing this encoding table, the traceability code is converted into a set of font sequences, i.e., generating a font version of the production date that corresponds one-to-one with the anti-counterfeiting traceability code. This font production date is visually indistinguishable from regular numbers, and ordinary users cannot perceive the difference. However, the font used for each number 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 prints the production date using the coding equipment. This ensures that different batches of products embed different traceability code data under a visually consistent production date, without adding additional anti-counterfeiting labels. At the identification and verification end, the image recognition decoding module is responsible for image acquisition and preprocessing of the production date area on the product packaging, including grayscale normalization, edge enhancement, and character region segmentation. It further uses a pre-trained font recognition model to identify the specific font identifier ID used for each digit and, combined with the identified production date text data, calls the corresponding font encoding table to complete the reverse mapping and recover 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 indexing and querying, obtaining the corresponding full-process information of the product, including the production factory, production time, distribution path, and channel information. Simultaneously, it determines whether the current query behavior matches the record and automatically judges the authenticity status of the product. Unlike existing technologies, the traceability information of this invention is not carried by an additional graphic code, but is embedded in the original production date field through a font variant encoding method, which has extremely high concealment and security. The system constructs a daily changing font encoding table by using a dynamic pseudo-random mapping function driven by the production date, realizing the non-repetition and non-copyability of the traceability code, and completely solving the problem of reuse and counterfeiting of traditional static labels. The recognition process combines a deep learning font classification network and a traceable database to realize an automated closed loop of anti-counterfeiting verification from data collection to traceability query, improving the overall recognition accuracy and real-time performance of the system.
[0052] Furthermore, the process of 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 manufacturing plant code;
[0054] A product ID is generated based on the product's basic information, serving as an anti-counterfeiting and traceability code.
[0055] It should be noted that the anti-counterfeiting traceability code generation module in the system is used to generate a globally unique anti-counterfeiting traceability code for each product to be packaged. The generation process takes basic product information as input and combines it with a unified coding logic to achieve standardization and tamper-proof traceability identification. Specifically, the system first automatically collects the basic attribute information corresponding to the product at the production end or before packaging. This information includes, but is not limited to, the product number (such as SKU code), the production batch number (such as a batch identifier defined by a combination of production line and time period), and the production factory code (such as a registered factory ID or regional code). This information constitutes a set of static identifiers that can be uniquely identified throughout the product's lifecycle, possessing a clear traceability dimension. Furthermore, 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 codes or splicing logic are different, the traceability codes generated by the system will also be different, effectively avoiding code value conflicts or reuse. Compared to the traditional method of generating codes by accumulating serial numbers, this embodiment improves the complexity and security of the coding by combining multi-field product identity information for digest calculation, ensuring that each code value has a clear and unique pointer. Ultimately, the generated anti-counterfeiting traceability code is not only used by the character encoding module to perform character sequence mapping, but is also written into the system database for subsequent anti-counterfeiting verification calls after image recognition decoding, forming the core foundational data for the entire product traceability management process. The generation process of this anti-counterfeiting traceability code fully embodies the collaborative design between standardized data structures, deterministic mapping logic, and the system's security and anti-counterfeiting capabilities. Unlike existing methods that rely on external code labeling, it possesses high controllability and integration. After data collection, the system structurally concatenates the aforementioned fields according to a set format, for example, using the concatenation rule of "product number-factory code-batch number" to form an initial data string. This data string retains the product's original identity information while also possessing stability and consistency. To ensure the security, desensitization, and irreversibility of data during transmission and storage, the system further performs hash function processing on the data string, using algorithms such as SHA-256 or HMAC-SHA1, thereby generating a set of fixed-length, uniformly distributed, and irreversible identification codes, i.e., the anti-counterfeiting traceability code.
[0056] Furthermore, the character encoding table is constructed through the following steps:
[0057] Based on the current product's production date, a unique date seed parameter is generated by converting the date into a standard format value, concatenating it with a preset key, and then hashing it.
[0058] Initialize the pseudo-random function using the date seed parameter;
[0059] The preset set of font identifier IDs and the set of numbers are input into the initialized pseudo-random function for mapping calculation to obtain the font encoding mapping relationship corresponding to the production date of the current product;
[0060] Based on the character encoding mapping relationship, construct the character encoding table corresponding to the current production date.
[0061] Specifically, the production date of the current product is first standardized, uniformly converted into a number format without separators, such as "April 22, 2025" being converted to "20250422". To introduce a system perturbation factor to enhance anti-counterfeiting security, this standardized date is concatenated with a preset private key in the system, which can be "20250422#MACHINE-A01", forming a set of original input information used to generate the perturbation seed. Subsequently, the system performs hash processing on this concatenated string. This process uses a secure hash algorithm to convert the input string into a fixed-length, uniformly distributed, and irreversible integer value, which serves as the perturbation seed parameter for this date. This seed parameter is unique every day, ensuring that even if the same traceability code is used on different dates, the generated character sequence will be completely different, fundamentally preventing duplication and forgery. Based on this date seed parameter, the system performs a mapping calculation between a preset set of numbers (such as 0 to 9) and a set of character identifier IDs. Each numeric character corresponds to multiple available font identifiers (IDs). For example, the number "3" might have several fonts with slightly different stroke styles, such as A31, A32, and A33. The system matches the numeric characters with the font ID set according to the order of the perturbation seed results, generating a one-to-one mapping table. This mapping is only valid for the current date and is stored encrypted, serving as the basis for subsequent encoding and decoding. The completed font encoding table will be used during the printing stage to replace each numeric character in the production date with its corresponding encrypted font. Taking "20250422" as an example, if in the font encoding table generated for that day, "2" is mapped to A21, "0" to A08, and "5" to A15, then the entire date will be rendered as a numeric string with a specific font combination. Visually, the date is identical to ordinary numbers, but each font has been encrypted and replaced, providing anti-counterfeiting functionality. This step implements a font encoding table that is not fixed and preset, but dynamically generated based on the product production date and system perturbation key. This makes the mapping relationship change daily, and the mapping path is unpredictable through a hash perturbation mechanism. Even if an attacker knows the encoding table for 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] Where g(k) represents the index position of the character identifier ID corresponding to the digital encoding value k after mapping; λ, μ, and θ are preset security disturbance parameters; t is the production date of the product; h(t) is the integer value obtained after hashing the production date t; and M is the total number of character identifier ID sets.
[0065] Specifically, for each numeric encoded value to be mapped, the system calculates based on three types of system parameters: First, perturbation parameters λ, μ, and θ, which are confidential parameters set internally by the system to disrupt the mapping pattern and prevent the mapping relationship from being reverse-engineered or modeled for reproduction; second, the production date, which is standardized and then hashed using a highly secure hash function (such as SHA-256 or SM3) to obtain a set of irreversible, unique hash integer values, serving as the time-sensitive seed factor in the perturbation function; and finally, the total number of font IDs, which contains all font variants that can be used for encoding, with each font ID representing a visual variant of the numeric character. Taking the number "4" as an example, during mapping, the system inputs "4" along with the perturbation parameters and the date hash value into a pseudo-random function for calculation, obtaining the index of the number in the font ID set. If the total number of font IDs is 30, the function ensures that the final output index value is always between 0 and 29, ensuring the validity of the mapping. Simultaneously, due to the combined effect of the perturbation parameters and the date seed, even the same number will yield different index results when input into the function on different dates, thus mapping to different font IDs. For example, the number "4" is mapped to font A12 on April 22, 2025, and to font A25 on April 23, 2025. While there are subtle structural differences, the semantics are identical, making them difficult for the human eye to distinguish, thereby achieving implicit encryption. Unlike traditional fixed mapping tables, the mapping results generated by this function possess high temporal correlation and non-linear perturbation characteristics. Even if an attacker knows the mapping relationship for a certain day, without the system's perturbation parameters and seed construction logic, they cannot deduce the mapping path for other dates, thus ensuring the uncopyability and robustness of the traceability code font embedding sequence. Furthermore, this pseudo-random function is lightweight and computationally efficient, suitable for embedded deployment and batch processing scenarios. It supports setting different perturbation parameters according to production line, shift, or factory area, achieving multi-dimensional differentiation of anti-counterfeiting strategies.
[0066] Furthermore, the image recognition decoding module includes a date recognition unit and a character recognition unit;
[0067] The date recognition unit is used to perform image segmentation and region localization on the acquired product packaging image, extract and recognize the character region containing the production date, and restore the production date text information;
[0068] The character recognition unit is used to perform character recognition on the character region containing the production date based on a convolutional neural network, and generate a character identifier ID for each number.
[0069] In some embodiments, after the image acquisition device acquires an 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 localization. The image preprocessing part includes operations such as grayscale conversion, edge enhancement, and noise filtering, aiming to improve the clarity of character boundaries and reduce image interference caused by packaging material, lighting changes, or inconsistent inkjet printing quality. After preprocessing, the system performs area localization based on character arrangement rules and morphological features. Through methods such as connected component analysis and candidate area screening, the system separates the character area containing the complete production date from the entire packaging image. Subsequently, the system calls the OCR (Optical Character Recognition) model to perform digital recognition of the characters in the area and restore the standardized date text information, such as parsing the inkjet printing area image as "20250422", which is used for subsequent character encoding table matching and time indexing. After successfully extracting the character area of the production date, the image of this area is input to the character recognition unit for more fine-grained character classification and recognition. This unit constructs a multi-class image recognition model based on a convolutional neural network (CNN). It segments each digit character digit by digit and extracts its corresponding image fragment. Unlike traditional OCR, which focuses only on character content, this recognition network pays more attention to the detailed features of each character at the glyph structure level, such as stroke thickness, curvature, angular proportions, and endpoint shapes. The model extracts local texture features of character images through convolutional layers, enhances robustness to small-scale deformations through pooling layers, and outputs the classification prediction result of the glyph ID at the fully connected layer. For example, for the recognized character "5", the system not only confirms that it is the digit "5", but also determines that it uses a specific glyph variant such as A15, A18, or A23, thereby achieving the extraction of embedded traceability information. During the system training phase, supervised learning is performed based on a pre-labeled glyph image dataset. This dataset covers all digit characters and their variant images with various glyph IDs, ensuring that the model fully learns the features of different fonts and characters. During the recognition process, the model outputs a character 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 step of performing image segmentation and region localization on the acquired product packaging image, and extracting and identifying the character region containing the production date, includes the following steps:
[0071] Image preprocessing is performed on the acquired product packaging images, including grayscale conversion, edge detection and noise filtering, and enhancement of character boundary features;
[0072] Based on character morphological features and arrangement rules, contour extraction and connected component analysis are performed on suspected text regions in the image to locate character regions containing production dates.
[0073] It should be noted that the image preprocessing and region localization process in the image recognition decoding module is designed as a stable and scalable visual perception workflow. The core of this workflow is to transform character information in a high-dimensional, complex background into target region images with clear boundaries and structural rules, which can then be used by the subsequent date recognition and character recognition modules. The entire process not only emphasizes the enhancement of character boundary features but also fully integrates character arrangement patterns and morphological rules, giving the system greater robustness and accuracy when processing complex industrial inkjet printing images. In the image preprocessing stage, the system first performs grayscale processing on the acquired raw packaging image. This operation, by converting a color image to a single-channel grayscale image, significantly reduces the interference of redundant color information on character structure analysis, making subsequent image edge feature extraction more focused. Next, the system performs edge detection based on operators such as Sobel or Canny, extracting regions of abrupt pixel gradient changes in the image and using them as preliminary candidate regions for character boundaries. Meanwhile, to address image noise interference caused by printhead aging and ink splatter in coding equipment, the system employs algorithms such as mean square filtering or Gaussian filtering for denoising, ensuring the continuity and clarity of character outlines in the image space, thus laying the foundation for subsequent region localization. After preprocessing, the system enters the region localization stage. This stage primarily analyzes the geometric features and arrangement patterns of the character structure. In packaging design specifications, production dates are typically presented as a horizontally spaced sequence of numbers. The system utilizes this prior information to perform geometric analysis on all connected regions in the image. Through contour extraction algorithms, the system can detect pixel sets with closed boundaries in the image and eliminate non-text regions that do not match the characters, such as background patterns, icons, and production batch numbers, based on features such as the aspect ratio, area, and major axis direction of the contours. Subsequently, the system uses connected component analysis to cluster adjacent characters into text lines and combines the character spacing to determine whether they constitute a complete production date field. If a number combination that meets the date format is found, such as "20250422" consisting of 8 consecutive digits, the system extracts its region and uses it as input to the character recognition module. In real-world deployment scenarios, this image segmentation and region localization process demonstrates strong adaptability. Taking a food packaging package as an example, its production date is inkjet-printed with a colored background and slight wrinkles. During the preprocessing stage, the system successfully extracted character boundaries through edge enhancement and excluded non-target areas similar to QR codes and other batch markings during region localization. Ultimately, it accurately extracted an image block containing the production date for subsequent text recognition and character classification by the recognition module.
[0074] Furthermore, the convolutional neural network is constructed through the following steps:
[0075] Based on the collected character image samples, each character image sample is labeled with the corresponding numeric character and character identifier ID, and a training sample dataset containing character images and target character identifier IDs is constructed.
[0076] The font image samples in the training sample dataset are subjected to size normalization and grayscale standardization to obtain standardized font image data with uniform structure.
[0077] The standardized character image data is input into a convolutional neural network structure containing convolutional layers, pooling layers, and nonlinear activation functions to extract local edge features and texture features of each image and generate corresponding feature representation vectors.
[0078] The feature representation vector is input into a fully connected layer for classification, and the predicted label of the character identifier ID is output.
[0079] The error between the predicted label of the character identifier ID and the target character identifier ID is calculated based on the cross-entropy loss function. The network parameters are updated through the backpropagation 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 recognize the font style in production date characters, thereby providing a basic font identifier ID sequence output for traceability code reconstruction. The training process of this convolutional neural network strictly follows the task-oriented feature learning paradigm in deep learning, focusing on distinguishing subtle differences in fonts from structural details, and improving classification accuracy and generalization ability in complex mixed font style environments. The entire construction process includes five core stages: data construction, standardization processing, feature extraction, classification output, and training optimization, ensuring the model's reliability and engineering deployment capability. In the data construction stage, the system first collects a large number of actual printed production date images from different product packaging, and uses image segmentation and character separation algorithms to split the complete date image into independent single-character image samples. Each sample image corresponds to a numeric character (such as "3" or "8") and its actual font identifier ID used during printing (such as A31, A85, etc.). Based on manual review, images and labels are paired and labeled to form a training dataset, covering all numeric characters (0-9) and their common font variations (e.g., each number category includes no fewer than 10 font styles), ensuring the training set's balance in category distribution and sample diversity. In the data preprocessing stage, the system performs a unified format conversion on the sample images. Considering that convolutional neural networks are sensitive to input size and pixel distribution when perceiving structural features, all font images are normalized in size (e.g., uniformly 28×28 or 32×32 pixels) and grayscale normalization is performed to ensure consistent representation of character boundaries and stroke structures in pixel space, eliminating interference from differences in brightness, proportion, or ink thickness between fonts on model training. The normalized image data is input into the convolutional neural network structure for feature extraction. This system adopts the classic CNN architecture, containing several convolutional and pooling layers. The convolutional layers are used to extract local perceptual features such as character stroke direction, edge structure, and connection points, while the pooling layers are used for dimensionality reduction and enhancing resistance to deformation. The feature maps extracted by convolution are flattened and then fed into a fully connected layer for feature fusion and classification calculations. The final output is a prediction result that corresponds one-to-one with a preset font identifier ID. Taking the number "5" as an example, the system will identify that the font used is A51 instead of A52 or A54, thus completing the font-level recognition task. During training, the system uses cross-entropy as the loss function to measure the difference between the model output and the true label, and uses this loss value as the target to continuously optimize the network parameters through backpropagation. The training process employs batch gradient descent and a learning rate scheduling mechanism to strictly control the model's convergence based on sufficient iterations. After the model reaches a set accuracy (e.g., above 95%) on the validation set, it is solidified for deployment, ensuring its usability 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 style. It can visually distinguish the subtle structural changes of the same number under different font conditions, such as the degree of opening of the tail arc, the central curvature angle, and the sharpness of the corners in different fonts of the character "3".
[0081] Furthermore, the formula for the cross-entropy loss function is as follows:
[0082]
[0083] Where L is the loss value of the sample; α i Weighting factors for each category; Let y be the predicted probability of the model for the i-th class; i Is the i-th category the correct answer? N is the total number of categories.
[0084] It should be noted that when constructing the training sample dataset, the system covers all target numeric characters (0-9) and their corresponding multiple font variants, with each font identifier ID serving as an independent classification label. Regarding the number of samples, some commonly used fonts have sufficient samples due to their high actual coding frequency; however, some marginal fonts or specially designed fonts have relatively fewer samples, resulting in an imbalanced class distribution. If the standard cross-entropy loss function is used, the network will favor the class with a larger sample proportion during training, leading to decreased accuracy in recognizing small-sample fonts and insufficient model generalization ability. To address these issues, the system introduces a class weight factor to weight and correct the cross-entropy loss function. In the loss calculation, higher weight factors are given to easily confused or low-sample font categories, forcing the model to bear a higher loss for misjudging these samples during training, thus prompting the network to focus more on the ability to distinguish detailed features. Taking the two variants of the font "3," A31 and A33, as examples, they have subtle differences in stroke closure and are easily misjudged in low-resolution images. The system sets the weight factor for this highly confusing category to 1.5 times that of the ordinary category, significantly reducing the model's tolerance threshold for its output during training and thus enhancing its feature separation capability. During actual training, the system performs the following operations on the predicted output of each training sample: First, based on the predicted probabilities of each category in the model's current output, combined with the true label information, the prediction error of the current sample is determined. Then, weight coefficients are introduced to weight and accumulate this error, ultimately forming the loss value. This loss value serves as the input signal for backpropagation, used to update the gradients of the parameters of the convolutional and fully connected layers, continuously iterating and optimizing until the model reaches the set recognition accuracy threshold on the validation set and the loss function converges and stabilizes.
[0085] Furthermore, the process of restoring the anti-counterfeiting traceability code through the character encoding table includes the following steps:
[0086] Based on the production date text information extracted by the image recognition decoding module, the character encoding table corresponding to the production date is retrieved;
[0087] The character identifier ID sequence extracted from the image recognition result is input into the character encoding table. By finding the correspondence between the character identifier ID and the numerical code, the numerical code sequence is restored bit by bit.
[0088] In some embodiments, the anti-counterfeiting traceability code is restored by decoding the font identifier ID sequence extracted from the product packaging image and using a font encoding table corresponding to the production date. This decoding process constitutes a key step in the anti-counterfeiting verification logic. Its function is to accurately parse the encrypted information hidden in the production date through font changes into the original traceability code, thereby realizing the restoration of product identity and verification of authenticity. The specific process is as follows: The image recognition decoding module first extracts the character content of the production date and its corresponding font identifier ID sequence from the packaging image. Taking "20250422" as an example, the numeric characters "2", "0", "2", "5", "0", "4", "2", "2" contained in this date have been converted by the system into a set of specific font variants, such as A12, A07, A13, A25, etc., during inkjet printing. The font recognition unit classifies and recognizes the image of each character and outputs a set of font identifier ID sequences that correspond one-to-one with the character position. At the same time, the system also obtains the standard text value "20250422" of the date field through the character region recognition module, as the time index for querying the font encoding table. Subsequently, the system calls the pre-generated and stored encoding table in the font encoding module and locates the corresponding font encoding table version for that date using the extracted production date information. This font encoding table records the mapping relationship between each numeric character and a specific font identifier ID for that production date. The system takes the identified font identifier ID sequence as input and searches for its corresponding numeric code in the encoding table item by item. For example, if a font identifier ID A25 corresponds to the coded number "3", the system restores that position to "3" during decoding. In this way, the system performs a mapping lookup operation on the entire set of font identifier IDs, ultimately recovering a complete numeric encoding 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 simultaneously meet two conditions: first, accurately identifying the font identifier ID; and second, matching the correct production date encoding table. This dual-condition constraint mechanism makes it difficult for attackers to correctly reconstruct the traceability code even if they possess partial font styles or forge font patterns, especially without the date parameter, thus significantly enhancing the overall anti-counterfeiting security of the system. Furthermore, the system supports batch decoding, enabling rapid reconstruction of anti-counterfeiting information at multiple stages, including factory re-inspection, channel sampling, and terminal barcode verification, providing reliable technical support for authenticity traceability throughout the entire product lifecycle.
[0089] Furthermore, the anti-counterfeiting traceability code database is constructed through the following steps:
[0090] Build product information files, including product number, production batch, factory code, production date, and logistics acceptance points;
[0091] Use anti-counterfeiting traceability codes as an index to link product information files.
[0092] It's important to note that a product information file is first established during the production phase before the product goes live. This file includes multiple dimensions and fields, comprehensively recording the product's core identity information and distribution nodes. Key fields include product number (e.g., SKU or product series code), production batch (a batch identifier formed by combining production date and shift number), factory code (used to identify a specific manufacturing plant or production line), production date (serving as a time index for generating the character encoding table and pseudo-random mapping parameters), and logistics acceptance node information (such as warehouse entry / exit, channel warehousing, and transportation tracking). This information, after standardization and structuring, is stored as a set of data structures with field labels, supporting field-based indexing, combined queries, and multi-source verification in the database. After the information file 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 hash processing based on the product number, batch, factory, and other fields, and does not directly contain plaintext product information, possessing the characteristics of data anonymization, secure transmission, and irreversibility. Subsequently, the system uses the anti-counterfeiting traceability code as the primary index key of the database, establishing a binding relationship between the code and the corresponding product information file, and writing it as a complete record entry into the traceability database. For example, a product's profile might contain the following fields: 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 field information. When a user or the system subsequently identifies the product's traceability code and submits a query request, it can quickly locate and reconstruct the product's production source, time, batch, and distribution path through primary key retrieval, thus verifying the product's authenticity and compliance. Compared to the traditional method of separating traceability codes from product information, this database construction method offers stronger consistency and tamper-proof capabilities. Furthermore, this structure supports multi-dimensional cross-queries, allowing regulatory or consumer interfaces to use the traceability code to retrieve product attributes across any dimension, achieving efficient information verification and tracing of violations.
[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. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A production date anti-counterfeiting traceability system based on character encryption, characterized in that, include: The anti-counterfeiting traceability code module is used to generate anti-counterfeiting traceability codes based on product information; The font encoding module is used to match the font encoding table corresponding to the production date of the product, traverse the font encoding table through the anti-counterfeiting traceability code to generate a font sequence, convert the production date numeric characters to be printed into the corresponding font according to the font sequence, and output the production date code. The image recognition and decoding module is used to identify the production date code on the product packaging through image recognition algorithms, and to extract the date data and the font identifier ID of each digit in the production date code; The traceability verification module is used to match the font encoding table with the identified date data, restore the anti-counterfeiting traceability code through the font encoding table based on the font identifier ID, and obtain product batch, authenticity and circulation source information through the anti-counterfeiting traceability code database. The process of generating an anti-counterfeiting traceability code based on product information includes the following steps: Collect basic product information, including product number, batch number, and manufacturing plant code; A product ID is generated based on the product's basic information and used as an anti-counterfeiting traceability code; The character encoding table is constructed through the following steps: Based on the current product's production date, a unique date seed parameter is generated by converting the date into a standard format value, concatenating it with a preset key, and then hashing it. Initialize the pseudo-random function using the date seed parameter; The preset set of font identifier IDs and the set of numbers are input into the initialized pseudo-random function for mapping calculation to obtain the font encoding mapping relationship corresponding to the production date of the current product; Based on the font encoding mapping relationship, a font encoding table corresponding to the current production date is constructed. The font encoding table defines a non-linear mapping relationship between the numbers 0 to 9 and multiple font variants. The pseudo-random function is as follows: ; in, Represents the numerical encoding value The index position of the corresponding font identifier ID after mapping; , , These are preset safety disturbance parameters; This refers to the product's production date; For the production date The integer value obtained after hashing; This represents the total number of font identifier ID sets.
2. The anti-counterfeiting traceability system for production dates based on character encryption according to claim 1, characterized in that, The image recognition and decoding module includes a date recognition unit and a character recognition unit; The date recognition unit is used to perform image segmentation and region localization on the acquired product packaging image, extract and recognize the character region containing the production date, and restore the production date text information; The character recognition unit is used to perform character recognition on the character region containing the production date based on a convolutional neural network, and generate a character identifier ID for each number.
3. The anti-counterfeiting traceability system for production dates based on character encryption according to claim 2, characterized in that, The process of segmenting and locating the acquired product packaging images, and extracting and identifying the character region containing the production date, includes the following steps: Image preprocessing is performed on the acquired product packaging images, including grayscale conversion, edge detection and noise filtering, and enhancement of character boundary features; Based on character morphological features and arrangement rules, contour extraction and connected component analysis are performed on suspected text regions in the image to locate character regions containing production dates.
4. The anti-counterfeiting traceability system for production dates based on character encryption according to claim 2, characterized in that, The convolutional neural network is constructed through the following steps: Based on the collected character image samples, each character image sample is labeled with the corresponding numeric character and character identifier ID, and a training sample dataset containing character images and target character identifier IDs is constructed. The font image samples in the training sample dataset are subjected to size normalization and grayscale standardization to obtain standardized font image data with uniform structure. The standardized character image data is input into a convolutional neural network structure containing convolutional layers, pooling layers, and nonlinear activation functions to extract local edge features and texture features of each image and generate corresponding feature representation vectors. The feature representation vector is input into a fully connected layer for classification, and the predicted label of the character identifier ID is output. The error between the predicted label of the character identifier ID and the target character identifier ID is calculated based on the cross-entropy loss function. The network parameters are updated through the backpropagation algorithm, and the training is repeated until the loss function converges and the set recognition accuracy threshold is reached on the validation set.
5. A production date anti-counterfeiting traceability system based on character encryption according to claim 4, characterized in that, The formula for the cross-entropy loss function is as follows: ; in, This represents the loss value for the sample. Weighting factors for each category; For the model to the first The predicted probability of a class; No. Is the class the correct answer? This represents the total number of categories.
6. The anti-counterfeiting traceability system for production dates based on character encryption according to claim 1, characterized in that, The process of restoring the anti-counterfeiting traceability code through the character encoding table includes the following steps: Based on the production date text information extracted by the image recognition decoding module, the character encoding table corresponding to the production date is retrieved; The character identifier ID sequence extracted from the image recognition result is input into the character encoding table. By finding the correspondence between the character identifier ID and the numerical code, the numerical code sequence is restored bit by bit.
7. The anti-counterfeiting traceability system for production dates based on character encryption according to claim 1, characterized in that, The anti-counterfeiting traceability code database is constructed through the following steps: Build product information files, including product number, production batch, factory code, production date, and logistics acceptance points; Use anti-counterfeiting traceability codes as an index to link product information files.