Text recognition method and device, equipment, medium and product
By combining character recognition and character fill-in-the-blank technology, the accuracy problem of existing text recognition methods when processing complex images is solved, and a higher accuracy text recognition result is achieved.
Patent Information
- Application Number
- CN202411465000.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-07
AI Technical Summary
When existing text recognition methods process special, complex or multilingual text in target images, it is difficult to accurately identify all characters, resulting in inaccurate text recognition results.
By combining character recognition and character fill-in-the-blank, the context of the blank character identification is identified by determining the first text recognition result of the target image, and the pre-trained character fill-in-the-blank model is input to obtain the fill-in-the-blank results. Finally, the fill-in-the-blank results are added to the text. Identification results.
It improves the accuracy of text recognition results, ensures that the recognition results of each character have high accuracy, and reduces the workload of subsequent manual verification.
Smart Images

Figure CN119399781A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a text recognition method, device, equipment, medium and product. Background Art
[0002] The existing technology usually recognizes characters in the target image based on the optical text recognition method (OCR). When the characters in the target image have special fonts, complex character patterns, or include multi-language text, this method is usually difficult to accurately recognize all the characters in the target image, so it is difficult to obtain accurate text recognition results.
[0003] Therefore, it is necessary to provide a text recognition method to obtain accurate text recognition results corresponding to the target image. Summary of the invention
[0004] The present invention provides a text recognition method, device, equipment, medium and product to solve the problem that the existing text recognition method cannot accurately determine the text recognition result of the target image.
[0005] According to one aspect of the present invention, there is provided a text recognition method, comprising:
[0006] Determining a first text recognition result of a target image, wherein the target image includes a plurality of character patterns;
[0007] In the case where the first text recognition result includes a missing character mark, inputting the context of the missing character mark into a pre-trained character filling model to obtain a filling result of the missing character mark;
[0008] The filling result of the missing character mark is added to the missing character mark of the first text recognition result to obtain a second text recognition result.
[0009] According to another aspect of the present invention, there is provided a text recognition device, comprising:
[0010] A recognition module, configured to determine a first text recognition result of a target image, wherein the target image includes a plurality of character patterns;
[0011] a filling-in result determination module, configured to input the context of the missing character identifier into a pre-trained character filling-in model to obtain a filling-in result of the missing character identifier when the first text recognition result includes the missing character identifier;
[0012] The adding module is used to add the filling result of the missing character mark to the missing character mark of the first text recognition result to obtain a second text recognition result.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the text recognition method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the text recognition method described in any embodiment of the present invention when executed.
[0018] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the text recognition method described in any embodiment is implemented.
[0019] The technical solution provided by the embodiment of the present invention adopts a method of combining character recognition with character filling-in to ensure that each character in the second text recognition result has a high accuracy, thereby ensuring that the second text recognition result has a high accuracy.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flowchart of a text recognition method provided according to an embodiment of the present invention;
[0023] Figure 2 is another flow chart of a text recognition method provided according to an embodiment of the present invention;
[0024] Figure 3 is a structural schematic diagram of a text recognition device provided according to an embodiment of the present invention;
[0025] Figure 4 is another structural schematic diagram of a text recognition device provided according to an embodiment of the present invention;
[0026] Figure 5 It is a structural schematic diagram of an electronic device for implementing the text recognition method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Figure 1 This is a flowchart of a text recognition method provided by an embodiment of the present invention. This embodiment can be applied to the case where character recognition and character filling are used to ensure that the characters added to the text recognition results have high accuracy, thereby ensuring that the text recognition results have high accuracy. This method can be executed by a text recognition device, which can be implemented in the form of hardware and / or software, and can be configured in a processor of an electronic device. Figure 1 As shown, the method includes:
[0030] S110 , determining a first text recognition result of a target image, where the target image includes a plurality of character patterns.
[0031] The first text recognition result of the target image may be determined based on an existing text recognition method, such as an existing text recognition method or a character recognition model.
[0032] In one embodiment, the character recognition results and confidence levels of each character pattern in the target image are determined in turn based on an optical text recognition method; if the confidence level of the character recognition result of the current character pattern is greater than or equal to a first threshold, the character recognition result of the current character pattern is added to the corresponding position of the first text recognition result; if the confidence level of the character recognition result of the current character is less than the first threshold, a missing character marker is added to the corresponding position of the current character in the first text recognition result.
[0033] Specifically, the confidence level is used to reflect the accuracy of the character recognition result. The higher the confidence level, the higher the accuracy of the character recognition result. Conversely, the lower the confidence level, the lower the accuracy of the character recognition result.
[0034] If the confidence of the character recognition result of the current character is greater than or equal to the first threshold, the character recognition result of the current character pattern is determined to be highly accurate and credible, so it is added to the corresponding position of the first text recognition result. On the contrary, if the character recognition result of the current character pattern is less accurate and uncredible, it is discarded and a missing character mark is added to the corresponding position of the first text recognition result. For example, a box, underline, etc. In this way, all character recognition results in the first text recognition result have a high confidence, ensuring the accuracy of each character recognition result in the first text recognition result.
[0035] S120: When the first text recognition result includes a missing character identifier, input the context of the missing character identifier into a pre-trained character filling model to obtain a filling result corresponding to the missing character identifier.
[0036] If the first text recognition result includes a missing character marker, it means that there are missing characters in the current first text recognition result. For this reason, the context of the missing character marker is input into the pre-trained character filling-in model so that the pre-trained character filling-in model can predict the content to be filled in the missing character marker based on the context, that is, the filling-in result corresponding to the missing character marker.
[0037] Among them, the character filling model can be selected as a T5 model (Text-to-Text Transfer Transformer) or other neural network models.
[0038] It should be noted that the character filling model needs to be pre-trained, and the character types in the training samples used in the training process must include the types of character patterns included in the target image. For example, if the target image includes Chinese character patterns, then the training samples must include Chinese characters so that the character filling model can complete the Chinese filling according to the context content; if the target image includes multiple types of character patterns, then the training samples must include all types of characters so that the character filling model can complete the filling of the corresponding type of characters according to the context content.
[0039] S130: Add the filling result of the missing character mark to the missing character mark of the first text recognition result to obtain a second text recognition result.
[0040] In one example, when any character is filled in the missing character mark in the first text recognition result, the missing character mark disappears immediately, so as to improve the editing speed and ease of the first text recognition result.
[0041] In one embodiment, after the filling result of the missing character mark is determined, it is directly added to the corresponding missing character mark of the first text recognition result to obtain the second text recognition result. The second text recognition result includes the character recognition results determined in two ways, and the character recognition results determined in different ways have high accuracy, thereby ensuring that the second text recognition result has high accuracy and reducing the workload of subsequent manual verification.
[0042] In one embodiment, if there is no alternative recognition result matching the target character pattern in the character library, the context of the missing character identifier is input into a pre-trained character filling-in model to obtain a filling-in result corresponding to the missing character identifier, and the target character pattern is the character pattern corresponding to the missing character identifier in the target image.
[0043] The character library is used to store alternative recognition results corresponding to difficult character patterns, which are manual recognition results of difficult character patterns, and difficult character patterns are character patterns that cannot be accurately and automatically recognized. If there is no alternative recognition result matching the target character pattern in the character library, it means that the target character pattern is not a difficult character pattern, so the context of the missing character identifier is input into the pre-trained character filling model to obtain a filling result corresponding to the missing character identifier, and the filling result is used as the character recognition result of the target character pattern corresponding to the missing character identifier, and it is added to the corresponding missing character identifier of the first text recognition result.
[0044] The technical solution provided by the embodiment of the present invention adopts a method of combining character recognition with character filling-in to ensure that each character in the second text recognition result has a high accuracy, thereby ensuring that the second text recognition result has a high accuracy.
[0045] Figure 2 This is a flowchart of a text recognition method provided by an embodiment of the present invention, and this embodiment is used to refine the steps of determining the filling result of the missing character identifier in the above embodiment. Figure 2 As shown, the method includes:
[0046] S210: Determine a first text recognition result of a target image, where the target image includes a character pattern.
[0047] S220. When the first text recognition result includes a missing character identifier, input the context of the missing character identifier into a pre-trained character filling model to obtain a filling result corresponding to the missing character identifier and a confidence level of the filling result.
[0048] The pre-trained character filling model not only determines the filling result corresponding to the missing character identifier, but also determines the confidence of the filling result.
[0049] S230. If the character library has alternative recognition results that match the target character pattern and confidence levels corresponding to the alternative recognition results, the filling-in-the-blank result and the result with the highest confidence level among the alternative recognition results are added to the missing character identifier in the first text recognition result to obtain a second text recognition result.
[0050] If the character library stores alternative recognition results of the target character pattern and the confidence of the alternative recognition results, it means that the target character pattern is a difficult character pattern. Therefore, the corresponding filling-in-the-blank result and the confidence of the alternative recognition result are determined, and the confidence of the two are compared. Then, the result corresponding to the maximum confidence is used as the character recognition result of the missing character identifier, and it is added to the missing character identifier in the first text recognition result to obtain the second text recognition result.
[0051] When determining whether the character library stores alternative recognition results of the target character pattern, first determine the character pattern vector of the target character pattern in the target image, then match the character pattern vector with all the character pattern vectors in the character library, and determine the alternative character pattern vector in the character library that has the highest match with the character pattern vector, and use the character corresponding to the alternative character pattern vector as the alternative recognition result of the target character pattern.
[0052] In one embodiment, the character library stores two alternative recognition results, one is an alternative recognition result for clear and complex character patterns, which has a higher confidence level; the other is an alternative recognition result for character patterns with poor clarity, which has a lower confidence level.
[0053] In one embodiment, the result with the highest confidence among the filling-in-the-blank result and the alternative recognition results is determined; if the confidence of the result with the highest confidence is greater than or equal to a second threshold, the result with the highest confidence is added to the missing character identifier; if the confidence of the result with the highest confidence is less than the second threshold, the missing character identifier and the context of the missing character identifier are displayed; in response to a filling-in operation for the missing character identifier, the fill-in character for the missing character identifier is filled into the missing character identifier to obtain the third text recognition result.
[0054] Specifically, if the confidence of the result with the highest confidence is greater than or equal to the second threshold, it means that the accuracy of the result with the highest confidence is acceptable, so the result with the highest confidence is added to the corresponding missing character mark in the first text recognition result.
[0055] If the confidence of the result with the highest confidence is lower than the second threshold, it means that the accuracy of the result with the highest confidence is unacceptable, so both the fill-in-the-blank result and the alternative results are discarded, and the missing character identifier and the context of the missing character identifier are displayed; the user manually identifies the corresponding character pattern, and uses the manually identified result as the fill-in character for the missing character identifier, and fills the fill-in character into the missing character identifier to obtain a third text recognition result.
[0056] In one embodiment, a semantic analysis is performed on the third text recognition result; if it is determined based on the semantic analysis that the third text recognition result contains a character to be confirmed whose confidence level is lower than a third threshold, the character to be confirmed and the context of the character to be confirmed are displayed; in response to a modification operation on the character to be confirmed, the character to be confirmed is replaced with the modified character to obtain a fourth text recognition result, and the modified character is added to the character library as an alternative recognition result of the pattern corresponding to the modified character in the target image.
[0057] After the third text recognition result is determined, a semantic analysis is performed on the third text recognition result to determine whether there are any characters to be confirmed whose confidence level is lower than the third threshold value; if there are characters to be confirmed whose confidence level is lower than the third threshold value, it is considered that the characters to be confirmed need to be confirmed, and the characters to be confirmed and the context of the characters to be confirmed are displayed in a visual confirmation interface, and the user confirms the characters to be confirmed in the confirmation interface, such as keeping them unchanged or modifying them manually; if manual modification is required, the manual modification result, i.e., the modified characters, is detected to obtain a fourth text recognition result.
[0058] The technical solution provided by the embodiment of the present invention fills in the corresponding missing character identifier from the result with the highest confidence among the alternative results and the filling-in-the-blank results, so that each character of the second text recognition result has a high confidence.
[0059] Figure 3 Schematic diagram of the structure of the text recognition device provided by the embodiment of the present invention. Figure 3 As shown, the device comprises:
[0060] A recognition module 310, configured to determine a first text recognition result of a target image, wherein the target image includes a plurality of character patterns;
[0061] The filling-in result determination module 320 is used for inputting the context of the missing character mark into the pre-trained character filling-in model to obtain the filling-in result of the missing character mark when the first text recognition result includes the missing character mark;
[0062] The adding module 330 is used to add the filling result of the missing character mark to the missing character mark of the first text recognition result to obtain a second text recognition result.
[0063] In one embodiment, the fill-in-the-blank result determination module 320 is specifically used to:
[0064] If there is no alternative recognition result matching the target character pattern in the character library, the context of the missing character identifier is input into a pre-trained character filling-in model to obtain a filling-in result corresponding to the missing character identifier, and the target character pattern is the character pattern corresponding to the missing character identifier in the target image.
[0065] In one embodiment, the fill-in-the-blank result determination module 320 is specifically used to:
[0066] Inputting the context of the missing character identifier into a pre-trained character filling model to obtain a filling result corresponding to the missing character identifier and a confidence level of the filling result;
[0067] The adding module 330 is specifically used for:
[0068] If the character library has alternative recognition results that match the target character pattern and the confidence levels corresponding to the alternative recognition results, the filling-in-the-blank result and the result with the highest confidence level among the alternative recognition results are added to the missing character identifier in the first text recognition result to obtain a second text recognition result.
[0069] In one embodiment, the adding module 330 includes:
[0070] A comparison unit, used to determine the result with the highest confidence between the filling-in-the-blank result and the candidate recognition result;
[0071] A first adding unit, configured to add the result with the highest confidence to the missing character mark if the confidence of the result with the highest confidence is greater than or equal to a second threshold;
[0072] A displayed element is used to display the missing character identifier and the context of the missing character identifier if the confidence of the result with the highest confidence is less than the second threshold;
[0073] The second adding unit is used for filling the missing character mark with a fill-in character for the missing character mark in response to the filling operation for the missing character mark, so as to obtain the third text recognition result.
[0074] In one embodiment, Figure 4 As shown, the device further includes a reconfirmation module 340, and the reconfirmation module 340 is used to:
[0075] If it is determined based on semantic analysis that the third text recognition result has a character to be confirmed whose confidence level is lower than a third threshold, displaying the character to be confirmed and the context of the character to be confirmed;
[0076] In response to the modification operation on the character to be confirmed, the character to be confirmed is replaced with the modified character to obtain a fourth text recognition result, and the modified character is added to the character library as an alternative recognition result of the pattern corresponding to the modified character in the target image.
[0077] In one embodiment, the identification module 310 is specifically used for:
[0078] Determining the character recognition result and confidence level of each character pattern in the target image in turn based on the optical text recognition method;
[0079] If the confidence of the character recognition result of the current character pattern is greater than or equal to the first threshold, the character recognition result of the current character pattern is added to the corresponding position of the first text recognition result; if the confidence of the character recognition result of the current character is less than the first threshold, the missing character marker is added to the corresponding position of the current character in the first text recognition result.
[0080] The technical solution provided by the embodiment of the present invention adopts a method of combining character recognition with character filling-in to ensure that each character in the second text recognition result has a high accuracy, thereby ensuring that the second text recognition result has a high accuracy.
[0081] The text recognition device provided in the embodiment of the present invention can execute the text recognition method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0082] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0083] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0084] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0085] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a text recognition method.
[0086] In some embodiments, the text recognition method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the text recognition method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the text recognition method in any other appropriate manner (e.g., by means of firmware).
[0087] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0088] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0089] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. 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.
[0090] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0091] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by 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), a blockchain network, and the Internet.
[0092] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0093] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the text recognition method provided in any embodiment of the present application.
[0094] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can 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 the case of a remote computer, the remote computer can 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 can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0095] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0096] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A text recognition method, characterized in that: include: Determining a first text recognition result of a target image, wherein the target image includes a plurality of character patterns; In the case where the first text recognition result includes a missing character mark, inputting the context of the missing character mark into a pre-trained character filling model to obtain a filling result of the missing character mark; The filling result of the missing character mark is added to the missing character mark of the first text recognition result to obtain a second text recognition result.
2. The method according to claim 1, characterized in that: The step of inputting the context of the missing character mark into a pre-trained character filling model to obtain a filling result of the missing character mark includes: If there is no alternative recognition result matching the target character pattern in the character library, the context of the missing character identifier is input into a pre-trained character filling-in model to obtain a filling-in result corresponding to the missing character identifier, and the target character pattern is the character pattern corresponding to the missing character identifier in the target image.
3. The method according to claim 1, characterized in that The step of inputting the context of the missing character mark into a pre-trained character filling model to obtain a filling result of the missing character mark includes: Inputting the context of the missing character identifier into a pre-trained character filling model to obtain a filling result corresponding to the missing character identifier and a confidence level of the filling result; The step of adding the filling result of the missing character mark to the missing character mark of the first text recognition result to obtain a second text recognition result includes: If the character library has alternative recognition results that match the target character pattern and the confidence levels corresponding to the alternative recognition results, the filling-in-the-blank result and the result with the highest confidence level among the alternative recognition results are added to the missing character identifier in the first text recognition result to obtain a second text recognition result.
4. The method according to claim 3, characterized in that The step of adding the filling-in-the-blank result and the character recognition result with the highest confidence among the candidate recognition results to the missing character mark to obtain a second text recognition result includes: Determine the result with the highest confidence among the filling-in-the-blank result and the alternative recognition result; If the confidence of the result with the highest confidence is greater than or equal to a second threshold, adding the result with the highest confidence to the missing character mark to obtain a second text recognition result; If the confidence of the result with the highest confidence is less than the second threshold, displaying the missing character mark and the context of the missing character mark; In response to the filling operation for the missing character mark, the filling character for the missing character mark is filled into the missing character mark to obtain a third text recognition result.
5. The method according to claim 4, characterized in that After obtaining the third text recognition result in response to the filling-in operation for the missing character mark, the method further includes: If it is determined based on semantic analysis that the third text recognition result has a character to be confirmed whose confidence level is lower than a third threshold, displaying the character to be confirmed and the context of the character to be confirmed; In response to the modification operation on the character to be confirmed, the character to be confirmed is replaced with the modified character to obtain a fourth text recognition result, and the modified character is added to the character library as an alternative recognition result of the pattern corresponding to the modified character in the target image.
6. The method according to claim 1, characterized in that The determining a first text recognition result of the target image includes: Determine the character recognition result and confidence level of each character pattern in the target image in turn based on the optical text recognition method; If the confidence of the character recognition result of the current character pattern is greater than or equal to the first threshold, the character recognition result of the current character pattern is added to the corresponding position of the first text recognition result; if the confidence of the character recognition result of the current character is less than the first threshold, the missing character marker is added to the corresponding position of the current character in the first text recognition result.
7. A text recognition device, characterized in that: include: A recognition module, configured to determine a first text recognition result of a target image, wherein the target image includes a plurality of character patterns; a filling-in result determination module, configured to input the context of the missing character identifier into a pre-trained character filling-in model to obtain a filling-in result of the missing character identifier when the first text recognition result includes the missing character identifier; The adding module is used to add the filling result of the missing character mark to the missing character mark of the first text recognition result to obtain a second text recognition result.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the text recognition method described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the text recognition method described in any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the text recognition method according to any one of claims 1 to 6.