Copyright protection method and system for handwritten font image synthesis and storage medium

By embedding hash keys in handwritten font images and combining a hybrid architecture with Transformer and CNN structures, the robustness of copyright protection of handwritten font images in the prior art is solved, and copyright verification and source traceability under JPEG compression and attack are realized to prevent unauthorized use.

CN120509011APending Publication Date: 2025-08-19JINAN UNIVERSITY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510618267.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In the face of JPEG compression and other attacks, the copyright protection of handwritten font images is insufficient, and it is difficult to achieve a good balance between concealment and robustness, and there is a risk of unauthorized abuse.

Method used

The font migration network and watermark embedding network are adopted, combined with Transformer and CNN structures, and the source and authenticity of handwritten font images are generated and verified by hash key embedding and extraction, and a comprehensive loss function is designed for training to improve robustness.

Benefits of technology

Maintain the integrity and traceability of copyright information in the face of JPEG compression and other attacks, prevent unauthorized use, and ensure the robustness of image quality and copyright protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120509011A_ABST
    Figure CN120509011A_ABST
Patent Text Reader

Abstract

The invention discloses a copyright protection method and system for handwritten font image synthesis, and a storage medium. The method comprises the following steps: S1, obtaining a reference font image; s2, embedding the hash key into the reference font image through a font migration network to generate a target font image; and S3, extracting the embedded Hash key from the target font image through the extraction network, comparing the Hash key with the original Hash key, and verifying the source and authenticity of the image. By adopting the technical scheme provided by the invention, the problem of robustness in the face of JPEG compression and other common attacks is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of copyright protection, and in particular relates to a copyright protection method and system for handwritten font image synthesis, and a storage medium. Background Art

[0002] With the development of deep learning and style transfer techniques, font transfer and text image generation technologies are becoming increasingly mature. Using a small number of samples, unique font features can be modeled and realistic handwritten text images can be synthesized. However, this advancement also carries the risk of misuse, such as electronic signature forgery and text content tampering, which can lead to serious social problems. Therefore, verifying the source and authenticity of handwritten text has become particularly important.

[0003] While some existing methods based on information hiding have been used to protect font copyrights, these methods often exhibit poor robustness against complex attacks (such as JPEG compression and noise interference). Furthermore, existing watermark embedding techniques can significantly impact image quality during the embedding process, making it difficult to strike a good balance between stealth and robustness. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a copyright protection method and system and storage medium for handwritten font image synthesis to solve the problem of robustness in the face of JPEG compression and other common attacks; by embedding binary copyright information in the generated handwritten font image, a means of verifying the source and authenticity of the image is provided to prevent unauthorized abuse and secondary modification.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] A copyright protection method for handwritten font image synthesis, comprising:

[0007] Step S1, obtaining a reference font image;

[0008] Step S2: embedding the hash key into the reference font image through the font transfer network and the watermark embedding network to generate the target font image; wherein the font transfer network is based on the HWT architecture and adopts an encoder-decoder structure; both the encoder and decoder combine the Transformer and CNN structures;

[0009] Step S3: Extract the embedded hash key from the target font image through the watermark extraction network and compare it with the original hash key to verify the source and authenticity of the image.

[0010] Preferably, in step S2, a 512-bit binary key is obtained, and the binary key is converted through a one-way hash network to generate a 128-bit hash key; wherein the hash network consists of a fully connected layer and a Sigmoid activation layer.

[0011] Preferably, in step S2, the hash key is modulated and copied to generate a key matrix; wherein the modulation function maps each bit of the hash key to a floating point number, that is,

[0012] k=mean(|zf|)×(m-0.5+0.5×rand(-δ,δ))

[0013] Among them, δ is a hyperparameter that controls the amplitude of random perturbations.

[0014] Preferably, the reference font image is firstly subjected to feature extraction through a CNN encoder, and then the font style features are obtained through a Transformer encoder. The key matrix is added to the extracted font style features through a watermark embedding network to generate encrypted font style features. The decoder performs cross-attention processing through a Transformer decoder based on the encrypted font features and the target text content, and at the same time adds random noise to the features, and performs upsampling operations through a CNN decoder to generate a target font image.

[0015] Preferably, the watermark embedding network receives the features of the reference font image and a hash key as input, generates a key matrix through a modulation and replication process, fuses the key matrix with the font features to generate encrypted font features; injects random noise into the fused features, and finally passes the features injected with random noise to a decoder to generate a target font image.

[0016] Preferably, the watermark extraction network receives the generated target font image as input, extracts the features of the image through a convolutional layer, then maps the features to a vector space of the same dimension as the hash key using a fully connected layer and an activation function, and finally outputs the extracted hash key.

[0017] The present invention also provides a copyright protection system for handwritten font image synthesis, comprising:

[0018] A first processing module is used to obtain a reference font image;

[0019] The second processing module is used to embed the hash key into the reference font image through the font transfer network and watermark embedding network to generate the target font image. The font transfer network is based on the HWT architecture and adopts an encoder-decoder structure. Both the encoder and decoder combine the Transformer and CNN structures.

[0020] The third processing module is used to extract the embedded hash key from the target font image through the watermark extraction network and compare it with the original hash key to verify the source and authenticity of the image.

[0021] The present invention also provides a storage medium, on which a computer program is stored. When the computer program is run, the copyright protection method for handwritten font image synthesis is executed.

[0022] The present invention has the following technical effects:

[0023] 1. Through key embedding and robustness training, the present invention can maintain the integrity and traceability of copyright information in the face of common attacks such as JPEG compression and noise interference, thereby improving the robustness of copyright protection.

[0024] 2. Combining the hybrid architecture of Transformer and CNN, it can maintain high-quality font migration while embedding copyright information.

[0025] 3. Through the key verification mechanism, ensure that only authorized users can use the font migration function to prevent unauthorized use. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0027] Figure 1 This is a flow chart of a copyright protection method for handwritten font image synthesis according to an embodiment of the present invention. DETAILED DESCRIPTION

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

[0029] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0030] Example 1:

[0031] like Figure 1As shown, an embodiment of the present invention provides a copyright protection method for handwritten font image synthesis, comprising:

[0032] Step S1, obtaining a reference font image;

[0033] Step S2: embedding the hash key into the reference font image through the font transfer network and the watermark embedding network to generate the target font image; wherein the font transfer network is based on the HWT architecture and adopts an encoder-decoder structure; both the encoder and decoder combine the Transformer and CNN structures;

[0034] Step S3: Extract the embedded hash key from the target font image through the watermark extraction network and compare it with the original hash key to verify the source and authenticity of the image.

[0035] As an implementation method of an embodiment of the present invention, in step S2, a 512-bit binary key is obtained, and the binary key is converted through a one-way hash network to generate a 128-bit hash key; wherein the hash network is composed of a fully connected layer and a Sigmoid activation layer.

[0036] As an implementation method of an embodiment of the present invention, in step S2, the hash key is modulated and copied to generate a key matrix; wherein the modulation function maps each bit of the hash key to a floating point number, that is,

[0037] k=mean(|zf|)×(m-0.5+0.5×rand(-δ,δ))

[0038] Among them, δ is a hyperparameter that controls the amplitude of random perturbations.

[0039] As an implementation method of an embodiment of the present invention, the reference font image is first subjected to feature extraction through a CNN encoder, and then the font style features are obtained through a Transformer encoder. The key matrix is added to the extracted font style features through a watermark embedding network to generate encrypted font style features. The decoder performs cross-attention processing through a Transformer decoder based on the encrypted font features and the target text content, and at the same time adds random noise to the features, and performs upsampling operations through a CNN decoder to generate a target font image.

[0040] As an implementation method of an embodiment of the present invention, the watermark embedding network receives the features of the reference font image and the hash key as input, generates a key matrix through a modulation and replication process, fuses the key matrix with the font features to generate encrypted font features; injects random noise into the fused features, and finally passes the features injected with random noise to the decoder to generate the target font image. The entire embedding process ensures that the hash key can be seamlessly embedded in the image without affecting the quality of the font migration.

[0041] As one implementation of an embodiment of the present invention, a watermark extraction network receives a generated target font image as input, extracts features from the image through a convolutional layer, then uses a fully connected layer and activation function to map the features to a vector space of the same dimension as the hash key, ultimately outputting the extracted hash key. The design goal of the watermark extraction network is to minimize the difference between the extracted hash key and the original hash key, ensuring that the embedded copyright information can be accurately recovered even in the face of various attacks. In this way, the extraction network provides a reliable means for copyright verification and source tracing.

[0042] To enhance the robustness of the embedded key, the network training process is divided into two phases. The first phase focuses on training the font transfer network to ensure the stability of image generation. The second phase introduces a perturbation layer to simulate attacks that may be encountered in real-world applications, such as cropping attacks, Gaussian noise, JPEG compression, rotation attacks, random cropping, and simulated photography attacks. Through training with these perturbation layers, the model learns how to maintain the integrity and extractability of key information in the face of these attacks.

[0043] As an implementation method of the present invention, the present invention designs a total loss function to balance the quality of font migration, the embedding effect of copyright information, and the accuracy of watermark extraction. The total loss function consists of the following parts:

[0044] (1) Font migration loss L font

[0045] The loss ensures that the generated font image is both realistic and in line with the target style while keeping the text content legible. It is composed of the adversarial loss L adv , style classification loss L cls and character recognition loss L ocr composition:

[0046] L font =L adv +L cls +L ocr

[0047] Adversarial loss L advHinge loss is used to train the generator to generate realistic images. It only penalizes the situation where the predicted value and the label value do not meet a certain distance. This alleviates the problem of gradient vanishing, helps improve the stability of GAN training, and also makes the discriminator give extreme scores for some difficult-to-distinguish samples, forcing the generator to generate more realistic images. The expression is:

[0048]

[0049] Where D represents the discriminator, G θ represents the font synthesis network, and I fs Represents the reference font image, I t Indicates the target text of the input.

[0050] Style classification loss L cls To ensure that the generated image is consistent with the reference style, a multi-classifier is defined that can classify the input text image into a font style category in the training dataset. In order to make the synthesized text image visually retain the font style of the reference image, this solution uses cross entropy loss to calculate the style classifier output of the two:

[0051]

[0052] Character recognition loss L ocr Ensure the readability of the text content. This solution uses the connection temporal classification loss (CTCLoss) to calculate the loss between the recognized text and the target text. The expression is:

[0053]

[0054] (2) Key embedding loss L key

[0055] This scheme uses a key-based activation mechanism to ensure that the model can only run correctly when the correct encryption key is provided. When the wrong key is input, we use the inverse of the classification loss to control the image generation process. It ensures that without the correct key, the generated image deviates significantly from the expected style, making it unusable for unauthorized purposes. For authorized users with the correct key, this mechanism helps maintain a high level of focus on the reference font style. The loss is defined as:

[0056]

[0057] Among them, S η is a style classifier that verifies whether the embedded key is consistent with the target style. w Incorrect key.

[0058] (3) Watermark extraction loss Lext

[0059] This loss ensures that the hash key extracted from the generated font image is as close as possible to the original hash key, thereby verifying the accuracy and robustness of the watermark:

[0060] L ext =||k M -E(I t )||2

[0061] Among them, k M is the original hash key and E is the extraction network.

[0062] By minimizing the total loss function Loss = L font +L key +L ext During the training process, the model optimizes the generator, discriminator, and extraction networks to achieve high-quality font migration and effective copyright protection. This design ensures that the model can effectively embed and extract copyright information while generating high-quality font images, thereby achieving the goals of copyright protection and source tracing.

[0063] 1. This invention ensures key security and irreversibility by embedding a 512-bit binary key and converting it into a 128-bit hash key through a one-way hash network. This mechanism not only protects the security of the original key but also, by embedding the hash key into the generated font image, verifies the image's origin and authenticity without compromising image quality.

[0064] 2. This paper utilizes a hybrid architecture combining Transformers and CNNs to achieve font transfer and copyright information embedding. The Transformer architecture captures the global characteristics and long-range dependencies of font styles, while the CNN architecture extracts local font features. This hybrid architecture not only effectively embeds copyright information while maintaining high-quality font transfer, but also achieves higher generation quality and robustness by combining the strengths of both architectures.

[0065] 3. This invention generates a key matrix through a modulation and replication process, mapping the input binary key to a floating-point matrix, enhancing the robustness and effectiveness of the key. The modulation function introduces random perturbations, further improving key security while ensuring effective integration of the key with font features, thereby achieving copyright protection without compromising font migration quality.

[0066] 4. This invention uses an extraction network to extract the embedded hash key from the generated font image and compare it with the original hash key to verify the image's origin and authenticity. The extraction network is jointly trained with the font transfer network to ensure accurate extraction of the embedded hash key, providing a reliable verification method for copyright protection and source tracing.

[0067] 5. This paper designs a comprehensive loss function, comprising an adversarial loss, a style classification loss, a character recognition loss, and an extraction loss. The combination of these loss functions ensures the quality of font transfer, the effective embedding of copyright information, and the accurate extraction of hash keys. By optimizing these loss functions, the model can generate high-quality font images while ensuring the security and traceability of copyright information.

[0068] Example 2:

[0069] The embodiment of the present invention also provides a copyright protection system for handwritten font image synthesis, comprising:

[0070] A first processing module is used to obtain a reference font image;

[0071] The second processing module is used to embed the hash key into the reference font image through the font transfer network and watermark embedding network to generate the target font image. The font transfer network is based on the HWT architecture and adopts an encoder-decoder structure. Both the encoder and decoder combine the Transformer and CNN structures.

[0072] The third processing module is used to extract the embedded hash key from the target font image through the watermark extraction network and compare it with the original hash key to verify the source and authenticity of the image.

[0073] Example 3:

[0074] The present invention also provides a storage medium, on which a computer program is stored. When the computer program is run, the copyright protection method for handwritten font image synthesis is executed.

[0075] The embodiments described above are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by persons skilled in the art should fall within the scope of protection defined by the claims of the present invention.

Claims

1. A copyright protection method for handwritten font image synthesis, characterized in that: include; Step S1, obtaining a reference font image; Step S2: embedding the hash key into the reference font image through the font transfer network and the watermark embedding network to generate the target font image; wherein the font transfer network is based on the HWT architecture and adopts an encoder-decoder structure; both the encoder and decoder combine the Transformer and CNN structures; Step S3: Extract the embedded hash key from the target font image through the watermark extraction network and compare it with the original hash key to verify the source and authenticity of the image.

2. The copyright protection method for handwritten font image synthesis according to claim 1, characterized in that: In step S2, a 512-bit binary key is obtained, and the binary key is converted through a one-way hash network to generate a 128-bit hash key; wherein the hash network is composed of a fully connected layer and a Sigmoid activation layer.

3. The copyright protection method for handwritten font image synthesis according to claim 2, wherein: In step S2, the hash key is modulated and copied to generate a key matrix; wherein the modulation function maps each bit of the hash key to a floating point number, that is, k=mean(|zf|)×(m-0.5+0.5×rand(-δ,δ)) Among them, δ is a hyperparameter that controls the amplitude of random perturbations.

4. The copyright protection method for handwritten font image synthesis according to claim 3, wherein: The reference font image is firstly extracted with a CNN encoder, and then the font style features are obtained with a Transformer encoder. The key matrix is added to the font style features through a watermark embedding network to generate encrypted font style features. The decoder performs cross-attention processing through the Transformer decoder based on the encrypted font features and target text content, adds random noise to the features, and performs upsampling operations through the CNN decoder to generate the target font image.

5. The copyright protection method for handwritten font image synthesis according to claim 4, wherein: The watermark embedding network receives the features of the reference font image and the hash key as input, generates a key matrix through a modulation and replication process, fuses the key matrix with the font features to generate encrypted font features; injects random noise into the fused features, and finally passes the features injected with random noise to the decoder to generate the target font image.

6. The copyright protection method for handwritten font image synthesis according to claim 5, wherein: The watermark extraction network receives the generated target font image as input, extracts the features of the image through the convolution layer, and then uses the fully connected layer and activation function to map the features to a vector space with the same dimension as the hash key, and finally outputs the extracted hash key.

7. A copyright protection system for handwritten font image synthesis, characterized in that: include; A first processing module is used to obtain a reference font image; The second processing module is used to embed the hash key into the reference font image through the font transfer network and watermark embedding network to generate the target font image. The font transfer network is based on the HWT architecture and adopts an encoder-decoder structure. Both the encoder and decoder combine the Transformer and CNN structures. The third processing module is used to extract the embedded hash key from the target font image through the watermark extraction network and compare it with the original hash key to verify the source and authenticity of the image.

8. A storage medium, characterized in that: The storage medium stores a computer program, which, when running, executes the copyright protection method for handwritten font image synthesis according to any one of claims 1 to 6.