Chinese character recognition method based on multi-dimensional representation
By introducing spatial information and multi-task networks into Chinese character recognition, multi-level features are extracted, and the Chinese character feature similarity algorithm is used to remove noise, which solves the problem of feature extraction and fusion in Chinese character recognition in complex scenes, and significantly improves recognition accuracy.
Patent Information
- Application Number
- CN202411150460.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-09-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In complex scenarios, it is difficult to extract fine-grained character features in Chinese character recognition, and there are problems in the extraction and fusion of multi-dimensional features, resulting in limited recognition accuracy.
A Chinese character recognition method based on multi-dimensional representation is adopted, by introducing spatial information to expand the character feature sequence, combining multi-task network and self-attention mechanism to extract multi-level features, removing noise through Chinese character feature similarity algorithm, and integrating multi-dimensional features to improve the accuracy of key features. priority.
It effectively improves the accuracy of Chinese character recognition in complex scenes and enhances the model's recognition ability in complex scenes. The effectiveness of the model has been verified through experiments on mainstream data sets and complex scene data sets.
Smart Images

Figure CN118658170A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Chinese character recognition, in particular to a Chinese character recognition method based on multi-dimensional representation. Background Art
[0002] Chinese character recognition technology occupies a core position in the field of image recognition, and is particularly important in applications such as document processing and certificate verification. At present, complex environments, such as changes in lighting conditions, image blur, and noise interference, significantly increase the difficulty of feature extraction, which in turn affects the recognition accuracy. At present, the mainstream method assists in Chinese character recognition by adding fine-grained features of characters, such as characters, radicals, and strokes. However, in complex scenarios, extracting effective features of characters is still challenging, highlighting the limitations of existing methods. In addition, introducing feature information of multiple dimensions of characters to enhance the fine-grained features of characters, there are also problems with how to fuse and extract features between multiple features.
[0003] In summary, the current complex scene Chinese character recognition methods have two problems, which limit the recognition accuracy of the model:
[0004] (1) Chinese character recognition in complex scenarios makes it difficult to extract fine-grained feature sequences of characters, resulting in insufficient feature extraction. Traditional models often improve character recognition capabilities by extracting fine-grained feature sequences of radicals and strokes. This approach will result in insufficient extraction of fine-grained features of radicals or strokes when characters are covered or smeared, resulting in a one-to-many problem between features and characters.
[0005] (2) The problem of extracting and fusing multi-dimensional features. Traditional methods tend to use encoders for radicals and characters to generate their respective feature representations. However, the features are not simply stacked. Studies have shown that this kind of feature difference is widely present in multi-feature Chinese character recognition, so that character features are often used in isolation during recognition, which in turn introduces feature noise. This phenomenon prevents the recognition model from using the extracted multi-dimensional features to further improve the Chinese character recognition ability. Summary of the invention
[0006] In view of the difficulty in extracting Chinese character features in complex scenes, the present invention proposes a Chinese character recognition method based on multi-dimensional representation, which can effectively improve the Chinese character recognition effect in complex scenes.
[0007] In order to achieve the above object, the technical solution specifically adopted by the present invention is as follows:
[0008] A Chinese character recognition method based on multi-dimensional representation, which introduces spatial information into the character feature sequence, expands the information richness of the character feature sequence, can not only capture the one-dimensional sequential relationship of key strokes but also capture the two-dimensional spatial position relationship, and realizes the independent recognition of Chinese characters using fewer key features. In the subsequent steps, it combines the multi-task network and the self-attention mechanism to extract multi-level features such as characters, radicals and key strokes, optimizes the richness and accuracy of features through the feedforward neural network, effectively improves the feature extraction capability, and solves the problem of difficulty in extracting Chinese character features in complex scenes; finally, the Chinese character feature similarity algorithm is used to remove noise in multi-dimensional features, fuse multi-dimensional features, and improve the priority of key features, thereby enhancing the model's Chinese character recognition ability in complex scenes, which specifically includes the following steps:
[0009] Step 1: Get the Chinese character recognition text dataset and input image and label text S;
[0010] Step 2: For the input image , first preprocess the image, adjust the aspect ratio of the image, and complete the image interpolation operation. Based on the ResNet-50 model, extract the character features in the image and obtain the preliminary shared feature Z;
[0011] Step 3: introduce the label text S corresponding to the input image, and convert the label text S into corresponding character embedding in the form of word embedding to obtain the embedding feature;
[0012] Step 4: Design a multi-dimensional feature recognition task, input the preliminary shared feature Z into the character decoder composed of the Transformer encoder, input the text into the decoder layer and the attention layer, and obtain the output result R and the attention matrix , and decode the result R into the corresponding character sequence R c ;
[0013] Step 5: Further process the extracted shared features Z to obtain fine-grained features at the character level , and map the embedded features into corresponding root embedding sequences and key stroke embedding sequences through corresponding dictionaries;
[0014] Step 6: The character-level fine-grained features obtained in step 5 Decode into corresponding radical sequences and key stroke sequences;
[0015] Step 7: Remove the noise in the multi-dimensional features through the Chinese character feature similarity algorithm, fuse the multi-dimensional features and improve the priority of key features;
[0016] Step 8: Calculate the loss of the multi-dimensional feature extraction network in step 5 and step 6 to obtain the corresponding total loss.
[0017] Furthermore, in the step 1, the Chinese character recognition text dataset uses the public general dataset CTR for the Chinese character recognition task, and the general dataset CTR is divided into a training set, a validation set, and a test set to provide basic data support for subsequent experiments.
[0018] Furthermore, the specific steps of step 2 include:
[0019] Step 2.1: Before the image is input to the feature extraction model, the aspect ratio of the input image is adjusted. Subsequently, a bilinear interpolation preprocessing operation is performed to obtain a new image. ;
[0020] Step 2.2: For the input image , add the character information of the input image to its character embedding, use ResNet-50 as the encoder for image feature extraction, and for a given input image I1, extract preliminary shared features Z for subsequent multi-dimensional representation recognition.
[0021] Furthermore, in step 3, for a given label text sequence , and the embedding process is performed, and the embedding feature E is obtained by character embedding. The embedding information includes three categories: token embedding, segment embedding, and position embedding, which respectively represent the vector representation of characters, the relationship information between different sentences, and the position information of characters in sentences.
[0022] Furthermore, the specific steps included in step 4 are as follows:
[0023] Step 4.1: Use the multi-layer attention layer to extract the image features of the preliminary shared features Z to obtain the result containing character information and the corresponding attention matrix. Then, use normalization to obtain the output result R and the attention matrix ;
[0024] Step 4.2: Input the output R of the decoder layer into the generator layer, use the linear layer to map the feature vector into a vector of the vocabulary size, and finally get the prediction result R c .
[0025] Furthermore, the specific steps of step 5 include:
[0026] Step 5.1: In order to align radicals, key strokes and characters, character-level image features are calculated through shared features and attention matrices. ;
[0027] Step 5.2: Use the dictionary matching method to convert the embedded feature E into the corresponding root sequence E rand key stroke sequence E k .
[0028] Furthermore, the specific steps of step 6 include:
[0029] Step 6.1: and root embedding sequence E r Input into the root decoder for decoding to obtain the corresponding root sequence result ;
[0030] Step 6.2: and the key pen shape embedding sequence E k Input into the key stroke decoder and decode into the corresponding key stroke sequence result .
[0031] Furthermore, the specific steps of step 7 include:
[0032] Step 7.1: First, and Mapping to character space:
[0033]
[0034]
[0035] In the formula, , , N represents the batch size, L is the text length, and C is the character space size.
[0036] Then, based on the idea of Chinese character similarity, the similarity between all features is calculated, and the two features with the highest similarity are selected. Then, the features with the highest correlation are fused and normalized to finally obtain the prediction result. , .
[0037] Furthermore, in step 8, in order to accurately calculate the loss of the multi-task network model, the cross entropy loss function is used to measure the loss of Chinese characters in different feature dimensions, and the weight coefficients are added to obtain the final loss function: , the specific calculation process is as follows:
[0038]
[0039] In the formula, , and is the trade-off coefficient, L k and L r It is the loss of key stroke shapes and the loss of radical modules.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] The present invention proposes a key stroke feature extraction method based on spatial position. Compared with the traditional method, the method can not only capture the one-dimensional sequence relationship of key strokes but also capture the two-dimensional spatial position relationship, so as to realize independent recognition of Chinese characters using fewer key features.
[0042] On this basis, the present invention proposes a Chinese character recognition model that integrates multi-dimensional representation. The model combines a multi-task network and a self-attention mechanism to extract multi-level features of characters, radicals, and key strokes, and optimizes the richness and accuracy of features through a feedforward neural network, effectively improving the feature extraction capability.
[0043] Finally, the present invention uses the Chinese character feature similarity algorithm to remove noise from multidimensional features, fuse multidimensional features, and increase the priority of key features, thereby enhancing the model's Chinese character recognition ability in complex scenes. Experiments on mainstream data sets and complex scene data sets have verified the effectiveness of the model in solving complex scene Chinese character recognition problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flowchart of a Chinese character recognition method based on multi-dimensional representation according to the present invention;
[0045] Figure 2 is a structural diagram of a key stroke shape prediction module of the present invention;
[0046] Figure 3 It is a structural diagram of the multi-dimensional feature comprehensive judgment module of the present invention. DETAILED DESCRIPTION
[0047] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.
[0048] A Chinese character recognition method based on multi-dimensional representation of the present invention, such as Figure 1 and Figure 2 As shown, the following steps are included:
[0049] Step 1: Get the Chinese character recognition text dataset and input image and label text S; the Chinese character recognition text dataset uses the public general dataset CTR for Chinese character recognition tasks, which includes scene text, printed text, web page text and handwriting datasets; the general dataset CTR is divided into training set, validation set and test set to provide basic data support for subsequent experiments.
[0050] Step 2: For the input image , first preprocess the image, adjust the aspect ratio of the image, and complete the image interpolation operation, then extract the character features in the image based on the ResNet-50 model to obtain the preliminary shared features Z; specifically:
[0051] Step 2.1. Before the image is input to the feature extraction model, a suitable ratio coefficient is selected between the long side and the short side of the input image to maintain the aspect ratio of the image. Subsequently, the input image is processed using a preprocessing operation. Perform bilinear interpolation to obtain a new image of the same size as the specified image. .
[0052] Step 2.2: For the input image , embedding pictures in its characters Corresponding character information, ResNet-50 is used as the encoder for image feature extraction. At the same time, in order to retain more image feature information in the future, the last three downsampling layers of the ResNet-50 model feature extraction module are deleted. For a given input image , obtain the preliminary shared features Z, , used for subsequent multi-dimensional representation extraction; among them, .
[0053] Subsequently, a feedforward neural network is used to optimize the improved model parameters of Rest-50 to better enhance the feature extraction capability of the image feature extraction model.
[0054] Step 3: Introduce the label text S corresponding to the input image, and obtain the corresponding character embedding of the label text S in the form of word embedding. Specifically:
[0055] Step 3.1: For a given label text sequence , perform preprocessing operations, use [CLS] as a marker for subsequent classification tasks, and add [SEP] markers at the end of the sentence to separate sentences. is the text label sequence after preprocessing and labeling, where and Indicates two additional tags. Before being input into the subsequent decoder model, the label text is processed by character embedding to obtain the embedding feature E; the embedding information includes token embedding, segment embedding, and position embedding, which respectively represent the vector representation of characters, the relationship information between different sentences, and the position information of characters in sentences.
[0056] Step 4: Design a multi-dimensional feature recognition task, input the preliminary shared feature Z into the character decoder composed of the Transformer encoder, input the text into the decoder layer and the attention layer, and obtain the output result R and the attention matrix , and decode the obtained result R into the corresponding prediction result R c Specific:
[0057] Step 4.1: Input the obtained preliminary shared features Z to the decoder layer and the attention layer, use the multi-head attention layer to perform self-attention operation, and then use the attention layer to process the attention operation between the text and the image to obtain the result containing the character information and the corresponding attention matrix. Then, add the result containing the character information to the original input and normalize it to obtain the output result containing the position information. Finally, return the output result R and the attention matrix .
[0058] Step 4.2: Input the output R of the decoder layer into the generator layer, use the linear layer to map the feature vector into a vector of the vocabulary size, and finally get the prediction result R c .
[0059] Step 5: In order to better capture fine-grained image features, the model needs to capture subtle and distinguishing local features, and further process the extracted shared features to obtain fine-grained features at the character level. At the same time, in order to better extract radicals and key stroke features in the future, the embedded features are mapped into corresponding radical embedding sequences and key stroke embedding sequences through the corresponding dictionary; specifically:
[0060] Step 5.1: In order to align the radicals, key strokes and characters, the following preprocessing is done: First, the attention matrix is processed and compressed into one channel. Then, the attention matrix generated by character decoding is converted into Multiply the convolution feature map Z at the corresponding position to get the character level image features In order to reduce unnecessary calculations and further extract more abstract features, a 1*1 convolutional layer is used to compress the features, so that the model can better generate or predict fine-grained features at the character level in subsequent tasks. The process is as follows:
[0061]
[0062] In the formula, is a convolutional layer with a convolution kernel size of 1, , representing the fine-grained features at the character level.
[0063] Step 5.2: Convert the embedded feature E into the corresponding root character embedded sequence E through dictionary matching method r and the key stroke embedded sequence E k .
[0064] Step 6: In order to obtain the two feature sequences of root characters and key strokes, decode the character-level fine-grained features obtained in Step 5 into the corresponding root character sequence and key stroke sequence; specifically:
[0065] Step 6.1: Input and the root character embedded sequence E r into the root character decoder for decoding to obtain the corresponding root character sequence result , and the process is as follows:
[0066]
[0067] In the formula, is the root character decoder, is the root character sequence result. Among them, the structures of the root character decoder and
[0068] Step 6.2: Input and the key stroke embedded sequence E k into the key stroke decoder to decode it into the corresponding key stroke sequence. The specific formula is as follows:
[0069]
[0070] is the key stroke decoder, is the key stroke sequence result. Among them, the structure of the key stroke is as Figure 3 shown. Taking the key stroke decoding process of the character "ice" as an example, the process is as follows:
[0071]
[0072]
[0073]
[0074] In the formula, is the position encoding of the key stroke order. , is the attention mask matrix. Finally, the prediction result is "3, 2, 1, 9, 0", and the corresponding Chinese character is "ice".
[0075] Step 7: In order to further improve the Chinese character recognition capability and enhance the utilization of fine-grained features, the Chinese character feature similarity algorithm is used to remove noise from the multi-dimensional features of characters, radicals, and key strokes, and the multi-dimensional features are integrated and the priority of key features is increased, thereby enhancing the Chinese character recognition capability of the model in complex scenarios; specifically:
[0076] Step 7.1, the specific method is as follows: first, the root sequence result and key pen sequence results Mapping to character space:
[0077]
[0078]
[0079] In the formula, , , N represents the batch size, L is the text length, and C is the character space size.
[0080] Then, based on the Chinese character similarity algorithm, the similarity between all features is calculated, and the two features with the highest similarity are selected. Then, the features with the highest correlation are fused and normalized:
[0081]
[0082]
[0083] In the formula, Sim(M 1, M2) represents the similarity between M1 and M2, n represents the total number of features, including the number of strokes, the number of Chinese character structures, radicals and key stroke shapes, fi (M1, M2) represents the character similarity in the i-th feature space, and Wi represents the weight of the i-th feature; () is used to find the two features with the highest similarity; ) indicates normalization processing.
[0084]
[0085] Finally, the prediction results are obtained , .
[0086] Step 8: Calculate the loss of the multidimensional feature extraction network composed of the characters, radicals and key strokes in steps 5 and 6 to obtain the corresponding total loss , used for subsequent model training and improvement, specifically:
[0087] Step 8.1: In order to accurately calculate the loss of the multi-task network model, the cross entropy loss function is used to measure the loss of Chinese characters in different feature dimensions, and the weight coefficients are added to obtain the final loss function. , the specific calculation process is as follows:
[0088]
[0089] In the formula, , and is the trade-off coefficient, L k and L r It is the loss of key stroke shapes and the loss of radical modules.
[0090] In order to illustrate the effect of the present invention, a comparative experiment was conducted using an existing model. The test was conducted on the public dataset CTR of the Chinese character recognition task, where the dataset includes a scene dataset, a webpage dataset, a text dataset, and a handwriting dataset. On this basis, data training and testing were performed on each dataset, and finally the experimental results were analyzed.
[0091] In addition, the present invention uses the metric accuracy (ACC) and the normalized evaluation (NED) indicators as the evaluation criteria for model performance. The values of ACC and NED are both in the range of [0,1]. Higher ACC and NED values indicate that the performance of the evaluation model is better.
[0092] Before the index calculation, the following preprocessing was performed: all spaces were deleted, all English characters were converted to lowercase, and simplified and traditional Chinese were converted to simplified Chinese. Subsequently, the accuracy was calculated using the metric precision. The experimental results of the comparison between the method of the present invention and nine existing methods such as CRNN, ASTER, and MORAN are shown in Table 1.
[0093] Table 1. Baseline comparison results on common datasets.
[0094]
[0095] As shown in Table 1, the method proposed in the present invention can effectively improve the Chinese character recognition effect, and the ACC and NED indicators are significantly improved, both of which are better than other benchmark models. The experimental data show the effectiveness of the model proposed in the present invention for Chinese character recognition in complex scenes.
[0096] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and descriptions are only preferred examples of the present invention and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A Chinese character recognition method based on multi-dimensional representation, Features: The steps include: Step 1: Get the Chinese character recognition text dataset and input image and label text S; Step 2: For the input image , first preprocess the image, adjust the aspect ratio of the image, and complete the image interpolation operation. Based on the ResNet-50 model, extract the character features in the image and obtain the preliminary shared feature Z; Step 3: introduce the label text S corresponding to the input image, and convert the label text S into corresponding character embedding in the form of word embedding to obtain the embedding feature; Step 4: Design a multi-dimensional feature recognition task, input the preliminary shared feature Z into the character decoder composed of the Transformer encoder, input the text into the decoder layer and the attention layer, and obtain the output result R and the attention matrix , and decode the result R into the corresponding character sequence R c ; Step 5: Further process the extracted shared features Z to obtain fine-grained features at the character level , and map the embedded features into corresponding root embedding sequences and key stroke embedding sequences through corresponding dictionaries; Step 6: The character-level fine-grained features obtained in step 5 Decode into corresponding radical sequences and key stroke sequences; Step 7: Remove noise from multi-dimensional features by using a Chinese character feature similarity algorithm, wherein the multi-dimensional features include characters, radicals, and key stroke shapes, thereby integrating multiple dimensional features and increasing the priority of key features; Step 8: Calculate the loss of the multi-dimensional feature extraction network in steps 5 and 6 to obtain the corresponding total loss for subsequent model training improvement.
2. A Chinese character recognition method based on multidimensional representation as claimed in claim 1, Features: In the step 1, the Chinese character recognition text data set uses the public general data set CTR for the Chinese character recognition task, and the general data set CTR is divided into a training set, a validation set and a test set.
3. A Chinese character recognition method based on multidimensional representation as claimed in claim 1, Features: The specific steps of step 2 include: Step 2.1: Before the image is input to the feature extraction model, the aspect ratio of the input image is adjusted. Subsequently, the processed image is obtained using a bilinear interpolation preprocessing operation. ; Step 2.2: For the input image , add the character information of the input image to its character embedding, use ResNet-50 as the encoder for image feature extraction, for a given input image ,The preliminary shared features Z are extracted for subsequent multi-dimensional representation recognition.
4. A Chinese character recognition method based on multidimensional representation as claimed in claim 1, Features: In step 3, for a given label text sequence , and the embedding process is performed, and the embedding feature E is obtained by character embedding. The embedding information includes three categories: token embedding, segment embedding, and position embedding, which respectively represent the vector representation of characters, the relationship information between different sentences, and the position information of characters in sentences.
5. A Chinese character recognition method based on multi-dimensional representation as claimed in claim 1, Features: The specific steps included in step 4 include: Step 4.1: Use the multi-layer attention layer to extract the image features of the preliminary shared features Z to obtain the result containing character information and the corresponding attention matrix. Then, use normalization to obtain the output result R and the attention matrix ; Step 4.2: Input the output R of the decoder layer into the generator layer, use the linear layer to map the feature vector into a vector of the vocabulary size, and finally get the prediction result R c .
6. A Chinese character recognition method based on multi-dimensional representation as claimed in claim 1, Features: The specific steps of step 5 include: Step 5.1: To align radicals, key strokes, and characters, character-level image features are calculated using shared features and attention matrices. ; Step 5.2: Use the dictionary matching method to convert the embedded feature E into the corresponding root sequence E r and key stroke sequence E k .
7. A Chinese character recognition method based on multi-dimensional representation as claimed in claim 1, Features: The specific steps of step 6 include: Step 6.1: and root embedding sequence E r Input into the root decoder for decoding to obtain the corresponding root sequence result ; Step 6.2: and the key pen shape embedding sequence E k Input into the key stroke decoder and decode into the corresponding key stroke sequence result .
8. A Chinese character recognition method based on multi-dimensional representation as claimed in claim 1, Features: In step 7, firstly the root sequence result and key pen sequence results Mapped to the character space, then, based on the idea of Chinese character similarity, calculate the similarity between all features, select the two features with the highest similarity, then fuse the features with the highest correlation, and perform normalization to finally get the prediction result .
9. A Chinese character recognition method based on multi-dimensional representation as claimed in claim 1, Features: In step 8, the cross entropy loss function is used to measure the loss of Chinese characters in different feature dimensions, and the weight coefficients are added to obtain the final loss function : In the formula, , and is the trade-off coefficient, L k and L r It is the loss of key stroke shapes and the loss of radical modules.
Citation Information
Patent Citations
Scene text recognition method based on explicit supervision attention mechanism
CN113159023A
Named entity recognition method and system based on adversarial transfer learning
CN116167378A
Chinese character stroke splitting method
CN117011864A
