Anticounterfeiting technology for 2d codes and related methods

IN604843BActive Publication Date: 2026-10-01PEPPERFLUX TECHNOLOGIES PTE LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
IN202531054665
Authority / Receiving Office
IN · IN
Patent Type
Patents
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2026-10-01
Estimated Expiration
2045-06-06

AI Technical Summary

Technical Problem

Traditional anticounterfeiting methods, such as holograms and watermarks, have become less effective as counterfeiters develop advanced techniques to mimic these security features, leading to a need for more sophisticated and reliable technologies to differentiate genuine products from counterfeit ones.

Method used

The use of specialized artificial intelligence techniques, unique textures, and advanced neural network architectures to enhance the security and verification of 2D codes, specifically by integrating QR codes with unique texture noise patterns, copy detection patterns, ArUco marks, anticounterfeit shapes, and UV ink patterns, and employing deep learning-based methods for authentication.

Benefits of technology

This approach significantly enhances the security and reliability of 2D code verification, making it difficult for counterfeiters to replicate the codes accurately, and provides a robust mechanism for authenticating products, thereby reducing forgery and protecting brand integrity.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The present invention relates to a system (100) and method (200) for creating and authenticating a 2D anticounterfeit code is described, which involves generating (202) a secure code by integrating a QR code with unique patterns and optionally including additional marks and ink patterns. The process includes printing (204) the code and authenticating (206) it using deep learning techniques for precise detection and anomaly comparison. Additionally, a computer-implemented method (700) predicts optimal preprocessing parameters for QR code generation by analyzing input factors and utilizing a deep learning model to estimate parameters for diverse printing features. The method (900) also includes restoring a degraded copy detection pattern using a neural network architecture, ensuring the restored image closely matches the original pattern by preserving texture and correcting distortions. Referring FIG. 1, 7 & 9
Need to check novelty before this filing date? Find Prior Art

Description

FIELD OF THE INVENTION

[0001] The present disclosure broadly relates to security and verification technologies. More particularly, the present invention relates to methods of generating and authenticating anticounterfeiting technology, and more specifically, involves the use of specialized artificial intelligence techniques, unique textures, and advanced neural network architectures to enhance the security and verification of 2D codes.BACKGROUND OF THE INVENTION

[0002] Background description includes information that may be useful in understanding the present invention. It is not an admission that any of the information provided herein is prior art or relevant to the presently claimed invention, or that any publication specifically or implicitly referenced is prior art.

[0003] Counterfeiting is a major global problem impacting various sectors, such as pharmaceuticals, electronics, fashion, and consumer goods. The spread of counterfeit products not only results in significant economic losses but also poses serious threats to consumer safety and brand reputation. Traditional methods of fighting counterfeiting, like holograms and watermarks, have become less effective as counterfeiters develop more advanced techniques to mimic these security features. Consequently, there is an increasing demand for more sophisticated and dependable anticounterfeiting technologies that can accurately differentiate genuine products from counterfeit ones.

[0004] CN105934780A discloses a new encoding method for authenticating printed documents is introduced, aimed at making reproduction more difficult. Under certain conditions, this method outperforms other 2D encoding techniques. It requires less printing space by optimizing features used in standard 2D codes for stabilization, which are essential for mobile applications. The code can be broken down into basic units or "byte units," which can be widely distributed across a text document. These "byte units" can be integrated into text symbols. If a document protected with this encoding is copied, some of these symbols may be significantly degraded by the copying process, effectively enabling duplication detection through this new encoding technique.

[0005] In recent years, the integration of digital technologies and artificial intelligence (AI) has opened new avenues for enhancing anticounterfeiting measures. AI-driven solutions offer the potential to create highly secure and unique identifiers that are difficult to replicate. These solutions can include complex patterns, textures, and codes that are embedded into product packaging or labels. Additionally, advancements in printing technologies and materials have enabled the development of more intricate and tamper-proof security features. However, the challenge remains to design a system that not only generates these secure identifiers but also provides a robust mechanism for their authentication, ensuring that counterfeit products can be reliably detected and prevented from entering the market.OBJECTIVES OF THE INVENTION

[0006] The principal objective of the present invention is to overcome the disadvantages of the prior art.

[0007] Another objective of the present invention is to enhance the security and verification of 2D codes using specialized artificial intelligence techniques, unique textures, and advanced neural network architectures.

[0008] Another objective of the present invention is to make advancements in printing technologies and materials that enable the development of more intricate and tamper-proof security features in 2D codes.

[0009] Another objective of the present invention is to provide a robust mechanism for the authentication using specialized AI techniques.

[0010] Yet another objective of the present invention is ensuring that counterfeit products can be reliably detected with high efficiency and accuracy and prevented from entering the market, thus reducing forgery.

[0011] The foregoing and other objects, features, and advantages of the present invention may become readily apparent upon further review of the following detailed description of the preferred embodiment as illustrated in the accompanying drawings.SUMMARY OF THE INVENTION

[0012] The present invention relates a methods of generating and authenticating anticounterfeiting technology, and more specifically, involves the use of specialized artificial intelligence techniques, unique textures, and advanced neural network architectures to enhance the security and verification of 2D codes.

[0013] According to an embodiment of present invention, the system may create and authenticate a 2D anticounterfeit code. The system can generate a secure anticounterfeit code by integrating a QR code with a unique texture noise pattern, a copy detection pattern (CDP), and may include an ArUco mark, anticounterfeit shapes, and UV ink patterns. The system may print the anticounterfeit code, producing a physical code and removing defective codes using a fast validation technique. The system can authenticate a scanned copy of the printed anticounterfeit code by detecting the QR code and ArUco mark using deep learning-based techniques for cropping the CDP at a sub-pixel level, rejecting blur frames using a deep learning-based blur detection technique, reconstructing a digital prediction using an image-to-image translation technique, and comparing the digital prediction with an original template using a threshold-based anomaly detection technique.

[0014] According to another embodiment of present invention, the process of creating the 2D anticounterfeit code may involve a computer-implemented method for predicting optimal preprocessing parameters for QR code generation. The system can receive input factors such as material, ink, printer settings, QR code design, and environment data through an automated data-driven solution. The system may capture complex relationships between the input factors and ideal preprocessing parameters needed to compensate for print distortions using a deep learning model. The system can predict all relevant preprocessing parameters for diverse printing features by jointly learning from the input factors using a multi-input, multi-output deep learning architecture. The system may treat the prediction as a multi-task regression problem, estimating each output parameter simultaneously while learning interdependencies and capturing correlations between the output parameters. The system can transform categorical features, normalize numerical features, and represent structured data in a suitable format for the deep learning model.

[0015] According to another embodiment of present invention, the input factors for the method may include coating type, error correction level, printing speed, and paper quality.

[0016] According to another embodiment of present invention, the ideal preprocessing parameters may include noise level, block size, and mean value.

[0017] According to another embodiment of present invention, the diverse printing features may include inkjet printing, laser printing, and thermal printing.

[0018] According to another embodiment of present invention, the deep learning model may include a convolutional neural network, a recurrent neural network, and a transformer-based architecture.

[0019] According to another embodiment of present invention, the categorical features may be transformed using embedding or one-hot encoding.

[0020] According to another embodiment of present invention, the step of authenticating the 2D anticounterfeit code may involve a computer-implemented method for restoring a copy detection pattern (CDP). The system can receive a degraded CDP scan and process it using a CDP restoration pipeline, which may include a neural network architecture with an encoder, a U-Net backbone, and a decoder, augmented with Low-Rank Adaptation (LoRA) adapters. The system may compress the degraded CDP scan into a latent representation using the encoder, transform the latent representation using the U-Net backbone with skip connections and cross-attention conditioning, and reconstruct a restored CDP image from the transformed latent representation using the decoder. The restored CDP image may closely match an original digital pattern of the CDP by preserving fine-grained random texture and binary contrast while correcting noise and distortion. The system can output the restored CDP image.

[0021] According to another embodiment of present invention, the neural network architecture may include a text encoder configured to process an optional text prompt into text embedding, which can be injected into the U-Net backbone through cross-attention layers to provide high-level guidance to the neural network architecture.

[0022] According to another embodiment of present invention, the optional text prompt may be received as an input to the CDP restoration pipeline.

[0023] According to another embodiment of present invention, the text embedding may provide high-level guidance to the neural network architecture for restoring the degraded CDP scan.

[0024] According to another embodiment of present invention, the LoRA adapters may allow the neural network architecture to be fine-tuned for CDP restoration with a reduced number of additional parameters compared to fine-tuning the entire neural network architecture.

[0025] According to yet another embodiment of present invention, the skip connections may pass features from early encoding layers of the encoder to corresponding decoding layers of the decoder, ensuring that fine details from the degraded CDP scan are preserved in the restored CDP image.

[0026] While the invention has been described and shown with particular reference to the preferred embodiment, it may be apparent that variations might be possible that might fall within the scope of the present invention.BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification. The drawings illustrate exemplary embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0028] In the figures, similar components and / or features may have the same reference label. Further various components of the same type may be distinguished by following the reference label with a second label that distinguishes among the similar components. If only the first reference label is used in the specification, the description is applicable to any of the similar components having the same reference label irrespective of the second reference label.

[0029] FIG. 1 illustrates a flow chart showing a system for creating and authenticating a 2D anticounterfeit code, according to an embodiment of the present invention.

[0030] FIG. 2 illustrates a flow chart showing a method for creating and authenticating a 2D anticounterfeit code, according to an embodiment of the present invention.

[0031] FIG. 3(A) to FIG. 3(E) show an exemplary transformation of an original QR code into an anti-counterfeiting QR code using Gaussian, interpolated, and halftoned textures, according to an embodiment of the present invention.

[0032] FIG. 4 shows an exemplary 2D anticounterfeit code having a QR code integrated with unique texture noise, copy detection pattern, ArUco mark, and anticounterfeit shapes for enhanced security, according to an embodiment of the present invention.

[0033] FIG. 5 shows a 2D anticounterfeit code with QR code, CDP, ArUco mark, anticounterfeit shapes, used for secure authentication, according to an embodiment of the present invention.

[0034] FIG. 6 shows an exemplary product label with invisible UV features for anticounterfeit purposes, according to an embodiment of the present invention.

[0035] FIG. 7 illustrate a flow chart showing a computer-implemented method for predicting optimal pre-processing parameters for QR code generation, according to an embodiment of the present invention.

[0036] FIG. 8 depicts a block diagram of deep learning pipeline for restoring copy detection patterns, involving an Encoder, a Text Encoder, U-Net architecture, LoRA Adapters, and Decoder, according to an embodiment of the present invention.

[0037] FIG. 9 presents a flow chart showing a computer-implemented method for restoring a copy-detection pattern (CDP), according to an embodiment of the present invention.

[0038] FIG. 10 shows a Copy Detection Pattern (CDP) with a unique texture noise pattern, used for the step of authenticating the 2D anticounterfeit code, according to an embodiment of the present invention.

[0039] FIG. 11(A) and FIG. 11(B) shows a comparison of scanned copy of printed template and original digital templates, including anomaly detection for anticounterfeit code verification, according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0040] Exemplary embodiments may now be described more fully hereinafter with reference to the accompanying drawings, in which exemplary embodiments are shown. This disclosure may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. These embodiments are provided so that this disclosure may be thorough and complete and may fully convey the scope of the disclosure to those of ordinary skill in the art. Moreover, all statements herein reciting embodiments of the disclosure, as well as specific examples thereof, are intended to encompass both structural and functional equivalents thereof. Additionally, it is intended that such equivalents include both currently known equivalents as well as equivalents developed in the future (i.e., any elements developed that perform the same function, regardless of structure).

[0041] The present invention relates to methods for generating and authenticating anticounterfeiting technology, specifically focusing on the use of specialized artificial intelligence techniques, unique textures, and advanced neural network architectures to enhance the security and verification of 2D codes.

[0042] Referring to FIG. 1 and FIG. 2, a system (100) and method (200) for creating and authenticating 2d counterfeiting codes is presented. The Anticounterfeit Code Generator (102), identified as component, is responsible for generating (202) a secure anticounterfeit code. This component utilizes an AI model and AI technique to create the anticounterfeiting code, which integrates a QR code with a unique texture noise pattern, a copy detection pattern (CDP), and optionally an ArUco mark, anticounterfeit shapes, and UV ink patterns. The generation process involves predicting optimal preprocessing parameters for QR code generation, achieved through a multi-input, multi-output deep learning architecture. This architecture treats the prediction as a multi-task regression problem, capturing (706) complex relationships between input factors such as material, ink, printer settings, QR code design, and environment data. The AI model predicts preprocessing parameters to optimize QR code generation, ensuring the printed code is scannable and effective in anticounterfeiting. The Anticounterfeit Code Generator (102) works in conjunction with other components, such as the Anticounterfeit Code Printer (104) and Anticounterfeit Code Authenticator (106), to ensure the overall effectiveness of the anticounterfeiting technology. The generated code is printed (204) by the Anticounterfeit Code Printer (104), which produces a physical code and removes defective codes using a fast validation technique. The printed code is then authenticated (206) by the Anticounterfeit Code Authenticator (106), which detects the QR code and ArUco mark using deep learning-based techniques, crops the CDP at a sub-pixel level, and compares the digital prediction with an original template using a threshold-based anomaly detection technique. The Anticounterfeit Code Generator (102), as part of this system (100), contributes to the generation (202) of a secure anticounterfeit code that is resistant to counterfeiting attempts, ensuring the integrity and authenticity of the product it is applied to.

[0043] According to an embodiment, the Anticounterfeit Code Printer (104) component is responsible for the task of printing the anticounterfeit code (204), which includes a variety of security features. This component utilizes advanced printing methods to ensure the effectiveness of the anticounterfeiting technology. The printing process involves producing a physical anticounterfeit code that integrates a QR code with a unique texture noise pattern, a copy detection pattern (CDP), and potentially additional elements such as an ArUco mark, anticounterfeit shapes, and UV ink patterns. The Anticounterfeit Code Printer (104) employs a fast validation technique to remove defective codes during the printing process, ensuring only high-quality codes are produced. The printing methods are adaptable to various substrates and printer types, allowing for flexibility in application. The component also applies preprocessing parameters, predicted by a multi-input, multi-output deep learning architecture, to optimize QR code generation. This optimization involves adjusting parameters such as noise level, block size, and mean value to compensate for print distortions and ensure the printed code is scannable. The Anticounterfeit Code Printer (104) works in conjunction with other components, such as the Anticounterfeit Code Generator (102) and the Anticounterfeit Code Authenticator (106), to create a system for generating (202), printing (204), and authenticating (206) anticounterfeit codes. The integration of these components enhances the security and reliability of the anticounterfeiting process, providing a solution for protecting products against counterfeiting.

[0044] According to an embodiment, the Anticounterfeit Code Authenticator (106) component authenticates (206) the scanned copy of the printed anticounterfeit code by employing a series of techniques. This component utilizes a cropping technique to precisely crop the unique copy detection pattern (CDP) at a sub-pixel level, which is crucial for detecting counterfeits. The cropping technique works in conjunction with deep learning-based techniques to accurately detect the QR code and ArUco mark, ensuring that the CDP is isolated with precision. The Anticounterfeit Code Authenticator also employs a deep learning-based blur detection technique to reject any blur frames, thereby maintaining the integrity of the authentication process.

[0045] Furthermore, the component reconstructs a digital prediction of the scanned code using an image-to-image translation technique, which involves a neural network architecture with an encoder, a U-Net backbone, and a decoder. This architecture is augmented with Low-Rank Adaptation (LoRA) adapters to enhance its ability to restore the original pattern from the scan. The reconstructed digital prediction is then compared with an original template using a threshold-based anomaly detection technique, which identifies any discrepancies indicative of counterfeiting.

[0046] According to an embodiment, the Anticounterfeit Code Authenticator (106) component integrates these processes to ensure an authentication system, leveraging the synergy of data-driven features and explicit conditioning to achieve high-fidelity output. This approach provides a solution for verifying the authenticity of printed anticounterfeit codes, ensuring that any attempt to replicate or forge the code is effectively detected.

[0047] Referring to FIG. 3, the technical drawing illustrates a method for transforming an original QR code into an anti-counterfeiting QR code by integrating various textures. The process begins with the 'Original QR Code' FIG. 3(A), which serves as the foundational element. This QR code is then enhanced with three distinct textures to bolster its security features against counterfeiting attempts.

[0048] According to an embodiment, the first texture applied is the 'Gaussian Texture' FIG. 3(B), which introduces a noise pattern to the QR code. This texture adds a layer of complexity by embedding random noise, making it difficult for counterfeiters to replicate the code accurately. In an alternative embodiment, optimized textures can be generated using a multi-input, multi-output deep learning model. This architecture takes diverse printing features as input and jointly predicts all relevant preprocessing parameters. This joint training approach allows the model to capture correlations effectively. Multi-task learning is beneficial in this context as it increases the effective training sample size, leading to the model learning a more generalized representation.

[0049] Following this, the 'Interpolated Texture' FIG. 3(C) is applied, which smooths transitions within the QR code. This texture helps in maintaining the integrity of the QR code's data while adding another layer of security by altering the visual appearance subtly. The third texture, the 'Halftoned Texture' FIG. 3(D), introduces a dot pattern. This texture further complicates the replication process by adding a distinct visual pattern that is challenging to duplicate precisely.

[0050] According to another embodiment, these textures are collectively integrated to form the 'Anti-Counterfeiting QR Code' FIG. 3(E). This final product combines the original QR code with the Gaussian, interpolated, and halftoned textures, resulting in a QR code that is more secure against counterfeiting. The integration of these elements enhances the QR code's resistance to unauthorized duplication by introducing unique visual and structural characteristics that are difficult to replicate without the original template and specific printing techniques.

[0051] Referring to FIG. 4, the technical drawing illustrates a 2D anticounterfeit code designed to enhance security against counterfeiting. This system integrates multiple security features into a single code, providing a solution for authentication and verification. The central component of the code is a QR code integrated with the unique texture noise pattern which is designed to introduce complexity and variability, making it difficult for counterfeiters to replicate the code accurately.

[0052] According to an embodiment, adjacent to the QR code is the copy detection pattern (CDP), which plays a role in identifying counterfeit copies. The CDP is a unique pattern that, when scanned, can reveal discrepancies introduced during unauthorized copying processes. This pattern is generated to be unique for each code, ensuring that any attempt to duplicate the code results in detectable anomalies. The CDP is processed using techniques such as deep learning-based cropping at a sub-pixel level and image-to-image translation for digital prediction reconstruction, allowing for precise comparison with the original template.

[0053] According to an embodiment, an ArUco mark is also integrated into the code, serving multiple purposes. It assists in determining the distance of the anticounterfeit code from the scanning device, providing position information and aiding in perspective distortion correction. This mark is crucial for ensuring that the code is scanned accurately, maintaining the integrity of the security features. The ArUco mark, along with the QR code, is detected using deep learning-based techniques, which enhance the accuracy and reliability of the scanning process.

[0054] According to an embodiment, the anticounterfeit code may incorporate specific anticounterfeit shapes, as referred in FIG. 5, these shapes provide an extra layer of security by acting as a weak classifier for rejection logic. They are designed to be detected by an image classifier, which uses them to identify and reject counterfeit codes. The presence of these shapes complicates the replication process, as they require precise reproduction to avoid detection.

[0055] According to an embodiment, the structural relationships among these components are carefully designed to ensure seamless interaction and functionality. The QR code, texture noise pattern, CDP, ArUco mark, and anticounterfeit shapes work together to create a robust system that is difficult to replicate or counterfeit. The integration of these elements ensures that the anticounterfeit code can be authenticated with high accuracy, providing a reliable method for verifying the authenticity of products or documents.

[0056] According to an another embodiment, the image illustrates an example of a product label incorporating advanced anticounterfeit technology, as referred in FIG. 6. In an instance, the label prominently features two key elements: an Invisible UV with Forensic ID Guilloche Design and an Invisible UV with Forensic ID Microtext. These components enhance security by providing unique, difficult-to-replicate patterns that can be verified under UV light.

[0057] Referring to FIG. 7, the anticounterfeit code generator (102) of the system (100) further includes a computer-implemented method (700) for predicting optimal preprocessing parameters for QR code generation. This involves receiving (702) input factors, capturing (706) complex relationships between the input factors and ideal preprocessing parameters using a deep learning model, and predicting (708) all relevant preprocessing parameters for diverse printing features.

[0058] Input Encoding: According to an embodiment, the input to the artificial intelligence enabled method may include a mix of numerical and categorical features describing the printing context. For example, Substrate characteristics including but not limited to for example, paper weight (GSM, numeric), coating type (coated / uncoated, categorical; Ink properties including but not limited to ink type (categorical), viscosity (numeric); Printer specifications including but not limited to DPI (numeric resolution), printing mode (static vs variable data printing, categorical); QR code features including but not limited to version (numeric or categorical, indicating module count and size), error correction level (categorical, for example, L / M / Q / H), physical size or module size (numeric, for example, in cm or pixels); and Environmental factors including but not limited to ambient temperature (numeric), printing speed (numeric, for example, pages per minute).

[0059] According to a preferred embodiment, each feature may be preprocessed and encoded appropriately. Categorical features like coating type or error correction level) may be transformed via embeddings or one-hot encoding. Learned embeddings are preferred for high-dimensional sparse data or nominal categories, as they allow the model to discover latent representations (for example, an embedding for "coated" vs "uncoated" paper could capture differences in reflectivity or ink absorption) and converts it into dense, low dimensional vectors. Alternatively, one-hot encoding may be used to represent the categorical features as binary vectors. Numerical features may be normalized (for example, scaled to 0-1 or standardized) and can be fed in directly or via a small fully-connected sub-network to project them into the model's latent space. This structured data can be represented as a single concatenated feature vector after encoding, or alternatively as a set of tokens for a transformer-based architecture.Backbone Network

[0060] According to an embodiment, for the accuracy, state-of-the-art deep learning techniques may be used as backbone as this model is computationally heavy (running offline). Two variable approaches that might be used are:

[0061] Vision Transformer (ViT) style backbone: Transformers have excelled in capturing complex patterns in data. A model like EVA (a recent ViT) has demonstrated state-of-the-art vision performance with a huge capacity (on the order of a billion parameters)

[0062] A hierarchical Transformer like Swin Transformer is also a strong candidate - Swin uses multi-scale representations (originally for images) and has shown outstanding accuracy (87%+ ImageNet top-1) and scalability. Using a transformer backbone brings the benefit of attention mechanisms, wherein the model can naturally weigh the most relevant features for each output prediction, which is useful in multi-factor scenario.Convolutional / Hybrid Backbone: Alternatively, a modern convolutional neural network such as ConvNeXt, which is a "ConvNet for the 2020s" could be used that incorporates design elements of transformers (for example, large kernels, better training procedures). ConvNeXt achieved accuracy comparable to ViTs by modernizing ResNet architectures. However, since inputs are not images in the traditional sense, a pure CNN might only be applicable if inputs are encoded in a spatial grid (not typical for this type of data). A hybrid approach might be to use small CNN modules for any image-like inputs (if rendered QR code images or other visual features can include), combined with feed-forward layers for the rest. Given that the user is open to heavy models like EVA, a transformer-based model is likely more straightforward for handling heterogeneous data.

[0063] Fusion of Inputs: If all inputs are structured (tabular) data, a single transformer encoder or a deep multi-layer perceptron (MLP) can fuse them. If an image input (for example, the raw QR code matrix or a sample printed patch image) may incorporate, the architecture becomes multi-modal. In a multi-modal design, one branch (for example, a CNN like ConvNeXt or a ViT pre-trained on images) might handle the image, while another branch (an MLP or transformer) handles the structured metadata. The two branches might then be fused - possible fusion strategies include concatenation of their latent features followed by further layers, or cross-attention (where, for instance, the transformer attending to image patch embeddings also attends to the encoded metadata tokens). Because the output parameters are interdependent, it's important that the fusion happens before the final prediction heads, so that the decision for each parameter can be informed by the others. For example, the model might internally learn a representation of overall print "difficulty" for a given scenario, which influences both the noise and the block size predictions together.

[0064] Output Heads: The network may branch into multiple output heads to produce the desired parameters. Each output head is typically a small fully connected network (or even a single linear layer) that takes the shared latent representation (or a subset of it) and outputs one of the parameters. For instance, one head predicting the Gaussian noise standard deviation, another predicting the block size for a filtering technique, another for the mean value adjustment, etc. By using separate heads, each parameter's prediction to be fine-tuned independently while still being based on the common learned features. This is a standard design in multi-task neural nets: a set of shared layers feeding into task-specific output layers. All heads are trained simultaneously, sharing the backbone weights. This design ensures consistency and interdependence: if one parameter affects another in the real process, the network can learn that relationship through the shared features. A person skilled in the art should understand that, if needed, one can even feed certain outputs as inputs to others within the model, although that is usually not required if the shared layers capture the relationships.

[0065] According to an embodiment, the input is predominantly structured (numerical / categorical data) with relatively low dimensionality compared to images, a purely transformer model for tabular data is quite suitable. In recent research, transformers have been adapted to tabular data by treating each feature as a token and learning feature interactions through self-attention. This approach can outperform classic MLPs on complex tabular problems, especially when feature interdependencies are important. This scenario exactly fits that description: for example, the importance of DPI might depend on QR version (higher DPI might mitigate issues with small modules of higher version QR codes), which is an interaction a transformer can learn by attending between those feature tokens.Training Data and Input / Output Formatting

[0066] According to an embodiment, a comprehensive dataset of printing scenarios and the corresponding optimal preprocessing parameters may use to train this model. Each training example should consist of:

[0067] Input Features: The set of attributes for a particular scenario, formatted as described (numerical features normalized, categorical features encoded). For example, one training sample might be: {GSM: 200, Coating: "GlossCoated", InkType: "UV_Curable", InkViscosity: 30 mPa·s, DPI: 600, PrintMode: "VariableData", QR_Version: 7, QR_ErrorCorrection: "Q", QR_Size: 5 cm, AmbientTemp: 25°C, PrintSpeed: 100 ppm}. All these might be either scaled numerical values or embedded category vectors when fed into the model. If an image of the QR code or a simulated printed patch might be include, that image might also be part of the input. For instance, one could render the QR code (without preprocessing) at a standard resolution and include that matrix as an input image to give the model a visual sense of the code's density and pattern. However, since the QR code's properties are already described by version and size, this image input is optional and the added value might need to justify the complexity.

[0068] Output Labels: The ideal preprocessing parameter values for that scenario. This could be a vector like [noise_sigma, block_size, mean_offset, ...] containing all relevant outputs. For example, for the above input might have labels: {GaussianNoiseSigma: 0.05, BlockSize: 5, IntensityMeanOffset: 10, ...} (just illustrative values). These labels can come from expert annotations or experiments - for example, printing the QR with various settings and choosing the combination that yielded the best scan grade. It's important that these represent the jointly optimal settings for the given scenario.Feature Vector Structure

[0069] In practice, a feature vector or tensor might be constructed for each input. If using a simple MLP / transformer, this could be one long vector concatenating either or more of Scaled continuous features (as floats), One-hot or embeddings outputs for categoricals, one or more Boolean flags (for example, PrintMode might be binary flag for static vs variable if not embedding). In an embodiment, if an image is included, it shall be processed separately and not concatenated directly with the others, but fed to the AI model. Label Formatting

[0070] The output labels may be formatted as either a vector or separate values per task. If a single combined output layer (with multiple neurons) might be used for all parameters, the label can be a single vector of length P (number of parameters). If multiple heads might be used, that might train the model with multiple loss outputs (one per head). Many deep learning frameworks allow multi-output models where you can define multiple loss functions and the total loss is a weighted sum. In our case, since all outputs are numeric and conceptually related, initially weight them equally and use Mean Squared Error (MSE) or Mean Absolute Error (MAE) for each. The dataset should store these label values in a consistent order (For example, always [noise, block_size, mean, ...]).

[0071] It may also be useful to include some derived features or augmentations in the training data:- Interactions explicitly could be included. For example, a feature that is DPI / QR_ModuleSize to represent how many printer dots correspond to one QR module (which impacts how well fine details print).- Another example: an encoded feature for expected print distortion level, if domain experts have a formula or prior knowledge (though ideally the model may learn this).- If actual images of printed QR codes in the dataset (with known outcomes), could include as additional training targets or inputs (though that veers into a different task of vision-based quality prediction).

[0072] According to an embodiment, data covering a wide range of conditions should be gathered covering multiple substrate types (paper, cardstock, plastic films, etc.), different ink formulations, a range of DPI settings, various QR code versions and sizes, etc. The dataset should also ideally include some difficult cases (extreme temperatures or very high-speed printing) so the model learns to handle those edge conditions.Data Volume and Augmentation

[0073] If the dataset is limited, augmentation strategies can be used. Additional training points may be generated through slight perturbations. Categorical diversity can be increased by combining features, ensuring realistic combinations. Transformer-based models may need substantial data to prevent overfitting. Transfer learning from related tasks, such as models trained on related parameters or pretraining on generic data, can be applied if necessary.Training Procedure

[0074] In a preferred embodiment, the model might be train in a supervised learning manner using the prepared dataset. Key aspects of the training procedure include:

[0075] Loss Function: For regression outputs, Mean Squared Error (MSE) is commonly used for each parameter. If parameters have different scales or impacts, normalization or adjustment of weights might be done. An advanced method is uncertainty-based weighting, where the model learns weights based on prediction uncertainty, balancing multi-task learning by preventing tasks with higher noise from dominating. This involves the network outputting an additional variance term for each parameter and adjusting the loss accordingly.

[0076] Optimizer: Modern optimizers like AdamW, which is Adam with weight decay, are effective for training transformers and CNNs. AdamW manages large models by separating weight decay from gradient updates. A low learning rate, typically between 1e-4 to 1e-5, is often used for such models to ensure stable convergence, often with warm-up schedules.

[0077] Training Schedule: Training should continue for enough epochs to ensure convergence, typically tens to hundreds, especially if the dataset isn't very large. Monitor for overfitting; if training loss decreases while validation loss increases, consider early stopping or reducing the learning rate. Techniques like learning rate scheduling, such as cosine or step decay, can aid in converging to a minimum.

[0078] Batch size: Depending on memory and model size, a moderate batch size, such as 32 or 64, can be used. Transformers benefit from larger batches for stability, but since this is offline, experiment with what fits in GPU memory based on the model size.

[0079] Regularization: In addition to multi-task learning as a regularizer, dropout layers in MLPs or attention dropout in transformers can reduce overfitting. Weight decay with AdamW also helps. For very large models relative to data, consider freezing some layers or using gradient clipping.

[0080] Evaluation during training: A validation set can be held out from the training data, or cross-validation can be used, to assess the model's performance on unseen data after each epoch or at intervals. Evaluation involves computing the error for each predicted parameter and possibly an overall score.

[0081] Multi-task training dynamics: Sometimes, one output's error might dominate or conflict with another's in training. An eye should be kept on the losses for each output. If one parameter is much harder to predict (higher loss magnitude), it could slow down learning for others. Techniques to address this include loss weighting (as above) or even multi-stage training (first focus on one set of outputs then fine-tune on others), but ideally, with proper weighting, the joint training should work. Gradient normalization methods might also be used to ensure each task's gradient contributions are balanced.Evaluation and Performance Benchmarking

[0082] According to another embodiment, as a next step, the Anticounterfeit Code Authenticator (106) component authenticates the scanned copy of the printed anticounterfeit code by employing a series of techniques. This component utilizes a cropping technique to precisely crop the unique copy detection pattern (CDP) at a sub-pixel level, which is crucial for detecting counterfeits. FIG. 8 shows a Copy Detection Pattern (CDP) with a unique texture noise pattern, used for the step of authenticating the 2D anticounterfeit code. The CDP shown in FIG. 8 is integral to the authentication of the 2D anticounterfeit code

[0083] FIG. 8 illustrates a block diagram depicting a deep learning pipeline designed for restoring copy detection patterns (CDP) and FIG. 9 illustrates a method for restoring copy detection patterns in the anticounterfeit code authenticator (106) of the system (100), respectively. This method is integral to the system for creating and authenticating 2D anticounterfeit codes. The method involves several components, each contributing to the restoration of the CDP from a degraded scan to a high-fidelity reconstruction.

[0084] According to an embodiment, Copy Detection Patterns (CDPs) are random, fine-textured images (often black-and-white) printed on documents or products through the anticounterfeit code printer (104) of the system (100) for authentication purposes. These patterns are designed such that any attempt to copy or scan-and-reprint them introduces subtle degradations (for example, ink spread, blurring) that can be detected to expose forgery. In a typical counterfeit scenario, a forger does not have access to the original digital pattern; instead they scan the genuine printed pattern and then reprint it to produce a fake. This print-and-scan process (often called the printing-imaging channel) inevitably alters the pattern - for example, increasing dot diffusion, noise, and geometric distortions - making the copied pattern visibly different from the original in fine detail. The goal of CDP restoration is to take such a degraded scanned image and recover a high-fidelity reconstruction of the original digital pattern template. Achieving this is challenging due to the high spatial frequency content of CDPs and the complex distortions introduced by printers and scanners.

[0085] According to an embodiment, restoring a CDP from its scan is valuable both for authentication and for analyzing security. On one hand, a successful restoration can improve authentication by allowing a direct comparison between the recovered pattern and the genuine original (if known). On the other hand, the ability to accurately recover the original pattern from a scan also poses a security risk: it implies the pattern can be cloned or forged. In fact, recent studies have shown that deep learning methods can recover significant portions of the original CDP from a scanned copy, enabling potential clonability attacks. For example, researchers demonstrated that a machine learning model could "accurately estimate digital codes from their printed counterparts" in many cases. These findings highlight both the importance of robust CDP authentication and the need for advanced restoration techniques to understand the limits of CDP security.

[0086] According to an embodiment, the process begins with the step labelled restore the copy detection pattern, which sets the stage for the subsequent operations. A Text Encoder is employed to process any textual prompts that may guide the restoration process. This component provides high-level guidance to the neural network architecture, allowing for potential variations in restoration tasks based on different prompts. The Encoder follows, tasked with extracting features from the input image. This step captures the multi-scale representation of the input CDP scan, ensuring that both low-level details and abstract features are preserved for further processing.

[0087] The extracted features are then processed by a U-Net architecture, which serves as the core of the restoration pipeline. The U-Net is responsible for transforming the encoded representation into a form suitable for reconstruction, utilizing its encoder-decoder structure to address both global distortions and local noise. The architecture incorporates Zero-conv layers and First-Stage Skip Connections to preserve fine details from the input, ensuring that the high-frequency content of the CDP is maintained throughout the process. These components work together to balance the preservation of input details with the necessary transformations for restoration.Encoder: Multi-Scale Image Feature Extraction

[0088] According to an embodiment, the image encoder is the initial stage of the pipeline, tasked with extracting a multi-scale representation of the input CDP scan. It functions as the downsampling path of an autoencoder or U-Net, using convolutional layers to reduce spatial dimensions while increasing feature map depth. This process captures low-level features like edges and dots in early layers and abstract features like texture groupings in deeper layers. For CDP restoration, retaining low-level detail is essential, as the encoder must preserve the precise arrangement of pixels. By creating a multi-scale feature pyramid, the encoder provides the U-Net backbone with features at various resolutions, addressing both global distortions and local noise.

[0089] According to an embodiment, Skip Connections and Zero-Convs: In the encoder-decoder design, certain encoder feature maps are directly forwarded to corresponding decoder layers via skip connections. This allows the decoder to use high-resolution details from the input, crucial for CDPs where pixel-level accuracy is important. A zero-initialized convolution (zero-conv), a $1\times1$ convolution layer with all weights set to zero, is included in each skip connection. Initially, this means no information is passed, preventing the network from merely copying input to output. During training, these layers learn to optimally blend or adjust the features. This technique, used in prior generative models, helps incorporate skip information safely. In this case, zero-conv layers learn how much raw input detail to inject into the decoder, aiding pattern reconstruction without overwhelming the U-Net's corrections. The encoder provides what to preserve and transform, and the network learns the right balance.

[0090] Text Prompt Conditioning and Text Encoder: According to another embodiment, the pipeline can accept an optional text prompt to guide the model's task. For CDP restoration, the prompt might be "restore the copy detection pattern" or left empty if textual guidance isn't needed. The text provides high-level control over the restoration process. While the task is always restoration, the text prompt could toggle different restoration modes, like "enhance contrast" or "full restore" using the same model. Consistent prompts during training, such as "restore the copy detection pattern," serve as a conditioning signal for the model.

[0091] According to another embodiment, the text prompt is processed by a dedicated text encoder, often a pre-trained Transformer-based language encoder like CLIP. The encoder converts the prompt into a latent textual embedding. These text features are integrated into the U-Net backbone via cross-attention, allowing the model to attend to text features alongside image features. This enables the text to influence image feature transformation, similar to how text-to-image models use prompts to guide image generation. In restoration, a prompt like "restore the pattern" might focus the network on fidelity and denoising. If used with different prompts, the cross-attention mechanism could adjust the restoration process accordingly.U-Net Backbone for Image Restoration

[0092] According to an embodiment, the core of the model is a U-Net backbone, a U-shaped neural network architecture effective for image-to-image tasks. A U-Net has two paths: a contracting (encoder) path that downsamples feature maps to capture context, and an expanding (decoder) path that upsamples features to the original resolution to capture detail. The U-Net in the pipeline transforms "degraded pattern" features into "restored pattern" features. It takes the encoded input representation and produces an intermediate representation for the decoder to convert into the output image. This U-Net is responsible for noise removal, distortion correction, and retrieving the original pattern structure from the encoded input.

[0093] Multi-Scale Processing: The U-Net processes the image at multiple scales. As input features move through the encoder, the receptive field expands, allowing the network to analyze larger image contexts. This is crucial for CDP restoration, as it helps identify broader patterns of distortion, such as geometric warps or uneven illumination, on smaller resolution feature maps. At the bottleneck, the network has a global, though coarse, view of the image. In the decoder, features are upsampled and refined. Skip connections provide high-resolution features from the encoder to the decoder, aiding in recovering fine details lost during downsampling.

[0094] Skip Connections for Detail Preservation: Skip connections in the U-Net link the encoder and decoder at matching resolutions, crucial for preserving fine details like the exact positions of black and white dots. Without them, high-frequency details might be lost. U-Nets are known for maintaining input structure, beneficial in tasks like segmentation. Studies show skip connections enhance detail preservation, essential for CDPs with tiny marks.

[0095] According to additional embodiment, each skip connection may include a zero-initialized conv layer, allowing the network to learn the right fusion of encoder and decoder information. Initially, the model may ignore the skip connection, focusing on global restoration. As training progresses, it adjusts the skip contribution to inject accurate micro-structure. This technique, used in T2I-Adapter, helps inject original image features without destabilizing the model.

[0096] Cross-Attention and Fusion in U-Net: This U-Net integrates text prompts using cross-attention layers throughout its blocks. Inspired by Stable Diffusion, cross-attention is applied in the middle and / or each downsampling / upsampling block with a multi-head attention mechanism. Here, image features serve as queries, while text embeddings provide keys and values, allowing image features to reference textual context. For instance, with the prompt "restore the copy detection pattern," cross-attention biases feature transformations towards a clean pattern. This method offers global conditioning, influencing all spatial locations.

[0097] According to alternative embodiment, text conditions can be injected through feature concatenation or AdaIN, but cross-attention is more powerful and commonly used in diffusion models. The text encoder outputs a sequence of token features or a single pooled embedding. Cross-attention typically uses the token sequence to capture semantic nuances, though in this case, the prompt is simple, providing an overall context like "do restoration." This mechanism is included for completeness and future extensibility.

[0098] U-Net Capacity and Layers: The U-Net can be quite large, with hundreds of millions of parameters, typical of diffusion model U-Nets. It includes convolutional and attention layers, self-attention blocks at low resolutions, and feed-forward networks between attention operations, similar to Transformer blocks. The depth allows the lowest feature map to be 1 / 8 or 1 / 16 of the input size, balancing global context and local detail. For example, a 256x256 input might reduce to a 32x32 latent space at the bottleneck. While inspired by generative diffusion models, this U-Net operates deterministically, mapping noisy patterns to clean ones. The text condition and skip connections ensure flexibility and detail preservation.

[0099] According to an embodiment, LoRA Adapters are integrated into the U-Net to enable efficient fine-tuning of the model. These adapters allow the pre-trained model to be adapted to the specific task of CDP restoration with minimal additional parameters, reducing the risk of overfitting and enhancing the model's ability to handle the unique challenges of CDP restoration.

[0100] LoRA Adapters for Efficient Fine-Tuning: According to an embodiment, to specialize the large U-Net for CDP restoration, LoRA (Low-Rank Adaptation) adapters can be used. LoRA allows fine-tuning a pre-trained model with minimal additional parameters by injecting small rank-decomposed weight matrices into each layer. In this context, a pre-trained U-Net and possibly a text encoder are adapted for CDP restoration by inserting small trainable LoRA modules at key points.

[0101] According to an embodiment, LoRA adapters work by introducing two small matrices, $A$ and $B$, into a neural network layer, creating a low-rank update to the original weight $W$. The effective weight becomes $W + \Delta W$, where $\Delta W = A B$. This reduces the number of trainable parameters and conserves memory, achieving fine-tuning performance comparable to full model tuning.

[0102] According to another embodiment, in CDP pipeline, LoRA adapters are integrated into U-Net modules, particularly in attention layers with large weight matrices. They can also be used in convolutional layers to handle binary textures. Initially, LoRA layers are set so $\Delta W = 0$, preserving the pre-trained model's behavior. As training progresses, LoRA layers learn necessary adjustments, reducing overfitting and speeding up fine-tuning.

[0103] According to another embodiment, another benefit of LoRA is that LoRA's modularity allows training multiple adapters for different tasks without separate full models. While the focus is on CDP restoration, LoRA can enable handling other tasks, like image enhancement, with the same base model by swapping adapters.

[0001] Finally, According to another embodiment, the decoder reconstructs the cleaned pattern from the transformed latent representation, ensuring pixel-level accuracy for authentication purposes.Decoder: Reconstructing the Cleaned Pattern

[0104] According to an embodiment, the final stage of the pipeline is the decoder, which reconstructs the full-resolution image from the U-Net's output. If a dedicated image encoder is used initially, the decoder acts as its counterpart. In latent diffusion implementations, the U-Net outputs a latent code, which the decoder transforms into an image. The decoder mirrors the encoder architecture, using transposed convolutions or upsampling layers to restore the original image size, synthesizing pixels while maintaining spatial coherence and detail.

[0105] According to another embodiment, For CDP restoration, the decoder's role is crucial for pixel-accurate reproduction, as errors can alter the pattern's code. The decoder must produce outputs closely matching the ground truth pattern. For binary patterns, a final thresholding or sigmoid output may enforce binary results, though a grayscale output is often used due to scanning noise, with post-processing for binary results if needed.

[0106] According to another embodiment, Skip connections feed into the U-Net's decoder path, but the final decoder stage converts latent to image. In some designs, the U-Net decoder is the final decoder. If using a VAE, the U-Net operates in latent space, and the VAE decoder converts to pixel space. The last network layers ensure the output is in the original resolution and format.

[0107] According to an embodiment, the pipeline may use a pre-trained decoder from models like Stable Diffusion's VAE, capable of generating high-fidelity details from latent codes. Fine-tuning adjusts it to handle CDP patterns better. The decoder must reproduce sharp edges of pattern elements, and the U-Net + decoder architecture, similar to an autoencoder, can achieve pixel-level accuracy. During training, losses imposed on the decoder's output compared to the ground truth drive the entire network to produce accurate reconstructions.

[0108] Training the Model for CDP Restoration: Training the text-conditioned U-Net pipeline for CDP restoration requires a dataset of paired images: each pair includes a degraded input (scanned print of a pattern) and the target output (original digital pattern). This dataset can be created by printing random CDPs, scanning them, and keeping the original digital versions. The model learns to map scanned versions to original ones. Key training considerations include selecting the loss function, deciding which parameters to freeze or train, and applying data augmentations or regularization.

[0109] Loss Functions: For high-fidelity reconstruction, a common loss is pixel-wise Mean Absolute Error (L1 loss) between the output and ground truth, as it preserves sharp edges better than Mean Squared Error (MSE). Hamming distance can be used for binary outputs, though it's non-differentiable unless relaxed to a continuous form. Structural Similarity Index (SSIM) or multi-scale SSIM loss can ensure structural alignment. Given the randomness of CDPs, perceptual losses like VGG-based ones may not be meaningful, so focus on pixel-level fidelity. A contrastive or frequency-domain loss might ensure correct local black / white distribution. However, a well-trained U-Net with L1 loss typically suffices for detail reproduction if the model's capacity is adequate.

[0110] Fine-Tuning Strategy: Starting with a pre-trained model, large portions of the network can initially be frozen. The text encoder remains static, as the meaning of "restore the copy detection pattern" doesn't change. The image encoder and decoder, if using a pre-trained VAE, can also be frozen or lightly fine-tuned, as they handle general compression and decompression. The U-Net is mostly frozen except for the trainable LoRA adapter weights. A few original U-Net parameters, like the first convolution layer and possibly the last, may be unfrozen to better adapt to input and output distributions. This approach, used in image translation research, allows the first layer to adjust to the different statistics of printed pattern scans, while LoRA in deeper layers handles fine adjustments.

[0111] According to an embodiment, the structural design of these components ensures seamless data flow and transformations. The Encoder and U-Net extract and process features, while LoRA Adapters and the Decoder provide adaptability and precision. Text prompts via the Text Encoder add flexibility, allowing for customization of the restoration process based on specific needs.

[0112] Overall, the block diagram in FIG. 8 and FIG. 9 provides a comprehensive overview of the system and method for restoring copy detection patterns in the anticounterfeit code authenticator (106) of the system (100), highlighting the interplay between advanced neural network components and innovative adaptation techniques. This process not only enhances the fidelity of the restored patterns but also contributes to the robust authentication of anticounterfeit codes.

[0113] Referring to FIG. 10, the illustration depicts a Copy Detection Pattern (CDP) characterized by a unique texture noise pattern. This pattern is a component of the anticounterfeit system, which involves a computer-implemented method for restoring a CDP. The pattern is designed to be challenging to replicate accurately, ensuring that any attempt to copy or scan-and-reprint introduces detectable degradations.

[0114] FIG. 11 illustrates a comprehensive process for verifying anticounterfeit codes by comparing printed and digital templates. The figure includes several components: a printed template, a predicted digital template (thresholded), an actual digital template (thresholded), a predicted digital template after applying grid logic, and an anomaly map. These elements are crucial for authenticating the anticounterfeit code by identifying discrepancies between the predicted and actual templates and detecting anomalies.

[0115] In an instance, the printed template represents the physical manifestation of the anticounterfeit code, which is initially scanned and processed. The predicted digital template (thresholded) is generated using advanced image processing techniques, including deep learning models that predict the digital equivalent of the printed code. This predicted template is then compared to the actual digital template (thresholded), which serves as the reference or original digital version of the code. The thresholding process ensures that both templates are in a binary format, facilitating a direct comparison.

[0116] In an instance, the predicted digital template after applying grid logic is an enhanced version where grid logic is used to refine the prediction. This step involves dividing the template into smaller grids and applying specific rules to improve accuracy, such as treating a grid as black if at least 50% of it is black. This refinement ensures that the predicted template closely matches the actual digital template.

[0117] Finally, the anomaly map highlights areas of discrepancy between the predicted and actual templates. It is generated by comparing the two templates and identifying regions where they differ, indicating potential counterfeiting attempts. The anomaly map is a tool for detecting and flagging counterfeit codes, as it visually represents the differences that may not be immediately apparent in the raw templates.

[0118] It should be apparent to those skilled in the art that many more modifications besides those already described are possible without departing from the inventive concepts herein. The inventive subject matter, therefore, is not to be restricted. Moreover, in interpreting both the specification and the claims, all terms should be interpreted in the broadest possible manner consistent with the context. While embodiments of the present disclosure have been illustrated and described, it may be clear that the disclosure is not limited to these embodiments only. Numerous modifications, changes, variations, substitutions, and equivalents may be apparent to those skilled in the art, without departing from the scope of the disclosure, as described in the claims.

Claims

1. A system (100) for creating and authenticating a 2D anticounterfeit code, comprising method (200) of: generating (202) a secure anticounterfeit code by an anticounterfeit code generator (102), wherein generating the secure anticounterfeit code comprises integrating a QR code with a unique texture noise pattern, a copy detection pattern (CDP), and optionally comprising an ArUco mark, anticounterfeit shapes, and UV ink patterns; printing (204) the anticounterfeit code by an anticounterfeit code printer (104), wherein printing the anticounterfeit code comprises producing a physical code and removing defective codes using a fast validation technique; and authenticating (206) a scanned copy of printed anticounterfeit code by an anticounterfeit code authenticator (106), wherein authenticating the anticounterfeit code comprises detecting the QR code and ArUco mark using deep learning-based techniques for cropping the CDP at a sub-pixel level, rejecting blur frames using a deep learning-based blur detection technique, reconstructing a digital prediction using an image-to-image translation technique, and comparing the digital prediction with an original template using a threshold-based anomaly detection technique.

2. The step of creating the 2D anticounterfeit code as claimed in claim 1, further comprising a computer-implemented method (700) for predicting optimal preprocessing parameters for QR code generation, comprising: Receiving (702), by an automated data-driven solution, input factors Comprising (704) material, ink, printer settings, QR code design, and environment data; Capturing (706), by a deep learning model, complex relationships between the input factors and ideal preprocessing parameters needed to compensate for print distortions; Predicting (708), by a multi-input, multi-output deep learning architecture, all relevant preprocessing parameters for diverse printing features by jointly learning from the input factors; Treating (710), by the deep learning model, the prediction as a multi-task regression problem; Estimating (712), by the deep learning model, each output parameter simultaneously while learning interdependencies and capturing correlations between the output parameters; and Transforming (714) categorical features, normalizing numerical features, and representing structured data in a suitable format for the deep learning model.

3. The method (700) of claim 2, wherein the input factors further comprise at least one of coating type, error correction level, printing speed, and paper quality.

4. The method (700) of claim 2, wherein the ideal preprocessing parameters comprise at least one of noise level, block size, and mean value.

5. The method (700) of claim 2, wherein the diverse printing features comprise at least one of inkjet printing, laser printing, and thermal printing.

6. The method (700) of claim 2, wherein the deep learning model comprises at least one of a convolutional neural network, a recurrent neural network, and a transformer-based architecture.

7. The method (700) of claim 2, wherein the categorical features are transformed using at least one of embeddings or one-hot encoding.

8. The step of authenticating the 2D anticounterfeit code as claimed in claim 1, further comprising a computer-implemented method (900) for restoring a copy detection pattern (CDP), comprising: Receiving (902) a degraded CDP scan; processing (904) the degraded CDP scan using a CDP restoration pipeline, wherein the CDP restoration pipeline comprises a neural network architecture with an encoder, a U-Net backbone, and a decoder, and wherein the neural network architecture is augmented with Low-Rank Adaptation (LoRA) adapters; compressing (906) the degraded CDP scan into a latent representation using the encoder; transforming (908) the latent representation using the U-Net backbone with skip connections and cross-attention conditioning; reconstructing (910) a restored CDP image from the transformed latent representation using the decoder, wherein the restored CDP image closely matches an original digital pattern of the CDP by preserving fine-grained random texture and binary contrast while correcting noise and distortion; and outputting the restored CDP image.

9. The computer-implemented method (900) of claim 8, wherein the neural network architecture further comprises a text encoder configured to process an optional text prompt into text embeddings, and wherein the text embeddings are injected into the U-Net backbone through cross-attention layers to provide high-level guidance to the neural network architecture.

10. The computer-implemented method (900) of claim 9, wherein the optional text prompt is received as an input to the CDP restoration pipeline.

11. The computer-implemented method (900) of claim 9, wherein the text embeddings provide high-level guidance to the neural network architecture for restoring the degraded CDP scan.

12. The computer-implemented method (900) of claim 8, wherein the LoRA adapters allow the neural network architecture to be fine-tuned for CDP restoration with a reduced number of additional parameters compared to fine-tuning the entire neural network architecture.

13. The computer-implemented method (900) of claim 8, wherein the skip connections pass features from early encoding layers of the encoder to corresponding decoding layers of the decoder, ensuring that fine details from the degraded CDP scan are preserved in the restored CDP image.