Text recognition method, medium, apparatus, and computing device

By extracting character features from the target text recognition model and comparing them with a preset codebook, the classification layer is eliminated, and a preset codebook with a small number of parameters is used. This solves the problem of high device performance caused by the large model size, and enables flexible application and accurate recognition on different devices.

CN114021557BActive Publication Date: 2026-03-20HANGZHOU NETEASE ZHIQI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111323474.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-08
Publication Date
2026-03-20
Estimated Expiration
2041-11-08

AI Technical Summary

Technical Problem

Existing target text recognition models require the recognition of tens of thousands of characters, resulting in a very large number of parameters corresponding to character classification probabilities, a large data package size, and high requirements for device performance.

Method used

The target text recognition model is used to extract the character features of the characters to be recognized, and the character features are compared with the preset codebook. The conventional classification layer is eliminated, and a relatively small preset codebook is used to determine the text corresponding to the characters.

Benefits of technology

While ensuring the accuracy of text recognition results, the size of the target text recognition model has been reduced, making it flexible for application on various computing devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114021557B_ABST
    Figure CN114021557B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a text recognition method, medium, device and computing device, the method comprising: obtaining to-be-recognized data; obtaining character features of to-be-recognized characters through a target text recognition model, the target text recognition model being obtained by training based on sample character features of sample characters in sample data; determining a text corresponding to the to-be-recognized characters according to the character features of the to-be-recognized characters; and determining a target text corresponding to the to-be-recognized data according to the text corresponding to the to-be-recognized characters. In this scheme, the text corresponding to the characters is obtained through the character features and a preset codebook, the conventional classification layer in the target text recognition model can be eliminated, the parameter amount of the preset codebook used is relatively small, the package size of the target text recognition model can be reduced while ensuring the accuracy of the text recognition result, and the target text recognition model can be flexibly applied to various computing devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this disclosure relate to the field of text recognition technology, and more specifically, the embodiments of this disclosure relate to text recognition methods, media, apparatus and computing devices. Background Technology

[0002] This section is intended to provide background or context for the embodiments of this disclosure as set forth in the claims. The description herein is not intended to be a prior art simply because it is included in this section.

[0003] With the continuous development of technology, text recognition technology has been applied to various scenarios, such as recognizing text in images or recognizing text in speech.

[0004] In related technologies, target text recognition models are typically used to improve text recognition efficiency. However, current target text recognition models usually calculate the character classification probability for each character through a classification layer, and then determine the text corresponding to the character based on the character classification probability. Since target text recognition models typically need to recognize tens of thousands of characters, and these classification layers are usually FP32 full-precision classification layers, the number of parameters corresponding to the character classification probability is very large, resulting in a large package size for the target text recognition model and high performance requirements for the devices using this model for text recognition. Summary of the Invention

[0005] This disclosure provides a text recognition method, medium, apparatus, and computing device to address the technical problem that in current text recognition processes, the target text recognition model has a large size, which places high performance requirements on the device using the model for text recognition.

[0006] In a first aspect of the present disclosure, a text recognition method is provided, comprising: acquiring data to be recognized, the data to be recognized corresponding to a plurality of characters to be recognized; acquiring character features of the characters to be recognized through a target text recognition model, the target text recognition model being trained based on the sample character features of sample characters in sample data, the sample characters including the characters to be recognized; determining the text corresponding to the characters to be recognized based on the character features of the characters to be recognized; and determining the target text corresponding to the data to be recognized based on the text corresponding to the characters to be recognized.

[0007] In one embodiment of this disclosure, the target text recognition model includes a character feature extraction layer; the character features of the character to be recognized are obtained through the character feature extraction layer.

[0008] In an embodiment of the present disclosure, the text corresponding to the to-be-recognized character is determined according to the character feature of the to-be-recognized character and the preset codebook, including: determining a target codebook corresponding to the to-be-recognized character in the preset codebook according to the similarity between the character feature of the to-be-recognized character and the preset codebook; determining a target state corresponding to the target codebook according to the correspondence between the preset codebook and the preset state feature; determining a target character in the to-be-recognized character according to the target state corresponding to the to-be-recognized character; and determining the text corresponding to the target character according to the target codebook of the target character.

[0009] In an embodiment of the present disclosure, the target text recognition model includes a classification layer; the target codebook corresponding to the to-be-recognized character in the preset codebook is determined according to the similarity between the character feature of the to-be-recognized character and the preset codebook through the classification layer, and the classification layer is obtained by normalizing the preset codebook.

[0010] In an embodiment of the present disclosure, different target states correspond to different character types, and the character types include empty symbols and repeated characters; the target character in the to-be-recognized character is determined according to the target state of the to-be-recognized character, including: determining the character type of the to-be-recognized character according to the target state of the to-be-recognized character; and determining the character in the to-be-recognized data other than the empty symbols and the repeated characters as the target character.

[0011] In an embodiment of the present disclosure, the text recognition method further includes: obtaining a plurality of sample data and a sample feature of a sample character in the sample data; obtaining a predicted state feature corresponding to the sample character through a feature generation model; determining a state feature of the sample character according to the sample feature of the sample character and the predicted state feature; and determining a preset codebook corresponding to the sample character according to the state features of the same sample character in the plurality of sample data.

[0012] In an embodiment of the present disclosure, the preset codebook corresponding to the sample character is determined according to the state features of the same sample character in the plurality of sample data, including: performing binaryzation processing on the state features of the same sample character to obtain a character feature corresponding to the state feature; and determining the preset codebook corresponding to the sample character according to the character feature corresponding to the state feature.

[0013] In a second aspect of the embodiment of the present disclosure, a training method of a target text recognition model is provided, including:

[0014] obtaining a plurality of sample data, the sample data corresponding to a plurality of sample characters; in an i-th training process, obtaining sample character features of the sample characters by an (i-1)-th text recognition model, the (i-1)-th text recognition model being obtained by training based on the sample character features of the sample characters, i being an integer greater than 1; determining a loss function value corresponding to the (i-1)-th text recognition model according to the sample character features of the sample characters and a preset codebook, the loss function value being used to indicate a distance between the sample character features and the preset codebook; and outputting the (i-1)-th text recognition model as a target text recognition model when the loss function value meets a preset requirement.

[0015] In an embodiment of the present disclosure, determining the loss function value corresponding to the (i-1)-th text recognition model according to the sample character features of the sample characters in the sample data and the preset codebook of the sample characters comprises:

[0016] determining a null symbol in the sample characters according to the state features of the sample characters; obtaining sample character features of a preset number of target null symbols in the sample data; and outputting the loss function value corresponding to the (i-1)-th text recognition model according to the sample character features of the non-null symbols, the sample character features of the target null symbols and the preset codebook.

[0017] In a third aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, and the computer readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the text recognition method of the first aspect or the training method of the target text recognition model of the second aspect is implemented.

[0018] In a fourth aspect of the embodiments of the present disclosure, a text recognition device is provided, and the text recognition device comprises:

[0019] The obtaining module is configured to obtain to-be-recognized data, the to-be-recognized data corresponding to a plurality of to-be-recognized characters, and obtain character features of the to-be-recognized characters by a target text recognition model, the target text recognition model being obtained by training based on sample character features of sample characters in sample data, the sample characters including the to-be-recognized characters.

[0020] The determining module is configured to determine a text corresponding to the to-be-recognized characters according to the character features of the to-be-recognized characters, and determine a target text corresponding to the to-be-recognized data according to the text corresponding to the to-be-recognized characters.

[0021] In an embodiment of the present disclosure, the target text recognition model comprises a character feature extraction layer, and the character features of the to-be-recognized characters are obtained by the character feature extraction layer.

[0022] In an embodiment of the present disclosure, the determining module is specifically configured to: determine, according to a similarity between the character feature of the to-be-recognized character and the preset codebook, a target codebook corresponding to the to-be-recognized character in the preset codebook; determine, according to a correspondence relationship between the preset codebook and the preset state feature, a target state corresponding to the target codebook; determine a target character in the to-be-recognized character according to the target state corresponding to the to-be-recognized character; and determine a text corresponding to the target character according to the target codebook of the target character.

[0023] In an embodiment of the present disclosure, the target text recognition model comprises a classification layer, and the classification layer is obtained by normalizing the preset codebook.

[0024] In an embodiment of the present disclosure, different target states correspond to different character types, and the character types include a null symbol and a repeated character.

[0025] The determining module is specifically configured to: determine a character type of the to-be-recognized character according to the target state of the to-be-recognized character; and determine a target character in the to-be-recognized data except the null symbol and the repeated character.

[0026] In an embodiment of the present disclosure, the obtaining module is further configured to: obtain a plurality of sample data and a sample feature of a sample character in the sample data; and obtain, by using a feature generation model, a predicted state feature corresponding to the sample character.

[0027] The determining module is further configured to: determine a state feature of the sample character according to the sample feature of the sample character and the predicted state feature; and determine a preset codebook corresponding to the sample character according to the state features of the same sample character in the plurality of sample data.

[0028] In an embodiment of the present disclosure, the determining module is specifically configured to: perform binaryzation processing on the state features of the same sample character to obtain a character feature corresponding to the state feature; and determine the preset codebook corresponding to the sample character according to the character feature corresponding to the state feature.

[0029] In a fifth aspect of the embodiment of the present disclosure, a training device of a target text recognition model is provided, comprising:

[0030] An obtaining module is configured to obtain a plurality of sample data, the sample data corresponding to a plurality of sample characters, and obtain a sample character feature of a sample character by using an initial target text recognition model;

[0031] A processing module is configured to, in an i-th training process, obtain a sample character feature of a sample character by using an (i-1)-th text recognition model, the (i-1)-th text recognition model being obtained by training based on the sample character feature of the sample character, and i being an integer greater than 1.

[0032] determining, by a determination module, a loss function value corresponding to the i-1th text recognition model according to the sample character features of the sample characters and the preset codebook, the loss function value being used to indicate a distance between the sample character features and the preset codebook;

[0033] outputting, by an output module, the i-1th text recognition model as a target text recognition model in response to the loss function value satisfying a preset requirement.

[0034] In an embodiment of the present disclosure, the determination module is specifically configured to: determine empty symbols in the sample characters according to the state features of the sample characters; obtain sample character features of a preset number of target empty symbols in the sample data; and determine a loss function value corresponding to the i-1th text recognition model according to the sample character features of the non-empty symbol characters, the sample character features of the target empty symbols, and the preset codebook.

[0035] In a sixth aspect of the embodiments of the present disclosure, a computing device is provided, including: at least one processor and a memory; the memory stores computer-executable instructions; and the at least one processor executes the computer-executable instructions stored in the memory, so as to execute the text recognition method of the first aspect or the training method of the target text recognition model of the second aspect.

[0036] In a seventh aspect of the embodiments of the present disclosure, a computer program product is provided, including a computer program; and the computer program is executed to implement the text recognition method of the first aspect or the training method of the target text recognition model of the second aspect.

[0037] The text recognition method, the medium, the device, and the computing device provided by the embodiments of the present disclosure include: obtaining to-be-recognized data; obtaining character features of to-be-recognized characters by a target text recognition model, the target text recognition model being obtained by training based on sample character features of sample characters in sample data, the sample characters including the to-be-recognized characters; determining a text corresponding to the to-be-recognized characters according to the character features of the to-be-recognized characters; and determining a target text corresponding to the to-be-recognized data according to the text corresponding to the to-be-recognized characters. Since the target text recognition model eliminates a conventional classification layer and the parameter amount of the preset codebook is relatively small, the package size of the target text recognition model can be reduced, so that the target text recognition model can be flexibly applied to various computing devices, while the accuracy of the text recognition result can be ensured. BRIEF DESCRIPTION OF DRAWINGS

[0038] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will be more apparent from the following detailed description taken in conjunction with the accompanying drawings, in which:

[0039] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present disclosure is shown in FIG. 1.

[0040] Figure 2 A schematic diagram of a text recognition method provided by an embodiment of the present disclosure is shown in FIG. 2. Figure 1 ;

[0041] Figure 3 A schematic diagram of a preset codebook acquisition process provided by an embodiment of the present disclosure is shown in FIG. 3.

[0042] Figure 4 A schematic diagram of a principle of a preset codebook acquisition process provided by an embodiment of the present disclosure is shown in FIG. 4.

[0043] Figure 5 A schematic diagram of a text recognition method provided by an embodiment of the present disclosure is shown in FIG. 5. Figure 2 ;

[0044] Figure 6 A schematic diagram of a principle of a target text recognition model provided by an embodiment of the present disclosure is shown in FIG. 6. Figure 1 ;

[0045] Figure 7 A schematic diagram of a principle of a target text recognition model provided by an embodiment of the present disclosure is shown in FIG. 7. Figure 2 ;

[0046] Figure 8 A schematic diagram of a training method of a target text recognition model provided by an embodiment of the present disclosure is shown in FIG. 8. Figure 1 ;

[0047] Figure 9 A schematic diagram of a training process of a target text recognition model provided by an embodiment of the present disclosure is shown in FIG. 9.

[0048] Figure 10 A schematic diagram of a training method of a target text recognition model provided by an embodiment of the present disclosure is shown in FIG. 10. Figure 2 ;

[0049] Figure 11 A schematic diagram of a storage medium provided by an embodiment of the present disclosure is shown in FIG. 11.

[0050] Figure 12 A schematic diagram of a text recognition apparatus provided by an embodiment of the present disclosure is shown in FIG. 12.

[0051] Figure 13 A schematic diagram of a training apparatus of a target text recognition model provided by an embodiment of the present disclosure is shown in FIG. 13.

[0052] Figure 14 A schematic diagram of a computing device provided by an embodiment of the present disclosure is shown in FIG. 14.

[0053] In the drawings, like or corresponding elements are denoted by like or corresponding reference numerals. DETAILED DESCRIPTION

[0054] The principles and spirits of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that the embodiments are given only so that those skilled in the art can better understand and implement the present disclosure, and do not limit the scope of the present disclosure in any way. On the contrary, the embodiments are provided so that the present disclosure is more thorough and complete, and the scope of the present disclosure is fully conveyed to those skilled in the art.

[0055] Those skilled in the art understand that the embodiments of the present disclosure can be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure can be embodied as a complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0056] According to embodiments of the present disclosure, a text recognition method, medium, device and computing equipment are provided.

[0057] In this paper, it should be understood that the term Optical Character Recognition (OCR) refers to the process of checking characters printed on paper by an electronic device (such as a scanner or digital camera), determining their shape by detecting light and dark patterns, and then translating the shape into computer text by character recognition method; that is, using optical method to convert the characters in paper document into black and white dot matrix image file, and converting the characters in the image into text format through recognition software, for further editing and processing by word processing software.

[0058] Automatic Speech Recognition (ASR) is a technology that converts the lexical content in human speech into computer-readable input, such as key, binary code or character sequence.

[0059] Connectionist temporal classification (CTC) based on neural network is an algorithm commonly used in the fields of speech recognition and text recognition, which is used to solve the problem that the input data and output data of the model are of different lengths and cannot be aligned.

[0060] In addition, the number of any elements in the drawings is used for example rather than limitation, and any naming is only used for distinction, and does not have any limiting meaning.

[0061] The principles and spirits of the present disclosure will be described below with reference to several representative embodiments of the present disclosure. SUMMARY

[0063] The present inventors have found that current target text recognition models generally need to calculate the character classification probability of each character, and then determine the corresponding text of the character according to the character classification probability through a classification layer, for example, OCR models and ASR models, etc. Since these target text recognition models generally need to recognize thousands of characters, the parameter amount corresponding to the character classification probability is very large, for example, the parameter amount in the FP32 full-precision classification layer will exceed 10MB, which makes the package body of the target text recognition model larger, and the performance requirement of the device using the model for text recognition is higher.

[0064] Therefore, the embodiments of the present disclosure provide a text recognition method, medium, device and computing device. First, a target text recognition model is used to extract character features of a to-be-recognized character, and then the character features are compared with a preset codebook to obtain a corresponding text according to the comparison result. By using the character features and the preset codebook to obtain the text corresponding to the character, the conventional classification layer in the target text recognition model can be eliminated, and the parameter amount of the preset codebook used is relatively small. The package body size of the target text recognition model can be reduced while ensuring the accuracy of the text recognition result, so that the target text recognition model can be flexibly applied to various computing devices.

[0065] Among them, the method and the device are based on the same application concept. Since the principles of the method and the device for solving problems are similar, the implementation of the device and the method can be mutually referred to, and the repeated parts will not be described again.

[0066] After introducing the basic principles of the present disclosure, the various non-limiting embodiments of the present disclosure will be specifically introduced below.

[0067] OVERVIEW OF APPLICATION SCENARIOS

[0068] Firstly, refer to Figure 1 , Figure 1 The application scenario diagram provided by the embodiments of the present disclosure. It schematically shows the application scenario of the text recognition method of the embodiments of the present disclosure, and / or the training method of the target text recognition model, as shown in Figure 1 , the scenario includes a server 101 and / or a terminal 102, and the text recognition process or the training process of the target text recognition model is realized through the server 101 or the terminal 102.

[0069] It should be noted that the text recognition process and the training process of the target text recognition model can be executed in the cloud (i.e. the server 101 side) or locally (i.e. the terminal 102), and the embodiments of the present disclosure do not make specific limitations.

[0070] The server 101 can be a single server, a server cluster, a distributed server, a centralized server, or a cloud server.

[0071] The terminal 102 can be a personal digital assistant (PDA) device, a handheld device (e.g., a smartphone, a tablet computer) with wireless communication functions, a computing device (e.g., a personal computer (PC)), a vehicle-mounted device, a wearable device (e.g., a smart watch, a smart bracelet), a smart home device (e.g., a smart display device), or the like.

[0072] Exemplary Method

[0073] The method for training a text recognition method and a target text recognition model according to an example embodiment of the present disclosure will be described below in combination with an application scenario of Figure 1 Figures 2-6 It should be noted that the above application scenario is only shown for the purpose of facilitating understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.

[0074] Figure 2 The flowchart of the text recognition method provided by the embodiments of the present disclosure is shown in Figure 1 . As shown in Figure 2 , the text recognition method provided by the embodiments includes the following steps:

[0075] S201, obtaining to-be-recognized data.

[0076] The to-be-recognized data corresponds to a plurality of to-be-recognized characters.

[0077] In some embodiments, the to-be-recognized data is different for different recognition scenarios. On the one hand, the to-be-recognized data can be image data, and the to-be-recognized characters are texts in the image. On the other hand, the to-be-recognized data can also be voice data, and the to-be-recognized characters are vocabulary contents in the voice.

[0078] S202, obtaining character features of the to-be-recognized characters by using a target text recognition model.

[0079] It should be noted that the type of the target text recognition model corresponds to the type of the to-be-recognized data described above, that is, when the to-be-recognized data is image data, the target text recognition model can be a target text recognition model based on OCR technology; when the to-be-recognized data is voice data, the target text recognition model can be a target text recognition model based on ASR technology. ​

[0080] The target text recognition model is trained based on sample character features of sample characters in sample data, and the sample characters include the to-be-recognized characters. After the training, the target text recognition model has the capability of obtaining character features of the to-be-recognized characters. In this step, the to-be-recognized data is input into the target text recognition model, and the target text recognition model first recognizes the to-be-recognized characters in the to-be-recognized data and then obtains the character features of the to-be-recognized characters.

[0081] It should be understood that the specific structure and implementation principle of the target text recognition model are shown in subsequent embodiments.

[0082] In some embodiments, the type of character features is not specifically limited in the embodiments of the present disclosure, for example, the character features can be embedding vectors of binary character sequences.

[0083] For example, the to-be-recognized data is image data, and the to-be-recognized characters contained in the image data are “C, A, and T”. In this step, the character features of “C, A, and T” are obtained through the target text recognition model, that is, “C, A, and T” in the image data are converted into binary character sequences.

[0084] S203, determining a text corresponding to the to-be-recognized character according to the character feature of the to-be-recognized character and a preset codebook.

[0085] The preset codebook is a character feature of a preset character, each preset codebook corresponds to a unique preset character, and the preset character includes the to-be-recognized character. In this step, after obtaining the character feature of the to-be-recognized character, the target codebook corresponding to the character feature can be obtained from the preset codebook according to the character feature, and the preset character corresponding to the target codebook can be determined according to the correspondence between the preset codebook and the preset character. The text corresponding to the preset character is the text corresponding to the to-be-recognized character.

[0086] It should be understood that the target codebook can be a codebook identical to the character feature in the preset codebook.

[0087] It should be noted that the preset codebook is also an embedding vector of a binary character sequence.

[0088] S204, determining a target text corresponding to the to-be-recognized data according to the text corresponding to the to-be-recognized character.

[0089] According to the above steps, after obtaining the texts corresponding to all to-be-recognized characters in the to-be-recognized data, the texts corresponding to the to-be-recognized characters can be sorted and combined according to the order of the characters in the to-be-recognized characters, and the target text can be obtained.

[0090] In the embodiments of the present disclosure, the text corresponding to the character is obtained through the character feature and the preset codebook, the conventional classification layer in the target text recognition model can be eliminated, and the preset codebook is a binary character sequence stored in the form of high-dimensional 1bit vector, the parameter amount of which is relatively small, so that the package size of the target text recognition model can be reduced while ensuring the accuracy of the text recognition result, and the target text recognition model can be flexibly applied to various computing devices.

[0091] Next, the acquisition process of the preset codebook will be described in detail in combination with the embodiments shown in the following Figure 3

[0092] Figure 3 The flowchart of the preset codebook acquisition process provided by the embodiments of the present disclosure is shown in FIG. 3. As shown in FIG. 3, the preset codebook acquisition process in the embodiments of the present disclosure includes the following steps: Figure 3

[0093] S301, acquire a plurality of sample data and sample features of sample characters in the sample data.

[0094] It should be understood that the type of sample data corresponds to the type of target text recognition model. For example, if the target text recognition model is a model for recognizing text in image data, the sample data is also image data, and if the target text recognition model is a model for recognizing text in audio data, the sample data is also audio data.

[0095] Among them, the sample feature of the sample character is the annotation data obtained by annotating the sample data. For example, when the sample data is image data, through annotation, the annotation data is: the character corresponding to each (or multiple) pixel; when the sample data is audio data, through annotation, the annotation data is: the character corresponding to each (or multiple) audio frame.

[0096] S302, obtain the predicted state feature corresponding to the sample character through the feature generation model.

[0097] S303, determine the state feature of the sample character according to the sample feature of the sample character and the predicted state feature.

[0098] In the current target text recognition model, for example, the model based on OCR, ASR and other technologies, the input is image data or audio data, and the image data and audio data are converted into feature sequences after being recognized by the model, and the image data or audio data often contains some empty symbols or repeated characters. For example, in the recognition process of image data, one or more pixels of the image are recognized, at this time, the pixels that do not contain characters (i.e. empty symbols) will also be converted into feature sequences; or, when multiple pixels contain the same character (i.e. repeated characters), these pixels will all be converted into the same feature sequence. ​​

[0099] Similarly, when recognizing the audio data, one or more frames of audio data are recognized, and the audio frames containing no characters (i.e., empty symbols) are also converted into feature sequences, or when multiple audio frames contain the same character (i.e., repeated characters), the audio frames are all converted into the same feature sequence.

[0100] Taking image data as an example, Figure 4 A principle diagram of a preset codebook acquisition process provided by an embodiment of the present disclosure is shown in FIG. 2. Figure 4 As shown in FIG. 2, in the input image data, the obtained sample features are "C, A, T" after labeling, however, there are empty symbols before the sample character "C" and the sample character "A" and after the sample character "T", which are also converted into feature sequences; since the sample character "A" occupies a large pixel space, the pixels are all converted into the same feature sequence, so that the repeated character "A" is obtained.

[0101] Therefore, in an embodiment of the present disclosure, the character state of the sample character can be recognized by using a feature generation model, so that the empty symbols, repeated characters and normal characters in the sample character are obtained, and the preset codebooks corresponding to the empty symbols, repeated characters and normal characters are obtained, so that after the character features of the to-be-recognized characters are recognized by using the target text recognition model, the states of the to-be-recognized characters can be accurately determined according to the corresponding relationship between the character features and the preset codebooks, so as to prevent the interference of the empty symbols and repeated characters on the recognition process and improve the accuracy of the recognition result.

[0102] In some embodiments, the feature generation model can be a CTC model.

[0103] Taking the CTC model as an example, in this step, the sample data and the sample features of the sample characters in the sample data are input into the CTC model, the state of the sample character is predicted by using the CTC model, and the predicted state features of the sample character are obtained.

[0104] Further, the preset state features of the sample characters are aligned with the sample features, so that the state features corresponding to each sample character are obtained.

[0105] In addition, it should be noted that since the feature sequence output by the CTC model is ordered, the feature sequence is assigned to the aligned character state according to the order, and each sample character can obtain its own feature high-dimensional vector, i.e., the state feature.

[0106] Specifically, the CTC method completes alignment by introducing an empty symbol state ε and a repeated state outside the character category, the empty symbol state ε represents no output (i.e., an empty symbol) at the prediction point, and the repeated state represents the repeated output of a character, and the number of categories of the repeated state is one more than the number of characters, such as Figure 4As shown, after the alignment processing, for Figure 4 The sample data "CAT" shown in the above formula (1) has a corresponding state feature "εCεAATε".

[0107] S304, determining a preset codebook corresponding to the sample character according to the state features of the same sample character in the plurality of sample data.

[0108] It should be noted that since the plurality of sample data can all contain the same character, and the character state of the same character in different sample data can be different, after obtaining the state features of the same character in different sample data, a state feature set of the same character is obtained.

[0109] For example, the sample data "CAT", "CRAB", and "CHICK" all contain the character "C", and after obtaining the state features of the character "C" in these sample data respectively, they are placed in the state feature set corresponding to the character "C" respectively. That is, the same character corresponds to a plurality of state features, and as for other sample characters, the same processing method is used, which is not shown here.

[0110] Further, according to the state features corresponding to the same character, the character feature of the character is obtained. Next, steps S3041 and S3042 are combined for detailed description:

[0111] S3041, performing binaryzation processing on the state features of the same sample character to obtain the character feature corresponding to the state feature.

[0112] It should be noted that when the dimension of the state feature output in the CTC model is higher than the preset dimension, a randomly generated matrix can be used to map the state feature to a low dimension N, wherein the value of N can be set as required, and the present disclosure does not limit the value of N.

[0113] For example, taking the number of state features contained in each sample character as 100, the feature dimension of each state feature as 1024, and the value of N as 256 as an example, the state feature matrix corresponding to each sample character is 100*1024, and after mapping, the state feature matrix of each character is 100*256.

[0114] Further, the state feature after mapping by the random matrix is binaryzation processed to obtain the character feature corresponding to each state feature, wherein each character feature is an N-bit binary string. For the sample character containing 100 state features, a total of 100 N-bit binary strings (character features) are corresponded.

[0115] S3042, determining a preset codebook corresponding to the sample character according to the state features of the same sample character in the plurality of sample data.

[0116] Still taking the above as an example, in this step, for each sample character, a character feature needs to be obtained from the 100 character features corresponding to the sample character as the preset codebook of the sample character.

[0117] It should be noted that in this process, a character feature can be randomly selected from the 100 character features corresponding to the sample character as the preset codebook of the sample character, or the character feature with the highest occurrence frequency among the 100 character features of the sample character can be determined as the preset codebook of the sample character, and the embodiments of the present disclosure are not limited.

[0118] It should be understood that for the null character sample, the preset codebook of the null character sample can be obtained according to the scheme of step S3042; in some embodiments, since the occurrence frequency of the null character sample is relatively high and the distribution is discrete, a N-bit binary sequence all of which are 0 or 1 can be specified as the preset codebook of the null character to reduce the operation amount and improve the efficiency of obtaining the preset codebook.

[0119] It should be understood that since the sample character includes the to-be-recognized character, through the scheme of the present embodiment, after obtaining the preset codebook of the sample character, the preset codebook of the to-be-recognized character can be directly obtained.

[0120] Next, the method of how the target text recognition model recognizes text will be described in more detail in combination with the specific structure of the target text recognition model.

[0121] Figure 5 Flowchart of the text recognition method provided by the embodiments of the present disclosure Figure 2 As shown in the flowchart, the text recognition method provided by the embodiments of the present disclosure includes the following steps: Figure 5

[0122] S501, obtaining to-be-recognized data.

[0123] The to-be-recognized data corresponds to a plurality of to-be-recognized characters.

[0124] S502, obtaining the character features of the to-be-recognized characters through a character feature extraction layer.

[0125] Figure 6 Principle diagram of the target text recognition model provided by the embodiments of the present disclosure Figure 1 As shown in the principle diagram, the target text recognition model includes a character feature extraction layer. Figure 6

[0126] ​​In this step, the data to be recognized is input into the target text recognition model, and the state features of the characters to be recognized are obtained through the character feature extraction layer. The character feature extraction layer can be the hamming embedding extraction layer in the Hamming-CTC model, meaning that the state feature corresponding to each character to be recognized is also an embedding vector.

[0127] S503. Determine the text corresponding to the character to be identified based on the character characteristics and the preset codebook.

[0128] In some embodiments, step S503 specifically includes the following steps:

[0129] S5031. Based on the similarity between the character features of the character to be identified and the preset codebook, determine the target codebook in the preset codebook corresponding to the character to be identified;

[0130] In some embodiments, for each character to be identified, the distance between the character feature (embedding) of the character to be identified and each codebook in the preset codebook can be calculated, thereby determining the similarity between the character feature of the character to be identified and the preset codebook based on the distance (the smaller the distance, the higher the similarity), and determining the codebook with the highest similarity as the target codebook for the character to be identified.

[0131] That is, after obtaining the character features of the character to be recognized through a text recognition model, the computing device (e.g., Figure 1 The processor in server 101 or terminal 102 determines the target codebook based on the similarity between character features and a preset codebook. In this scheme, the target codebook is determined by a computing device, which can eliminate the conventional classification layer in the text recognition model and reduce the number of parameters in the text recognition model.

[0132] In other embodiments, a classification layer can be set in the text recognition model to determine the target codebook corresponding to the character to be recognized in a preset codebook. For example, Figure 7 A schematic diagram of the principle of the target text recognition model provided in the embodiments of this disclosure. Figure 2 .like Figure 7 As shown, the target text recognition model also includes a classification layer.

[0133] It should be understood that after obtaining the preset codebook of the sample characters, the preset codebook can be normalized and transformed into a classification layer of the same dimension, wherein the classification layer is a linear 1*1 convolutional layer.

[0134] In this scheme, when obtaining the target codebook through the classification layer, the character features of the character to be identified are input into the classification layer. The classification layer can then determine the target codebook of the character to be identified based on the cosine similarity between the character features and each preset codebook in the classification layer.

[0135] Since the classification layer in this embodiment is obtained through normalization using a preset codebook, its parameter count is the same as that of the preset codebook. Compared to a conventional classification layer, it still achieves the goal of reducing the size of the target text recognition model and enabling the target text recognition model to be flexibly applied to various computing devices. Furthermore, compared to the method of having the computing device determine the target codebook, obtaining the target codebook through the classification layer of the target text recognition model is more efficient and can further improve the text recognition efficiency of the computing device.

[0136] S5032. Determine the target state corresponding to the target codebook based on the correspondence between the preset codebook and the preset state features.

[0137] according to Figure 3 As can be seen from the embodiments shown, since the preset codebook is obtained by binarizing state features, the correspondence between the preset codebook and the preset state is clear.

[0138] In this step, after determining the target codebook, the target state corresponding to the character to be recognized can be determined.

[0139] Different target states correspond to different character types, including null characters and repeating characters.

[0140] S5033. Determine the target character in the character to be recognized based on the target state corresponding to the character to be recognized.

[0141] In some embodiments, step S5033 specifically includes the following steps (1) to (2):

[0142] (1) Determine the character type of the character to be recognized based on the target state of the character to be recognized.

[0143] For example, using the data to be identified as Figure 4 Taking the sample data shown as an example, the character types of each character to be identified in the character to be identified are "empty character, normal character 1, empty character, normal character 2, repeated character, normal character 3, empty character".

[0144] (2) Identify the characters in the data to be identified, excluding empty characters and duplicate characters, as target characters.

[0145] For example, for the above characters to be identified, the target characters are "normal character 1, normal character 2, normal character 3".

[0146] S5034, determine the text corresponding to the target character according to the target codebook of the target character.

[0147] It should be noted that since the preset codebook is obtained according to the sample character, each preset codebook corresponds to a unique character. After determining the target codebook of each target character, the text corresponding to each target character can be determined according to the target codebook.

[0148] S504, determine the target text corresponding to the to-be-recognized data according to the text corresponding to the to-be-recognized character.

[0149] Figure 8 Flowchart of the training method of the target text recognition model provided by the embodiments of the present disclosure Figure 1 It should be noted that the target text recognition model in the embodiments of the present disclosure can be any one of the models described above Figure 6 or Figure 7 The embodiments of the present disclosure are not limited, as shown in Figure 8 , the target text recognition model training method of the embodiments of the present disclosure includes the following steps:

[0150] S801, obtain a plurality of sample data.

[0151] The sample data corresponds to a plurality of sample characters.

[0152] It should be noted that the sample data of the present disclosure can be the same as the sample data in the embodiments shown in Figure 3 , which will not be repeated here.

[0153] S802, in the i-th training process, obtain the sample character features of the sample characters by the (i-1)-th text recognition model.

[0154] The (i-1)-th text recognition model is trained based on the sample character features of the sample characters, and i is an integer greater than 1.

[0155] S803, determine the loss function value corresponding to the sample data according to the sample character features of the sample characters and the preset codebook.

[0156] In some embodiments, the loss function value is used to indicate the distance between the sample character features and the preset codebook of the sample characters.

[0157] Figure 9 Principle diagram of the training process of the target text recognition model provided by the embodiments of the present disclosure. It should be noted that Figure 9 , the sample data is still taken as an example of image data, but it is not limited thereto. In addition, the way of generating the state features corresponding to the sample characters in the sample data and the preset codebook by the feature generation model is please refer to the embodiments shown in Figure 3 , which will not be repeated here.

[0158] As Figure 9 shown, the sample character features corresponding to the sample characters "character ① (space), character ② (C), character ③ (space), character ④ (A), character ⑤ (repeated character), character ⑥ (T), and character ⑦ (space)" in the sample data are obtained by the (i-1)th text recognition model.

[0159] Further, the distances between the sample character features of the sample characters and the preset codebook are determined, and thus the loss function value corresponding to the ith text recognition model is obtained according to the distances.

[0160] The preset codebook of the sample characters can be obtained based on the scheme in the embodiment shown in Figure 3 , which will not be described herein again. The distance between the sample character features and the preset codebook can be a cosine distance, and the present embodiment is not limited in this regard.

[0161] S804, in response to the loss function value meeting the preset requirement, outputting the (i-1)th text recognition model as the target text recognition model.

[0162] Specifically, when the loss function value is less than the preset loss value, or when the loss function value has no change relative to the previous training, it is determined that the loss function value meets the preset requirement. At this time, it is indicated that the current text recognition model meets the preset requirement, and thus the current text recognition model is outputted as the target text recognition model.

[0163] Figure 10 The flowchart of the training method of the target text recognition model provided by the present embodiment is shown in Figure 2 . Based on the embodiment shown in Figure 8 , the present embodiment will make a more detailed description of the training method of the target text recognition model. As Figure 10 shown, the training method of the target text recognition model of the present embodiment includes the following steps:

[0164] S1001, obtaining a plurality of sample data.

[0165] The sample data correspond to a plurality of sample characters.

[0166] S1002, in the ith training process, obtaining the sample character features of the sample characters by the (i-1)th text recognition model.

[0167] S1003, determining the spaces in the sample characters according to the state features of the sample characters.

[0168] Please refer to Figure 9 , since the state features of the sample characters are "εCεAATε", it can be concluded that the spaces in the sample characters are: character ①, character ③, and character ⑦.

[0169] S1004. Obtain the sample character features of a preset number of target empty characters in the sample data.

[0170] It should be noted that the present invention does not specifically limit the value of the preset number. On the one hand, the number of target empty characters can be a fixed value, such as 2 or 3; on the other hand, it can also be obtained according to the number of sample characters. For example, the more sample characters there are, the larger the number of target empty characters can be set to. Taking a target empty character of 1 as an example, the target empty character can be any one of "character ①, character ③, character ⑦".

[0171] S1005. Based on the sample character features corresponding to the non-empty character and the sample character features of the target empty character, determine the loss function value corresponding to the (i-1)th text recognition model.

[0172] Taking the target empty character "character ①" as an example, in this step, the sample character features and preset codebook of characters ①, ②, ④, ⑤, and ⑥ are obtained, the distance between the sample character features and preset codebook of each sample character is determined, and the loss function value corresponding to the i-1th text recognition model is determined based on the distance corresponding to each sample character.

[0173] S1006. When the loss function value meets the preset requirements, the (i-1)th text recognition model is output as the target text recognition model.

[0174] In this embodiment, the model is trained using only a subset of empty characters. Compared to training the model using sample character features of all empty characters and a preset codebook, this avoids the model being biased towards recognizing empty characters and further improves the model's accuracy.

[0175] Exemplary Medium

[0176] After introducing the methods of exemplary embodiments of this disclosure, the following references are made. Figure 11 The storage medium of the exemplary embodiments of this disclosure will be described.

[0177] Figure 11 A schematic diagram of a storage medium provided in an embodiment of this disclosure. (See reference) Figure 11 As shown, a program product 1100 for implementing the above-described method according to an embodiment of the present disclosure is described. This product may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto.

[0178] The program product can employ any combination of one or more computer-readable media. The computer-readable media can be a computer-readable storage medium or a computer-readable signal medium. The computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include the following: an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0179] The computer-readable signal medium can include a computer-readable program code in a baseband or propagated as a carrier wave in a propagation medium. Such a propagated computer-readable signal medium can take a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium.

[0180] The program code for carrying out operations of the present disclosure can be written in any combination of one or more programming languages, including an object-oriented programming language such as Java, C++, or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, such as through the Internet using an Internet Service Provider (ISP).

[0181] Exemplary Apparatus

[0182] After introducing the medium of the exemplary embodiments of the present disclosure, next, the text recognition device and the training device of the target text recognition model of the exemplary embodiments of the present disclosure are described with reference to Figure 12 and Figure 13 respectively.

[0183] Figure 12 The structure schematic diagram of the text recognition device provided by the embodiments of the present disclosure is shown in FIG. 12. As shown in FIG. 12, the text recognition device 1200 provided by the embodiments of the present disclosure includes: Figure 12

[0184] ​The obtaining module 1201 is configured to obtain to-be-recognized data, the to-be-recognized data corresponding to a plurality of to-be-recognized characters, and obtain character features of the to-be-recognized characters by using a target text recognition model, the target text recognition model being obtained by training based on sample character features of sample characters in sample data, and the sample characters including the to-be-recognized characters.

[0185] The determining module 1202 is configured to determine a target text corresponding to the to-be-recognized characters according to the character features of the to-be-recognized characters, and determine a target text corresponding to the to-be-recognized data according to the target text corresponding to the to-be-recognized characters.

[0186] In an embodiment of the present disclosure, the target text recognition model includes a character feature extraction layer, and the character features of the to-be-recognized characters are obtained by using the character feature extraction layer.

[0187] In an embodiment of the present disclosure, the determining module 1202 is specifically configured to determine a target codebook corresponding to the to-be-recognized characters in a preset codebook according to a similarity between the character features of the to-be-recognized characters and the preset codebook, determine a target state corresponding to the target codebook according to a correspondence between the preset codebook and a preset state feature, determine a target character in the to-be-recognized characters according to the target state corresponding to the to-be-recognized characters, and determine a target text corresponding to the target character according to the target codebook of the target character.

[0188] In an embodiment of the present disclosure, the target text recognition model includes a classification layer, and the target codebook corresponding to the to-be-recognized characters in the preset codebook is determined according to the similarity between the character features of the to-be-recognized characters and the preset codebook by using the classification layer, and the classification layer is obtained by normalizing the preset codebook.

[0189] In an embodiment of the present disclosure, different target states correspond to different character types, and the character types include a null symbol and a repeated character, and the determining module 1202 is specifically configured to determine a character type of the to-be-recognized characters according to the target state of the to-be-recognized characters, and determine a target character in the to-be-recognized data except the null symbol and the repeated character.

[0190] In an embodiment of the present disclosure, the obtaining module 1201 is further configured to obtain a plurality of sample data and sample features of sample characters in the sample data, and obtain predicted state features corresponding to the sample characters by using a feature generation model, and the determining module 1202 is further configured to determine state features of the sample characters according to the sample features of the sample characters and the predicted state features, and determine a preset codebook corresponding to the sample characters according to the state features of the same sample characters in the plurality of sample data.

[0191] In an embodiment of the present disclosure, the determining module 1202 is specifically configured to: binarize the state features of the same sample character to obtain character features corresponding to the state features; and determine the preset codebook corresponding to the sample character according to the character features corresponding to the state features.

[0192] It should be noted that the above text recognition device provided by the embodiments of the present disclosure can implement each process in the embodiments of the foregoing text recognition method and achieve the same functions and effects, and details are not described herein.

[0193] Figure 13 A structural schematic diagram of a training device for a target text recognition model is provided in an embodiment of the present disclosure. As shown in the structural schematic diagram of the training device 1300, Figure 13 The training device 1300 includes:

[0194] The obtaining module 1301 is configured to obtain a plurality of sample data, the sample data corresponding to a plurality of sample characters, and obtain sample character features of the sample characters by using an initial target text recognition model;

[0195] The processing module 1302 is configured to, in an i th training process, obtain the sample character features of the sample characters by using an (i-1) th text recognition model, the (i-1) th text recognition model being obtained by training based on the sample character features of the sample characters, and i being an integer greater than 1;

[0196] The determining module 1303 is configured to determine a loss function value corresponding to the (i-1) th text recognition model according to the sample character features of the sample characters and a preset codebook, the loss function value being used to indicate a distance between the sample character features and the preset codebook;

[0197] The output module 1304 is configured to, when the loss function value meets a preset requirement, output the (i-1) th text recognition model as the target text recognition model.

[0198] In an embodiment of the present disclosure, the determining module 1303 is specifically configured to: determine a null symbol in the sample characters according to the state features of the sample characters; obtain sample character features of a preset number of target null symbols in the sample data; and determine the loss function value corresponding to the (i-1) th text recognition model according to the sample character features of the non-null character, the sample character features of the target null symbol, and the preset codebook.

[0199] It should be noted that the above training device provided by the embodiments of the present disclosure can implement each process in the embodiments of the foregoing training method of the target text recognition model and achieve the same functions and effects, and details are not described herein.

[0200] Exemplary Computing Device

[0201] After introducing the method, medium, and device of the exemplary embodiments of the present disclosure, next, reference will be made toFigure 14 A computing device for the exemplary embodiments of the present disclosure is described.

[0202] It should be appreciated that Figure 14 The computing device 1400 shown is only one example of a computing device and should not be taken to limit the scope of functionality of embodiments of the present disclosure.

[0203] Figure 14 A structural schematic diagram of a computing device provided for embodiments of the present disclosure is shown. As shown, the computing device 1400 is in the form of a general-purpose computing device. The components of computing device 1400 can include, but are not limited to, at least one processing unit 1401, at least one memory unit 1402, and a bus 1403 that couples various system components, including the processing unit 1401 and the memory unit 1402. Figure 14

[0204] The bus 1403 includes an address bus, a control bus, and a data bus. The memory unit 1402 can include read-only memory (ROM) 1432 in the form of nonvolatile memory, and can further include random access memory (RAM) 1412 in the form of volatile memory, and / or cache memory 1422.

[0205] The memory unit 1402 can also include a program / utility 1452 having a set of program modules 1442, including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which can give rise to an implementation of a network environment, alone or in some combination.

[0206] The computing device 1400 can also communicate with one or more external devices 1404 such as a keyboard, a pointing device, etc. through an input / output (I / O) interface 1405. Further, the computing device 1400 can communicate with one or more networks, such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet, through a network adapter 1406. As Figure 14 illustrated, the network adapter 1406 communicates with the other modules of the computing device 1400 through the bus 1403. It should be appreciated that although not shown, other hardware and / or software modules could be used in conjunction with the computing device 1400. Such modules can include, but are not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.

[0207] ​It should be noted that while several elements of an apparatus are referred to in the detailed description above as units / modules or sub-units / modules, such partitioning is merely exemplary and not mandatory. In fact, the features and functionality of two or more units / modules described above can be embodied in a single unit / module according to the embodiments of the present disclosure. Conversely, a single unit / module described above can be split into multiple units / modules according to the embodiments of the present disclosure.

[0208] Further, although operations of the methods of the present disclosure are described in a particular order in the drawings, this is not required or implied in any way as to a particular order or that all described operations be performed to achieve desirable results. Additionally or alternatively, certain steps can be omitted, combined into a single step, and / or split into multiple steps.

[0209] While the spirit and principles of the present disclosure have been described with reference to several specific embodiments, it is to be understood that the disclosure is not limited to the specific embodiments disclosed and that the division of aspects is not meant to imply that features from one aspect cannot be combined with features from another aspect to advantage, but is merely for convenience of description. The present disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the claims that follow.

Claims

1. A text recognition method, comprising: Acquire the data to be identified, which corresponds to multiple characters to be identified; The target text recognition model is used to obtain the character features of the character to be recognized. This model is trained based on the sample character features of sample characters in sample data, which includes the character to be recognized. The target text recognition model is trained as follows: multiple sample data sets are acquired, each corresponding to multiple sample characters; during the i-th training iteration, the sample character features of the sample characters are obtained using the (i-1)-th text recognition model, which is trained based on the sample character features, where i is an integer greater than 1; based on the state features of each sample character, the empty character in the sample character is determined; and a preset number of target empty characters' sample character features are obtained from the sample data. Based on the sample character features corresponding to the non-empty character, the sample character features of the target empty character, and the preset codebook, the loss function value corresponding to the (i-1)th text recognition model is determined. The loss function value is used to indicate the distance between the sample character features and the preset codebook. In response to the loss function value satisfying the preset requirements, the (i-1)th text recognition model is output as the target text recognition model. Based on the character features of the character to be identified and the preset codebook, the text corresponding to the character to be identified is determined; the preset codebook includes the preset codebook corresponding to the empty character and the preset codebook corresponding to the repeated character. Based on the text corresponding to the character to be identified, determine the target text corresponding to the data to be identified; The step of determining the text corresponding to the character to be identified based on the character features of the character to be identified and a preset codebook includes: Based on the similarity between the character features of the character to be identified and the preset codebook, the target codebook corresponding to the character to be identified in the preset codebook is determined; Based on the correspondence between the preset codebook and the preset state features, the target state corresponding to the target codebook is determined; different target states correspond to different character types, and the character types include empty characters and repeating characters; Based on the target state of the character to be identified, determine the character type of the character to be identified; The characters in the data to be identified, excluding empty characters and duplicate characters, are identified as target characters; Based on the target codebook of the target character, determine the text corresponding to the target character.

2. The text recognition method according to claim 1, wherein the target text recognition model includes a character feature extraction layer; The character features of the character to be identified are obtained through the character feature extraction layer.

3. The text recognition method according to claim 1, wherein the target text recognition model includes a classification layer; The classification layer determines the target codebook corresponding to the character to be identified in the preset codebook based on the similarity between the character features of the character to be identified and the preset codebook. The classification layer is obtained by normalizing the preset codebook.

4. The text recognition method according to any one of claims 1-3 further includes: Obtain multiple sample data sets and the sample features of sample characters within those sample data sets; The predicted state features corresponding to the sample characters are obtained through a feature generation model. The state features of the sample character are determined based on the sample features and predicted state features of the sample character. Based on the state characteristics of the same sample character in multiple sample data, the preset codebook corresponding to the sample character is determined.

5. The text recognition method according to claim 4, wherein determining the preset codebook corresponding to the sample character based on the state features of the same sample character in multiple sample data includes: The state features of the same sample character are binarized to obtain the character features corresponding to the state features. Based on the character features corresponding to the state features, determine the preset codebook corresponding to the sample character.

6. A method for training a target text recognition model, wherein the target text recognition model is used to implement the text recognition method according to any one of claims 1 to 5, comprising: Acquire multiple sample data, each corresponding to a multiple sample character; During the i-th training process, the sample character features of the sample character are obtained through the (i-1)-th text recognition model. The (i-1)-th text recognition model is trained based on the sample character features of the sample character, where i is an integer greater than 1. Based on the sample character features of each sample character and the preset codebook, the loss function value corresponding to the (i-1)th text recognition model is determined. The loss function value is used to indicate the distance between the sample character features and the preset codebook. In response to the loss function value meeting the preset requirements, the (i-1)th text recognition model is output as the target text recognition model.

7. The training method for the target text recognition model according to claim 6, wherein determining the loss function value corresponding to the (i-1)th text recognition model based on the sample character features of the sample characters and the preset codebook includes: Based on the state characteristics of each sample character, the empty character in the sample character is determined; Obtain the sample character features of a preset number of target empty characters in the sample data; Based on the sample character features corresponding to the non-empty character, the sample character features of the target empty character, and the preset codebook, the loss function value corresponding to the (i-1)th text recognition model is determined.

8. A computer-readable storage medium storing computer-executable instructions, wherein when a processor executes the computer-executable instructions, it implements the text recognition method according to any one of claims 1 to 5 or the training method for the target text recognition model according to any one of claims 6 to 7.

9. A text recognition device, comprising: An acquisition module is used to acquire data to be recognized, which corresponds to multiple characters to be recognized. The module acquires the character features of the characters to be recognized using a target text recognition model, which is trained based on the sample character features of sample characters in the sample data, including the characters to be recognized. The target text recognition model is trained as follows: acquiring multiple sample data, each corresponding to multiple sample characters; during the i-th training process, acquiring the sample character features of the sample characters using the (i-1)-th text recognition model, which is trained based on the sample character features, where i is an integer greater than 1; determining the empty characters in the sample characters based on their state features; and acquiring the sample character features of a preset number of target empty characters in the sample data. Based on the sample character features corresponding to the non-empty character, the sample character features of the target empty character, and the preset codebook, the loss function value corresponding to the (i-1)th text recognition model is determined. The loss function value is used to indicate the distance between the sample character features and the preset codebook. In response to the loss function value satisfying the preset requirements, the (i-1)th text recognition model is output as the target text recognition model. The determining module is used to determine the text corresponding to the character to be identified based on the character features of the character to be identified and a preset codebook, and to determine the target text corresponding to the data to be identified based on the text corresponding to the character to be identified; the preset codebook includes a preset codebook corresponding to the empty character and a preset codebook corresponding to the repeated character; The determining module is specifically used for: Based on the similarity between the character features of the character to be identified and the preset codebook, the target codebook corresponding to the character to be identified in the preset codebook is determined; Based on the correspondence between the preset codebook and the preset state features, the target state corresponding to the target codebook is determined; different target states correspond to different character types, and the character types include empty characters and repeating characters; Based on the target state of the character to be identified, determine the character type of the character to be identified; The characters in the data to be identified, excluding empty characters and duplicate characters, are identified as target characters; Based on the target codebook of the target character, determine the text corresponding to the target character.

10. The text recognition device according to claim 9, wherein the target text recognition model includes a character feature extraction layer; The character features of the character to be identified are obtained through the character feature extraction layer.

11. The text recognition device according to claim 9, wherein the target text recognition model includes a classification layer; The classification layer determines the target codebook corresponding to the character to be identified in the preset codebook based on the similarity between the character features of the character to be identified and the preset codebook. The classification layer is obtained by normalizing the preset codebook.

12. The text recognition device according to any one of claims 9-11, wherein the acquisition module is further configured to: acquire a plurality of sample data and sample features of sample characters in the sample data; The predicted state features corresponding to the sample characters are obtained through a feature generation model. The determining module is further configured to: determine the state features of the sample character based on the sample features and predicted state features of the sample character; Based on the state characteristics of the same sample character in multiple sample data, the preset codebook corresponding to the sample character is determined.

13. The text recognition device according to claim 12, wherein the determining module is specifically used for: The state features of the same sample character are binarized to obtain the character features corresponding to the state features. Based on the character features corresponding to the state features, determine the preset codebook corresponding to the sample character.

14. A training apparatus for a target text recognition model, wherein the target text recognition model is used in the text recognition apparatus according to any one of claims 9 to 13, comprising: The acquisition module is used to acquire multiple sample data, which correspond to multiple sample characters, and to acquire the sample character features of the sample characters through an initial target text recognition model; The processing module is used to obtain the sample character features of the sample character through the (i-1)th text recognition model during the i-th training process. The (i-1)th text recognition model is trained based on the sample character features of the sample character, where i is an integer greater than 1. The determination module is used to determine the loss function value corresponding to the (i-1)th text recognition model based on the sample character features of each sample character and the preset codebook. The loss function value is used to indicate the distance between the sample character features and the preset codebook. The output module is used to output the (i-1)th text recognition model as the target text recognition model in response to the loss function value meeting the preset requirements.

15. The training apparatus for the target text recognition model according to claim 14, wherein the determining module is specifically used for: Based on the state characteristics of each sample character, the empty character in the sample character is determined; Obtain the sample character features of a preset number of target empty characters in the sample data; Based on the sample character features corresponding to the non-empty character, the sample character features of the target empty character, and the preset codebook, the loss function value corresponding to the (i-1)th text recognition model is determined.

16. A computing device, comprising: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor stores computer execution instructions in the memory, causing the at least one processor to execute the text recognition method according to any one of claims 1 to 5 or the training method for the target text recognition model according to any one of claims 6 to 7.

17. A computer program product comprising a computer program; wherein the computer program, when executed, implements the text recognition method according to any one of claims 1 to 5 or the training method for the target text recognition model according to any one of claims 6 to 7.

Citation Information

Patent Citations

  • Identifier identification method, training method and device of identifier identification model, and electronic system

    CN110555439A

  • Hamming OCR method based on locality sensitive Hash network

    CN112784838A