A controllable visual text generation system based on decoupled rendering diffusion

By decoupling rendering diffusion into a controllable visual text generation system, the text generation process is separated into three independent modules: layout, glyphs, and style. This solves the problem of multi-task coupling in existing technologies, improves the controllability of text accuracy and style, and adapts to the diverse needs of commercial design.

CN123181631APending Publication Date: 2026-11-27SHENZHEN ZHIXIANG FUTURE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610997859.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-06
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing visual text generation models cannot simultaneously meet the commercial design requirements of high text recognition accuracy, free and controllable layout, high fidelity to reference fonts, mixed layout of multiple fonts, and stable generation of long and short texts. They suffer from problems such as multi-task coupling, inability to balance character accuracy and font style, distortion in reconstruction of small fonts/long texts, and lack of differentiated style control for multiple text units.

Method used

A controllable visual text generation system based on decoupled rendering diffusion is adopted, which is divided into a layout generation module, an initial glyph generation module, a style encoding module, a stylized glyph rendering module, and an image generation module. Combined with glyph recombination, style-aware optimization, and multi-style combination modules, the system achieves decoupled control of text spatial arrangement, fine-grained font style, and background semantics through independent training and inference.

Benefits of technology

It achieves simultaneous improvement in text accuracy and style controllability, adapts to small font size and ultra-long text with lossless reconstruction, supports multi-font layered rendering, meets the diverse needs of commercial design, and improves text recognition accuracy and style consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123181631A_ABST
    Figure CN123181631A_ABST
Patent Text Reader

Abstract

The application discloses a controllable visual character generation system based on decoupled rendering diffusion, which is divided into five basic modules of layout generation, initial glyph, style coding, glyph rendering and image generation, and is matched with glyph reorganization, style perception optimization and multi-style combination expansion modules. The application splits character generation into three-stage decoupled processing of layout prediction, stylized glyph rendering and semantic image synthesis; designs a font special contrast learning style encoder, optimizes the rendering network through OCR-style double-reward optimization, and additionally adds an intermediate canvas glyph reorganization and multi-style parallel rendering module. The application solves the defects of the prior art that character precision and font style cannot be considered simultaneously, small size / long text distortion and single font support in a single image, greatly improves the accuracy of artistic character generation and the degree of style restoration, and is suitable for poster, advertisement and brand design automatic generation scenes, and the modules can be independently replaced and have strong engineering expansibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of multimodal image generation and diffusion model visual text generation technology, and specifically relates to a controllable visual text generation system based on decoupled rendering diffusion. Background Technology

[0002] The existing mainstream visual text generation technologies in the industry can be divided into three categories, and their respective technical architectures and inherent limitations are described below: The first category: Native general-purpose text-to-image diffusion models directly generate images containing text. This type of solution has no independent text control branch, relying solely on the semantic constraints of prompt words to determine text content, position, and font. The model needs to simultaneously complete four optimization objectives: global image semantic modeling, text region spatial localization, single-character glyph structure reconstruction, and font style transfer. Multi-task coupled training leads to the model weights being unable to simultaneously consider the convergence of multi-objective losses. In scenarios where text length exceeds 10 characters, font size is less than 1 / 12 of the image size, or artistic decorative fonts are used, the character recognition accuracy is below 60%, with frequent issues such as stroke adhesion, character missingness, and text rotation misalignment. It is only suitable for generating extremely short sentences and standard undecorated fonts such as boldface and serif, failing to meet commercial design needs.

[0003] The second type: Mask / Text Box / Standard Font Condition-Guided Generation Architecture. This type of solution adds a binary text mask, character edge map, and standard vector font map as spatial constraints to the diffusion model input. By controlling the branches, it locks the pixel range of the text region, improving the text position and the integrity of the basic font structure to some extent. However, this type of solution only uses unstylized standard printed fonts as the constraint source. The conditional input does not carry artistic font features such as stroke texture, contour curvature, 3D material, and gradient shadow. The generated text can only restore the basic character skeleton and cannot transfer personalized decorative fonts, retro calligraphy fonts, or brand-customized 3D fonts from the reference image. If artistic fonts are replaced as the mask input, pixel noise and irregular edges in the mask image will cause oscillations in the diffusion network training, resulting in font collapse. At the same time, this architecture requires users to manually draw text box masks, lacks automated layout capabilities, has high interaction costs, and cannot generate multi-format posters in batches.

[0004] The third category: Joint style-encoding text generation models. This architecture adds an independent style encoder to extract visual features from reference images, and integrates style features with text generation and background image generation into the same diffusion network for unified training. This approach suffers from underlying coupling defects: the gradients of the three loss functions—text structure reconstruction loss, font style similarity loss, and global image semantic matching loss—interfere with each other, making it difficult for the model to balance the three optimization objectives; the general visual encoder's training objective is global image semantic matching, resulting in weak extraction capabilities for fine-grained features such as font stroke thickness, decorative patterns, rounded corners, and gradient colors, leading to insufficient style transfer similarity; there is no dedicated reconstruction optimization strategy for ultra-long text and small-sized text, resulting in severe pixel information loss during low-resolution text latent variable decoding, and significant character adhesion and stroke breakage phenomena; furthermore, the globally unified style encoding cannot assign independent styles to different text units such as titles, subtitles, body text, and slogans within an image, resulting in only a single font text being generated per image, making it extremely unsuitable for multi-font layered design scenarios in commercial posters.

[0005] The three current mainstream solutions have not achieved the decoupling of the three stages of layout planning, stylized font rendering, and global image semantic synthesis. They cannot independently control the training and inference processes of the three major modules of text spatial arrangement, fine-grained font style, and background image semantics. They lack dedicated reward training strategies for font optimization, small-sized text intermediate canvas recombination inference mechanisms, and multi-text unit style-based parallel rendering architectures. They cannot simultaneously meet the five major commercial design requirements of high text recognition accuracy, free and controllable layout, high fidelity to reference fonts, mixed layout of multiple fonts, and stable generation of long and short texts, which has become a key technical obstacle to the implementation of controllable visual text generation. Summary of the Invention

[0006] To address the technical shortcomings of existing visual text generation models, such as multi-task coupling, inability to balance character precision and font style, distortion in small-sized / long text reconstruction, lack of differentiated style control for multiple character units, and style encoder ignoring fine-grained font features, this invention provides a controllable visual text generation system based on decoupled rendering diffusion.

[0007] To achieve the above objectives, this invention provides the following technical solution: a controllable visual text generation system based on decoupled rendering diffusion. The overall hardware carrier is an image generation server equipped with GPU computing power. The software architecture consists of five basic modules and three types of optional extended sub-modules. The five basic modules are: layout generation module, initial glyph generation module, style encoding module, stylized glyph rendering module, and image generation module. The three types of optional extended sub-modules are: glyph recombination module, style-aware optimization module, and multi-style combination module. Each module's hardware relies on the server's GPU parallel computing unit, and the modules transmit image latent variables, text features, style features, and layout coordinate tensors between each other through the video memory tensor channel.

[0008] Layout generation module: Input user prompt text, build-in text semantic parsing unit and text layout prediction network, output set of text units to be rendered and spatial layout tensor of each text unit; spatial layout tensor contains numerical matrices of text box coordinates, size, rotation angle, character spacing and line spacing. Initial glyph generation module: Receives a set of character units and a spatial layout tensor, and outputs a black and white standard glyph mask image. The standard glyph mask fixes the character skeleton structure and spatial arrangement. Style Encoding Module: Input one or more reference style images, build a dedicated font style visual encoder and query transformation sub-network, and output a standardized style feature tensor with the cross attention layer of the adaptation diffusion network; The font style visual encoder is pre-trained by contrast learning of positive and negative font samples to extract fine-grained features of strokes, contours, textures and colors. Stylized glyph rendering module: Built-in diffusion transformer and glyph control branch. The glyph control branch inputs standard glyph mask to generate glyph constraint features; the diffusion transformer receives noisy glyph latent variables, text semantic features and style feature tensors, and injects style features into the denoising inference process through multi-layer cross attention, and outputs a complete stylized glyph image. Image generation module: It adopts a conditional diffusion flow matching network, takes stylized glyph images and original user prompt text as input, encodes the glyph images into glyph latent variables and fuses them with the latent variable channels of noisy target images, and outputs a complete target generated image carrying accurate text elements; Optional glyph reconstruction module: Built-in temporary canvas generation unit, OCR verification unit, and spatial transformation unit. For small font size and ultra-long text, multiple candidate glyphs are first generated on the medium-sized canvas. After OCR filters the candidate with the highest matching degree, the glyphs are reconstructed into standard-sized stylized glyph images through scaling and perspective transformation. Optional style-aware optimization module: Built-in OCR recognition unit, style similarity calculation unit, and strategy gradient update unit; batch sampling of multiple sets of stylized glyph candidate images; calculation of OCR matching reward and style similarity reward weighted total reward; and back-updating the network weight of the stylized glyph rendering module after normalization advantage. Optional multi-style combination module: Receives multiple sets of independent reference style images and multiple sets of text unit layout tensors, generates multiple sets of differentiated style glyph sub-images in parallel across channels, fuses all sub-images based on the spatial coordinate tensors of each text unit, and outputs a unified global multi-style glyph control map which is then sent to the image generation module.

[0009] The system includes a training data construction unit that collects real-world images containing text, generates text mask annotations through text detection and OCR segmentation, and generates image-text matching prompts by combining a multimodal description model, thus constructing a joint training dataset for the modules.

[0010] The network selection for each module can be replaced independently: the layout generation module uses a large language sequence prediction network or an object detection network; the stylized glyph rendering module and the image generation module use a diffusion transformer, U-Net, and a flow matching generation network; the style encoding module uses a convolutional visual transformer and a multi-layer convolutional encoder.

[0011] The beneficial effects of this invention are: 1. This invention physically breaks down the complete visual text generation process into three stages: layout prediction, stylized glyph rendering, and semantic image synthesis. Each stage is equipped with three core modules that are independent, trainable, and capable of independent inference. Each module focuses on a single optimization objective, eliminating interference from multi-task loss gradients. The layout generation module is dedicated to predicting the spatial arrangement of text units; the stylized glyph rendering module is dedicated to fusing reference font styles under standard character skeleton constraints to output a complete stylized glyph control map; the image generation module only performs background semantic synthesis based on mature glyph images and no longer participates in the inference and calculation of text structure and style. This achieves simultaneous improvement in text accuracy and style controllability from the underlying architecture.

[0012] 2. This invention designs a dedicated style visual encoder for fine-grained font features, which differs from general image encoders. It uses paired font image samples for comparative learning training, focusing on extracting font-specific features such as stroke curvature, thickness, texture, shadow, and three-dimensional material. At the same time, it constructs a two-dimensional reward function, using OCR text recognition matching degree and font style cosine similarity to jointly construct the reward value. It adopts a reinforcement learning strategy to gradient update the glyph rendering diffusion network, which solves the defect of traditional reconstruction loss that cannot take into account both character readability and style restoration, and greatly improves the consistency of artistic font generation.

[0013] 3. To address the distortion issues of small font sizes and ultra-long texts, this invention adds a character reorganization reasoning logic: first, candidate character shapes are generated on a temporary canvas of intermediate size; after OCR selection of high-matching character units, they are scaled and perspective transformed to the target layout size for reorganization, avoiding the loss of low-resolution pixels; a multi-style combination submodule is added, which supports binding independent reference style maps to different text units within an image, generating multiple sets of differentiated style character shape sub-maps in parallel across channels, and then merging them into a unified global character shape control map, realizing multi-font layered rendering of a single image, adapting to multi-element design scenarios in posters and advertisements. Attached Figure Description

[0014] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This is a flowchart illustrating the overall architecture of the controllable visual text generation system based on decoupled rendering diffusion, as described in this invention. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0017] like Figure 1 As shown, the underlying hardware of the system of this invention is an 8-card NVIDIA A100 80G cloud image generation server. The server is equipped with 2 AMD EPYC 7742 CPUs, 1TB of memory, and 4TB of NVMe high-speed storage. The hardware resource allocation logic is as follows: GPU computing power allocation: GPU0 and GPU1 are dedicated to running the layout generation module and the initial glyph generation module; GPU2 and GPU3 are dedicated to running the style encoding module and the style-aware optimization module; GPU4 and GPU5 are dedicated to running the stylized glyph rendering module (with the highest memory usage for diffusion inference); GPU6 and GPU7 are dedicated to running the image generation module, the glyph recombination module, and the multi-style combination module; tensor data between modules is transmitted via high-speed interconnection through the server NVLink, with latency of less than 8ms for latent variables and image tensors, meeting the requirements of real-time image generation inference.

[0018] Storage resource allocation: NVMe storage partitions are divided into three storage pools: The first storage pool stores the training dataset (including millions of text-annotated images and font style reference atlases); the second storage pool stores the pre-trained weight files for each module (layout prediction weights, font style encoder weights, glyph rendering diffusion weights, and image generation stream matching weights); the third storage pool caches inference intermediate tensors, temporary canvas glyph images, and generated target images. There is an automatic cache cleanup mechanism, and the storage threshold is set to 3TB. Files cached more than 72 hours ago will be automatically deleted if the threshold is exceeded.

[0019] CPU and memory resource allocation: The CPU core is responsible for text semantic parsing, OCR text recognition, style similarity cosine calculation, policy gradient loss calculation, and data annotation preprocessing; 1TB of memory is divided into independent memory pools for each module to avoid memory contention caused by multiple module tensors, which can lead to inference lag. The maximum memory allocation limit for a single module is 128GB, which is suitable for high-resolution 4K image generation tasks.

[0020] The software uses the PyTorch 2.3 deep learning framework and CUDA 12.2 for accelerated computing. Each module is encapsulated as an independent Docker container, and tensor data is transferred between containers through the gRPC interface. It supports horizontal scaling of distributed multi-server clusters. In enterprise-level batch poster generation scenarios, it can be scaled up to a 32-card cluster, generating more than 1,200 4K text posters per hour.

[0021] The module input is the user's natural language prompt text, which contains two types of information: a global image description and the text content to be generated (the text content is marked with double quotes to facilitate extraction by the semantic parsing unit).

[0022] Internal network selection example: The layout prediction network is composed of an LLaMA2-7B sequence prediction network and a YOLOv8 text detection head. The text semantic parsing unit identifies text units within quotation marks through regular expressions, splits independent text entries, and outputs a list of text units. The sequence prediction network learns the mapping relationship between text units and image spatial coordinates, and outputs a spatial layout tensor with dimensions [N,6], where N is the number of text units. The 6 columns of the tensor correspond to: the x-coordinate of the top left corner of the text box, the y-coordinate of the top left corner, the x-coordinate of the bottom right corner, the y-coordinate of the bottom right corner, the rotation angle θ, and the font size scaling factor s.

[0023] Network training dataset construction: Collect 1 million commercial posters and advertising images, extract all text in the images through OCR recognition, manually annotate the coordinates, rotation angle, and font size of the text boxes, and generate image and text prompts by pairing them to form a dedicated training set for layout; the loss function adopts L1 coordinate loss and cross-entropy font size classification loss, iterates training for 300 epochs, the initial learning rate is 1e-4, and cosine annealing decay is used.

[0024] Inference process: Step 1: Input prompt text, extract all text units to be rendered using regular expression parsing; Step 2: Sequence prediction network outputs the original coordinate tensor; Step 3: Coordinates are normalized to [0,1] relative image coordinates to adapt to image generation at any resolution; Step 4: Output the list of text units and normalize the spatial layout tensor to the initial glyph generation module.

[0025] Input: List of text units, normalized spatial layout tensor; Output: 2048×2048 resolution black and white standard character mask image.

[0026] The embodiment uses the open-source Source Han Sans standard vector font library as the basic rendering source for the glyphs. Relying on the OpenCV vector rendering unit, it renders each character to a blank canvas according to the coordinates, rotation, and scaling parameters within the layout tensor. All characters are filled with pure white, and the canvas background is pure black, forming a binary mask image. Only the standard character skeleton is retained, without any font decoration, color, or texture features.

[0027] Core function: Provides rigid character structure constraints for subsequent stylized glyph rendering modules. No matter what style features are injected later, the diffusion network cannot modify the basic strokes of the characters within the mask or the order of the text layout, thus eliminating typos, reversed text order, and misaligned layout issues from the bottom up.

[0028] Parameter configuration: The mask image resolution is fixed at 2048×2048, the number of channels is 1 (single-channel grayscale image), the anti-aliasing level for character rendering is 4, and bilinear interpolation is used for rotation interpolation to ensure smooth and jagged character edges, providing accurate structural constraints for subsequent diffusion rendering.

[0029] The module consists of two sub-networks: a visual encoder and a query transform sub-network. The input is a single or multiple reference style images (the resolution is uniformly scaled to 1024×1024). The output dimension is a standardized style feature tensor of [1,512], which is adapted to the input dimension of the diffusion transform cross attention layer.

[0030] Implementation of font-specific visual encoder pre-training: Unlike the general CLIP image encoder, this encoder is trained using a font pairwise contrast learning dataset. The dataset is constructed according to the following rules: positive sample pairs = font images of the same character, same font, but different colors / sizes; negative sample pairs = same character, different fonts; different characters, same font; different characters, different fonts. The total number of training sample pairs is 8 million, covering six major categories of fonts: calligraphy fonts, 3D fonts, gradient fonts, retro printing fonts, cartoon decorative fonts, and metallic brand fonts.

[0031] The encoder backbone network employs the ViT-B / 16 visual transformer, removing the global pooling layer and adding a font local feature aggregation head to aggregate four types of local features: stroke edges, contour curvature, texture pixels, and color histograms. The loss function used is InfoNCE contrastive loss, with 200 epochs of training and a learning rate of 5e-5. After training, the encoder's ability to extract fine-grained font features is significantly better than the general CLIP, with a mean increase of 0.28 in the cosine similarity of image features for the same font style.

[0032] Query transformation subnetwork implementation: The visual encoder outputs the original image feature dimensions [64,768]. The query transformation subnetwork consists of three fully connected layers with layer normalization, which maps the original image features into a matrix of query features, key features, and value features adapted by the diffusion network. It outputs a standardized style feature tensor F, which is directly fed into the cross-attention layer of the stylized glyph rendering module.

[0033] Multi-reference style image fusion logic: When multiple reference style images are input, multiple sets of style feature tensors are encoded and generated respectively. These are then fused into a unified comprehensive style tensor through mean pooling to achieve mixed reference font style transfer.

[0034] This is the core intermediate module of the three-stage decoupling architecture of the present invention. Inputs: standard glyph mask, style feature tensor, semantic embedding of user prompt text, and random noise latent variables; Output: 2048×2048 resolution RGB three-channel stylized glyph image, the image retains only the pixels of the text area, the background is black, and it fully carries the character skeleton, reference font style texture, color, and three-dimensional decoration.

[0035] The module has a dual-branch structure: a character shape control branch and a diffusion converter generation branch.

[0036] Character shape control branch process: Input a single-channel standard character shape mask, and generate an 8×8 resolution character shape constraint feature map with 128 channels through four layers of convolution downsampling; This constraint feature is embedded in each layer of the diffuse transformer decoder throughout the process, and the character space structure is locked through residual connection. No step in the diffuse denoising process can modify the character position and basic stroke shape within the mask.

[0037] Diffusion converter generation branch implementation: The network employs a flow-matching-based diffusion transformer architecture with 24 layers, each layer containing 16 multi-head cross-attention heads; the cross-attention injection formula for each layer is as follows: In the formula: i represents the layer index in the generator network. Let F represent the intermediate hidden state of the i-th layer, and let F represent the style feature corresponding to the reference style image. , and This represents the trainable projection parameters.

[0038] Training process: Step 1: Extract the pure text region image x0 from the labeled dataset and encode it into the latent variable space; Step 2: Randomly sample time steps t∈[0,1] and add Gaussian noise to generate noisy latent variables. ε represents standard normal distribution noise; Step 3: Input xt to the network, embedding the time step, character shape constraint features, text semantic embedding, and style features F; Step 4: The network predicts the flow matching velocity field, using flow matching loss and character shape reconstruction L2 loss for joint training; Step 5: Backpropagation updates all weights of the network.

[0039] Inference process: Gaussian noise latent variables are randomly initialized, 50-step flow matching denoising inference is performed, style features are injected at each step with cross attention, character skeletons are locked throughout the glyph constraint branch, and finally RGB stylized glyph images are decoded and output.

[0040] This module is only responsible for global background semantic synthesis and no longer participates in text structure and font style reasoning, which greatly reduces the optimization difficulty. Input: RGB stylized glyph image, original user prompt text; Output: 4K (3840×2160) complete target image.

[0041] Network selection: Stream matching conditional diffusion U-Net, with a built-in dual-channel conditional fusion unit. The first channel embeds the input prompt text CLIP text, and the second channel encodes the stylized glyph image into glyph latent variables, which are then concatenated and fused with the latent variables of the noisy target image in the channel dimension.

[0042] Training logic: The training samples are the original poster images and the corresponding glyph images of the text regions; Step 1: The original image is encoded as the target latent variable, and noise is added to generate noisy latent variables; Step 2: The glyph images are encoded as glyph conditional latent variables; Step 3: The network receives the noisy latent variables, text embeddings, and glyph conditional latent variables, and predicts the flow matching velocity field; Step 4: The loss is calculated only for global image semantic reconstruction, without text-related loss terms, which improves the training convergence speed by 40%.

[0043] Reasoning advantages: The latent variables of the character shape condition already contain accurate text content, layout, and font style. The image generation network only needs to generate the background, objects, lighting, and colors that match the prompt text around the text area. There will be no text distortion or style deviation. The text and background image blend naturally and uniformly.

[0044] Font Recombination Module (An innovative module to solve the distortion of small font sizes and ultra-long texts) Applicable scenarios: rendering of very long texts where the target size of the text unit is less than 1 / 12 of the image and the number of characters in a single group of text is greater than 30.

[0045] Complete reasoning steps: Step 1: Initialize the temporary canvas: Set the resolution of the intermediate canvas to 1024×1024 (much larger than the target small font size in pixels), and generate 3 candidate stylized glyph sub-images in the temporary canvas according to the layout tensor ratio; Step 2, OCR accuracy verification: The open-source PP-OCRv4 is used to recognize the text in three candidate sub-images. The edit distance between the recognized text and the target text is calculated respectively, and the optimal candidate glyph image with the smallest edit distance and the highest matching degree is selected. Step 3, Spatial geometric transformation: Based on the coordinates, scaling factor, and rotation angle of the original spatial layout tensor, perform bilinear scaling, rotation transformation, and perspective correction on the optimal candidate glyphs, mapping them to the corresponding text box size of the target image; Step 4, Pixel fusion and recombination: Cache the transformed single character unit glyphs to the global canvas, traverse all character units to complete the recombination, and output a complete and lossless stylized glyph image to the image generation module.

[0046] Quantitative effect verification: For 32×32 pixel ultra-small font text, the character adhesion rate was 92.6% when the reorganization module was not enabled, and it dropped to 10.3% after enabling it, with a significant improvement in the integrity of character strokes; for 60-character ultra-long text, the rate of missing characters and misspellings decreased from 48.2% to 3.5%.

[0047] The style-aware optimization module iteratively fine-tunes the training of the stylized glyph rendering module, building a closed-loop self-optimizing training pipeline that eliminates the need for manual annotation of font style matching tags.

[0048] Execution steps: Step 1, Batch Sampling: Under the same group of text units and the same reference style, sample 8 candidate stylized glyph images at once; Step 2, Two-Dimensional Reward Calculation: ① OCR Recognition Reward Rocr: PP-OCR recognizes candidate image text and calculates the accuracy of matching the recognized text with the target text, with a value range of [0,1]. ② Style similarity reward Rstyle: The candidate glyph image and the reference style image are fed into the font-specific style encoder to calculate the feature cosine similarity, with a value range of [0,1]. The total reward weighting formula is: R_total = 0.6×Rocr + 0.4×Rstyle. The weights can be adjusted according to the scenario (Rocr weight is increased to 0.8 for printed font scenarios and Rstyle weight is increased to 0.6 for artistic font scenarios). Step 3, Normalized advantage calculation: Calculate the mean μ and standard deviation σ of the total reward for the 8 candidate maps, and the advantage of a single candidate map A = (R_total-μ) / (σ+1e-6); Step 4, Policy Gradient Backward Update: Using advantage A as the gradient weight, perform gradient update on all parameters of the flow matching diffusion transformer. Sample 100 batch candidates in each training iteration and continuously fine-tune for 100 epochs. The model's font style restoration accuracy is steadily improved, while ensuring that the text recognition accuracy does not decrease.

[0049] It features a multi-style combination module, a layered poster design scene, and supports binding N sets of text units to N sets of independent reference style images to achieve parallel rendering of multiple fonts.

[0050] Implementation process: Step 1, Grouping Mapping: Receive the grouping instructions input by the user, divide the list of text units into M text groups, and bind a unique reference style image to each text group; Step 2, Parallel rendering and distribution: Multiple GPUs are allocated to each text group to an independent inference channel in parallel. Each group calls the style encoding module and the stylized glyph rendering module to independently generate glyph sub-images of the corresponding style. Step 3, Spatial fusion and splicing: Read the spatial layout tensor corresponding to each group of text, map the differentiated glyph sub-images of each group to a unified 2048×2048 canvas according to coordinates, and cover the overlapping text areas according to layer priority; Step 4: Output a global multi-style fused glyph image as a unified condition input for the image generation module.

[0051] Application example: In a commercial poster scenario, text group 1 (main title) is bound to a reference image of 3D metallic lettering, text group 2 (body text) is bound to a reference image of sans-serif printed font, and text group 3 (bottom slogan) is bound to a reference image of gradient glowing cartoon font. The system generates three different styles of fonts in parallel and automatically stitches them together into a complete font control diagram. The final image presents three different fonts simultaneously without the need for manual post-processing.

[0052] This invention features a dedicated data construction pipeline that supports training four types of networks: layout generation, style encoding, glyph rendering, and image generation. The data production process is semi-automatic and consists of four main processing steps: Step 1: Original Image Acquisition: Collect 1.5 million images with clearly visible text from publicly available commercial image libraries and our own design material library, covering six major scenarios: posters, e-commerce main images, product packaging, short video covers, infographics, and outdoor advertising. Filter out low-quality images with blurry text, severe obstruction, or those that cannot be recognized by OCR, and retain 1.12 million valid images. Step 2, Pixel-level text annotation pipeline: The DB text detection model is used to locate all text boxes in the image, PP-OCRv4 is used to recognize the text content, the SAM segmentation model is used to generate pixel-level text masks, and the three-fold annotation data of text coordinates, text content, and text mask for each image is automatically output. Step 3: Image and text prompt generation: The multimodal description model generates a global image description based on the content of the original image, automatically splices the text content marked in quotation marks within the image to form standard training prompt text; manual sampling is used to correct description deviations, with a sampling rate of 10%, to ensure the semantic accuracy of the prompt text; Step 4: Classify and store the dataset: Split the dataset into four subsets according to its purpose: layout prediction dataset (image, text coordinates, prompt text), font style comparison dataset (single character font cropping image), glyph rendering training set (text mask, text content), and complete image generation dataset (original image, text mask, prompt text); the dataset is uniformly converted into WebDataset streaming storage format, which supports high-speed GPU loading and eliminates IO bottlenecks.

[0053] For small design studios with low computing power, a lightweight deployment solution is provided, which removes the two major expansion units, the font reorganization module and the multi-style combination module, and retains only five basic modules. The hardware uses a single RTX 4090 24G GPU, an i9-14900K CPU, and 64GB of memory.

[0054] Network lightweighting adjustment strategy: The layout generation module was replaced with a small 7B parameter LLM + lightweight YOLOv8-nano detector head, reducing inference memory usage by 60%. The font style encoder has been replaced with the lightweight MobileViT architecture, which compresses the feature output dimension to 256 and improves inference speed by 2.3 times; The number of stylized glyph rendering diffusion transformer layers has been reduced from 24 to 12, and the number of flow matching inference steps has been reduced from 50 to 25. The image generation module uses a lightweight U-Net flow matching network, with a maximum generation resolution limited to 1920×1080.

[0055] Lightweight solution performance metrics: 18 seconds for generating and reasoning a single 1080P poster, 86.3% accuracy in OCR recognition of short text, and 0.82 similarity in basic artistic font style. It meets the daily simple poster and graphic design needs of small studios, and the hardware procurement cost is only 1 / 20 of that of an 8-card cloud server, making it suitable for low-cost deployment scenarios.

[0056] Three sets of control experiments were set up to compare the quantitative data of the present invention system with the three existing mainstream technical solutions under five core indicators. The experiment unified the test conditions: the test dataset contained 2,000 test prompt texts, covering five major scenarios: short printed text, long text promotional copy, 32×32 small font, multi-font mixed posters, and artistic decorative fonts. The unified hardware was an 8-card A100 server, with a generation resolution of 3840×2160.

[0057] Control group setup Comparison 1: Native general text-based graph diffusion model (Category 1 prior art); Comparison 2: Standard character mask conditional diffusion model (Category II prior art); Comparison 3: Globally Joint Style Encoding Text Generation Model (Category 3 Existing Technology); Experimental group: This invention is a controllable visual text generation system based on decoupled rendering diffusion (all extension modules enabled).

[0058] Quantitative test metrics and results Average text OCR recognition accuracy: Control 1 = 51.8%, Control 2 = 73.4%, Control 3 = 62.5%, Experimental group = 91.7%; Average cosine similarity of reference font styles: Control 1 = 0.59, Control 2 = 0.63, Control 3 = 0.61, Experimental group = 0.94; Adhesion rate of 32×32 small font size text: Control 1 = 94.2%, Control 2 = 81.5%, Control 3 = 88.7%, Experimental group = 10.3%; Word-level error rate for 60-character super-long texts: Control 1 = 52.7%, Control 2 = 36.1%, Control 3 = 45.3%, Experimental group = 3.5%; Multi-font mixed scene adaptation capability (single image can distinguish font types): Control 1 = 1 type, Control 2 = 1 type, Control 3 = 1 type, Experimental group = unlimited number of groups; Average reasoning time for generating a single poster: Control 1 = 12.4s, Control 2 = 15.7s, Control 3 = 18.2s, Experimental group = 16.9s (the time increased slightly, but the text accuracy and style quality were greatly improved, which is acceptable for engineering purposes).

[0059] The test data clearly demonstrates that the four core technical solutions of this invention—decoupling the three-stage architecture, font-specific style encoding, glyph recombination, and multi-style combination—comprehensively surpass the existing three types of technologies, while simultaneously addressing five core technical deficiencies in the industry, demonstrating outstanding creativity and practicality.

[0060] The network architecture of each module in this invention is not bound to any specific network and can be replaced with any equivalent generator network within the domain. Several alternative embodiments are listed below: Replacement solution for layout generation module: Abandon the LLM+YOLO combination and replace it with Seq2Seq temporal prediction network, text detection and segmentation network, and regularized coordinate parsing module, all of which can achieve text unit and spatial layout tensor output; Style encoding module replacement solution: The font visual encoder can be replaced with a deep convolutional residual network ResNet50 or a lightweight convolutional network ConvNeXt, only requiring a re-completion of font contrast learning pre-training; Stylized glyph rendering / image generation module replacement scheme: The flow matching diffusion transformer can be replaced with the traditional DDPM diffusion U-Net, ADM diffusion model, or variational autoencoder VAE generation network. It can run normally by only adjusting the cross-attention feature injection dimension adaptation. Extension module expansion scheme: The multi-style combination module can be extended to the user interaction interface, supporting drag-and-drop text boxes and manual specification of independent reference styles for single characters, adapting to refined human design scenarios; The style perception optimization module can be extended to the human scoring module, combining human scoring with OCR and style similarity rewards to further improve the accuracy of high-end customized font restoration.

[0061] Scenario: Generate an e-commerce skincare product promotional poster with the following text: "A light blue gradient soft-light background, a bottle of white face cream placed in the center of the image, with an overall fresh and Instagram-worthy style. The poster title is 'Clear and Brightening Moisturizing Face Cream,' the body text is 'Deeply Hydrating, Soothing, and Repairing, Suitable for Sensitive Skin,' and the bottom slogan is 'Limited-Time 20% Off Offer, Only for 7 Days.' The font size is as follows: title largest, body text medium, slogan smallest. The slogan is placed at the bottom center of the image, the title image is centered at the top, and the body text is located below the face cream."

[0062] Complete system reasoning steps: Step 1: The layout generation module parses the three sets of text units within the quotation marks of the prompt text, predicts the spatial layout tensors corresponding to the three sets of text, and outputs the coordinates, dimensions, and rotation parameters of the title, body text, and slogan respectively. Step 2: The initial glyph generation module generates three independent standard glyph masks based on the three sets of layout tensors; Step 3: Input the reference values ​​into the style coding module. Figure 1 Generate three sets of independent style feature tensors; Step 4: The multi-style combination module divides the text units into three groups and their corresponding style features, and calls the stylized glyph rendering module in parallel to generate three groups of differentiated glyph sub-images. Step 5: The font reshaping module performs intermediate canvas generation, OCR filtering, and scaling transformation on the small font size slogan at the bottom to eliminate the sticking of small font strokes; Step 6: The multi-style combination module merges three sub-images of character shapes according to the three sets of text layout coordinates, and outputs a unified global multi-style character shape image; Step 7: The style-aware optimization module samples 5 candidate global glyph images, calculates the OCR and style-weighted reward, and selects the optimal glyph image to send to the image generation module; Step 8: The image generation module receives the optimal glyph image and the original poster prompt text, and uses flow matching diffusion inference to generate a complete 4K skincare poster. In the final image, the three sets of text present three independent fonts: metallic 3D, fine black printing, and pink gradient glow. There are no errors or omissions in the characters, the layout meets the requirements, and the fonts are highly consistent with the three reference images. The background is fresh and soft, and the image and text blend naturally without text distortion or style deviation defects.

[0063] This embodiment fully reproduces the collaborative workflow of all basic and extended modules of the system. Those skilled in the art can reproduce the system of this invention without creative effort by following the hardware deployment, network parameters, inference steps, and training scheme described in this specification, thereby achieving controllable multi-style visual text image generation and meeting the requirements for full disclosure in patent writing.

Claims

1. A controllable visual text generation system based on decoupled rendering diffusion, wherein the hardware carrier is an image generation server equipped with parallel GPU computing units, characterized in that, include: The layout generation module is used to input prompt text and output a set of text units and a spatial layout tensor; An initial glyph generation module, connected to the layout generation module, is used to receive the set of character units and the spatial layout tensor and output a standard glyph mask. The style encoding module is used to take a reference style image as input and output a normalized style feature tensor. It has a built-in font style visual encoder pre-trained by font pairwise sample comparison learning. The stylized glyph rendering module is connected to the initial glyph generation module and the style encoding module respectively. It has a built-in glyph control branch and a diffusion transformer. The glyph control branch inputs the standard glyph mask to generate glyph constraint features. The diffusion transformer injects the style feature tensor through multi-layer cross attention and outputs a stylized glyph image. The image generation module is connected to the stylized glyph rendering module. It uses a flow matching conditional diffusion network to receive the stylized glyph image and the prompt text, and outputs a complete target image. The glyph recombination module, style perception optimization module, and multi-style combination module are all connected in parallel to the output of the stylized glyph rendering module; A supporting training data construction unit is used to collect images containing text and generate image-text pairing and annotation datasets; The network structures of the layout generation module, the style encoding module, the stylized glyph rendering module, and the image generation module are independent and replaceable.

2. The controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The spatial layout tensor is a numerical matrix of dimension [N,6], where N is the number of text units. The six columns of the matrix store the coordinates of the two vertices of the text box, the rotation angle, and the font size scaling factor.

3. The controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The font style visual encoder uses a ViT-B / 16 backbone network and adds a font local feature aggregation head. The training positive samples are image pairs with the same text and font, and the training negative samples are image pairs with different text / fonts. The loss function is the InfoNCE contrastive loss.

4. The controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The diffusion transformer has multiple cross-attention heads in each layer, and the style feature injection calculation formula is as follows: , Let F be the hidden state of the i-th layer of the network, and let F be the style feature tensor. , , This is a trainable projective weight matrix.

5. The controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The character reconstruction module includes a temporary canvas generation unit, an OCR verification unit, and a spatial transformation unit. The resolution of the temporary canvas is greater than the pixel size of the target text. The OCR verification unit filters the optimal candidate characters by editing distance. The spatial transformation unit performs scaling, rotation, and perspective correction.

6. The controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The style-aware optimization module includes an OCR recognition unit, a style similarity calculation unit, and a strategy gradient update unit. It samples 8 candidate glyph images in a single batch, and obtains the total reward by weighting the OCR matching accuracy and font feature cosine similarity. Based on the reward normalization advantage, it updates the weight of the stylized glyph rendering module in reverse.

7. The controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The multi-style combination module includes a text grouping and mapping unit, a multi-channel parallel rendering unit, and a pixel fusion and splicing unit. The text grouping and mapping unit divides the text units into multiple groups, each group is bound to an independent reference style image, and after generating differentiated glyph sub-images in parallel through multiple channels, they are fused into a unified glyph image according to coordinates.

8. The controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The training data construction unit sequentially performs four steps: original image acquisition, text pixel-level mask annotation, multimodal prompt text generation, and dataset classification and storage, resulting in four independent training subsets: layout, font comparison, glyph rendering, and complete image generation.

9. A controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The training data construction unit sequentially performs four steps: original image acquisition, text pixel-level mask annotation, multimodal prompt text generation, and dataset classification and storage, resulting in four independent training subsets: layout, font comparison, glyph rendering, and complete image generation.

10. A controllable visual text generation system based on decoupled rendering diffusion according to claim 1, characterized in that, The GPU computing unit adopts a multi-card NVLink interconnect architecture. The GPU is allocated computing power according to the module function partition. The CPU is paired with a large-capacity memory to divide the independent module memory pool. Tensor data between modules is transmitted through the gRPC interface.