Font generation method and device based on tensor high-order coupling layer, equipment and medium
Through a font generation method based on tensor high-order coupling layers, utilizing multi-rank tensor decomposition and dynamic gating mechanism, the problems of insufficient style control accuracy and difficulty in structure preservation in traditional font generation are solved, and high-quality and diverse font generation is achieved.
Patent Information
- Application Number
- CN202510955107.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-10-10
AI Technical Summary
Existing font generation technology has shortcomings in style control accuracy and structure preservation, especially in application scenarios that require maintaining both fine glyph structure and rich stylistic details. Traditional methods find it difficult to effectively capture the nonlinear relationship between font style and glyph structure, and lack a dynamic adjustment mechanism.
A method based on tensor high-order coupling layers is adopted to obtain font style descriptors and glyph structure data for preprocessing to generate standardized features. Multi-rank tensor decomposition and dynamic gating mechanism are used to adjust the coupling strength of style and structural features. The graph convolutional network and Transformer encoder are combined to process features to achieve refined coupling of style and structure.
The visual quality and style diversity of font generation have been improved. The generated fonts have high-precision style control and rich detail expression while maintaining topological integrity.
Smart Images

Figure CN120765792A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology and can be applied to the medical field and the financial technology field, and in particular to a font generation method, device, equipment and medium based on a tensor high-order coupling layer. Background Art
[0002] In digital media design and print publishing, font generation technology has long faced the dual challenges of insufficient style control precision and difficulty maintaining structure. Font generation technology has applications in the financial technology and medical fields, for example, in dynamic financial document generation systems that generate personalized reports, or in automated annotation scenarios for medical imaging reports.
[0003] Traditional font generation methods primarily employ techniques based on contour deformation or style transfer. These methods often struggle to maintain the integrity of glyph structure when achieving style transfer, leading to problems such as broken strokes or style distortion in the generated fonts. While existing deep learning-based solutions have improved generation quality to a certain extent, they still face the following technical bottlenecks: First, the coupling of style and structural features is overly simplistic, typically employing linear weighting or simple concatenation, which makes it difficult to capture the complex nonlinear relationship between font style and glyph structure. Second, the lack of a dynamic adjustment mechanism during feature interaction prevents adaptive adjustment of the influence of different style attributes on glyph structure. Third, existing methods often employ fixed-rank tensor decomposition when processing multi-scale style features, limiting the model's ability to express font styles of varying complexity. These issues severely restrict the visual quality and stylistic diversity of generated fonts, particularly in applications where both fine glyph structure and rich stylistic details must be maintained. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to propose a font generation method, device, equipment and medium based on a tensor high-order coupling layer, which has the advantages of improving the font style control accuracy and structure retention capability.
[0005] In order to solve the above technical problems, an embodiment of the present application provides a font generation method based on a tensor high-order coupling layer, comprising:
[0006] Obtaining a font style descriptor and glyph structure data, and preprocessing the font style descriptor and the glyph structure data to generate a standardized font style descriptor and glyph structure embedding;
[0007] Performing feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor;
[0008] Obtaining a data segmentation vector, and performing multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformation feature of the injected style attribute;
[0009] Adjusting the coupling strength between different attributes of the transformation feature through a dynamic gating mechanism to generate gated optimized features;
[0010] The gated optimized features are fused with the glyph structure embedding, and the fused features are decoded to generate a target font image.
[0011] In order to solve the above technical problems, an embodiment of the present application provides a font generation device based on a tensor high-order coupling layer, comprising:
[0012] A data acquisition module, configured to acquire font style descriptors and glyph structure data, and pre-process the font style descriptors and glyph structure data to generate standardized font style descriptors and glyph structure embeddings;
[0013] A style factor generation module is configured to perform feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor;
[0014] a transformation feature generation module, configured to obtain a data segmentation vector and perform multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformation feature that injects style attributes;
[0015] A coupling strength adjustment module, configured to adjust the coupling strength between different attributes of the transformation feature through a dynamic gating mechanism to generate gated optimized features;
[0016] The font image generation module is used to fuse the gated optimized features with the glyph structure embedding, and decode the fused features to generate a target font image.
[0017] In order to solve the above technical problems, a technical solution adopted by the present invention is: to provide a computer device, including one or more processors; a memory for storing one or more programs, so that the one or more processors can implement any one of the above-mentioned font generation methods based on tensor high-order coupling layers.
[0018] In order to solve the above technical problems, a technical solution adopted by the present invention is: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements any one of the above-mentioned font generation methods based on tensor high-order coupling layers.
[0019] The embodiment of the present invention provides a font generation method, device, equipment and medium based on a tensor high-order coupling layer. The method includes: obtaining a font style descriptor and glyph structure data, and pre-processing the font style descriptor and the glyph structure data to generate a standardized font style descriptor and glyph structure embedding; performing feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor; obtaining a data segmentation vector, and performing multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformation feature injected with style attributes; adjusting the coupling strength between different attributes of the transformation feature through a dynamic gating mechanism to generate a gated optimized feature; fusing the gated optimized feature with the glyph structure embedding, and decoding the fused feature to generate a target font image. The embodiment of the present invention realizes the refined coupling of style attributes and structural features through multi-rank tensor decomposition and dynamic gating mechanism, and combines the graph convolutional network and the Transformer encoder to process structural features and style features respectively, effectively solving the technical problems of insufficient style control accuracy and difficulty in structure preservation in traditional methods, and has the advantages of high visual quality and rich style diversity in generated fonts. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0021] Figure 1 2 is a schematic diagram of an application environment of a font generation method based on a tensor high-order coupling layer according to an embodiment of the present invention;
[0022] Figure 2 This is a flowchart of the implementation of the font generation method based on the tensor high-order coupling layer provided in an embodiment of the present application;
[0023] Figure 3 yes Figure 2 A schematic flow chart of a specific implementation of step S1;
[0024] Figure 4 yes Figure 2 A schematic flow chart of a specific implementation of step S2;
[0025] Figure 5 yes Figure 2 A schematic flow chart of a specific implementation of step S3;
[0026] Figure 6 yes Figure 2 A schematic flow chart of a specific implementation of step S4;
[0027] Figure 7 is Figure 2 is a specific embodiment flowchart of step S5 in the method;
[0028] Figure 8 is a schematic diagram of a font generation device based on a tensor high-order coupling layer provided by an embodiment of the present application;
[0029] Figure 9 is a schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0030] 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 and the claims of the present application and the above description of the drawings includes the terms specifically mentioned above as well as their derivatives.
[0031] 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 various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. It is expressly understood that the embodiments described herein are merely examples from a
[0032] In order to make the person skilled 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.
[0033] The present application will be described in detail below in conjunction with the drawings and embodiments.
[0034] It should be noted that the font generation method based on a tensor high-order coupling layer provided by the embodiments of the present application is generally executed by a server, and accordingly, the font generation device based on a tensor high-order coupling layer is generally configured in the server.
[0035] The font generation method based on a tensor high-order coupling layer provided by the embodiments of the present application can be applied in, for example, Figure 1In an application environment, the client communicates with the server through a network. The server can receive the font style descriptor and glyph structure data from the client; and generate a target font image according to the font style descriptor and glyph structure data. The server in the present invention sends the target font image to the client. The client can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.
[0036] The font generation method based on tensor high-order coupling layer provided in the embodiment of the present application can be applied to a dynamic financial document generation system, or can be applied to the automatic annotation scenario of medical imaging reports.
[0037] Existing font generation techniques typically employ style transfer or generative adversarial networks to achieve a fusion of glyph form and style. Traditional methods often simply concatenate or linearly transform stylistic and structural features, leading to unnatural stroke transitions and the loss of decorative elements. Existing technologies struggle to effectively model the nonlinear relationship between stylistic attributes and glyph topology, and lack a dynamic mechanism for adjusting coupling strength during feature interaction, resulting in localized distortion and stylistic inconsistencies in the generated fonts.
[0038] To address the aforementioned issues, the root cause of poor font generation quality lies in the single-minded coupling of stylistic and structural features. Analysis of feature interaction revealed that traditional methods, using fixed-weight fully connected layers for feature fusion, are unable to adapt to the differentiated association requirements between different font components. Further research revealed that tensor decomposition can establish high-order feature interactions, but existing tensor models lack the ability to adaptively adjust dynamic style parameters. Based on this, the inventors propose combining multi-rank tensor decomposition with a dynamic gating mechanism to establish a learnable feature coupling channel, enabling precise spatial infusion of stylistic attributes. Therefore, this application proposes obtaining font style descriptors and glyph structure data and preprocessing them to generate standardized features; extracting features from the standardized style descriptors to generate style factors; performing multi-rank tensor decomposition on the data segmentation vectors based on the style factors to generate transformed features; adjusting the feature coupling strength through a dynamic gating mechanism; and integrating the optimized features with the structural embedding and decoding to generate the target font. This application achieves efficient coupling of stylistic and structural features, precisely controlling the distribution of decorative elements while maintaining glyph topological integrity. The dynamic gating mechanism automatically identifies sensitive locations in the stroke connection region, suppressing the excessive diffusion of irrelevant stylistic features. Multi-rank tensor decomposition provides a flexible feature interaction channel, which significantly improves the generation quality of detailed features such as serifs and stroke ends, and ultimately obtains a target font image with unified style and accurate structure.
[0039] See also Figure 2 , Figure 2 A specific implementation of a font generation method based on a tensor high-order coupling layer is shown.
[0040] It should be noted that the method of the present invention is not limited to the method of Figure 2 The process sequence shown is limited to the following steps:
[0041] S1: Obtain font style descriptors and glyph structure data, and pre-process the font style descriptors and glyph structure data to generate standardized font style descriptors and glyph structure embeddings.
[0042] Font style descriptors refer to vectorized representations of visual features such as stroke thickness, decorative elements, and tilt angles. These can be achieved by extracting image features using convolutional neural networks, and are used to quantitatively describe the stylistic characteristics of the target font. Glyph structure data refers to topological graph data composed of stroke coordinates and connection relationships. Specifically, a graph data structure can be used to store the starting and ending points of strokes and their adjacent relationships, representing the spatial layout characteristics of glyphs.
[0043] See also Figure 3 , Figure 3 A specific implementation of step S1 is shown, which is described in detail as follows:
[0044] S11: Acquire the font style descriptor and the glyph structure data.
[0045] S12: Normalize the font style descriptor to generate the standardized font style descriptor.
[0046] S13: Extracting skeleton topological features of the glyph structure data through a graph convolutional network to obtain a glyph structure embedding of a low-dimensional embedding vector.
[0047] Specifically, in the font generation process, the original input data containing style attributes and structural attributes is first obtained. The font style descriptors are normalized to eliminate the differences in numerical distribution between different font samples, and to generate standardized features with a unified dimension. For non-Euclidean structured glyph data, graph structure data is constructed with strokes as nodes and stroke connection relationships as edges, and the spatial topological features between strokes are extracted through multi-layer neighborhood information aggregation of the graph convolutional network. Finally, the high-dimensional original structural data is compressed into a low-dimensional vector representation, which reduces the feature dimension while retaining key structural information, and provides an adaptive input form for subsequent feature fusion. The present application effectively solves the problem of insufficient extraction of glyph structural features during font generation, and realizes accurate modeling of complex glyph topological structures.
[0048] Normalization refers to the process of converting raw data of different dimensions into a unified numerical range. This can be achieved using the Z-score normalization method, which eliminates scale differences between different data sources by performing mean zeroing and variance normalization on the raw data. A graph convolutional network refers to a neural network that extracts features based on graph-structured data. This can be achieved using spectral domain graph convolution or spatial domain graph convolution architectures, capturing topological relationships by aggregating node neighborhood information. Skeleton topology features refer to spatial structural features that characterize the connection relationships between glyph strokes. This can be achieved by constructing a stroke node graph and calculating the spatial distance between adjacent strokes. They are used to describe the connection order and spatial distribution patterns between strokes.
[0049] S2: Perform feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor.
[0050] Among them, the style factor refers to a dynamic parameter that controls the intensity of style injection. Specifically, it can be generated by extracting global style-related features through the Transformer encoder and then mapped by a multi-layer perceptron. It is used to adaptively adjust the style transformation amplitude of different font components.
[0051] See also Figure 4 , Figure 4 A specific implementation of step S2 is shown, which is described in detail as follows:
[0052] S21: Performing style feature extraction on the standardized style descriptor through a Transformer encoder to generate initial style features.
[0053] S22: Perform feature mapping on the initial style features through a multi-layer perceptron to generate the style-adaptive style factor.
[0054] Specifically, the standardized style descriptor is integrated into the tensor factor to generate the style factor using the following formula:
[0055]
[0056] Among them, MLP represents a multi-layer perceptron, which is used to encode the standardized style descriptor s, U (k) is the projection matrix, mapping the style code to the factor space, b (k) is the bias term, These are all style factors. This application enables the transformation parameters to be dynamically adjusted according to the input style. For example, when generating a "bold" style, the weight of the factors related to stroke width is automatically increased.
[0057] In the embodiments of the present application, the standardized style descriptor is first input into the Transformer encoder, the correlation weight between different feature positions is calculated through the self-attention mechanism, and the initial style feature containing global context information is aggregated. The feature is then input into the multi-layer perceptron for nonlinear spatial transformation, and the decoupling and reorganization of style attributes are realized through layer-by-layer weight adjustment, and finally the style factor with dynamic adaptability is output. In the two-stage processing architecture, the Transformer encoder solves the problem of fragmentation of style elements caused by the limitation of the local receptive field of the traditional convolutional network, and the multi-layer perceptron establishes a dynamic association mechanism between the style feature and the generated parameters through parameterized mapping. The present application realizes the global extraction of deep font style features and the adaptive generation of dynamic parameters, solves the problems of style element fragmentation and parameter rigidity in traditional methods, and improves the representation accuracy and generation flexibility of complex font styles.
[0058] The Transformer encoder refers to a deep neural network structure based on a self-attention mechanism, which can be implemented by a stacked structure containing multi-head attention layers and feedforward network layers, and is used to capture the global semantic association across regions in the font style descriptor. The multi-layer perceptron refers to a neural network module composed of fully connected layers and nonlinear activation functions, which can be implemented by a network architecture containing three hidden layers, and is used to map high-dimensional style features to a dynamic parameter space.
[0059] Further, to ensure the stability of training, the style factor The following initialization strategy is adopted, Without:
[0060] W (k) = Q (k) diag(λ (k) )
[0061] Where Q (k) is a random orthogonal matrix that maintains the orthogonality of the transformation, and λ (k) is a scaling factor generated by the truncated normal distribution. The initialization method of the present application avoids the problem of gradient explosion or disappearance caused by traditional random initialization.
[0062] S3: Obtain a data segmentation vector, and perform multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformed feature with injected style attributes.
[0063] Specifically, the data segmentation vector is a segmented feature vector of the input data, which is obtained by any pre-trained image encoder and represents some attributes of the font style (such as stroke width). The data segmentation vector is derived from font image coding during training and from noise segmentation during generation.
[0064] Further, the calculation formula of the transformed feature is:
[0065]
[0066] in, is the data segmentation vector, y1 is the transformation feature, ⊙ represents element-by-element multiplication, represents the outer product of tensors, and are the k-th style factor of the r-th rank, R is the rank of the multi-rank tensor decomposition, and K is the order of the tensor.
[0067] See also Figure 5 , Figure 5 A specific implementation of step S3 is shown, which is described in detail as follows:
[0068] S31: Obtain the data segmentation vector, and generate dynamic parameters based on the sub-vector paired with the style factor and the data segmentation vector through a multi-layer perceptron.
[0069] S32: Reconstructing a transformation tensor through multi-rank tensor decomposition based on the dynamic parameters to perform scale and translation transformation on the data segmentation vector to obtain the transformation feature of the injected style attribute.
[0070] Specifically, after the data segmentation vector is divided into several sub-vectors, each sub-vector and the corresponding style factor are input into a multi-layer perceptron to generate a dynamic parameter group containing scale and translation components. This dynamic parameter group is decomposed into multiple low-rank tensor components and reconstructed into a complete transformation tensor through outer product operations. This transformation tensor acts on the original data segmentation vector, realizes the scale transformation of the feature space through matrix multiplication, and completes the translation operation by combining element-by-element addition. The multi-rank decomposition structure allows different rank components to capture style attributes such as stroke thickness and corner radian respectively, and realizes multi-dimensional style injection by superimposing each rank component. The dynamic parameter generation mechanism automatically adjusts the weight distribution of each rank component according to the current style factor to ensure that the stroke features corresponding to different styles remain proportional and coordinated during the transformation process. This application realizes the dynamic adaptive generation of transformation parameters in the font generation process, solves the technical problem of stiff generation effect caused by mismatch between style attributes and transformation operators; realizes the layered injection of multi-dimensional style features through multi-rank tensor decomposition structure, overcomes the defect of insufficient feature expression ability of traditional single-rank method; maintains the geometric constraint relationship of glyph structure when implementing scale translation transformation, and avoids structural distortion during style injection process.
[0071] The data segmentation vector divides the input data into multiple sub-vectors with independent semantics. This can be achieved through sliding window segmentation or fully connected layer mapping, providing the basic input unit for subsequent feature transformations. A multi-layer perceptron (MLP) is a fully connected neural network with hidden layers. It can be implemented using a three-layer linear transformation structure with an activation function. It dynamically generates transformation parameters adapted to different sub-vectors based on style factors. A style factor is a latent space vector representing the stylistic characteristics of a font. It can be generated by extracting global style features through a Transformer encoder and then performing linear projection. It controls the generation direction of dynamic parameters. Dynamic parameters are learnable parameter groups consisting of scale factors and translation vectors. They can be generated through grouping fully connected layers to generate parameter components of different dimensions, driving feature transformations during tensor decomposition. Multi-rank tensor decomposition decomposes a high-order tensor into a combination of multiple low-rank tensors. This can be achieved through CP decomposition or Tucker decomposition, capturing multi-dimensional feature interactions while maintaining computational efficiency. A transformation tensor is a high-order data structure containing linear transformation parameters. It can be generated by reconstructing the decomposition terms through an outer product operation and then performing a weighted summation. It is used to apply geometric transformations to the data segmentation vector.
[0072] S4: The coupling strength between different attributes of the transformation feature is adjusted through a dynamic gating mechanism to generate a gated optimized feature.
[0073] Among them, the dynamic gating mechanism refers to a module that automatically generates adjustment weights based on local features. Specifically, it can generate multi-scale gating coefficients by calculating the similarity between the learnable template tensor and the current features, which is used to control the interaction intensity between different attributes.
[0074] Specifically, the dynamic gating mechanism is implemented by the following formula:
[0075] G (l) =σ(Conv1D(x1)*T (l) )
[0076] in, is the gated tensor of the lth scale, σ is the sigmoid function, which limits the output between 0 and 1; Conv1D represents a one-dimensional convolution operation for extracting local features. * represents a tensor contraction operation, T (l) is the learnable template tensor of the lth scale. The gated tensor G (l) Dynamically adjust the coupling strength between different attributes. For example, when generating serif fonts, the interaction weight between the serif area and the stroke connection can be enhanced.
[0077] See also Figure 6 , Figure 6 A specific implementation of step S4 is shown, which is described in detail as follows:
[0078] S41: extracting local structural features from the transformed features.
[0079] S42: Generate a multi-scale gating tensor based on the local structural features and the learnable template tensor.
[0080] S42: Perform feature weighted fusion on the multi-scale gating tensor and the transformation feature to generate the gated optimized feature.
[0081] Specifically, in the dynamic gating mechanism, a convolutional layer with a kernel size of 3×3 is first used to extract local structural features at the intersection of strokes within the transformed features, capturing information about the turning angles and connection point density of the strokes. These local features are then fed into a multi-scale interaction module constructed from a learnable template tensor. Gating weights with varying spatial resolutions are generated through an outer product operation. The template tensor is adaptively adjusted during training to match the glyph structure. Finally, the original transformed features are multiplied channel-by-channel by the gating weights, enhancing the coupling strength of style attributes at the end of the strokes and reducing it at the backbone region, thus achieving a balance between structural stability and style diversity during the feature fusion process.
[0082] Traditional font generation methods usually use a linear fusion method with fixed weights, which cannot dynamically adjust the feature coupling strength according to the regional characteristics of the glyph, and easily cause the strokes to stick together or break. However, this application constructs a dynamic gating mechanism through a learnable multi-scale template tensor, which can generate adaptive fusion weights based on local structural features, and accurately control the injection strength of style features while maintaining the integrity of the skeleton topology. This application effectively solves the problem that the coupling strength between different attributes of the transformation features is difficult to dynamically adjust during the font generation process. Through the combination of local structure perception and multi-scale gating mechanism, it avoids the stroke deformation caused by over-coupling and the style weakening caused by under-coupling, so that the generated font can achieve delicate style feature expression while retaining the standard glyph structure.
[0083] Among them, local structural features refer to key geometric features such as stroke turning points and connection areas extracted from font transformation features. Specifically, they can be implemented by using a convolutional neural network in conjunction with a dilated convolution operation, capturing the changes in stroke thickness and skeleton connection relationships through different receptive fields. A learnable template tensor refers to a parameterized tensor with a multi-scale structure. Specifically, it can be implemented by initializing a Gaussian distribution tensor and embedding it into a neural network for end-to-end training. It is used to establish a mapping relationship between glyph topological constraints and style features. A multi-scale gated tensor refers to a dynamic weight matrix generated by the interaction between local features and template tensors. Specifically, it can be generated by using a tensor outer product operation combined with a channel attention mechanism, which can allocate differentiated fusion weights according to the importance of stroke areas.
[0084] S5: Fusing the gated optimized features with the glyph structure embedding, and decoding the fused features to generate a target font image.
[0085] See also Figure 7 , Figure 7 A specific implementation of step S5 is shown, which is described in detail as follows:
[0086] S51: performing feature splicing on the gated optimized features and the glyph structure embedding to obtain the fused features.
[0087] S52: progressively upsampling the fused features through a glyph conditional decoder to obtain an initial font image.
[0088] S53: performing edge sharpening and anti-aliasing optimization processing on the initial font image to obtain the target font image.
[0089] Specifically, the feature splicing operation cross-modally fuses the style attribute features optimized by dynamic gating with the original glyph structure embedding to ensure the deep coupling of style features and structural features; the glyph conditional decoder is used to gradually upsample the fused features, and the font details are restored through layered feature mapping to avoid the loss of details caused by direct decoding; finally, the clarity of the stroke contour is enhanced by edge sharpening, and high-frequency noise is eliminated by combining anti-aliasing processing. The double composite optimization enables the generated font image to retain both structural integrity and smooth visual performance. The gradual upsampling process realizes feature reconstruction by gradually expanding the spatial resolution, and the synergistic effect of edge sharpening and anti-aliasing effectively solves the common artifact problem in the generative model. The present application effectively solves the image edge blur and jagged phenomenon caused by insufficient feature fusion and missing decoding details in the font generation process, ensures the deep coupling of style and structure through cross-modal feature splicing, restores the stroke details by using a layered upsampling reconstruction mechanism, and combines a composite post-processing algorithm to simultaneously optimize the contour clarity and transition smoothness, and finally generates a target font image with high fidelity.
[0090] Among them, feature splicing refers to the operation of connecting feature vectors from two different sources in the channel dimension or spatial dimension. Specifically, it can be implemented by channel cascading or spatial stacking, which is used to preserve the style attributes of the gated optimized features and the topological relationship in the glyph structure embedding. The glyph conditional decoder refers to the inverse feature mapping module built based on the generative adversarial network architecture. Specifically, it can be implemented by a conditional generator with a dynamic convolution kernel, which is used to recover the detailed texture of the font image from the fused features. Progressive upsampling refers to the process of gradually improving the spatial resolution through multi-stage feature amplification operations. Specifically, it can be implemented by alternating stacking structures of transposed convolution layers and pixel shuffling layers to reconstruct the local structure of the font image in layers. Edge sharpening refers to the processing algorithm that enhances the contrast of stroke contours in the image. Specifically, it can be implemented by the Laplacian operator or unsharp mask algorithm to eliminate the edge blurring caused by upsampling. Anti-aliasing optimization processing refers to the operation of reducing jagged artifacts caused by high-frequency signal aliasing. Specifically, it can be implemented by Gaussian filtering or sub-pixel convolution algorithm to smooth the transition areas of font curves.
[0091] In the dynamic financial document generation system in the FinTech sector, the pain point is that financial institutions need to generate a large number of personalized reports (such as customer statements and risk assessments). Traditional template fonts are monotonous and cannot dynamically adjust visual presentation based on content importance. Input: style descriptor \mathbf{s}s: {Seriousness = 0.9, Key Data Prominence = 0.8} (e.g., risk warnings use bold serif fonts), and input: glyph structure \mathbf{g}g: standard financial terminology encoding (e.g., the skeleton structure of "annualized rate of return"). Output: adaptive document—key data is automatically rendered in a bold serif font, while auxiliary explanations use a thin sans serif font, enhancing the sense of information hierarchy. Advantage: A multi-scale gating mechanism dynamically adjusts stroke weight, ensuring that numbers (such as "12.5%") remain fuzzy when printed at reduced size. In the automated annotation scenario of medical imaging reports, the pain point is that the annotated text in CT / MRI images must be clearly readable against low-contrast backgrounds and not obscure anatomical structures. In this scenario, the input is s: {background brightness = 0.3, urgency = 0.9} (red alert font), and the input g: a compact skeleton of the anatomical part name (e.g., "left ventricle"). The output is adaptively annotated text—a bold font with a reversed font for dark areas and a thin font for bright areas, automatically avoiding key anatomical points. Advantage: The glyph conditional decoder ensures that characters remain distorted when deforming on curved organ surfaces (e.g., fitting blood vessel labels).
[0092] In an embodiment of the present application, a font style descriptor and glyph structure data are obtained, and the font style descriptor and the glyph structure data are preprocessed to generate a standardized font style descriptor and glyph structure embedding; the standardized style descriptor is subjected to feature extraction and dynamic parameter generation processing to generate a style factor; a data segmentation vector is obtained, and the data segmentation vector is subjected to multi-rank tensor decomposition based on the style factor to obtain a transformation feature that injects style attributes; the coupling strength between different attributes of the transformation feature is adjusted through a dynamic gating mechanism to generate a gated optimized feature; the gated optimized feature is feature fused with the glyph structure embedding, and the fused feature is decoded to generate a target font image. The embodiment of the present invention achieves refined coupling of style attributes and structural features through multi-rank tensor decomposition and dynamic gating mechanisms, combines graph convolutional networks and Transformer encoders to process structural features and style features respectively, effectively solving the technical problems of insufficient style control accuracy and difficulty in structure preservation in traditional methods, and has the advantages of generating fonts with high visual quality and rich style diversity.
[0093] Please refer to Figure 8 , as a response to the above Figure 2 The present application provides an embodiment of a font generation device based on a tensor high-order coupling layer. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0094] like Figure 8 As shown, the font generation device based on the tensor high-order coupling layer of this embodiment includes: a data acquisition module 61, a style factor generation module 62, a transformation feature generation module 63, a coupling strength adjustment module 64 and a font image generation module 65, wherein:
[0095] A data acquisition module 61 is used to acquire font style descriptors and glyph structure data, and pre-process the font style descriptors and glyph structure data to generate standardized font style descriptors and glyph structure embeddings;
[0096] A style factor generation module 62 is configured to perform feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor;
[0097] A transformation feature generation module 63 is configured to obtain a data segmentation vector and perform multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformation feature that injects style attributes;
[0098] A coupling strength adjustment module 64 is configured to adjust the coupling strength between different attributes of the transformation feature through a dynamic gating mechanism to generate a gated optimized feature;
[0099] The font image generation module 65 is configured to fuse the gated optimized features with the glyph structure embedding, and decode the fused features to generate a target font image.
[0100] Furthermore, the data acquisition module 61 includes:
[0101] A font data acquisition unit, configured to acquire the font style descriptor and the font structure data;
[0102] a normalization processing unit, configured to normalize the font style descriptor to generate the standardized font style descriptor;
[0103] The feature extraction unit is used to extract the skeleton topology features of the glyph structure data through a graph convolutional network to obtain the glyph structure embedding of a low-dimensional embedding vector.
[0104] Furthermore, the style factor generation module 62 includes:
[0105] A style feature extraction unit, configured to extract style features from the standardized style descriptor using a Transformer encoder to generate initial style features;
[0106] The feature mapping unit is used to perform feature mapping on the initial style features through a multi-layer perceptron to generate the style factor of style adaptation.
[0107] Furthermore, the transformation feature generation module 63 includes:
[0108] a dynamic parameter generating unit, configured to obtain the data segmentation vector and generate dynamic parameters based on a sub-vector paired with the style factor and the data segmentation vector through a multi-layer perceptron;
[0109] A tensor reconstruction unit is used to reconstruct a transformation tensor through multi-rank tensor decomposition based on the dynamic parameters, so as to perform scale and translation transformation on the data segmentation vector to obtain the transformation feature of the injected style attribute.
[0110] Furthermore, the coupling strength adjustment module 64 includes:
[0111] A local structural feature extraction unit, configured to extract local structural features from the transformed features;
[0112] A multi-scale gated tensor generation unit, configured to generate a multi-scale gated tensor based on the local structural features and the learnable template tensor;
[0113] A weighted fusion unit is used to perform feature weighted fusion on the multi-scale gated tensor and the transformed features to generate the gated optimized features.
[0114] Furthermore, the calculation formula of the transformation feature is:
[0115]
[0116] in, is the data segmentation vector, y1 is the transformation feature, ⊙ represents element-by-element multiplication, represents the outer product of tensors, and are the k-th style factor of the r-th rank, R is the rank of the multi-rank tensor decomposition, and K is the order of the tensor.
[0117] Furthermore, the font image generation module 65 includes:
[0118] A feature splicing unit, configured to perform feature splicing on the gated optimized feature and the glyph structure embedding to obtain the fused feature;
[0119] an upsampling unit, configured to gradually upsample the fused features through a glyph conditional decoder to obtain an initial font image;
[0120] The image optimization unit is used to perform edge sharpening and anti-aliasing optimization processing on the initial font image to obtain the target font image.
[0121] To solve the above technical problems, the present application also provides a computer device. Figure 9 , Figure 9 This is a basic structural block diagram of the computer device in this embodiment.
[0122] The computer device 7 includes a memory 71, a processor 72, and a network interface 73 that are interconnected through a system bus. It should be noted that Figure 9 Only a computer device 7 having three components, memory 71, processor 72, and network interface 73, is shown. However, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead. It should be understood by those skilled in the art that a computer device herein is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes 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.
[0123] Computer devices can be desktop computers, laptops, PDAs, cloud servers, etc. Computer devices can interact with users through keyboards, mice, remote controls, touchpads, or voice-activated devices.
[0124] The memory 71 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory 71 may be an internal storage unit of the computer device 7, such as the hard disk or memory of the computer device 7. In other embodiments, the memory 71 may also be an external storage device of the computer device 7, such as a plug-in hard disk, a SmartMedia Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on the computer device 7. Of course, the memory 71 may also include both the internal storage unit of the computer device 7 and its external storage devices. In this embodiment, the memory 71 is generally used to store the operating system and various application software installed on the computer device 7, such as the program code of the font generation method based on the tensor high-order coupling layer. In addition, the memory 71 can also be used to temporarily store various types of data that have been output or are to be output.
[0125] In some embodiments, processor 72 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. Processor 72 is typically used to control the overall operation of computer device 7. In this embodiment, processor 72 is used to execute program code stored in memory 71 or process data, such as executing the program code of the aforementioned tensor high-order coupling layer-based font generation method to implement various embodiments of the tensor high-order coupling layer-based font generation method.
[0126] The network interface 73 may include a wireless network interface or a wired network interface. The network interface 73 is generally used to establish a communication connection between the computer device 7 and other electronic devices.
[0127] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores a computer program, and the computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned font generation method based on tensor high-order coupling layer.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of each embodiment of the present application.
[0129] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of protection of the present application.
Claims
1. A font generation method based on tensor high-order coupling layer, characterized in that: include: Obtaining a font style descriptor and glyph structure data, and preprocessing the font style descriptor and the glyph structure data to generate a standardized font style descriptor and glyph structure embedding; Performing feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor; Obtaining a data segmentation vector, and performing multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformation feature of the injected style attribute; Adjusting the coupling strength between different attributes of the transformation feature through a dynamic gating mechanism to generate gated optimized features; The gated optimized features are fused with the glyph structure embedding, and the fused features are decoded to generate a target font image.
2. The font generation method based on tensor high-order coupling layer according to claim 1, characterized in that: The obtaining of the font style descriptor and the glyph structure data, and preprocessing the font style descriptor and the glyph structure data to generate a standardized font style descriptor and glyph structure embedding, includes: Obtaining the font style descriptor and the glyph structure data; Normalizing the font style descriptor to generate the standardized font style descriptor; The skeleton topological features of the glyph structure data are extracted through a graph convolutional network to obtain a glyph structure embedding of a low-dimensional embedding vector.
3. The font generation method based on tensor high-order coupling layer according to claim 1, characterized in that: The step of performing feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor includes: Performing style feature extraction on the standardized style descriptor through a Transformer encoder to generate initial style features; The initial style features are subjected to feature mapping by a multi-layer perceptron to generate the style factor of style adaptation.
4. The font generation method based on tensor high-order coupling layer according to claim 1, characterized in that: The acquiring of the data segmentation vector and performing multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformation feature of the injected style attribute includes: Obtaining the data segmentation vector, and generating dynamic parameters based on a sub-vector paired with the style factor and the data segmentation vector through a multi-layer perceptron; A transformation tensor is reconstructed by multi-rank tensor decomposition based on the dynamic parameters to perform scale and translation transformation on the data segmentation vector to obtain the transformation feature injected with style attributes.
5. The font generation method based on tensor high-order coupling layer according to claim 1, characterized in that: The method of adjusting the coupling strength between different attributes of the transformation feature through a dynamic gating mechanism to generate gated optimized features includes: extracting local structural features from the transformed features; generating a multi-scale gating tensor based on the local structural features and the learnable template tensor; The multi-scale gating tensor and the transformation feature are subjected to feature weighted fusion to generate the gated optimized feature.
6. The font generation method based on tensor high-order coupling layer according to claim 1, characterized in that: The calculation formula of the transformation feature is: in, is the data segmentation vector, y1 is the transformation feature, ⊙ represents element-by-element multiplication, represents the outer product of tensors, and are the k-th style factor of the r-th rank, R is the rank of the multi-rank tensor decomposition, and K is the order of the tensor.
7. The font generation method based on tensor high-order coupling layer according to any one of claims 1 to 6, characterized in that: The step of fusing the gated optimized features with the glyph structure embedding and decoding the fused features to generate a target font image includes: Perform feature splicing on the gated optimized features and the glyph structure embedding to obtain the fused features; Stepwise upsampling of the fused features is performed through a glyph conditional decoder to obtain an initial font image; The initial font image is subjected to edge sharpening and anti-aliasing optimization processing to obtain the target font image.
8. A font generation device based on a tensor high-order coupling layer, characterized in that: include: A data acquisition module, configured to acquire font style descriptors and glyph structure data, and pre-process the font style descriptors and glyph structure data to generate standardized font style descriptors and glyph structure embeddings; A style factor generation module is configured to perform feature extraction and dynamic parameter generation processing on the standardized style descriptor to generate a style factor; a transformation feature generation module, configured to obtain a data segmentation vector and perform multi-rank tensor decomposition on the data segmentation vector based on the style factor to obtain a transformation feature that injects style attributes; A coupling strength adjustment module, configured to adjust the coupling strength between different attributes of the transformation feature through a dynamic gating mechanism to generate gated optimized features; The font image generation module is used to fuse the gated optimized features with the glyph structure embedding, and decode the fused features to generate a target font image.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the font generation method based on a tensor high-order coupling layer as claimed in any one of claims 1 to 7 is implemented.
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 a tensor high-order coupling layer according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Image restoration method and related equipment
CN121563838A