Font generation method and device based on geometric perception mechanism, equipment and medium

By mapping font data to Riemannian manifold space and performing geometric perception transformation, the contradiction between discrete topology and continuous style modeling in font generation is resolved, achieving high-quality font generation while maintaining stroke connection integrity and style diversity.

CN120807700APending Publication Date: 2025-10-17PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510957883.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Existing font generation technologies have difficulty effectively handling the discrete topological constraints and continuous style changes in font data, resulting in poor generation results. In particular, when generating complex fonts, stroke connections are incomplete and the style is monotonous.

Method used

By mapping font data to the Riemannian manifold space, using cascaded Riemannian coupling layers to perform geometric perception transformation, and combining the dynamically generated Riemannian metric tensor to adjust the coordinate transformation, high-quality font images are generated.

Benefits of technology

It achieves the unity of the integrity of the font structure and the diversity of styles, avoids stroke breaks and adhesions, and improves the topological correctness and style consistency of the generated font.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120807700A_ABST
    Figure CN120807700A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, can be applied to the medical field and the financial science and technology field, and discloses a font generation method and device based on a geometric perception mechanism, equipment and a medium which are applied to a doctor handwritten prescription recognition scene or a bill handwritten information recognition scene. Preprocessing the font data to generate preprocessed font data; mapping the preprocessed font data to a Riemannian manifold space to generate manifold coordinates; geometric perception transformation is carried out on the manifold coordinates through a cascaded Riemann coupling layer, transformed manifold coordinates are generated, and the transformed coordinates are transformed into base distribution; sampling from the base distribution to obtain a target manifold coordinate, and generating an initial font image based on the target manifold coordinate through reverse Riemannian coupling transformation and a generative network; and performing image optimization on the initial font image to generate a target font image. The method has the advantage of improving the structural rationality and style consistency of the generated fonts.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and can be applied to the fields of medical treatment and financial technology, and particularly relates to a font generation method and device based on a geometric perception mechanism, equipment and a medium. BACKGROUND

[0002] Font generation technology is an important research direction in the intersection of computer vision and graphics, and the core challenge thereof is how to automatically synthesize a font shape that not only maintains structural rationality but also has specific style characteristics. Font generation technology can be applied to the fields of medical treatment and financial technology, and specifically can be applied to a doctor handwritten prescription recognition scene in the field of medical treatment and a bill handwritten information recognition scene in the field of financial technology.

[0003] In recent years, a deep generative model based on manifold learning provides a new idea for solving the above problems. Among them, normalizing flows are concerned because of their accurate probability density modeling capability and reversible transformation characteristics. This method realizes the reversible transformation of data distribution through cascading coupled layers, and can theoretically accurately model any complex distribution. However, the standard normalizing flow assumes that the data exists in the Euclidean space, ignoring the inherent manifold structure characteristics of the font data. Specifically, font data contains both discrete topological constraints and continuous style changes: on the one hand, the connection relationship between strokes constitutes a discrete topological constraint; on the other hand, style changes form a continuous manifold structure. This discrete-continuous mixed characteristic makes it difficult for the normalizing flow under the traditional Euclidean space assumption to accurately model. To cope with this challenge, researchers have begun to explore the introduction of differential geometry into the generative model. The geometric perception autoencoder learns the data manifold structure through Riemannian metric, and the manifold-based normalizing flow adjusts the transformation process through pullback metric. However, the existing methods still have significant limitations: first, most Riemannian flow models are designed for pure continuous data, and it is difficult to effectively handle the unique discrete-continuous mixed structure of the font; second, the affine transformation of the traditional coupled layer lacks adaptive adjustment capability for local geometry, resulting in inaccurate manifold curvature matching; finally, the design of the fixed metric tensor cannot dynamically adapt to the geometric changes of different font styles, limiting the generalization ability of the model. These technical bottlenecks seriously restrict the generation effect of high-quality fonts. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide a font generation method, device, equipment and medium based on a geometric perception mechanism to improve the text rendering quality and efficiency.

[0005] To solve the above technical problems, the embodiments of the present application provide a font generation method based on a geometric perception mechanism, comprising:

[0006] Obtain original font data, and pre-process the original font data to generate pre-processed font data;

[0007] Map the pre-processed font data to a Riemann manifold space to generate manifold coordinates;

[0008] Perform geometric perception transformation on the manifold coordinates through a cascaded Riemann coupling layer to generate transformed manifold coordinates, and convert the transformed coordinates into a base distribution;

[0009] Sample target manifold coordinates from the base distribution, and generate an initial font image based on the target manifold coordinates through inverse Riemann coupling transformation and a generation network;

[0010] Optimize the initial font image to generate a target font image.

[0011] To solve the above technical problems, an embodiment of the present application provides a font generation device based on a geometric perception mechanism, comprising:

[0012] A font data acquisition module is configured to obtain original font data, and pre-process the original font data to generate pre-processed font data;

[0013] A font data mapping module is configured to map the pre-processed font data to a Riemann manifold space to generate manifold coordinates;

[0014] A geometric perception transformation module is configured to perform geometric perception transformation on the manifold coordinates through a cascaded Riemann coupling layer to generate transformed manifold coordinates, and convert the transformed coordinates into a base distribution;

[0015] A coordinate inverse transformation module is configured to sample target manifold coordinates from the base distribution, and generate an initial font image based on the target manifold coordinates through inverse Riemann coupling transformation and a generation network;

[0016] An image optimization module is configured to optimize the initial font image to generate a target font image.

[0017] To solve the above technical problems, an embodiment of the present application provides a font generation device based on a geometric perception mechanism, comprising:

[0018] To solve the above technical problems, an embodiment of the present application provides a font generation device based on a geometric perception mechanism, comprising:

[0019] Embodiments of the present application provide a font generation method and device based on a geometric perception mechanism, and a medium. The method comprises: obtaining original font data, and preprocessing the original font data to generate preprocessed font data; mapping the preprocessed font data to a Riemann manifold space to generate manifold coordinates; performing geometric perception transformation on the manifold coordinates through a cascaded Riemann coupling layer to generate transformed manifold coordinates, and converting the transformed coordinates into a base distribution; sampling target manifold coordinates from the base distribution, and generating an initial font image based on the target manifold coordinates through inverse Riemann coupling transformation and a generation network; and performing image optimization on the initial font image to generate a target font image. Embodiments of the present application effectively solve the problem that traditional methods are difficult to model the discrete-continuous mixed structure of fonts by mapping font data to a Riemann manifold space and performing geometric perception transformation, and combining dynamically generated Riemann metric tensors to adjust the coordinate transformation process, thereby improving the rationality of generated font structure and the consistency of style. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the scheme in the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0021] Figure 1 is an application environment diagram of the font generation method based on the geometric perception mechanism in an embodiment of the present application;

[0022] Figure 2 is an implementation flowchart of the font generation method based on the geometric perception mechanism provided by the embodiments of the present application;

[0023] Figure 3 is Figure 2 is a specific implementation flowchart of step S1 in the method;

[0024] Figure 4 is Figure 2 is a specific implementation flowchart of step S2 in the method;

[0025] Figure 5 is Figure 3 is a specific implementation flowchart of step S3 in the method;

[0026] Figure 6 is Figure 5 is a specific implementation flowchart of step S31 in the method;

[0027] Figure 7 is Figure 5is a specific embodiment flowchart of step S32;

[0028] Figure 8 is Figure 2 is a specific embodiment flowchart of step S4;

[0029] Figure 9 is a schematic diagram of a font generation device based on a geometric perception mechanism provided by an embodiment of the present application;

[0030] Figure 10 is a schematic diagram of a computer device. DETAILED DESCRIPTION

[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application; the description and the drawings are to be regarded as illustrative in nature and are not intended to limit the application; the terminology used in the description of the application herein including the appended claims as well as the drawings is not intended to be limiting, unless otherwise defined by context; terms such as "including", "having", and "containing" and variations are intended to cover inclusive rather than exclusive.

[0032] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in an embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily all directed to the same embodiment, or to a single alternative embodiment. It is explicitly contemplated that embodiments described herein can be combined with each other.

[0033] In order to make the technical personnel in the art better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings.

[0034] The application will be described in detail in conjunction with the drawings and embodiments.

[0035] It should be noted that the font generation method based on the geometric perception mechanism provided by the embodiments of the present application is generally executed by a server, and accordingly, the font generation device based on the geometric perception mechanism is generally configured in the server.

[0036] The font generation method based on the geometric perception mechanism provided by the embodiments of the present application can be applied to, for example, Figure 1The application environment is that the client communicates with the server through a network. The server can generate a target font image according to original font data of the client by receiving the original font data. The server in the application sends the target font image to the client. The client can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers. The application will be described in detail through specific embodiments.

[0037] The font generation method based on the geometric perception mechanism provided by the embodiments of the application can be applied to a doctor handwritten prescription recognition scene in the medical field, and can be applied to a bill handwritten information recognition scene in the financial technology field.

[0038] In the prior art, the font generation technology has experienced a development process from a parameterized template to a generative adversarial network. The traditional method relies on an artificially designed rule system and is difficult to handle the topological changes of complex fonts. Although the generative adversarial network can generate diversified fonts, the implicit modeling characteristics often cause strokes to break or stick together. Recent research attempts to introduce manifold learning into font generation, but the existing methods have three main limitations: it is difficult to handle the discrete-continuous mixed structure specific to fonts, the affine transformation lacks local geometric adaptability, and the fixed metric tensor cannot adapt to different style changes. When facing the generation of calligraphy fonts with complex connected strokes, the existing methods often cannot maintain the topological integrity of the stroke connection, and it is difficult to accurately control the gradual change of the stroke thickness.

[0039] In order to solve the above problems, the font data contains both discrete topological constraints and continuous style change characteristics. Traditional Euclidean space modeling cannot effectively coordinate the contradiction between the two types of characteristics, and the fixed metric tensor used in existing manifold learning methods limits the adaptability of the model to different font styles. By analyzing the differential structure of Chinese characters, it is found that the stroke connection points form a discrete manifold, and the stroke direction forms a continuous manifold. Based on this cognition, the application combines the geometric perception mechanism with the normalized flow model to accurately model the intrinsic manifold structure of the font data. The application constructs a Riemann coupling layer architecture that dynamically adapts to the geometric characteristics of the font. The architecture can handle both the discrete topological constraints and the continuous style changes in the font data.

[0040] Therefore, the application provides a font generation method based on a geometric perception mechanism, including: obtaining original font data and preprocessing to generate preprocessed font data; mapping the preprocessed font data to a Riemann manifold space to generate manifold coordinates; performing geometric perception transformation on the manifold coordinates through a cascaded Riemann coupling layer to generate transformed manifold coordinates, and converting the transformed coordinates into a base distribution; sampling target manifold coordinates from the base distribution, generating an initial font image through reverse Riemann coupling transformation and a generation network; and performing image optimization on the initial font image to generate a target font image. The Riemann manifold modeling of the application explicitly separates the topological constraint and the style feature, and realizes local geometric self-adaptation by using a dynamic metric tensor. Compared with the manifold learning method with a fixed metric, the application dynamically generates a metric through a graph attention network, which can adapt to the geometric change requirements of different font styles. The application effectively solves the modeling contradiction between discrete topology and continuous style in font generation, and realizes the unity of the integrity of the character structure and the diversity of the style. For complex structure connected pen font, the generation result avoids the common defects of breakage or adhesion in traditional methods, and realizes the continuous regulation of the stroke style under the premise of maintaining the topological correctness.

[0041] Reference is made to Figure 2 , Figure 2 A specific embodiment of the font generation method based on the geometric perception mechanism is shown.

[0042] It should be noted that the method of the application is not limited to the order of the processes shown, and the method includes the following steps: Figure 2

[0043] S1: obtaining original font data, and preprocessing the original font data to generate preprocessed font data.

[0044] The preprocessed font data refers to grayscale bitmap data after standardization processing, and can be realized by adopting a median filter for noise reduction combined with pixel normalization processing, which provides noise suppression input data for subsequent manifold mapping.

[0045] Reference is made to Figure 3 , Figure 3 A specific embodiment of step S1 is shown, and is described as follows:

[0046] S11: obtaining the original font data, and uniformly converting the original font data into a grayscale bitmap.

[0047] S12: performing normalization processing on the pixel value of the grayscale bitmap to generate a normalized bitmap.

[0048] S13: adopting a median filter to perform noise reduction processing on the normalized bitmap to generate the preprocessed font data. ​

[0049] Specifically, the original font data is converted into a single-channel grayscale image after RGB three-channel weighted calculation, eliminating the interference of decorative colors in the color font on stroke topology recognition. Normalization processing linearly converts the grayscale value from the range of 0-255 to the interval of [-1, 1], so that font data of different resolutions and scanning qualities have comparability. The median filter traverses the image with a 3x3 pixel window, and determines the median value of the pixels in the window using the quicksort algorithm, which eliminates isolated noise points while avoiding the stroke edge blurring phenomenon caused by Gaussian filtering.

[0050] wherein the grayscale bitmap refers to converting the original font data containing multi-channel color information into a single-channel grayscale image, which can be specifically implemented by using the RGB weighted average algorithm, focusing on the extraction of the structure features of the font by eliminating the interference of color information. The normalization processing refers to linearly mapping the pixel value to a preset numerical interval, which can be specifically implemented by using the min-max scaling algorithm, eliminating the dimensional differences by unifying the numerical distribution range of font data from different sources. The median filter refers to a nonlinear filtering device based on a sliding window, which can be specifically implemented by using a 3x3 pixel window, effectively suppressing salt and pepper noise while preserving the sharpness of the stroke edge.

[0051] S2: mapping the preprocessed font data to a Riemannian manifold space to generate manifold coordinates.

[0052] wherein the Riemannian manifold space refers to a non-Euclidean geometric space with local differential structure, which can be specifically implemented by implementing manifold embedding after extracting multi-scale features by a residual convolutional network. This space can simultaneously encode the discrete topology and continuous style features of the font.

[0053] Please refer to Figure 4 , Figure 4 A specific implementation of step S2 is shown as follows:

[0054] S21: extracting multi-scale features based on the preprocessed font data by a residual convolutional network, wherein the residual convolutional network is constructed by using residual blocks with Swish activation functions.

[0055] S22: mapping the multi-scale features to the Riemannian manifold space to generate the manifold coordinates. Specifically, the preprocessed font data is mapped to a d-dimensional manifold space, and its formula is represented as: z=E φ (x); wherein E φ represents an embedding network with parameters φ, is a local coordinate on the manifold. The residual block with a Swish activation function is used to build the embedding network, and the Swish activation function is represented as: σ(x) = x sigmoid(βx); β is a learnable parameter that can adaptively adjust the shape of the activation function.

[0056] Specifically, the residual convolutional network builds a deep feature extractor by stacking residual blocks with Swish activation functions, uses a 3x3 convolution kernel for feature transformation in each level of the residual block, and adds the input features to the transformed results through a skip connection. Different levels of feature output nodes are set in the network architecture to form a feature pyramid containing 64x64, 32x32, and 16x16 resolutions. The multi-scale features are projected to a preset 256-dimensional manifold space through a fully connected layer, and the metric tensor of the manifold space is dynamically generated by the font topology structure. In the mapping process, the Euclidean space feature vector is converted into manifold coordinates using the exponential mapping algorithm, while maintaining the geodesic distance between feature vectors and the semantic similarity of the original pixel space. The present application effectively solves the problem of insufficient multi-scale feature extraction of font data in the manifold mapping process, and realizes the collaborative representation of stroke details and overall structure through multi-level feature fusion of the residual network. At the same time, the nonlinear embedding method based on Riemannian manifold overcomes the inaccuracy of Euclidean space geometric representation, so that the topological relationship of the font key points can be accurately maintained in the feature space, laying a precise mathematical foundation for subsequent geometric transformation operations.

[0057] wherein the residual convolutional network refers to a deep neural network composed of multiple residual blocks, which can be implemented using a skip connection structure, and can effectively alleviate the gradient vanishing problem during training of deep networks by establishing cross-layer connection paths between network layers. The Swish activation function refers to a nonlinear activation function with self-gating characteristics, which can be implemented using a Swish function with a beta parameter of 1, and its continuous derivable property is conducive to improving the network's ability to capture font outline details. The multi-scale feature refers to a set of feature maps containing different receptive fields, which can be implemented by setting convolution kernels with different dilation rates, and can capture both local details and overall structure information of strokes. The Riemannian manifold space refers to a differential manifold equipped with local curvature metrics, which can implement mapping operations through a tangent space projection algorithm, and provides a geometric representation space that maintains the topological structure for font data.

[0058] S3: Perform geometric perception transformation on the manifold coordinates through a cascaded Riemannian coupling layer to generate transformed manifold coordinates, and convert the transformed coordinates into a base distribution.

[0059] The cascaded Riemann coupled layer refers to a multi-stage reversible transformation module with geometric perception capability, and can be implemented by using an affine transformation of coordinate grouping guided by a dynamically generated Riemann metric tensor. The structure can realize continuous adjustment of style features while maintaining topological constraints.

[0060] Please refer to Figure 5 , Figure 5 An embodiment of step S3 is shown as follows:

[0061] S31: Perform glyph analysis based on the manifold coordinates by using a graph attention network, and generate a Riemann metric tensor.

[0062] S32: Perform geometric perception transformation on the manifold coordinates based on the Riemann metric tensor by using the cascaded Riemann coupled layer, and generate the transformed manifold coordinates.

[0063] S33: Gradually convert the transformed coordinates into the base distribution.

[0064] Specifically, the graph attention network calculates the Riemann metric tensor G k The formula is as follows: Wherein, J φ is the Jacobian matrix of the embedding network E φ , and ∈ is a small constant that ensures positive definiteness.

[0065] Each Riemann coupled layer implements a reversible geometric perception transformation For the segmentation of the manifold coordinates z=[z a ,z b ], the transformation is defined as:

[0066] z b ′=z b ⊙exp(s k (z a ;G k ))+t k (z a ;G k );

[0067] Wherein, s k and t k are scale and translation functions, G k is a dynamically learned Riemann metric tensor, and ⊙ represents element-wise multiplication; the parameters s k and t k both depend on the current manifold metric G k , which enables the transformation to adaptively maintain the local geometric structure. The Jacobian determinant of the transformation is:

[0068]

[0069] wherein tr is a probabilistic path trajectory, and det is a matrix determinant.

[0070] In the embodiments of the present application, the graph attention network first performs feature analysis on the input manifold coordinates, identifies the topological structure composed of stroke connection points, and extracts a style feature vector. Based on these features, the network dynamically generates a Riemannian metric tensor reflecting the local geometric characteristics of the current font. Subsequently, the cascaded Riemannian coupling layer divides the coordinates into fixed groups and reorganizable groups at each transformation stage, calculates adjustment parameters using the fixed group coordinates and the metric tensor, and performs scale stretching and position offset operations on the reorganizable group coordinates. Through progressive processing of the multi-layer cascaded structure, the manifold coordinates gradually complete geometric shape adjustment, and finally are converted into base distribution conforming to the target distribution through reversible mapping. The present application solves the problem of lack of geometric adaptability in the coupling layer transformation in the prior art, effectively improves the manifold curvature matching accuracy, dynamically adapts to the geometric changes of different font styles, and ensures that the generated font reaches a higher standard in terms of topological integrity and style consistency.

[0071] wherein the graph attention network refers to a neural network architecture based on graph structure data modeling, which can be specifically constructed using a multi-head attention mechanism to achieve feature aggregation by calculating the attention weights between nodes. This network is used to analyze the topological structure of the character and extract style features, providing data support for dynamically generating the Riemannian metric tensor. The Riemannian metric tensor refers to a second-order symmetric tensor field defined on the manifold space, which can be specifically generated by mapping the feature vector output by the graph attention network through a fully connected layer. This tensor is used to describe the local geometric properties of the manifold, providing curvature adjustment basis for subsequent coordinate transformation. The cascaded Riemannian coupling layer refers to a sequence structure composed of multiple reversible transformation modules, which can be specifically constructed in the form of a combination of affine coupling layers and orthogonal transformations. This structure realizes progressive geometric adjustment of manifold coordinates through hierarchical processing, ensuring that the transformation process matches the local curvature characteristics. The base distribution refers to the standard probability distribution of the target latent space, which can be specifically in the form of a Gaussian distribution or a uniform distribution. This distribution serves as a benchmark reference for the generation process, establishing the correspondence between manifold coordinates and latent variables through reversible transformation.

[0072] Please refer to Figure 6 , Figure 6 An embodiment of step S31 is shown as follows:

[0073] S311: Identify the key connection points of the character topography of the manifold coordinates through the graph attention network, generate the character topography, and detect the style features based on the manifold coordinates.

[0074] S312: Dynamically generate the Riemannian metric tensor according to the character topography and the style features.

[0075] Specifically, the graph attention network first models the graph structure of the input manifold coordinates, taking each coordinate point as a graph node. The connection weights between adjacent nodes are calculated through a multi-head attention mechanism to identify key connection points at the intersections and turning points of strokes, forming a discrete glyph topology. Meanwhile, the convolutional layers in the network extract features from the neighborhood of coordinate points, capturing the continuous variation characteristics of stroke patterns. The discrete topology and continuous features are jointly encoded through a feature fusion layer to generate a hybrid feature vector containing structural constraints and style attributes. This feature vector is input into the metric generator, which outputs a positive definite symmetric Riemannian metric tensor through fully connected layers and matrix normalization operations. The dynamically generated metric tensor can adaptively adjust the local curvature of the manifold space according to the specific morphology of the current font, providing precise geometric constraints for subsequent geometric transformations.

[0076] wherein the glyph key connection points refer to geometric feature points at the intersections of font strokes, which can be located by edge detection algorithm combined with curvature analysis, and are used to represent the discrete topology structure of the font. The style features refer to the morphological attributes of the font represented in the continuous manifold space, which can be extracted by convolution kernels to represent visual features such as stroke thickness and corner radius.

[0077] Please refer to Figure 7 , Figure 7 One specific implementation of step S32 is shown below:

[0078] S321: input the manifold coordinates into the cascaded Riemann coupling layer.

[0079] S322: in each Riemann coupling layer, divide the manifold coordinates into fixed group coordinates and reorganizable coordinates.

[0080] S323: calculate adjustment parameters based on the fixed group coordinates and the Riemann metric tensor.

[0081] S324: based on the adjustment parameters, perform scale stretching and position offset on the reorganizable coordinates to obtain initial transformed coordinates.

[0082] S325: splice the initial transformed coordinates with the fixed group coordinates to generate the transformed manifold coordinates.

[0083] Specifically, the gradual geometric adjustment of manifold coordinates is realized by a hierarchical progressive processing architecture. In the initial stage, the manifold coordinates are input into the first layer of the cascaded coupling layer, at which point the coordinate grouping operation marks part of the dimensions as fixed groups to preserve the original geometric characteristics. The fixed group coordinates are input into the parameter calculation module together with the dynamically generated Riemannian metric tensor, producing adjustment parameters that match the local geometric properties of the current manifold. When these parameters act on the reconfigurable coordinates, they automatically adjust the scaling factor and translation amount according to the curvature changes of the manifold, enabling the coordinate transformation process to accurately adapt to the geometric differences in different regions. After multiple layers of cascaded processing, the reconfigurable coordinates complete the multi-scale geometric deformation while maintaining topological consistency with the fixed group coordinates. Finally, the transformed reconfigurable coordinates and the unchanged fixed group coordinates are re-integrated through the coordinate splicing operation to form new manifold coordinates that inherit the original structural characteristics and contain local deformations.

[0084] wherein the division of fixed group coordinates and reconfigurable coordinates refers to dividing the input coordinates into a part that maintains the original geometric constraints and a part that allows deformation adjustment according to a predetermined proportion. This can be achieved by random grouping or alternating grouping by spatial position, and the stability of the local structure of the manifold is maintained by keeping part of the coordinates unchanged. The calculation of adjustment parameters refers to deriving the transformation coefficients of reconfigurable coordinates based on the geometric features of fixed group coordinates and Riemannian metric tensor. Specifically, a multi-layer perceptron can be used to model the mapping relationship from fixed group coordinates to transformation parameters, and dynamic generation of parameters can be achieved by fusing local manifold curvature information. Scale stretching and position offset refer to linear scaling and nonlinear translation operations on reconfigurable coordinates. Specifically, an affine transformation matrix can be used to act on the coordinate vector to accurately match the local curvature of the manifold by adjusting the transformation amplitude.

[0085] S4: Sample the target manifold coordinates from the base distribution, and generate an initial font image based on the target manifold coordinates through the inverse Riemann coupling transformation and the generation network.

[0086] wherein the inverse Riemann coupling transformation refers to a reversible manifold coordinate restoration process, which can be implemented by executing the coupling layer transformation sequence in reverse. This process ensures the reversibility and controllability of the generation process.

[0087] Please refer to Figure 8 , Figure 8 One specific implementation of step S4 is shown below:

[0088] S41: Sample the target manifold coordinates from the base distribution.

[0089] S42: Generate the restored manifold coordinates by performing inverse Riemann coupling transformation on the target manifold coordinates.

[0090] S43: generating an initial font image by performing a generation process on the reduced manifold coordinates by the generation network.

[0091] Specifically, the target manifold coordinates are sampled from the base distribution (K) Then, a new glyph is generated by inverse transformation, and the specific formula is as follows:

[0092]

[0093] where D ψ is a generation network with parameter ψ, is an inverse transformation of the kth coupling layer, and x' is a result of the generated font.

[0094] In the embodiments of the present application, the sampling operation randomly selects target manifold coordinates from the base distribution, ensuring that the generation process can cover the probability distribution space of the font style. The inverse Riemann coupling transformation re-establishes the geometric constraint relationship of the stroke connection point by reversely performing the coordinate grouping operation separated in the forward transformation, for example, inversely scaling the reorganizable coordinates and correcting the positions. The generation network adopts a multi-layer deconvolution structure, gradually expands the low-dimensional manifold coordinates into high-resolution feature maps, and retains key geometric features through residual connection in the decoding process, and finally outputs an initial font image with clear contours. The present application effectively solves the distortion problem of stroke connection caused by manifold space transformation in the font generation process, and avoids the single style defect caused by insufficient coverage of the hidden variable space in the traditional method. At the same time, through the joint optimization of the inverse geometric transformation and the generation network, a reversible conversion from the probability distribution to the high-quality glyph image is realized, which significantly improves the performance of the generated font in stroke continuity and style consistency.

[0095] where the generation network refers to a deep neural network for mapping the manifold coordinates to the pixel space, which can be implemented by a convolutional neural network with skip connection, and its function is to convert the abstract coordinates after geometric correction into glyph images with clear topological structure.

[0096] S5: performing image optimization on the initial font image to generate a target font image.

[0097] Specifically, the initial font image is sharpened, anti-aliased and binarized to generate a target font image. Wherein, sharpening can enhance the clarity of stroke edges. Anti-aliasing can smooth the staircase pixel distortion. Binarization can convert to contour curves when generating vector fonts.

[0098] ​In a specific embodiment, a specific font generation scenario is provided: the input is 10 Chinese fonts of different styles, and each style contains 100 commonly used Chinese characters. These input fonts differ significantly in style, including: 1. Traditional regular script: obvious changes in stroke thickness and rigorous structure; 2. Modern bold: uniform strokes and no serifs; 3. Handwriting: with natural writing traces; 4. Artistic font: with decorative elements. After being processed by the method provided by this application, the generated font can: 1. Maintain the structural integrity of the original font and avoid stroke breaks 2. Achieve a smooth transition in style, such as a gradient from regular script to bold 3. Create a completely new hybrid style, such as a modern font with handwriting features. It is particularly noteworthy that for Chinese characters with complex structures (such as the word "鬱"), this application can still maintain the correct connection relationship of all strokes, which is difficult to achieve with traditional methods.

[0099] In the scenario of handwritten bill information recognition in the field of financial technology, since the handwritten amount and date of checks or bills may be misrecognized due to illegible fonts, this application can perform error correction based on the topological error correction mechanism of the font manifold space. In this scenario, the basic structure of the strokes is restored through the Riemann coupling layer, and the easily confused characters are distinguished through the dynamic metric network to generate standardized data text that can be output. In the scenario of handwritten prescription recognition of doctors in the medical field, the recognition rate of conventional fonts is low due to the large variation in the font structure of doctors' sketches. The method provided in this application trains a graph attention network based on the historical prescription dataset to learn the topological constraints of the drug names, and adapts the personal writing style through the Riemann coupling layer, so that the doctor's personal writing style can be accurately identified and the font recognition accuracy can be improved.

[0100] In an embodiment of the present application, original font data is obtained, and the original font data is preprocessed to generate preprocessed font data; the preprocessed font data is mapped to the Riemann manifold space to generate manifold coordinates; the manifold coordinates are geometrically transformed through a cascaded Riemann coupling layer to generate transformed manifold coordinates, and the transformed coordinates are converted into a basis distribution; target manifold coordinates are sampled from the basis distribution, and an initial font image is generated based on the target manifold coordinates through an inverse Riemann coupling transformation and a generative network; the initial font image is image optimized to generate a target font image. The embodiment of the present invention effectively solves the problem that traditional methods find it difficult to model discrete-continuous hybrid structures of fonts by mapping font data to the Riemann manifold space and performing geometric transformation, combined with the dynamically generated Riemann metric tensor to adjust the coordinate transformation process, and has the advantage of improving the rationality of the generated font structure and the consistency of style.

[0101] Please refer to Figure 9 , as a response to the above Figure 2To implement the method, the application provides an embodiment of a font generation device based on a geometric perception mechanism, which is implemented in the method embodiment Figure 2 The device can be applied to various electronic devices.

[0102] As Figure 9 The font generation device based on the geometric perception mechanism comprises a font data acquisition module 61, a font data mapping module 62, a geometric perception transformation module 63, a coordinate inverse transformation module 64, and an image optimization module 65.

[0103] The font data acquisition module 61 is configured to acquire original font data, pre-process the original font data, and generate pre-processed font data.

[0104] The font data mapping module 62 is configured to map the pre-processed font data to a Riemann manifold space and generate manifold coordinates.

[0105] The geometric perception transformation module 63 is configured to perform geometric perception transformation on the manifold coordinates through cascaded Riemann coupling layers, generate transformed manifold coordinates, and convert the transformed coordinates into a base distribution.

[0106] The coordinate inverse transformation module 64 is configured to sample target manifold coordinates from the base distribution, and generate an initial font image based on the target manifold coordinates through inverse Riemann coupling transformation and a generation network.

[0107] The image optimization module 65 is configured to perform image optimization on the initial font image and generate a target font image.

[0108] Further, the font data acquisition module 61 comprises:

[0109] A data acquisition unit is configured to acquire the original font data and uniformly convert the original font data into a grayscale bitmap.

[0110] A normalization unit is configured to perform normalization processing on pixel values of the grayscale bitmap and generate a normalized bitmap.

[0111] A noise reduction unit is configured to perform noise reduction processing on the normalized bitmap by using a median filter and generate the pre-processed font data.

[0112] Further, the font data mapping module 62 comprises:

[0113] A multi-scale feature extraction unit is configured to extract multi-scale features based on the pre-processed font data through a residual convolutional network, wherein the residual convolutional network is constructed by using residual blocks with Swish activation functions.

[0114] a feature mapping unit configured to map the multi-scale features to the Riemannian manifold space to generate the manifold coordinates.

[0115] Further, the geometry-aware transformation module 63 comprises:

[0116] a glyph analysis unit configured to perform glyph analysis on the manifold coordinates based on the Riemannian metric tensor via a graph attention network to generate a Riemannian metric tensor;

[0117] a coordinate transformation unit configured to perform geometry-aware transformation on the manifold coordinates based on the Riemannian metric tensor via the cascaded Riemannian coupled layers to generate the transformed manifold coordinates;

[0118] a base distribution generation unit configured to convert the transformed coordinates into the base distribution step by step.

[0119] Further, the glyph analysis unit comprises:

[0120] a glyph topology generation unit configured to identify glyph key connection points of the manifold coordinates via the graph attention network to generate a glyph topology and detect style features based on the manifold coordinates;

[0121] a Riemannian metric tensor generation unit configured to dynamically generate the Riemannian metric tensor according to the glyph topology and the style features.

[0122] Further, the coordinate transformation unit comprises:

[0123] a coordinate input unit configured to input the manifold coordinates to the cascaded Riemannian coupled layers;

[0124] a coordinate grouping unit configured to group the manifold coordinates into fixed group coordinates and re-groupable coordinates in each of the Riemannian coupled layers;

[0125] an adjustment parameter calculation unit configured to calculate adjustment parameters based on the fixed group coordinates and the Riemannian metric tensor;

[0126] an initial transformed coordinate generation unit configured to perform scale stretching and position offset on the re-groupable coordinates based on the adjustment parameters to obtain initial transformed coordinates;

[0127] a concatenation unit configured to concatenate the initial transformed coordinates with the fixed group coordinates to generate the transformed manifold coordinates.

[0128] Further, the coordinate inverse transformation module 64 comprises:

[0129] a sampling unit configured to sample the target manifold coordinates from the base distribution;

[0130] The coordinate restoring unit is configured to generate a restored manifold coordinate by performing inverse Riemann coupling transformation on the target manifold coordinate.

[0131] The initial font image generating unit is configured to perform a generating process on the restored manifold coordinate by the generating network to obtain the initial font image.

[0132] To solve the above technical problems, the embodiments of the present application further provide a computer device. For details, please refer to Figure 10 , Figure 10 The basic structure block diagram of the computer device of the present embodiment is shown in FIG. 7.

[0133] The computer device 7 comprises a memory 71, a processor 72 and a network interface 73 which are connected to each other through a system bus. It should be noted that Figure 10 The computer device 7 shown in FIG. 7 comprises three components, i.e., the memory 71, the processor 72 and the network interface 73, but it should be understood that all the components shown are not required to be implemented, and more or less components can be alternatively implemented. Those skilled in the art can understand that the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and the hardware thereof comprises but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.

[0134] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing devices. The computer device can interact with a user through a keyboard, a mouse, a remote controller, a touchpad or a voice control device.

[0135] The memory 71 includes at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 71 can be an internal storage unit of the computer device 7, such as a hard disk or a memory of the computer device 7. In other embodiments, the memory 71 can also be an external storage device of the computer device 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 7. Of course, the memory 71 can also include both the internal storage unit and the external storage device of the computer device 7. In the present embodiment, the memory 71 is generally used to store an operating system and various application software installed on the computer device 7, such as program codes of the font generation method based on the geometric perception mechanism, etc. In addition, the memory 71 can also be used to temporarily store various data that have been output or will be output.

[0136] The processor 72 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 72 is generally used to control the overall operation of the computer device 7. In the present embodiment, the processor 72 is used to run program codes or process data stored in the memory 71, such as running program codes of the font generation method based on the geometric perception mechanism to implement various embodiments of the font generation method based on the geometric perception mechanism.

[0137] The network interface 73 can include a wireless network interface or a wired network interface, and is generally used to establish a communication connection between the computer device 7 and other electronic devices.

[0138] The present application also provides another implementation, i.e., to provide a computer readable storage medium storing a computer program, which can be executed by at least one processor to make the at least one processor execute the steps of the font generation method based on the geometric perception mechanism as described above.

[0139] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, can also be through hardware, but in many cases the former is a better implementation. Based on such understanding, the technical solutions of the present application essentially or say the part of the prior art to make contributions can be in the form of a software product, the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), including a number of instructions to make a terminal device (may be a mobile phone, computer, server, air conditioner, or network equipment, etc.) to execute the method of each embodiment of the present application.

[0140] Obviously, the above-described embodiments are only a part of the embodiments of the present application, rather than all the embodiments, the preferred embodiments of the present application are given in the drawings, but do not limit the scope of the present application. The present application can be realized in many different forms, and contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing specific embodiments, or make equivalent replacement for some technical features. Any equivalent structure made by using the contents of the present application specification and drawings, directly or indirectly used in other related technical fields, are also within the scope of the present application.

Claims

1. A font generation method based on geometric perception mechanism, characterized in that: include: Acquiring original font data, and preprocessing the original font data to generate preprocessed font data; Mapping the pre-processed font data to a Riemannian manifold space to generate manifold coordinates; Performing a geometrically perceptual transformation on the manifold coordinates through a cascade of Riemannian coupling layers to generate transformed manifold coordinates, and converting the transformed coordinates into a basis distribution; Sampling target manifold coordinates from the basis distribution, and generating an initial font image based on the target manifold coordinates through an inverse Riemannian coupling transformation and a generative network; The initial font image is optimized to generate a target font image.

2. The font generation method based on geometric perception mechanism according to claim 1, characterized in that: The obtaining of original font data and preprocessing the original font data to generate preprocessed font data includes: Acquire the original font data, and convert the original font data into a grayscale bitmap; Normalizing the pixel values ​​of the grayscale bitmap to generate a normalized bitmap; A median filter is used to perform noise reduction processing on the normalized bitmap to generate the pre-processed font data.

3. The font generation method based on geometric perception mechanism according to claim 1, characterized in that: Mapping the pre-processed font data to a Riemannian manifold space to generate manifold coordinates includes: Extracting multi-scale features based on the preprocessed font data using a residual convolutional network, wherein the residual convolutional network is constructed using residual blocks with a Swish activation function; The multi-scale features are mapped to the Riemannian manifold space to generate the manifold coordinates.

4. The font generation method based on geometric perception mechanism according to claim 1, characterized in that: The step of performing a geometrically perceptual transformation on the manifold coordinates through a cascaded Riemann coupling layer to generate transformed manifold coordinates, and converting the transformed coordinates into a basis distribution includes: Performing glyph analysis based on the manifold coordinates through a graph attention network to generate a Riemannian metric tensor; Performing a geometric perception transformation on the manifold coordinates based on the Riemannian metric tensor through the cascaded Riemannian coupling layers to generate the transformed manifold coordinates; The transformed coordinates are converted step by step into the basis distribution.

5. The font generation method based on geometric perception mechanism according to claim 4, characterized in that: The graph attention network is used to perform glyph analysis based on the manifold coordinates to generate a Riemannian metric tensor, including: identifying key glyph connection points of the manifold coordinates through the graph attention network, generating glyph topology, and detecting style features based on the manifold coordinates; The Riemannian metric tensor is dynamically generated according to the glyph topology and the style features.

6. The font generation method based on geometric perception mechanism according to claim 4, characterized in that: The step of performing a geometric perception transformation on the manifold coordinates based on the Riemannian metric tensor through the cascaded Riemannian coupling layers to generate the transformed manifold coordinates includes: Inputting the manifold coordinates into the cascaded Riemann coupling layer; In each Riemann coupling layer, the manifold coordinates are divided into fixed group coordinates and reorganizable coordinates; calculating an adjustment parameter based on the fixed set of coordinates and the Riemannian metric tensor; Performing scaling and position shifting on the reorganizable coordinates based on the adjustment parameters to obtain initial transformed coordinates; The initial transformed coordinates are concatenated with the fixed set of coordinates to generate the transformed manifold coordinates.

7. The font generation method based on geometric perception mechanism according to any one of claims 1 to 6, characterized in that: The step of sampling the target manifold coordinates from the base distribution and generating an initial font image based on the target manifold coordinates through an inverse Riemannian coupling transformation and a generative network includes: Sampling from the basis distribution to obtain the target manifold coordinates; Generate restored manifold coordinates by performing an inverse Riemann coupling transformation on the target manifold coordinates; The initial font image is obtained by performing a generation process based on the restored manifold coordinates through the generation network.

8. A font generation device based on a geometric perception mechanism, characterized in that: include: A font data acquisition module, configured to acquire original font data and preprocess the original font data to generate preprocessed font data; a font data mapping module, configured to map the pre-processed font data to a Riemannian manifold space to generate manifold coordinates; a geometric perception transformation module, configured to perform a geometric perception transformation on the manifold coordinates through a cascaded Riemann coupling layer, generate transformed manifold coordinates, and convert the transformed coordinates into a basis distribution; a coordinate inverse transformation module, configured to sample target manifold coordinates from the basis distribution, and generate an initial font image based on the target manifold coordinates through an inverse Riemann coupling transformation and a generative network; The image optimization module is used to optimize the initial font image to generate a target font image.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the font generation method based on the geometric perception mechanism according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the font generation method based on the geometry perception mechanism according to any one of claims 1 to 7 is implemented.