Chinese character font generation method and system based on four-corner coding

By combining four-corner encoding and generative adversarial networks and optimizing the training process of the generator and discriminator, the structural accuracy and style consistency problems of Chinese character font generation in the existing technology are solved, and higher-quality Chinese character image generation is achieved.

CN120597839AInactive Publication Date: 2025-09-05WUHAN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511108445.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-09-05
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing Chinese font generation methods lack structural accuracy and poor style consistency when generating Chinese character images, especially when processing complex glyphs, they cannot effectively maintain the structural consistency and detail accuracy of Chinese characters.

Method used

Combining four-corner encoding with generative adversarial networks, the four-corner consistency loss function is used to optimize the training process of the generator and discriminator to ensure the consistency of the generated Chinese character images in structure and style.

Benefits of technology

The structural consistency and style consistency of the generated Chinese character images are improved, and the generated Chinese character images are more realistic and accurate, and can effectively perform font migration under asymmetric data conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120597839A_ABST
    Figure CN120597839A_ABST
Patent Text Reader

Abstract

The invention discloses a Chinese character font generation method and system based on four-corner coding, and relates to the technical field of Chinese character generation, and the method comprises the steps: combining four-corner coding with a generative adversarial network and a four-corner consistency loss function, and generating a Chinese character font through a training set composed of a source font and a target font. The method can better adapt to various fonts, and the accuracy of the generated structure is improved; by introducing the four-corner coding information based on the traditional four-corner number system, a generator is helped to better understand the structure details of the fonts, so that the generated fonts have high accuracy in the aspects of the overall structure and strokes, and the generation quality of the fonts is further optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Chinese character generation, and in particular to a method and system for generating Chinese character fonts based on four-corner coding. Background Art

[0002] As an important cultural heritage of human civilization, Chinese characters not only carry profound historical and cultural value, but also embody the uniqueness and artistry of the Chinese language. With the rapid development of digital technology, the demand for diversified and personalized Chinese fonts continues to grow. The application prospects of Chinese font generation technology are becoming increasingly broad, especially in areas such as font style transfer and personalized writing design.

[0003] However, traditional Chinese font generation methods usually rely on rule-defined stroke decomposition and reorganization. Although they can generate Chinese character images to a certain extent, such methods are prone to incoherent glyph structures, inaccurate stroke order, and loss of details. Especially when dealing with complex glyphs, they often cannot effectively maintain the structural consistency of Chinese characters.

[0004] With the development of deep learning technology, especially the emergence of generative adversarial networks (GANs) and their variants (such as CycleGAN), Chinese character font generation technology has made significant progress in the field of image generation. Through "generative-discriminative" adversarial training, GANs can generate visually similar Chinese character images and perform style transfer and image synthesis.

[0005] However, while existing generative models can visually mimic the appearance of the target font when generating Chinese character images, they still face the following major issues: 1. Insufficient structural accuracy: Due to the complex structure of Chinese characters, existing generative models often fail to effectively model the stroke structure of Chinese characters, resulting in ambiguous or inaccurate generated glyphs, especially problems with stroke connection. 2. Poor style consistency: Although current models can generate visually similar target font images, they still lack style consistency when switching between different font styles, especially in terms of font detail and sophistication, and cannot guarantee that the uniqueness of the target font is effectively reproduced. Summary of the Invention

[0006] In order to solve the above problems, the purpose of the present invention is to provide a Chinese character font generation technology combined with four-corner coding. By combining four-corner coding with a generative adversarial network, it aims to effectively improve the structural accuracy and style consistency in the Chinese character font generation process, thereby generating more realistic and accurate Chinese character images.

[0007] In order to achieve the above technical objectives, the present application provides a method for generating Chinese character fonts based on four-corner encoding, comprising the following steps: By combining four-corner encoding with generative adversarial networks and four-corner consistency loss function, Chinese fonts are generated using a training set consisting of source and target fonts.

[0008] Preferably, when generating Chinese character fonts, in the discriminator, the four-corner coding information is used to influence the output effect of the generator and the judgment result of the discriminator.

[0009] Preferably, when using the four-corner code, the four-foot numbers are encoded by a one-hot encoding method to generate the four-corner code, wherein the four-corner code consists of five digits, representing the structural characteristics of the Chinese character, the first four digits representing the codes of the four areas, and the fifth digit representing the additional angle or number.

[0010] Preferably, when using the four-corner code, the Unicode code in the image file name is used to make a one-to-one correspondence between the Chinese character image and the four-corner code, thereby achieving association between the four-corner code and the image.

[0011] Preferably, when using a generative adversarial network, a generator is composed of multiple convolution blocks, residual blocks and deconvolution blocks, and the source domain image is converted into the target domain image through multi-level transformation of the image using the generator.

[0012] Preferably, when using a generative adversarial network, the discriminator uses multiple convolution blocks to extract features of the input image, makes true or false judgments through the fully connected layer, and provides feedback to the generator.

[0013] Preferably, when using the four-corner consistency loss function, the four-corner consistency loss function is used to ensure that the generated image does not deviate from the structural features of the original image during style conversion.

[0014] Preferably, when using the training set for model training, on the basis of the four-corner encoding consistency loss, the accuracy of the generator in generating Chinese character fonts is ensured by introducing cycle consistency loss, identity loss and adversarial loss.

[0015] Preferably, when generating a Chinese character font, the generator converts the source font into the target font, or converts the target font into the source font.

[0016] The present invention discloses a Chinese character font generation system based on four-corner coding, which is used to implement the above-mentioned Chinese character font generation method based on four-corner coding, and is characterized in that the system includes: A data acquisition module, used for acquiring a training set consisting of source fonts and target fonts; The Chinese character generation module is used to generate Chinese character fonts using the training set by combining four-corner encoding with generative adversarial networks and four-corner consistency loss functions.

[0017] The present invention discloses the following technical effects: 1. Improve the structural consistency of generated Chinese characters: By combining four-corner encoding, the generated Chinese character images can better follow the structural characteristics of the source font, avoiding the structural inconsistency problems common in traditional methods.

[0018] 2. Enhanced style consistency: The application of the four-corner consistency loss function not only ensures structural consistency, but also effectively improves the consistency of the style transfer process, ensuring that the generated image details are more complete.

[0019] 3. Efficient training without paired samples: Combined with CycleGAN's unpaired training method, it reduces the dependence on paired data, making this method able to effectively perform font migration even in the case of data asymmetry.

[0020] 4. Accurate generation results: After integrating the four-corner coding prediction module into the discriminator, the generator output receives more accurate feedback, ensuring that the generated Chinese character images have high quality in terms of stroke consistency, structure, and style. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] 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. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 This is a workflow diagram of the method for generating Chinese character fonts based on four-corner coding according to the present invention; Figure 2 This is a schematic diagram of the structure of the Chinese character font generation method based on four-corner coding according to the present invention; Figure 3 A comparison diagram of the blackbody generation effects of the model of the present invention and the basic model; Figure 4 A comparison chart of the official script generation effects of the model of the present invention and the basic model; Figure 5 This is a comparison chart of the handwriting generation effects of the model described in the present invention and the basic model. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this application.

[0024] like Figure 1-Figure 5 As shown, the present invention provides a Chinese character font generation technology based on four-corner encoding, which greatly improves the quality and consistency of generated images. It has broad application prospects in the fields of style transfer, personalized writing design, and artistic creation, and specifically includes the following contents: Reference Attachment Figure 1 FIG. 1 is a flowchart of a method for generating Chinese character fonts based on four-corner coding according to the present invention, comprising the following steps: Step 1: Construct source and target font training sets: First, construct a training set containing a variety of font styles, including source fonts (Songti) and target fonts (Bold, Lishu, etc.). The dataset should cover a wide range of Chinese character morphology and stroke characteristics to ensure that the differences between different font styles can be fully learned. Each font image must be preprocessed to ensure a consistent size (128×128×3) and normalized.

[0025] Step 2: Generate four-corner codes and integrate them with the corresponding image data: Using the Unicode encoding of Chinese characters, we can name each character image and extract its corresponding four-corner code. By encoding the stroke order and positional features of a character, the four-corner code effectively captures the character's structural information. The generated four-corner code is then combined with the corresponding character image data and provided as auxiliary input to the font style transfer network. In this way, the four-corner code not only provides structural guidance for the character but also helps the generator more accurately reconstruct the structure of the source font.

[0026] Step 3: Integrate the four-corner coding prediction module into the discriminator: The discriminator integrates a four-corner code prediction module to further guide the generator's output by predicting the four-corner codes of the generated image. Specifically, the discriminator not only evaluates the authenticity of the generated image but also predicts the four-corner codes of the image to ensure that the generated image conforms to the structural characteristics of the source font. This process helps the generator optimize the generated results through feedback from the discriminator, improving the structural accuracy of the generated image.

[0027] Step 4: Design and apply the four-corner consistency loss function and optimize the training process: In this step, we first design and apply a four-corner consistency loss function to ensure that the generated Chinese character image is structurally consistent with the source font and stylistically consistent with the target font. This loss function helps the model more accurately capture the structural characteristics of Chinese characters by measuring the difference in four-corner encoding between the generated image and the source font. Specifically, the loss function combines generative adversarial loss, cycle consistency loss, and identity loss, so that the generated image strictly adheres to the structural requirements of the source font while performing style conversion, thereby improving the structural consistency of the generated image. The specific formula is as follows: During the training process of the generator and discriminator, multiple loss functions such as generative adversarial loss, cycle consistency loss, and identity loss are combined for optimization. The formula is as follows: in, To generate adversarial loss, is the cycle consistency loss, For identity loss, is the four-corner consistency loss, , , , is the weight coefficient of each loss item.

[0028] The four-corner consistency loss maintains the structural consistency of Chinese characters by guiding the generator in the generation process and the discriminator in the discrimination process.

[0029] Four-corner consistency loss in the generator: in, and are the generators of source and target fonts respectively, and The image output by the generator; and It is the discriminator of source font and target font; and are the four-corner encodings of the source font and the target font respectively; the mean square error (MSE) is used to measure the structural difference between the generated image and the target image, Ex represents the maximum likelihood estimate in the x domain, E y represents the maximum likelihood estimate in the y domain.

[0030] Four-corner consistency loss in the discriminator: in, and is the discriminator of source font and target font; and The image output by the generator; and is the four-corner encoding of the source font and the target font; the mean square error (MSE) is used to measure the structural difference between the generated image and the real image.

[0031] To further optimize the training process, label smoothing techniques are used to avoid excessive competition between the generator and discriminator, thereby improving training stability. Furthermore, different learning rates are set for the generator and discriminator to ensure a balanced training process and avoid vanishing gradients or overfitting. This series of optimization measures effectively improves the network's generation performance, ensuring that the model generates high-quality and structurally consistent Chinese character images.

[0032] Step 5: Use the optimized model to generate Chinese fonts: The optimized and trained model is then used in the actual task of generating Chinese fonts. During this process, the network generates high-quality images of the target font based on the input source font image and its corresponding four-corner encoding. By combining four-corner consistency loss, generative adversarial loss, and cycle consistency loss, the generated Chinese character images are not only structurally consistent with the target font, but also naturally transfer in style. Ultimately, the model can output Chinese character images with accurate structure and consistent style, meeting the needs of font style transfer and personalized handwriting design.

[0033] Through this optimization process, the quality of the generated image is improved, and it maintains high consistency with the structure of the source font. The style transfer is also smoother and has high application value.

[0034] Reference Attachment Figure 2 FIG. 1 is a network structure diagram of the Chinese character font generation method based on four-corner coding according to the present invention.

[0035] The four-corner code generation method of the present invention is composed of the following key modules: First, the extraction of four-corner numbers to four-corner codes: The four-corner code is an identifier for a Chinese character, usually consisting of five digits, representing the structural characteristics of the Chinese character. The first four digits represent the codes for four regions, and the fifth digit represents an additional corner or symbol. Each Chinese character corresponds to a unique four-corner code. To convert the four-corner code into a feature vector that can be input into the model, we use one-hot encoding to convert the four-corner code into a four-corner encoding or , respectively representing the structural information of the source domain x and the target domain y. The four-corner encoding is a 50-dimensional vector representing the structural characteristics of the Chinese character

[0036] Second, the matching of Unicode encoding and images Each Chinese character has a unique encoding in the Unicode standard, usually represented as a string. By using the Unicode encoding in the image file name, we can map the Chinese character images to the four-corner encodings one by one

[0037] Third, input data into the generator The generator consists of multiple convolutional blocks, residual blocks, and deconvolutional blocks. It extracts image features through convolutional layers, captures complex image details with residual blocks, and restores the image to the target style using deconvolutional blocks. Finally, through multi-level transformation of the image, the generator converts the source domain image into the target domain image

[0038] Generator : responsible for converting the Chinese character image in the source domain (e.g., Song typeface) into the style of the target domain (e.g., Bold typeface). The input data includes the source domain image and the source domain four-corner encoding . Input: source domain image and the source domain four-corner encoding . Output: the generated target domain image (e.g., converting the Song typeface "花" to the Bold typeface "花").

[0039] Generator : responsible for converting the Chinese character image in the target domain (e.g., Bold typeface) into the style of the source domain (e.g., Song typeface). The input data includes the target domain image and the target domain four-corner encoding . Input: target domain image and the target domain four-corner encoding . Output: the generated source domain image (converting the Bold typeface "朵" to the Song typeface "朵").

[0040] Fourth, the discriminator's evaluation of the generated images The discriminator extracts features from the input image through multiple convolutional blocks and makes a true or false judgment through a fully connected layer. The discriminator's goal is to distinguish between generated images and real images and provide feedback to the generator.

[0041] Discriminator and Responsible for evaluating the authenticity of generated images: Discriminator :Judge the generated image Is it a real Songti image? :Judge the generated image Whether it is a true blackbody image.

[0042] Four-corner encoding consistency loss: The discriminator not only evaluates the authenticity of the generated image, but also predicts the four-corner encoding of the generated image and compares it with the four-corner encoding of the original image.

[0043] For the generator , the discriminator predicts the generated image Four-corner encoding and the source image Four-corner code Make a comparison.

[0044] For the generator , the discriminator predicts the generated image Four-corner encoding and the target image Four-corner code Make a comparison.

[0045] The four-corner encoding consistency loss ensures that the generated image does not deviate from the structural features of the original image during style transfer. In the Chinese character generation task, the basic form of Chinese characters (such as the number of strokes and structural type) needs to remain consistent, even though the font style may change.

[0046] The four-corner encoding of Chinese characters affects the Chinese character generation process through the four-corner encoding consistency loss, thereby improving the structural consistency of the generated results.

[0047] Fifth, cycle consistency loss: Because the model introduces cycle consistency loss. Specifically, the generator The source domain image Convert to target domain image , and the generator will Convert back to source domain image , thus ensuring that the generated image can restore the original image.

[0048] Likewise, the conversion in the opposite direction (from bold to Songti) follows the same steps to ensure that the style transfer between the two domains is reversible.

[0049] Sixth, identity loss: The introduction of identity loss ensures that the generator does not make meaningless changes if the input image already belongs to the target domain or source domain. It helps the generator maintain the original characteristics of the source or target image, especially when the image is already in the target style.

[0050] Specifically, the generator and When converting an image back to its original style, you should try to leave the original image as unchanged as possible.

[0051] Seventh, fight against losses: Adversarial loss is a core component of generative adversarial networks (GANs). It ensures that the images produced by the generator are realistic enough to fool the discriminator into not being able to tell the difference between the generated images and real images. The adversarial loss is calculated based on the discriminator's output—the probability that the generated image is classified as "real." By maximizing the adversarial loss, the generator improves the quality of generated images, making them more similar to real images. The goal of the generator is to produce images that are as realistic as possible through adversarial training, while the goal of the discriminator is to distinguish between real and generated images as closely as possible.

[0052] Eighth, the comprehensive effect of four-corner coding consistency loss combined with other losses: Combined with adversarial loss: The adversarial loss promotes the realism of the generated images, while the four-corner encoding consistency loss ensures the structural consistency of the generated images. The combination of the two can help the generator produce images that are both realistic and structurally accurate.

[0053] Combining Cycle Consistency Loss: Cycle consistency loss ensures that the translation from the source domain to the target domain is reversible, while the four-corner encoding consistency loss further ensures that the structural features of the image remain consistent when translated between the two domains. The combination of the two can ensure that the style of the image changes during the translation process while maintaining its structural accuracy.

[0054] Ninth, training and optimization: During the training process, the generator and the discriminator compete with each other. The goal of the generator is to generate images that are as realistic as possible, and the goal of the discriminator is to distinguish between real images and generated images as correctly as possible.

[0055] The optimization goal of the generator is not only to minimize the loss of the discriminator, but also to minimize the four-corner encoding consistency loss and the cycle consistency loss, thereby ensuring that the structure of Chinese characters remains consistent during the generation process.

[0056] Tenth, the final result is: After multiple rounds of training, the generator can successfully convert images from the source domain (Songti) to images from the target domain (Boldti) while maintaining the structural consistency of Chinese characters. Generated Chinese character images (bold flowers) should be consistent with the source image (Songtihua) has obvious differences in style while maintaining a consistent four-corner code structure.

[0057] At the same time, the reverse generation can also restore the source domain image (Songti) from the target domain image (bold), maintaining the ability of bidirectional style transfer.

[0058] This method effectively improves the structural consistency, style consistency, and detail preservation of generated Chinese characters. By designing a four-corner consistency loss function and integrating a four-corner encoding prediction module, it optimizes structure preservation and style transfer during the generation process, overcoming the structural inaccuracies and style inconsistencies common in traditional Chinese character generation methods. Experiments demonstrate that this method can achieve high-quality Chinese character font generation without the need for paired samples and outperforms existing methods across multiple evaluation metrics.

[0059] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0060] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "plurality" means two or more, unless otherwise specifically defined.

[0061] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. A method for generating Chinese character fonts based on four-corner coding, characterized in that: The following steps are involved: By combining four-corner encoding with generative adversarial networks and four-corner consistency loss function, Chinese fonts are generated using a training set consisting of source and target fonts.

2. The method for generating Chinese character fonts based on four-corner coding according to claim 1, characterized in that: When generating Chinese fonts, in the discriminator, the four-corner encoding information affects the output effect of the generator and the judgment result of the discriminator.

3. The method for generating Chinese character fonts based on four-corner coding according to claim 2, characterized in that: When using the four-corner code, the four-digit numbers are encoded by one-hot encoding to generate the four-corner code, wherein the four-corner code consists of five digits, representing the structural characteristics of the Chinese character, the first four digits representing the codes of the four areas, and the fifth digit representing the additional angle or number.

4. The method for generating Chinese character fonts based on four-corner coding according to claim 3, characterized in that: When using the four-corner code, the Unicode code in the image file name is used to correspond the Chinese character image to the four-corner code one by one, thereby realizing the association between the four-corner code and the image.

5. The method for generating Chinese character fonts based on four-corner coding according to claim 4, characterized in that: When using a generative adversarial network, a generator is composed of multiple convolution blocks, residual blocks, and deconvolution blocks. The generator is used to convert the source domain image into the target domain image through multi-level image transformation.

6. The method for generating Chinese character fonts based on four-corner coding according to claim 5, characterized in that: When using a generative adversarial network, the discriminator uses multiple convolutional blocks to extract the features of the input image, makes true or false judgments through the fully connected layer, and provides feedback to the generator.

7. The method for generating Chinese character fonts based on four-corner coding according to claim 6, characterized in that: When using the four-corner consistency loss function, the four-corner consistency loss function is used to ensure that the generated image does not deviate from the structural characteristics of the original image during style conversion.

8. The method for generating Chinese character fonts based on four-corner coding according to claim 7, characterized in that: When using the training set for model training, on the basis of the four-corner encoding consistency loss, the cycle consistency loss, identity loss and adversarial loss are introduced to ensure the accuracy of the generator in generating Chinese character fonts.

9. The method for generating Chinese character fonts based on four-corner coding according to claim 8, characterized in that: When generating a Chinese character font, the source font is converted into a target font, or the target font is converted into a source font through the generator.

10. A Chinese character font generation system based on four-corner coding, the system being used to implement a Chinese character font generation method based on four-corner coding as claimed in any one of claims 1 to 9, characterized in that: The system includes: A data acquisition module, used for acquiring a training set consisting of source fonts and target fonts; The Chinese character generation module is used to generate Chinese character fonts using the training set by combining four-corner encoding with a generative adversarial network and a four-corner consistency loss function.

Citation Information

Patent Citations

  • Chinese character font generation method based on font contour information

    CN117830074A

  • Chinese character output method and device based on four-corner number brain-computer interface, and storage medium

    CN118331435A