Character recognition method, device, readable medium and electronic device

By using a preset non-autoregressive model in optical character recognition combined with the recognition results of character and line area images, the problems of low efficiency and poor accuracy in long text recognition in the existing technology are solved, and efficient and accurate character recognition is achieved.

CN113313064BActive Publication Date: 2024-08-23BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110698184.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-23
Publication Date
2024-08-23
Estimated Expiration
2041-06-23

AI Technical Summary

Technical Problem

Existing optical character recognition methods have long inference times, low efficiency, and poor accuracy when recognizing long texts. In particular, the autoregressive model cannot effectively utilize contextual semantic information during the recognition process, resulting in inaccurate recognition results.

Method used

By obtaining the character and line area images in the text image to be recognized, the pre-trained character recognition model and the non-autoregressive model are used, and the to-be-determined character recognition results are used as the prediction basis to perform target character recognition and avoid erroneous transmission of the autoregressive model. phenomenon, improving identification efficiency and accuracy.

Benefits of technology

It effectively improves the efficiency and accuracy of character recognition, can improve the accuracy of text recognition results without increasing recognition time, and combines contextual semantic information for recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113313064B
    Figure CN113313064B
Patent Text Reader

Abstract

The present disclosure relates to a character recognition method, device, readable medium and electronic device. The character recognition method obtains a character text area image corresponding to each character in a text image to be recognized, and a line area image in the text image to be recognized; based on the character text area image, a pre-trained preset character recognition model is used to obtain a pending character recognition result corresponding to the text image to be recognized; and based on the line area image and the character recognition result corresponding to the line area image in the pending character recognition result, a pre-trained preset non-autoregressive model is used to obtain a target character recognition result corresponding to the text image to be recognized. In this way, by using the preset non-autoregressive model with the pending character recognition result as the prediction basis, not only can the character recognition efficiency be effectively improved, but also the accuracy of the character recognition result can be improved by combining contextual semantic information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of character recognition, and in particular, to a character recognition method, device, readable medium and electronic device. Background Art

[0002] Optical Character Recognition (OCR) refers to the process of analyzing and identifying image files to obtain text information. The optical character recognition usually includes two stages: text detection and text recognition. Among them, text detection is used to find and segment the text area in the image, and text recognition is used to recognize the text area sub-image segmented in the text detection stage to obtain text translation information.

[0003] Current text recognition methods usually use the CTC (Connectionist Temporal Classification) algorithm or the Attention mechanism model. During the recognition process, the generated characters need to be used to predict the characters at the next position. Therefore, for long texts, the inference time required by current text recognition methods increases significantly, which is not conducive to improving text recognition efficiency. Summary of the invention

[0004] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0005] The present disclosure provides a character recognition method, device, readable medium and electronic device.

[0006] In a first aspect, the present disclosure provides a character recognition method, the method comprising:

[0007] Obtaining character position information and text line position information in the text image to be recognized;

[0008] According to the character position information, a character text area image corresponding to each character in the text image to be recognized is obtained, and according to the text line position information, a line area image in the text image to be recognized is obtained;

[0009] According to the character text area image, obtaining a pending character recognition result corresponding to the to-be-recognized text image through a pre-trained preset character recognition model;

[0010] According to the line area image and the character recognition result corresponding to the line area image in the pending character recognition result, a target character recognition result corresponding to the text image to be recognized is obtained through a pre-trained preset non-autoregressive model.

[0011] In a second aspect, the present disclosure provides a character recognition device, the device comprising:

[0012] A first acquisition module is used to acquire character position information and text line position information in the text image to be recognized;

[0013] A second acquisition module, configured to acquire a character text area image corresponding to each character in the to-be-recognized text image according to the character position information, and to acquire a line area image in the to-be-recognized text image according to the text line position information;

[0014] A first determination module is used to obtain a pending character recognition result corresponding to the to-be-recognized text image through a pre-trained preset character recognition model according to the character text area image;

[0015] The second determination module is used to obtain the target character recognition result corresponding to the text image to be recognized through a pre-trained preset non-autoregressive model based on the line area image and the character recognition result corresponding to the line area image in the pending character recognition result.

[0016] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect above.

[0017] In a fourth aspect, the present disclosure provides an electronic device, including:

[0018] a storage device having a computer program stored thereon;

[0019] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect above.

[0020] Through the above technical scheme, according to the character text area image, the pending character recognition result corresponding to the text image to be recognized is obtained through a pre-trained preset character recognition model; and according to the row area image, and the character recognition result corresponding to the row area image in the pending character recognition result, the target character recognition result corresponding to the text image to be recognized is obtained through a pre-trained preset non-autoregressive model. In this way, by using the preset non-autoregressive model with the pending character recognition result as the prediction basis, not only can the character recognition efficiency be effectively improved, but also the contextual semantic information can be effectively combined to improve the accuracy of the character recognition result.

[0021] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:

[0023] Figure 1 is a flow chart of a character recognition method shown in an exemplary embodiment of the present disclosure;

[0024] Figure 2 is a schematic diagram of a character recognition process shown in an exemplary embodiment of the present disclosure;

[0025] Figure 3 is based on Figure 1 A flow chart of a character recognition method shown in the illustrated embodiment;

[0026] Figure 4 is a block diagram of a character recognition device shown in an exemplary embodiment of the present disclosure;

[0027] Figure 5 It is a block diagram of an electronic device shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0034] Before introducing the specific implementation of the present disclosure in detail, the application scenario of the present disclosure is first described as follows. The present disclosure can be applied to the process of recognizing text content in an image. At present, in the related art, the CTC algorithm represented by CRNN (Convolutional Recurrent Neural Network) and the Attention mechanism represented by Transformer are usually used. However, whether the CTC algorithm or the Attention mechanism model is adopted, it is an autoregressive structure, that is, the characters generated by the model itself are needed to predict and recognize the characters in the next position. Therefore, for long texts, the required reasoning time is usually significantly increased, which is not conducive to improving the text recognition efficiency. The inventor found that although the non-autoregressive model in the related art can generate multiple reasoning results at the same time within a constant number of iterations, since the current non-autoregressive model cannot utilize the contextual semantic information in the text sequence to be recognized, the accuracy of the text recognition result usually obtained is too low, and it is even considered not to be suitable for text recognition scenarios. In other words, the text recognition model in the related art either has a low recognition efficiency or a poor accuracy of the recognition result, and cannot recognize the text content both efficiently and accurately.

[0035] In order to solve the above technical problems, the present disclosure provides a character recognition method, device, readable medium and electronic device. The character recognition method obtains the character text area image corresponding to each character in the text image to be recognized, and the line area image in the text image to be recognized; according to the character text area image, a pre-trained preset character recognition model is used to obtain the pending character recognition result corresponding to the text image to be recognized; and according to the line area image and the character recognition result corresponding to the line area image in the pending character recognition result, a pre-trained preset non-autoregressive model is used to obtain the target character recognition result corresponding to the text image to be recognized. In this way, by using the preset non-autoregressive model with the pending character recognition result as the prediction basis, not only can the character recognition efficiency be effectively improved, but also the contextual semantic information can be effectively combined to improve the accuracy of the character recognition result.

[0036] The embodiments of the present disclosure are described in detail below with reference to the specific drawings.

[0037] Figure 1 is a flowchart of a character recognition method shown in an exemplary embodiment of the present disclosure; see Figure 1 , the method may include the following steps:

[0038] Step 101: Obtain character position information and text line position information in a text image to be recognized.

[0039] Among them, the character position information may include the pixel coordinates of the character in the image. The character may be a single character or a wide character. For example, a character may be an English letter or a Chinese character. The text line position information may include the pixel coordinates corresponding to the text line in the image.

[0040] A possible implementation method of this step is: obtaining a character mask image and a text line mask image corresponding to the text image to be recognized; using the text image to be recognized, the character mask image and the text line mask image corresponding to the text image to be recognized as inputs of a preset multi-granularity character position detection model, so that the multi-granularity character position detection model outputs character position information corresponding to each character in the text image to be recognized and text line position information corresponding to each text line in the text image to be recognized.

[0041] Among them, the multi-granularity character position detection model can be trained by the following training methods:

[0042] Acquire multiple second text image sample sets to be recognized, the second text image sample sets to be recognized include second text image samples to be recognized, and character mask images and text line area mask images corresponding to the second text image samples to be recognized; use the multiple second text image sample sets to be recognized as second model training data, and train the second preset initial model with the second model training data to obtain the multi-granularity character position detection model. The second preset initial model can be a DNN (Deep Neural Networks) model.

[0043] For example, Figure 2 As shown, Figure 2 is a schematic diagram of a character recognition process shown in an exemplary embodiment of the present disclosure, Figure 2 After the character position information and text line position information of the image I to be identified are identified, Figures II and III are obtained. In Figure II, each small box is the position box of each character, and in Figure III, each small box is the position box of the text line.

[0044] In addition, this step can also be carried out through a binary classification detection model in the related technology, so that the binary classification detection model can simultaneously detect the position of the characters and the position of the text lines in the text image to be recognized, and the binary classification detection model can simultaneously output the position box corresponding to the characters in the text image to be recognized and the position box corresponding to the text line in the text image to be recognized, wherein the above binary classification detection model and the training method of the binary classification detection model are relatively common in the prior art and will not be repeated in this disclosure.

[0045] Furthermore, in this step, a first model for identifying the position of a character and a second model for identifying the position of a text line can be trained separately, and a position box corresponding to the character and a position box corresponding to the text line can be obtained respectively through the first model and the second model, wherein the above first model, the second model and the training method of the first model and the training method of the second model are relatively common in the prior art and will not be repeated in the present disclosure.

[0046] Step 102: acquiring a character text region image corresponding to each character in the text image to be recognized according to the character position information, and acquiring a line region image in the text image to be recognized according to the text line position information.

[0047] In this step, the character position information (such as Figure 2 The character position box) captures the corresponding character text area image from the text image to be recognized, and according to the text line position information (such as Figure 2 In the text line position box, the corresponding line area image is captured from the text image to be recognized.

[0048] Step 103, based on the character text area image, a pre-trained preset character recognition model is used to obtain a pending character recognition result corresponding to the to-be-recognized text image.

[0049] In this step, an affine transformation can be performed on each of the character text area images in the text image to be recognized to obtain a character text input image corresponding to each of the character text area images; and the character text input image corresponding to each of the character text area images is used as the input of the preset character recognition model to output the character recognition result to be determined.

[0050] The preset character recognition model is trained in the following way:

[0051] Acquire multiple character text area image samples; use the multiple character text area image samples as third model training data, and train a third preset initial model through the third model training data to obtain the preset character recognition model. The third preset initial model can be any deep learning model in the prior art, such as a CNN (Convolutional Neural Networks) network model.

[0052] It should be noted that the reason why each character text area image in the text image to be recognized needs to be affine transformed is that the character text area image intercepted from the text image to be recognized needs to be transformed into an input image of pixels required by the preset character recognition model, so as to facilitate input into the preset character recognition model. The character text input image corresponding to each character text area image is input so that the preset character recognition model outputs the text corresponding to each character text area image, thereby obtaining each character text in the text image to be recognized, that is, obtaining the pending character recognition result.

[0053] For example, Figure 2 Taking the text image to be recognized shown in the figure as an example, after the character text area image corresponding to the position box of each character in Figure II is input into the preset character recognition model, the pending character recognition results "E" "U" "R", "0" "." "0" "0", "B" "E" "T" "R" "I" "E" "B" "S" "B" "E" "R" "E" "I" "T" are obtained. It should be pointed out that since no contextual semantic information is combined when recognizing the character text in each character image, the pending character recognition result cannot be used as the final target recognition result.

[0054] Step 104, based on the row area image and the character recognition result corresponding to the row area image in the pending character recognition result, a target character recognition result corresponding to the text image to be recognized is obtained through a pre-trained preset non-autoregressive model.

[0055] The preset non-autoregressive model may be a RNN (Recurrent Neural Network) or a Decoder model in an Encoder-Decoder.

[0056] It should be noted that, since the input of the autoregressive model at each moment comes from the output at the previous moment when performing text recognition, once there is a character recognition error, the error may be transmitted, making the subsequent recognition results less accurate. And also because the autoregressive model requires the input of each moment to come from the output at the previous moment, therefore, for long texts, it will take longer to recognize the entire text sequence. The preset non-autoregressive model adopted in this application does not need to use the output of the model at the previous moment as the input at the current moment, that is, it does not need to use the recognition result generated by itself as the basis for prediction, so there will be no error transmission phenomenon, which is conducive to improving the accuracy of the target character recognition result. And because the non-autoregressive model can use the pending character recognition result as contextual semantic information, it can simultaneously and parallelly recognize the character text corresponding to each character text area image, thereby not only ensuring that the recognition time is independent of the sequence length in the text image to be recognized, but also effectively ensuring the accuracy of the text recognition result.

[0057] The above technical solution can use the preset non-autoregressive model to take the pending character recognition results as the prediction basis, which can not only effectively improve the character recognition efficiency, but also combine the contextual semantic information to improve the accuracy of the character recognition results.

[0058] Further, Figure 3 is based on Figure 1 A flowchart of a character recognition method is shown in the embodiment shown; see Figure 3 ,above Figure 1 The step 104 of obtaining the target character recognition result corresponding to the text image to be recognized by using a pre-trained preset non-autoregressive model according to the row area image and the character recognition result corresponding to the row area image in the pending character recognition result may include the following steps:

[0059] Step 1041, obtaining the one-step offset data of the character recognition result corresponding to each row area image.

[0060] The one-step offset data includes the character recognition result and a preset identifier located before the character recognition result.

[0061] For example, Figure 2 The following is an example for explanation. Figure 2 In Figure I, 3 text lines are included, and the images corresponding to the position boxes of the three text lines in Figure III are the three line area images in Figure I. It can be seen from the example shown in step 103 that the character recognition result in the line area image corresponding to the first text line in the figure is "E", "U", "R", then the one-step offset data of the character recognition result corresponding to the first text line can be "CLS", "E", "U", "R", and the character recognition result in the line area image corresponding to the second text line is "0", ".", "0", "0", then the one-step offset data of the character recognition result corresponding to the second text line can be "CLS", "0", ".", "0", and similarly, the third The character recognition results in the row area image corresponding to the text line are "B", "E", "T", "R", "I", "E", "B", "S", "B", "E", "R", "E", "I", "T", then the one-step offset data of the character recognition result corresponding to the third text line can be "CLS", "B", "E", "T", "R", "I", "E", "B", "S", "B", "E", "R", "E", "I", "T", where "CLS" is the preset start marker. The above "CLS" is only used to illustrate the preset marker and is not used to limit the specific scope of protection. The preset markers in the present disclosure can also be other letters, numbers, graphics and other symbols, which are no longer listed one by one in the present disclosure.

[0062] Step 1042, using each row area image and the one-step offset data corresponding to the row area image as input of the preset non-autoregressive model, so that the preset non-autoregressive model outputs the target character recognition result.

[0063] In this step, the preset non-autoregressive model is trained in the following way:

[0064] Acquire multiple first text image sample sets to be recognized, wherein the first text image sample sets to be recognized include first text image samples to be recognized and one-step offset data corresponding to each row area image sample in the first text image sample to be recognized; use the multiple first text image sample sets to be recognized as first model training data, and perform model training on a first preset initial model through the first model training data to obtain the preset non-autoregressive model.

[0065] It should be noted that the first preset initial model may be an initial RNN model or an initial Decoder model, wherein the RNN model and the Decoder model are both common in the prior art and will not be described in detail in this disclosure.

[0066] It should be noted that, by using multiple groups of the first text image samples to be recognized and the one-step offset data corresponding to each row area image sample in the first text image samples to be recognized as the first model training data, and using the first model training data to train the first preset initial model to obtain the preset non-autoregressive model, a recognition model that is independent of time complexity can be obtained, that is, in the character recognition process, there is no need to use the output of the model at the previous moment as the input at the current moment, and the one-step offset data corresponding to the pending character recognition result can be used as a prediction basis, and the character text corresponding to each character text area image can be recognized in parallel, thereby not only ensuring that the recognition time is independent of the sequence length in the text image to be recognized, but also effectively ensuring the accuracy of the text recognition result.

[0067] The above technical scheme, by using multiple groups of the first text image samples to be recognized and the one-step offset data corresponding to each row area image sample in the first text image samples to be recognized as the first model training data, performs model training on the first preset initial model through the first model training data to obtain the preset non-autoregressive model, and can obtain a text recognition model that is independent of time complexity, which can not only effectively improve the character recognition efficiency, but also combine contextual semantic information to improve the accuracy of character recognition results.

[0068] Figure 4 is a block diagram of a character recognition device shown in an exemplary embodiment of the present disclosure; see Figure 4 , the device may include:

[0069] The first acquisition module 401 is used to acquire character position information and text line position information in the text image to be recognized;

[0070] A second acquisition module 402 is used to acquire a character text region image corresponding to each character in the text image to be recognized according to the character position information, and acquire a line region image in the text image to be recognized according to the text line position information;

[0071] The first determination module 403 is used to obtain a pending character recognition result corresponding to the to-be-recognized text image through a pre-trained preset character recognition model according to the character text area image;

[0072] The second determination module 404 is used to obtain a target character recognition result corresponding to the text image to be recognized through a pre-trained preset non-autoregressive model based on the row area image and the character recognition result corresponding to the row area image in the pending character recognition result.

[0073] The above technical solution can use the preset non-autoregressive model to take the pending character recognition results as the prediction basis, which can not only effectively improve the character recognition efficiency, but also combine the contextual semantic information to improve the accuracy of the character recognition results.

[0074] Optionally, the second determining module 404 is used to:

[0075] Acquire one-step offset data of the character recognition result corresponding to each row region image, the one-step offset data including the character recognition result and a preset identifier located before the character recognition result;

[0076] Each row area image and the one-step offset data corresponding to the row area image are used as inputs of the preset non-autoregressive model, so that the preset non-autoregressive model outputs the target character recognition result.

[0077] Optionally, the preset non-autoregressive model is trained in the following manner:

[0078] Acquire a plurality of first to-be-recognized text image sample sets, the first to-be-recognized text image sample sets comprising first to-be-recognized text image samples and one-step offset data corresponding to each row region image sample in the first to-be-recognized text image samples;

[0079] A plurality of first to-be-recognized text image sample sets are used as first model training data, and a first preset initial model row model is trained through the first model training data to obtain the preset non-autoregressive model.

[0080] Optionally, the first acquisition module 401 is used to:

[0081] Obtain the character mask image and text line mask image corresponding to the text image to be recognized;

[0082] The text image to be recognized, the character mask image and the text line mask image corresponding to the text image to be recognized are used as inputs of a preset multi-granularity character position detection model, so that the multi-granularity character position detection model outputs character position information corresponding to each character in the text image to be recognized and text line position information corresponding to each text line in the text image to be recognized.

[0083] Optionally, the multi-granularity character position detection model is trained by the following training method:

[0084] Acquire a plurality of second text image sample sets to be recognized, the second text image sample sets to be recognized comprising second text image samples to be recognized, and character mask images and text line area mask images corresponding to the second text image samples to be recognized;

[0085] The plurality of second to-be-recognized text image sample sets are used as second model training data, and the second preset initial model is trained by the second model training data to obtain the multi-granularity character position detection model.

[0086] Optionally, the first determining module 403 is used to:

[0087] Performing an affine transformation on each of the character text region images in the text image to be recognized, so as to obtain a character text input image corresponding to each of the character text region images;

[0088] The character text input image corresponding to each character text area image is used as the input of the preset character recognition model to output the pending character recognition result.

[0089] Optionally, the preset character recognition model is trained in the following way:

[0090] Obtain multiple character text area image samples;

[0091] The plurality of character text area image samples are used as third model training data, and the third preset initial model is trained by the third model training data to obtain the preset character recognition model.

[0092] The above technical scheme, by using multiple groups of the first text image samples to be recognized and the one-step offset data corresponding to each row area image sample in the first text image samples to be recognized as the first model training data, performs model training on the first preset initial model through the first model training data to obtain the preset non-autoregressive model, and can obtain a text recognition model that is independent of time complexity, which can not only effectively improve the character recognition efficiency, but also combine contextual semantic information to improve the accuracy of character recognition results.

[0093] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0094] like Figure 5As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0095] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0096] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0097] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0098] In some embodiments, the client can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0099] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0100] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:

[0101] Obtain character position information and text line position information in a text image to be recognized; obtain a character text area image corresponding to each character in the text image to be recognized based on the character position information, and obtain a line area image in the text image to be recognized based on the text line position information; obtain a pending character recognition result corresponding to the text image to be recognized through a pre-trained preset character recognition model based on the character text area image; obtain a target character recognition result corresponding to the text image to be recognized through a pre-trained preset non-autoregressive model based on the line area image and the character recognition result corresponding to the line area image in the pending character recognition result.

[0102] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0103] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0104] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of the module does not limit the module itself in some cases. For example, the first acquisition module may also be described as "acquiring character position information and text line position information in the text image to be recognized".

[0105] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0106] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0107] According to one or more embodiments of the present disclosure, Example 1 provides a character recognition method, including:

[0108] Obtain character position information and text line position information in a text image to be recognized; obtain a character text area image corresponding to each character in the text image to be recognized based on the character position information, and obtain a line area image in the text image to be recognized based on the text line position information; obtain a pending character recognition result corresponding to the text image to be recognized through a pre-trained preset character recognition model based on the character text area image; obtain a target character recognition result corresponding to the text image to be recognized through a pre-trained preset non-autoregressive model based on the line area image and the character recognition result corresponding to the line area image in the pending character recognition result.

[0109] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein, based on the line area image and the character recognition result corresponding to the line area image in the pending character recognition result, a target character recognition result corresponding to the text image to be recognized is obtained by a pre-trained preset non-autoregressive model, including:

[0110] Obtain one-step offset data of the character recognition result corresponding to each row area image, wherein the one-step offset data includes the character recognition result and a preset identifier located in front of the character recognition result; use each row area image and the one-step offset data corresponding to the row area image as input of the preset non-autoregressive model, so that the preset non-autoregressive model outputs the target character recognition result.

[0111] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, wherein the preset non-autoregressive model is trained in the following manner:

[0112] Acquire a plurality of first to-be-recognized text image sample sets, wherein the first to-be-recognized text image sample sets include first to-be-recognized text image samples and one-step offset data corresponding to each row region image sample in the first to-be-recognized text image samples;

[0113] The plurality of first to-be-recognized text image sample sets are used as first model training data, and a first preset initial model is trained using the first model training data to obtain the preset non-autoregressive model.

[0114] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 1, wherein obtaining character position information and text line position information in the text image to be recognized includes:

[0115] Obtaining a character mask image and a text line mask image corresponding to the text image to be recognized;

[0116] The text image to be recognized, the character mask image and the text line mask image corresponding to the text image to be recognized are used as inputs of a preset multi-granularity character position detection model, so that the multi-granularity character position detection model outputs character position information corresponding to each character in the text image to be recognized and text line position information corresponding to each text line in the text image to be recognized.

[0117] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 4, wherein the multi-granularity character position detection model is trained by the following training method:

[0118] Acquire a plurality of second text image sample sets to be recognized, wherein the second text image sample sets to be recognized include second text image samples to be recognized, and character mask images and text line area mask images corresponding to the second text image samples to be recognized;

[0119] The plurality of second to-be-recognized text image sample sets are used as second model training data, and the second preset initial model is trained using the second model training data to obtain the multi-granularity character position detection model.

[0120] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 1, wherein obtaining a pending character recognition result corresponding to the to-be-recognized text image through a pre-trained preset character recognition model according to the character text area image includes:

[0121] Performing an affine transformation on each of the character text area images in the text image to be recognized, so as to obtain a character text input image corresponding to each of the character text area images;

[0122] The character text input image corresponding to each of the character text area images is used as the input of the preset character recognition model to output the pending character recognition result.

[0123] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 1, wherein the preset character recognition model is trained in the following manner:

[0124] Obtain multiple character text area image samples;

[0125] The plurality of character text area image samples are used as third model training data, and a third preset initial model is trained using the third model training data to obtain the preset character recognition model.

[0126] According to one or more embodiments of the present disclosure, Example 8 provides a character recognition device, including:

[0127] A first acquisition module is used to acquire character position information and text line position information in the text image to be recognized;

[0128] A second acquisition module, configured to acquire a character text area image corresponding to each character in the to-be-recognized text image according to the character position information, and to acquire a line area image in the to-be-recognized text image according to the text line position information;

[0129] A first determination module is used to obtain a pending character recognition result corresponding to the to-be-recognized text image through a pre-trained preset character recognition model according to the character text area image;

[0130] The second determination module is used to obtain the target character recognition result corresponding to the text image to be recognized through a pre-trained preset non-autoregressive model based on the line area image and the character recognition result corresponding to the line area image in the pending character recognition result.

[0131] According to one or more embodiments of the present disclosure, Example 9 provides the apparatus of Example 8, wherein the second determining module is configured to:

[0132] Acquire one-step offset data of the character recognition result corresponding to each row region image, wherein the one-step offset data includes the character recognition result and a preset identifier located before the character recognition result;

[0133] Each of the row area images and the one-step offset data corresponding to the row area image are used as inputs of the preset non-autoregressive model, so that the preset non-autoregressive model outputs the target character recognition result.

[0134] According to one or more embodiments of the present disclosure, Example 10 provides the apparatus of Example 9, wherein the preset non-autoregressive model is trained in the following manner:

[0135] Acquire a plurality of first to-be-recognized text image sample sets, wherein the first to-be-recognized text image sample sets include first to-be-recognized text image samples and one-step offset data corresponding to each row region image sample in the first to-be-recognized text image samples;

[0136] The plurality of first to-be-recognized text image sample sets are used as first model training data, and a first preset initial model is trained using the first model training data to obtain the preset non-autoregressive model.

[0137] According to one or more embodiments of the present disclosure, Example 11 provides the apparatus of Example 8, wherein the first acquisition module is used to:

[0138] Obtaining a character mask image and a text line mask image corresponding to the text image to be recognized;

[0139] The text image to be recognized, the character mask image and the text line mask image corresponding to the text image to be recognized are used as inputs of a preset multi-granularity character position detection model, so that the multi-granularity character position detection model outputs character position information corresponding to each character in the text image to be recognized and text line position information corresponding to each text line in the text image to be recognized.

[0140] According to one or more embodiments of the present disclosure, Example 12 provides the apparatus of Example 11, wherein the multi-granularity character position detection model is trained by the following training method:

[0141] Acquire a plurality of second text image sample sets to be recognized, wherein the second text image sample sets to be recognized include second text image samples to be recognized, and character mask images and text line area mask images corresponding to the second text image samples to be recognized;

[0142] The plurality of second to-be-recognized text image sample sets are used as second model training data, and the second preset initial model is trained using the second model training data to obtain the multi-granularity character position detection model.

[0143] According to one or more embodiments of the present disclosure, Example 13 provides the apparatus of Example 8, wherein the first determining module is configured to:

[0144] Performing an affine transformation on each of the character text area images in the text image to be recognized, so as to obtain a character text input image corresponding to each of the character text area images;

[0145] The character text input image corresponding to each of the character text area images is used as the input of the preset character recognition model to output the pending character recognition result.

[0146] According to one or more embodiments of the present disclosure, Example 14 provides the apparatus of Example 8, wherein the preset character recognition model is trained in the following manner:

[0147] Obtain multiple character text area image samples;

[0148] The plurality of character text area image samples are used as third model training data, and a third preset initial model is trained using the third model training data to obtain the preset character recognition model.

[0149] According to one or more embodiments of the present disclosure, Example 15 provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in any one of Examples 1-7 above.

[0150] According to one or more embodiments of the present disclosure, Example 15 provides an electronic device, including:

[0151] a storage device having a computer program stored thereon;

[0152] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in any one of Examples 1-7 above.

[0153] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0154] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0155] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims

1. A character recognition method, characterized in that: The method comprises: Obtaining character position information and text line position information in the text image to be recognized; According to the character position information, a character text area image corresponding to each character in the text image to be recognized is obtained, and according to the text line position information, a line area image in the text image to be recognized is obtained; According to the character text area image, obtaining a pending character recognition result corresponding to the to-be-recognized text image through a pre-trained preset character recognition model; According to the line region image and the character recognition result corresponding to the line region image in the pending character recognition result, a target character recognition result corresponding to the to-be-recognized text image is obtained through a pre-trained preset non-autoregressive model; The method of obtaining a target character recognition result corresponding to the text image to be recognized by using a pre-trained preset non-autoregressive model according to the line area image and the character recognition result corresponding to the line area image in the pending character recognition result includes: Acquire one-step offset data of the character recognition result corresponding to each row region image, wherein the one-step offset data includes the character recognition result and a preset identifier located before the character recognition result; Each of the row area images and the one-step offset data corresponding to the row area image are used as inputs of the preset non-autoregressive model, so that the preset non-autoregressive model outputs the target character recognition result.

2. The method according to claim 1, characterized in that The preset non-autoregressive model is trained in the following way: Acquire a plurality of first to-be-recognized text image sample sets, wherein the first to-be-recognized text image sample sets include first to-be-recognized text image samples and one-step offset data corresponding to each row region image sample in the first to-be-recognized text image samples; The plurality of first to-be-recognized text image sample sets are used as first model training data, and a first preset initial model is trained using the first model training data to obtain the preset non-autoregressive model.

3. The method according to claim 1, characterized in that: The step of obtaining character position information and text line position information in the text image to be recognized includes: Obtaining a character mask image and a text line mask image corresponding to the text image to be recognized; The text image to be recognized, the character mask image and the text line mask image corresponding to the text image to be recognized are used as inputs of a preset multi-granularity character position detection model, so that the multi-granularity character position detection model outputs character position information corresponding to each character in the text image to be recognized and text line position information corresponding to each text line in the text image to be recognized.

4. The method according to claim 3, characterized in that The multi-granularity character position detection model is trained by the following training method: Acquire a plurality of second text image sample sets to be recognized, wherein the second text image sample sets to be recognized include second text image samples to be recognized, and character mask images and text line area mask images corresponding to the second text image samples to be recognized; The plurality of second to-be-recognized text image sample sets are used as second model training data, and the second preset initial model is trained using the second model training data to obtain the multi-granularity character position detection model.

5. The method according to claim 1, characterized in that The step of obtaining the undetermined character recognition result corresponding to the to-be-recognized text image by using a pre-trained preset character recognition model according to the character text area image includes: Performing an affine transformation on each of the character text area images in the text image to be recognized, so as to obtain a character text input image corresponding to each of the character text area images; The character text input image corresponding to each of the character text area images is used as the input of the preset character recognition model to output the pending character recognition result.

6. The method according to claim 1, characterized in that The preset character recognition model is trained in the following way: Obtain multiple character text area image samples; The plurality of character text area image samples are used as third model training data, and a third preset initial model is trained using the third model training data to obtain the preset character recognition model.

7. A character recognition device, characterized in that: The device comprises: A first acquisition module is used to acquire character position information and text line position information in the text image to be recognized; A second acquisition module, configured to acquire a character text area image corresponding to each character in the to-be-recognized text image according to the character position information, and to acquire a line area image in the to-be-recognized text image according to the text line position information; A first determination module is used to obtain a pending character recognition result corresponding to the to-be-recognized text image through a pre-trained preset character recognition model according to the character text area image; A second determination module is used to obtain a target character recognition result corresponding to the text image to be recognized through a pre-trained preset non-autoregressive model according to the line area image and the character recognition result corresponding to the line area image in the pending character recognition result; The second determining module is used for: Acquire one-step offset data of the character recognition result corresponding to each row region image, wherein the one-step offset data includes the character recognition result and a preset identifier located before the character recognition result; Each of the row area images and the one-step offset data corresponding to the row area image are used as inputs of the preset non-autoregressive model, so that the preset non-autoregressive model outputs the target character recognition result.

8. The device according to claim 7, characterized in that The preset non-autoregressive model is trained in the following way: Acquire a plurality of first to-be-recognized text image sample sets, wherein the first to-be-recognized text image sample sets include first to-be-recognized text image samples and one-step offset data corresponding to each row region image sample in the first to-be-recognized text image samples; The plurality of first to-be-recognized text image sample sets are used as first model training data, and a first preset initial model is trained using the first model training data to obtain the preset non-autoregressive model.

9. The device according to claim 7, characterized in that The first acquisition module is used for: Obtaining a character mask image and a text line mask image corresponding to the text image to be recognized; The text image to be recognized, the character mask image and the text line mask image corresponding to the text image to be recognized are used as inputs of a preset multi-granularity character position detection model, so that the multi-granularity character position detection model outputs character position information corresponding to each character in the text image to be recognized and text line position information corresponding to each text line in the text image to be recognized.

10. The device according to claim 9, characterized in that The multi-granularity character position detection model is trained by the following training method: Acquire a plurality of second text image sample sets to be recognized, wherein the second text image sample sets to be recognized include second text image samples to be recognized, and character mask images and text line area mask images corresponding to the second text image samples to be recognized; The plurality of second to-be-recognized text image sample sets are used as second model training data, and the second preset initial model is trained using the second model training data to obtain the multi-granularity character position detection model.

11. The device according to claim 7, characterized in that The first determining module is used for: Performing an affine transformation on each of the character text area images in the text image to be recognized, so as to obtain a character text input image corresponding to each of the character text area images; The character text input image corresponding to each of the character text area images is used as the input of the preset character recognition model to output the pending character recognition result.

12. The device according to claim 7, characterized in that The preset character recognition model is trained in the following way: Obtain multiple character text area image samples; The plurality of character text area image samples are used as third model training data, and a third preset initial model is trained using the third model training data to obtain the preset character recognition model.

13. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 6 are implemented.

14. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 6.