Artificial intelligence-based complex scene text recognition enhancement method

By introducing variational autoencoders and reinforcement learning frameworks, and optimizing latent space representation and decoder strategies, the problems of text recognition accuracy and stability in complex scenarios are solved, achieving high-confidence text recognition results.

CN121330698BActive Publication Date: 2026-04-21TIBET CHAVAYUN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TIBET CHAVAYUN TECH CO LTD
Filing Date
2025-11-21
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing text recognition algorithms lack the ability to express features in complex scenarios and lack dynamic adaptive mechanisms, resulting in decreased recognition accuracy and performance fluctuations.

Method used

A variational autoencoder structure and contrastive learning are introduced to optimize the latent space representation. Combined with a reinforcement learning framework, the decoder attention weights and CTC threshold are adjusted through an Actor-Critic structure to form a closed-loop feedback mechanism and achieve dynamic adaptive optimization.

Benefits of technology

It improves the model's recognition stability and confidence in complex backgrounds, and can maintain high-confidence recognition output in changing environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121330698B_ABST
    Figure CN121330698B_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer vision, specifically to an artificial intelligence-based method for enhancing text recognition in complex scenes. The method includes complex scene text image construction and partitioning, conditional feature fusion, contrastive learning to optimize the latent space representation, decoding and reconstruction, loss function optimization, latent variable extraction and enhanced feature output, reinforcement learning optimization, and final recognition output. It introduces a variational autoencoder structure and combines it with contrastive learning to optimize the latent space representation, enabling the model to learn discriminative latent variable representations under various font, lighting, and noise conditions. Positive and negative sample contrast constraints are introduced into the latent variable space to reduce feature distribution differences across different scenes. This invention introduces a reinforcement learning framework into complex scene text recognition, using the recognition result and confidence level as state inputs. A dynamic enhancement strategy is learned through an Actor-Critic structure network, and by defining a linear and nonlinear composite reward function, joint optimization of recognition error rate and confidence level improvement is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision, specifically to a method for enhancing text recognition in complex scenes based on artificial intelligence. Background Technology

[0002] With the widespread adoption of smart devices and the improvement of image acquisition capabilities, image-based text recognition technology has been widely applied in fields such as intelligent transportation, ticket recognition, advertising text extraction, and video caption detection. However, existing text recognition algorithms still face the following major problems in complex scenarios:

[0003] (1) Problem of insufficient feature expression ability

[0004] Traditional OCR algorithms are mostly based on convolutional neural networks (CNN) or recurrent neural networks (RNN) to extract features, but feature aliasing and text boundary blurring are prone to occur in complex backgrounds, resulting in a significant decrease in recognition accuracy. Especially in scenes with changes in lighting or font distortion, the model has difficulty capturing semantically relevant robust features.

[0005] (2) The problem of the lack of dynamic adaptive mechanism in the recognition strategy

[0006] Most existing methods employ static feature extraction and decoding strategies, with model parameters fixed during inference. These parameters cannot be dynamically adjusted based on the complexity or confidence level of the input image, resulting in significant fluctuations in recognition performance across different scenarios. Summary of the Invention

[0007] To address the above issues and overcome the shortcomings of existing technologies, this invention provides an AI-based method for enhancing text recognition in complex scenes. To address the problem of insufficient feature representation capabilities, this invention introduces a variational autoencoder structure and combines it with contrastive learning to optimize the latent space representation. This enables the model to learn discriminative latent variable representations under various font, lighting, and noise conditions. By introducing positive and negative sample contrast constraints into the latent variable space, the difference in feature distribution under different scenes is significantly reduced, improving the model's recognition stability in complex backgrounds, reflective surfaces, and blurred text. To address the lack of dynamic adaptive mechanisms in the recognition strategy, this invention introduces a reinforcement learning framework into text recognition in complex scenes. The recognition result and confidence level are used as state inputs, and a dynamic enhancement strategy is learned through an Actor-Critic structure strategy network. By defining a linear and nonlinear composite reward function, joint optimization of the recognition error rate and confidence level is achieved. During inference, the decoder attention weights and CTC threshold are adjusted in real time based on the recognition result, thereby dynamically optimizing the recognition strategy and forming a closed-loop feedback from "recognition result → model adjustment → re-recognition." Compared to traditional static recognition methods, this invention can continuously and adaptively optimize feature enhancement and strategy allocation, enabling the system to maintain high-confidence recognition output in changing environments.

[0008] The technical solution adopted by this invention is as follows: The present invention provides a text recognition enhancement method for complex scenes based on artificial intelligence, which includes the following steps:

[0009] Step S1: Construct and segment text images for complex scenes. Collect text images of complex scenes, perform sliding window segmentation to obtain window image samples, and label each window image sample with text region condition labels, including font type, size and lighting conditions.

[0010] Step S2: Conditional Feature Fusion. The window image samples and text region conditional labels are input into the encoder network. The encoder network includes a feature extraction unit, a temporal coding layer, a conditional fusion unit, and a parameter output head, specifically including the following:

[0011] The feature extraction unit employs a convolutional neural network structure to perform multi-scale feature extraction on the input window image samples, obtaining a high-dimensional visual feature vector set, represented as follows: F i =[ f 1 , f 2 , ... , f T ] ,in Indicates the length of the position sequence;

[0012] The temporal coding layer is used to serialize and model high-dimensional visual feature vector sets, capture spatial dependencies through a self-attention mechanism, and output sequence context feature representations.

[0013] The conditional fusion unit fuses sequence context features and corresponding text region conditional labels to obtain a joint feature representation;

[0014] The parameter output header constructs a variational posterior approximate distribution, using the following formula:

[0015] ;

[0016] in, This represents the variational posterior approximation distribution parameterized by the encoder network. Let be the latent variable vector of the window image sample, representing the window image sample. Latent semantic features Indicates a text region condition label. Let be the posterior mean vector. Let be the posterior variance vector. Indicates a Gaussian distribution;

[0017] Step S3: Contrastive learning optimizes the latent space representation. A contrastive learning mechanism is introduced. During the contrastive learning training process, one window image sample is selected as the anchor sample at each step. Window image samples with the same text region condition labels as the anchor samples are defined as positive samples, and window image samples with different text region condition labels as negative samples. A contrastive loss function based on the latent representation is constructed, and the formula used is as follows:

[0018] ;

[0019] in, For the contrastive loss function based on latent representation, Represents cosine similarity. For temperature parameters, This represents the latent variable vector corresponding to the anchor sample. This represents the latent variable vector corresponding to the positive sample. This represents the latent variable vector corresponding to the negative sample. This indicates summing over all negative samples;

[0020] Step S4: Decoding and reconstruction, setting the decoder network to VAE decoder, represented as... Given the latent variable vectors of the window image samples and the conditional labels of the text regions, the decoder network reconstructs the window image samples to obtain reconstructed samples. By minimizing the error between the input samples and the reconstructed samples, a reconstruction loss function is defined, and the formula used is as follows:

[0021] ;

[0022] in, Indicates parameters Controlled decoder network, Indicates the reconstructed sample. Represents the reconstruction loss function;

[0023] Step S5: Loss function optimization. Combining the reconstruction loss function, the KL divergence regularization term, and the contrastive loss function based on latent representation, a joint optimization objective function is constructed. The formula used is as follows:

[0024] ;

[0025] in, and For adjustable hyperparameters, Describe the joint optimization objective function;

[0026] Step S6: Latent variable extraction and enhanced feature output. After training, the latent variable distribution parameters are extracted from the encoder network. The reparameterization technique is used to sample and obtain a differentiable latent variable vector. Combined with the text region condition label, the vector is input into the decoder network to obtain the enhanced feature representation of the complex scene text image. The enhanced feature representation is then input into the CTC decoder to obtain the recognition result and recognition confidence index.

[0027] Step S7: Reinforcement learning optimization. Using the recognition results and recognition confidence index as input states, a deep reinforcement learning policy network is constructed. The optimal recognition enhancement and policy tuning mechanism is learned through interactive training to obtain the reinforcement learning decision output results.

[0028] Step S8: Final recognition output. Based on the reinforcement learning decision output, the text image of the complex scene is enhanced with feature adjustment and decoder optimization to obtain the final text recognition result and confidence index.

[0029] Furthermore, step S7 specifically includes the following steps:

[0030] Step S71: Normalize the state definition and construct the system state space, as follows:

[0031] s t =[ Q i , c i ] ;

[0032] in, Represents the system state vector. This indicates the confidence level index for identification. Indicates the recognition result;

[0033] Step S72: Action space construction, defining the action set of the reinforcement learning agent. This includes adjusting the weights of enhanced image features, adjusting the decoder attention weight strategy, adjusting the CTC decoding confidence threshold, and maintaining the current state.

[0034] Step S73: Design the reward function, design a composite reward function. It includes linear reward functions and nonlinear reward functions, and the functions used are as follows:

[0035] Linear reward function:

[0036] ;

[0037] in, To identify the amount of improvement in error rate, To identify the confidence level increase, , These are the weighting coefficients;

[0038] Non-linear reward function:

[0039] ;

[0040] Step S74: Network structure initialization. Initialize the deep reinforcement learning policy network, which specifically includes the following components:

[0041] Actor network: employs a multilayer perceptron structure, with parameters as follows: Updated via policy gradient;

[0042] Critic network: evaluates the value of a state-action sequence, with the following parameters: Updated by minimizing the timing difference error;

[0043] Target networks: A set of parameter copies is set for both the Actor network and the Critic network;

[0044] Experience replay buffer: with a capacity of 100,000, stores the processed state vector;

[0045] Step S75: Network update and training. The state vector after random sampling from the experience replay buffer is updated using the Critic network parameters. This is achieved by minimizing the following loss function, as shown in the following formula:

[0046] ;

[0047] ;

[0048] in, Represents the current state vector. This indicates the current action of the reinforcement learning agent. This represents the reward value at the current moment. Represents the loss function. Indicates the target Q value. Indicates the discount factor. The Actor network parameters represent the target. The Critic network parameters represent the target. The Actor network representing the target, The Critic network representing the target. This represents the number of state vectors after random sampling and processing from the experience replay buffer;

[0049] The parameters of the Actor network are updated according to the policy gradient formula, as follows:

[0050] ;

[0051] in, This represents the policy objective function. This represents the action policy generated by the Actor network. This represents the gradient feedback of the Critic network;

[0052] A soft update mechanism is used to perform smooth updates for the networks of two targets, and the formula used is as follows:

[0053] ;

[0054] in, Indicates the soft update coefficient. A unified representation of network parameters for two targets. To uniformly represent the two network parameters;

[0055] The updated deep reinforcement learning policy network is obtained;

[0056] Step S76: Policy optimization. Repeat the training process in step Q5, set a training threshold, and end the iteration when the loss function converges to the training threshold, outputting the optimal deep reinforcement learning policy network.

[0057] Step S77: Output the results. Deploy the optimal deep reinforcement learning policy network and output the reinforcement learning decision results.

[0058] The beneficial effects achieved by the present invention using the above solution are as follows:

[0059] (1) To address the problem of insufficient feature representation ability, this invention introduces a variational autoencoder structure and combines contrastive learning to optimize the latent space representation, enabling the model to learn discriminative latent variable representations under various font, lighting and noise conditions. By introducing positive and negative sample contrast constraints in the latent variable space, the feature distribution differences under different scenarios are significantly reduced, and the recognition stability of the model under complex backgrounds, reflections, blurry text and other conditions is improved.

[0060] (2) To address the lack of dynamic adaptive mechanism in recognition strategies, this invention introduces a reinforcement learning framework in text recognition in complex scenarios. The recognition result and confidence are used as state inputs. Dynamic enhancement strategies are learned through the Actor-Critic structure strategy network. By defining a linear and nonlinear composite reward function, the joint optimization of recognition error rate and confidence improvement is achieved. During the inference process, the decoder attention weight and CTC threshold are adjusted in real time according to the recognition result, thereby dynamically optimizing the recognition strategy and forming a closed-loop feedback from "recognition result → model adjustment → re-recognition". Compared with traditional static recognition methods, this invention can continuously and adaptively optimize feature enhancement and strategy allocation, enabling the system to maintain high confidence recognition output in a variable environment. Attached Figure Description

[0061] Figure 1 This is a flowchart illustrating the AI-based text recognition enhancement method for complex scenes provided by the present invention.

[0062] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof. Detailed Implementation

[0063] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0064] In the description of this invention, it should be understood that the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0065] Example 1, see Figure 1 The present invention provides an artificial intelligence-based method for enhancing text recognition in complex scenes, which includes the following steps:

[0066] Step S1: Construct and segment text images for complex scenes. Collect text images of complex scenes, perform sliding window segmentation to obtain window image samples, and label each window image sample with text region condition labels, including font type, size and lighting conditions.

[0067] Step S2: Conditional Feature Fusion. The window image samples and text region conditional labels are input into the encoder network. The encoder network includes a feature extraction unit, a temporal coding layer, a conditional fusion unit, and a parameter output head, specifically including the following:

[0068] The feature extraction unit employs a convolutional neural network structure to perform multi-scale feature extraction on the input window image samples, obtaining a high-dimensional visual feature vector set, represented as follows: F i =[ f 1 , f 2 , ... , f T ] ,in Indicates the length of the position sequence;

[0069] The temporal coding layer is used to serialize and model high-dimensional visual feature vector sets, capture spatial dependencies through a self-attention mechanism, and output sequence context feature representations.

[0070] The conditional fusion unit fuses sequence context features and corresponding text region conditional labels to obtain a joint feature representation;

[0071] The parameter output header constructs a variational posterior approximate distribution, using the following formula:

[0072] ;

[0073] in, This represents the variational posterior approximation distribution parameterized by the encoder network. Let be the latent variable vector of the window image sample, representing the window image sample. Latent semantic features Indicates a text region condition label. Let be the posterior mean vector. Let be the posterior variance vector. Indicates a Gaussian distribution;

[0074] Step S3: Contrastive learning optimizes the latent space representation. A contrastive learning mechanism is introduced. During the contrastive learning training process, one window image sample is selected as the anchor sample at each step. Window image samples with the same text region condition labels as the anchor samples are defined as positive samples, and window image samples with different text region condition labels as negative samples. A contrastive loss function based on the latent representation is constructed, and the formula used is as follows:

[0075] ;

[0076] in, For the contrastive loss function based on latent representation, Represents cosine similarity. For temperature parameters, This represents the latent variable vector corresponding to the anchor sample. This represents the latent variable vector corresponding to the positive sample. This represents the latent variable vector corresponding to the negative sample. This indicates summing over all negative samples;

[0077] Step S4: Decoding and reconstruction, setting the decoder network to VAE decoder, represented as... Given the latent variable vectors of the window image samples and the conditional labels of the text regions, the decoder network reconstructs the window image samples to obtain reconstructed samples. By minimizing the error between the input samples and the reconstructed samples, a reconstruction loss function is defined, and the formula used is as follows:

[0078] ;

[0079] in, Indicates parameters Controlled decoder network, Indicates the reconstructed sample. Represents the reconstruction loss function;

[0080] Step S5: Loss function optimization. Combining the reconstruction loss function, the KL divergence regularization term, and the contrastive loss function based on latent representation, a joint optimization objective function is constructed. The formula used is as follows:

[0081] ;

[0082] in, and For adjustable hyperparameters, Describe the joint optimization objective function;

[0083] Step S6: Latent variable extraction and enhanced feature output. After training, the latent variable distribution parameters are extracted from the encoder network. The reparameterization technique is used to sample and obtain a differentiable latent variable vector. Combined with the text region condition label, the vector is input into the decoder network to obtain the enhanced feature representation of the complex scene text image. The enhanced feature representation is then input into the CTC decoder to obtain the recognition result and recognition confidence index.

[0084] Step S7: Reinforcement learning optimization. Using the recognition results and recognition confidence index as input states, a deep reinforcement learning policy network is constructed. The optimal recognition enhancement and policy tuning mechanism is learned through interactive training to obtain the reinforcement learning decision output results.

[0085] Step S8: Final recognition output. Based on the reinforcement learning decision output, the text image of the complex scene is enhanced with feature adjustment and decoder optimization to obtain the final text recognition result and confidence index.

[0086] In this embodiment, complex scene text images from the publicly available datasets ICDAR2019-ReCTS and SynthText are selected as training samples;

[0087] The original image is divided into window image samples of size 64×64 pixels using the sliding window technique, and each window corresponds to at least one character region;

[0088] Manually label the text area conditions for each window, including font type, font size, and lighting conditions;

[0089] Conditional feature fusion involves inputting window image samples into the encoder network, which employs the following structure:

[0090] Feature extraction unit: Based on ResNet-34 convolutional neural network, it performs multi-scale feature extraction on window image samples, with an output dimension of 256×16×16;

[0091] Temporal coding layer: Uses a bidirectional Transformer Encoder, 6 layers, 512 hidden dimensions, 8-head attention mechanism, to model the relationship between local and global spaces;

[0092] Conditional fusion unit: The extracted contextual features and corresponding text region conditional labels are fused through concatenation and linear projection to obtain a joint feature representation;

[0093] Parameter output header: Outputs the parameters of the variational posterior distribution as a 128-dimensional mean and variance vector, constructing the posterior distribution;

[0094] During the training phase, anchor samples are selected from each batch of samples. Positive samples are window image samples with the same font type and similar lighting conditions, while negative samples are samples with different font types. Cosine similarity is used to construct the contrast loss function.

[0095] The decoder network is set as a symmetrical VAE decoder, consisting of a five-layer deconvolutional network, with a reconstruction size of 64×64;

[0096] exist and Under the constraints, output the reconstructed image;

[0097] Optimize reconstruction performance by minimizing the following loss:

[0098] Taking into account reconstruction loss, KL divergence regularization term, and contrast loss, a joint optimization objective is constructed, and the formula used is as follows:

[0099] ;

[0100] After the model training is complete, the latent variable distribution parameters are extracted from the encoder and reparameterized using the following formula:

[0101] ;

[0102] The sampled and The enhanced visual features are input into the decoder to obtain the enhanced visual feature representation. The enhanced features are then processed by the decoder to output the text sequence and recognition confidence score.

[0103] A deep reinforcement learning policy network is constructed using the text sequence results and recognition confidence as input states, where:

[0104] The Actor network adopts a three-layer fully connected structure;

[0105] The Critic network employs a two-branch structure;

[0106] The reward function is designed as follows:

[0107] ;

[0108] in , ;

[0109] Reinforcement learning networks dynamically adjust the weights of augmented features and CTC decoding parameters during training.

[0110] Example 2, based on the above example, specifically includes the following steps in step S7:

[0111] Step S71: Normalize the state definition and construct the system state space, as follows:

[0112] s t =[ Q i , c i ] ;

[0113] in, Represents the system state vector. This indicates the confidence level index for identification. Indicates the recognition result;

[0114] Step S72: Action space construction, defining the action set of the reinforcement learning agent. This includes adjusting the weights of enhanced image features, adjusting the decoder attention weight strategy, adjusting the CTC decoding confidence threshold, and maintaining the current state.

[0115] Step S73: Design the reward function, design a composite reward function. It includes linear reward functions and nonlinear reward functions, and the functions used are as follows:

[0116] Linear reward function:

[0117] ;

[0118] in, To identify the amount of improvement in error rate, To identify the confidence level increase, , These are the weighting coefficients;

[0119] Non-linear reward function:

[0120] ;

[0121] Step S74: Network structure initialization. Initialize the deep reinforcement learning policy network, which specifically includes the following components:

[0122] Actor network: employs a multilayer perceptron structure, with parameters as follows: Updated via policy gradient;

[0123] Critic network: evaluates the value of a state-action sequence, with the following parameters: Updated by minimizing the timing difference error;

[0124] Target networks: A set of parameter copies is set for both the Actor network and the Critic network;

[0125] Experience replay buffer: with a capacity of 100,000, stores the processed state vector;

[0126] Step S75: Network update and training. The state vector after random sampling from the experience replay buffer is updated using the Critic network parameters. This is achieved by minimizing the following loss function, as shown in the following formula:

[0127] ;

[0128] ;

[0129] in, Represents the current state vector. This indicates the current action of the reinforcement learning agent. This represents the reward value at the current moment. Represents the loss function. Indicates the target Q value. Indicates the discount factor. The Actor network parameters represent the target. The Critic network parameters represent the target. The Actor network representing the target, The Critic network representing the target. This represents the number of state vectors after random sampling and processing from the experience replay buffer;

[0130] The parameters of the Actor network are updated according to the policy gradient formula, as follows:

[0131] ;

[0132] in, This represents the policy objective function. This represents the action policy generated by the Actor network. This represents the gradient feedback of the Critic network;

[0133] A soft update mechanism is used to perform smooth updates for the networks of two targets, and the formula used is as follows:

[0134] ;

[0135] in, Indicates the soft update coefficient. A unified representation of network parameters for two targets. To uniformly represent the two network parameters;

[0136] The updated deep reinforcement learning policy network is obtained;

[0137] Step S76: Policy optimization. Repeat the training process in step Q5, set a training threshold, and end the iteration when the loss function converges to the training threshold, outputting the optimal deep reinforcement learning policy network.

[0138] Step S77: Output the results. Deploy the optimal deep reinforcement learning policy network and output the reinforcement learning decision results.

[0139] Example 3, based on the above examples, uses the following core code for steps S71 to S77:

[0140] import numpy as np

[0141] import torch

[0142] import torch.nn as nn

[0143] import torch.optim as optim

[0144] # Actor Network Example

[0145] class Actor(nn.Module):

[0146] def __init__(self):

[0147] super().__init__()

[0148] self.fc1 = nn.Linear(2, 128)

[0149] self.fc2 = nn.Linear(128, 64)

[0150] self.out = nn.Linear(64, 4) # Action space size is 4

[0151] def forward(self, s):

[0152] x = torch.relu(self.fc1(s))

[0153] x = torch.relu(self.fc2(x))

[0154] return torch.softmax(self.out(x), dim=-1)

[0155] # Critic Network Example

[0156] class Critic(nn.Module):

[0157] def __init__(self):

[0158] super().__init__()

[0159] self.fc1 = nn.Linear(2 + 4, 128) # 2D state + 4D action

[0160] self.fc2 = nn.Linear(128, 64)

[0161] self.out = nn.Linear(64, 1)

[0162] def forward(self, s, a):

[0163] x = torch.relu(self.fc1(torch.cat([s, a], dim=-1)))

[0164] x = torch.relu(self.fc2(x))

[0165] return self.out(x)

[0166] # Loss function L = (y - Q(s,a))^2

[0167] def critic_loss(Q, y):

[0168] return ((Q - y)**2).mean().

[0169] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0170] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

[0171] The present invention and its embodiments have been described above. This description is not restrictive, and the accompanying drawings are only one embodiment of the present invention; the actual structure is not limited thereto. In conclusion, if those skilled in the art are inspired by this description and design similar structures and embodiments without departing from the spirit of the invention, such designs should fall within the protection scope of the present invention.

Claims

1. A text recognition enhancement method for complex scenes based on artificial intelligence, characterized in that: The method includes the following steps: Step S1: Construct and segment text images for complex scenes. Collect text images of complex scenes, perform sliding window segmentation to obtain window image samples, and label the text region condition labels for each window image sample. Step S2: Conditional Feature Fusion. The window image samples and text region conditional labels are input into the encoder network. The encoder network includes a feature extraction unit, a temporal coding layer, a conditional fusion unit, and a parameter output head, specifically including the following: The feature extraction unit adopts a convolutional neural network structure to perform multi-scale feature extraction on the input window image samples, thereby obtaining a high-dimensional visual feature vector set; The temporal coding layer is used to serialize and model high-dimensional visual feature vector sets, capture spatial dependencies through a self-attention mechanism, and output sequence context feature representations. The conditional fusion unit fuses sequence context features and corresponding text region conditional labels to obtain a joint feature representation; The parameter output header constructs a variational posterior approximation distribution; Step S3: Contrastive learning optimizes the latent space representation. A contrastive learning mechanism is introduced. During the contrastive learning training process, one window image sample is selected as the anchor sample each time. Window image samples with the same text region condition labels as anchor samples are defined as positive samples, and window image samples with different text region condition labels as negative samples. A contrastive loss function based on the latent representation is constructed. Step S4: Decoding and reconstruction. Set the decoder network as a VAE decoder. Under the conditions of the latent variable vector of the window image sample and the conditional label of the text region, the decoder network reconstructs the window image sample to obtain the reconstructed sample. Define the reconstruction loss function by minimizing the error between the input sample and the reconstructed sample. Step S5: Loss function optimization. Combine the reconstruction loss function, KL divergence regularization term, and contrastive loss function based on latent representation to construct a joint optimization objective function; Step S6: Latent variable extraction and enhanced feature output. After training, the latent variable distribution parameters are extracted from the encoder network. The reparameterization technique is used to sample and obtain a differentiable latent variable vector. Combined with the text region condition label, the vector is input into the decoder network to obtain the enhanced feature representation of the complex scene text image. The enhanced feature representation is then input into the CTC decoder to obtain the recognition result and recognition confidence index. Step S7: Reinforcement learning optimization. Using the recognition results and recognition confidence index as input states, a deep reinforcement learning policy network is constructed. The optimal recognition enhancement and policy tuning mechanism is learned through interactive training to obtain the reinforcement learning decision output results. Step S8: Final recognition output. Based on the reinforcement learning decision output, the text image of the complex scene is enhanced with feature adjustment and decoder optimization to obtain the final text recognition result and confidence index.

2. The method for enhancing text recognition in complex scenes based on artificial intelligence according to claim 1, characterized in that: Step S7 specifically includes the following steps: Step S71: Normalize the state definition and construct the system state space, as follows: ; in, Represents the system state vector. This indicates the confidence level index for identification. Indicates the recognition result; Step S72: Action space construction, defining the action set of the reinforcement learning agent. This includes adjusting the weights of enhanced image features, adjusting the decoder attention weight strategy, adjusting the CTC decoding confidence threshold, and maintaining the current state. Step S73: Design the reward function, design a composite reward function. It includes linear reward functions and nonlinear reward functions, and the functions used are as follows: Linear reward function: ; in, To identify the amount of improvement in error rate, To identify the confidence level increase, , These are the weighting coefficients; Non-linear reward function: ; Step S74: Network structure initialization. Initialize the deep reinforcement learning policy network, which specifically includes the following components: Actor network: employs a multilayer perceptron structure, with parameters as follows: Updated via policy gradient; Critic network: evaluates the value of a state-action sequence, with the following parameters: Updated by minimizing the timing difference error; Target networks: A set of parameter copies is set for both the Actor network and the Critic network; Experience replay buffer: with a capacity of 100,000, stores the processed state vector; Step S75: Network update and training. The state vector after random sampling from the experience replay buffer is updated using the Critic network parameters. This is achieved by minimizing the following loss function, as shown in the following formula: ; ; in, Represents the current state vector. This indicates the current action of the reinforcement learning agent. This represents the reward value at the current moment. Represents the loss function. Indicates the target Q value. Indicates the discount factor. The Actor network parameters represent the target. The Critic network parameters represent the target. The Actor network representing the target, The Critic network representing the target. This represents the number of state vectors after random sampling and processing from the experience replay buffer; The parameters of the Actor network are updated according to the policy gradient formula, as follows: ; in, This represents the policy objective function. This represents the action policy generated by the Actor network. This represents the gradient feedback of the Critic network; A soft update mechanism is used to perform smooth updates for the networks of two targets, and the formula used is as follows: ; in, Indicates the soft update coefficient. A unified representation of network parameters for two targets. To uniformly represent the two network parameters; The updated deep reinforcement learning policy network is obtained; Step S76: Policy optimization. Repeat the training process in step Q5, set a training threshold, and end the iteration when the loss function converges to the training threshold, outputting the optimal deep reinforcement learning policy network. Step S77: Output the results. Deploy the optimal deep reinforcement learning policy network and output the reinforcement learning decision results.

Citation Information

Patent Citations

  • Content extraction method, device and equipment for text image as well as storage medium

    CN108830186A

  • Semantic enhanced scene text recognition method and device

    CN113591546A