Optical character recognition method and device, electronic equipment and storage medium

By using large language models to calculate the confusion of text sequences in OCR system and sorting out structured content in combination with visual language models, the problem of insufficient semantic understanding in the recognition of complex structure table formulas is solved, and a higher level of Identify accuracy and semantic comprehension ability.

CN119418353APending Publication Date: 2025-02-11IOL WUHAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411333150.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

When identifying complex structure table formulas and other contents, the existing OCR system lacks semantic understanding, which leads to insufficient resistance to noise and incomplete semantic understanding.

Method used

By obtaining the initial recognition results of the image to be identified, text segmentation is performed, and each text sequence is input into a large language model, the confusion degree is calculated to determine the target text sequence, and combining the visual language model to organize structured text such as table formulas, we obtain The final optical character recognition result.

Benefits of technology

The initial recognition results are optimized, and the accuracy of optical character recognition is improved, especially when dealing with complex structures and noise scenarios, which significantly improve semantic understanding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119418353A_ABST
    Figure CN119418353A_ABST
Patent Text Reader

Abstract

The invention provides an optical character recognition method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a to-be-recognized image, carrying out the recognition of the to-be-recognized image, and obtaining an initial recognition result of the to-be-recognized image; performing character segmentation on the initial recognition result to obtain character sequences; inputting each character sequence into a large-scale language model to obtain the confusion degree of each character sequence output by the large-scale language model; and determining a target character sequence based on the confusion degree of each character sequence, and obtaining an optical character recognition result of the to-be-recognized image based on the target character sequence and the to-be-recognized image. In the process, the target character sequence is sorted by the visual language large model, structured character display forms such as table formulas in the to-be-recognized image are restored, and a final optical character recognition result in the html format is obtained, so that the initial recognition result is optimized, and the accuracy of optical character recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of optical character recognition, and in particular to an optical character recognition method, device, electronic equipment and storage medium. Background Art

[0002] Optical Character Recognition (OCR) is a technology that recognizes and extracts text from images. OCR technology is widely used in various scenarios, from scanned bill documents to text extraction in natural scenes. For different image contents, OCR requires the recognition of the exact text content and the display form of the text, such as formulas and tables.

[0003] Existing OCR systems face many challenges in terms of accuracy, such as image scene noise, variable fonts and glyphs, and complex text semantic structures. These factors hinder further improvement in the accuracy of OCR systems. With the development of deep learning, neural network-based OCR systems are also developing further, but most models only focus on the recognition of single words, sentences, or plain text, and lack semantic understanding of complex structures, tables, formulas, etc. This leads to insufficient resistance to noise and incomplete semantic understanding in actual application scenarios. The development of multimodal large models also provides new opportunities for OCR systems. However, the ability of large models mainly lies in understanding the structural content of images, and lacks in-depth understanding and analysis of specific and subtle text information. Summary of the invention

[0004] The present invention provides an optical character recognition method, device, electronic device and storage medium to solve the problem that the model in the prior art only focuses on the recognition of single words, sentences or plain texts, but lacks semantic understanding of complex structure tables and formulas, which leads to insufficient resistance to noise and incomplete semantic understanding in actual application scenarios.

[0005] The present invention provides an optical character recognition method, comprising the following steps: Acquire an image to be recognized, and recognize the image to be recognized to obtain an initial recognition result of the image to be recognized; Segmenting the initial recognition result into characters to obtain character sequences; Inputting each of the character sequences into a large language model to obtain the perplexity of each of the character sequences output by the large language model; Based on the perplexity of each character sequence, a target character sequence is determined, and based on the target character sequence and the image to be recognized, an optical character recognition result of the image to be recognized is obtained.

[0006] According to an optical character recognition method provided by the present invention, determining a target character sequence based on the perplexity of each character sequence includes: When the perplexity of the current character sequence is greater than a preset threshold, the current character sequence, a character sequence before the current character sequence, and a character sequence after the current character sequence are concatenated into a concatenated character sequence; The concatenated character sequence is input into the large language model to obtain a modified character sequence of the current character sequence output by the large language model, and the target character sequence is determined based on each modified character sequence.

[0007] According to an optical character recognition method provided by the present invention, the perplexity of each character sequence is determined based on the length of each character sequence segment and the probability of each word in each character sequence appearing in a large language model.

[0008] According to an optical character recognition method provided by the present invention, the step of obtaining an image to be recognized includes: Get the original image; Performing grayscale processing on the original image to obtain a grayscale image of the original image; Filtering the grayscale image to obtain a filtered image of the grayscale image; Based on the filtered image, the image to be recognized is obtained.

[0009] According to an optical character recognition method provided by the present invention, obtaining the image to be recognized based on the filtered image includes: A text region in the filtered image is identified, and based on a tilt angle in the text region, the filtered image is rotated to obtain the image to be identified.

[0010] According to an optical character recognition method provided by the present invention, obtaining an optical character recognition result of the image to be recognized based on the target text sequence and the image to be recognized includes: The target text sequence and the image to be recognized are input into a large visual language model to obtain the optical character recognition result output by the large visual language model.

[0011] The present invention also provides an optical character recognition device, comprising the following modules: An acquisition unit, used for acquiring an image to be recognized, and recognizing the image to be recognized to obtain an initial recognition result of the image to be recognized; A character segmentation unit, used for segmenting the initial recognition result into character sequences; A perplexity determination unit is used to input each of the character sequences into a large language model to obtain the perplexity of each of the character sequences output by the large language model; The optical character recognition result determination unit is used to determine a target character sequence based on the perplexity of each character sequence, and obtain an optical character recognition result of the image to be recognized based on the target character sequence and the image to be recognized.

[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any one of the optical character recognition methods described above is implemented.

[0013] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the optical character recognition method described above is implemented.

[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the optical character recognition method described above is implemented.

[0015] The optical character recognition method, device, electronic device and storage medium provided by the present invention obtain an image to be recognized, recognize the image to be recognized, obtain an initial recognition result of the image to be recognized, and then segment the initial recognition result into text to obtain each text sequence; input each text sequence into a large language model to obtain the perplexity of each text sequence output by the large language model; determine the target text sequence based on the perplexity of each text sequence, and obtain the optical character recognition result of the image to be recognized based on the target text sequence and the image to be recognized. In this process, the large visual language model organizes the target text sequence, restores the structured text display form such as the table formula in the image to be recognized, and obtains the final optical character recognition result in HTML format, thereby optimizing the initial recognition result and improving the accuracy of optical character recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 This is one of the flow charts of the optical character recognition method provided by the present invention.

[0018] Figure 2This is the second flow chart of the optical character recognition method provided by the invention.

[0019] Figure 3 It is a structural schematic diagram of the optical character recognition device provided by the present invention.

[0020] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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 are within the scope of protection of the present invention.

[0022] Figure 1 is one of the flow charts of the optical character recognition method provided by the present invention, such as Figure 1 As shown, the method includes step 110 , step 120 , step 130 and step 140 .

[0023] Step 110 , obtaining an image to be recognized, and recognizing the image to be recognized to obtain an initial recognition result of the image to be recognized.

[0024] Specifically, an image to be identified can be obtained. Here, the image to be identified is an image that needs to be recognized. The image to be identified can be pre-acquired by an image acquisition device, or can be obtained by real-time photography, or can be downloaded or scanned from the Internet. The embodiment of the present invention does not make any specific limitation to this.

[0025] After the image to be recognized is acquired, the image to be recognized may be recognized to obtain an initial recognition result of the image to be recognized.

[0026] Here, the image to be recognized may be recognized by OCR recognition, and the image to be recognized may be obtained through a pre-processing operation, such as denoising, etc., to facilitate subsequent processing of the image to be recognized.

[0027] Step 120, segmenting the initial recognition result into text segments to obtain text sequences.

[0028] Specifically, after obtaining the initial recognition result, the initial recognition result may be segmented into text segments to obtain text sequences.

[0029] It is understandable that the initial recognition result is a whole text sequence, and the initial recognition result can be segmented into text segments according to 500 words or periods to obtain various text sequences, such as M text sequences.

[0030] Step 130: input each of the text sequences into a large language model to obtain the perplexity of each of the text sequences output by the large language model.

[0031] Specifically, after obtaining each text sequence, each text sequence can be input into a large language model (LLM) to obtain the perplexity of each text sequence output by the large language model.

[0032] Here, the perplexity of each text sequence is determined based on the length of each text sequence segment and the probability of each word in each text sequence appearing in the large language model.

[0033] Step 140, determining a target character sequence based on the perplexity of each character sequence, and obtaining an optical character recognition result of the image to be recognized based on the target character sequence and the image to be recognized.

[0034] Specifically, after obtaining the perplexity of each text sequence, the target text sequence can be determined based on the perplexity of each text sequence. Here, the target text sequence can be represented by [text_1, text_2, ..., text_M].

[0035] After the target text sequence is obtained, an optical character recognition result of the image to be recognized can be obtained based on the target text sequence and the image to be recognized.

[0036] For example, the target text sequence and the image to be recognized can be input into a visual language model (Visual Language Model, VLM) to obtain the optical character recognition result of the image to be recognized output by the visual language model.

[0037] It can be understood that by combining the visual language model's ability to understand the structure of the image, the visual language model organizes the target text sequence, restores the structured text display forms such as tables and formulas in the image to be recognized, and obtains the final optical character recognition result in HTML format.

[0038] The method provided by the embodiment of the present invention obtains an image to be recognized, recognizes the image to be recognized, obtains an initial recognition result of the image to be recognized, and then performs text segmentation on the initial recognition result to obtain each text sequence; each text sequence is input into a large language model to obtain the perplexity of each text sequence output by the large language model; based on the perplexity of each text sequence, a target text sequence is determined, and based on the target text sequence and the image to be recognized, an optical character recognition result of the image to be recognized is obtained. In this process, the large visual language model organizes the target text sequence, restores the structured text display form such as the table formula in the image to be recognized, and obtains the final optical character recognition result in HTML format, thereby optimizing the initial recognition result and improving the accuracy of optical character recognition.

[0039] Based on the above embodiment, the step 140 of determining the target text sequence based on the perplexity of each text sequence includes: Step 141, when the perplexity of the current character sequence is greater than a preset threshold, concatenate the current character sequence, a character sequence before the current character sequence, and a character sequence after the current character sequence into a concatenated character sequence; Step 142, input the concatenated text sequence into the large language model, obtain a modified text sequence of the current text sequence output by the large language model, and determine the target text sequence based on each modified text sequence.

[0040] Specifically, when the perplexity of the current character sequence in each character sequence is greater than a preset threshold, the current character sequence, the previous character sequence of the current character sequence, and the next character sequence of the current character sequence are concatenated into a concatenated character sequence.

[0041] For example, if the perplexity exceeds the preset threshold, it is considered that the error between this text sequence and the correct text after OCR recognition is large, and the current text sequence text_i and the adjacent text_{i-1} and text_{i+1} are used as context information to splice into a spliced ​​text sequence [text_{i-1}; text_i; text_{i+1}].

[0042] Here, the preset threshold may be 30 or 40, etc., and this is not specifically limited in the embodiment of the present invention.

[0043] After the concatenated text sequence is obtained, the concatenated text sequence can be input into a large language model to obtain a modified text sequence text^{'}_i of the current text sequence output by the large language model, and based on each modified text sequence, a target text sequence can be determined.

[0044] It can be understood that the modified text sequence is a text sequence that has been polished by a large language model, thereby improving the accuracy and reliability of the text sequence.

[0045] It should be noted that if the perplexity of the current text sequence is less than or equal to the preset threshold, the current text sequence is retained to the next step, and if the current text sequence is the first text sequence and the last text sequence in each text sequence, no processing is performed.

[0046] Based on the above embodiment, the perplexity of each text sequence is determined based on the length of each text sequence segment and the probability of each word in each text sequence appearing in a large language model.

[0047] Specifically, the perplexity (x[1:N]) of each text sequence is determined based on the length of each text sequence segment and the probability of each word in each text sequence appearing in the large language model. The formula is as follows: Perplexity(x[1:N])=2^{-\frac{1}{N}\sum_{i=1}^{N} \log p(x_i)}

[0048] Where N is the length of the input text sequence segment, and p(x_i) is the probability of the i-th word in the text sequence text appearing in the large model.

[0049] Based on the above embodiment, the step of obtaining the image to be recognized in step 110 includes: Step 111, obtaining an original image; Step 112, grayscale processing is performed on the original image to obtain a grayscale image of the original image; Step 113, filtering the grayscale image to obtain a filtered image of the grayscale image; Step 114: obtaining the image to be recognized based on the filtered image.

[0050] Specifically, the original image may be acquired, and the original image may be acquired in advance by an image acquisition device, may be acquired by real-time shooting, or may be acquired by downloading or scanning from the Internet, which is not specifically limited in the embodiment of the present invention.

[0051] Then, the original image can be grayed to obtain a grayscale image of the original image. For example, the opencv library can be used to convert the color image of the original image into a grayscale image.

[0052] Furthermore, the grayscale image can be filtered to obtain a filtered image of the grayscale image. For example, a filter in opencv can be used to eliminate small noise points in the image and improve the clarity of the characters in the image.

[0053] Finally, based on the filtered image, an image to be recognized is obtained. For example, the image size can be cropped to a size suitable for the input of the OCR system according to the input requirements of the OCR system.

[0054] Based on the above embodiment, step 114 includes: Step 1141 , identifying a text region in the filtered image, and rotating the filtered image based on a tilt angle in the text region to obtain the image to be identified.

[0055] Specifically, the text area in the filtered image can be identified, and based on the tilt angle in the text area, the filtered image is rotated to obtain the image to be identified.

[0056] For example, it is identified whether there is a tilted text area in the filtered image. If so, the tilted image is rotated to be parallel according to the tilt angle of the text area.

[0057] The method provided by the embodiment of the present invention identifies the text area in the filtered image, rotates the filtered image based on the tilt angle in the text area, and obtains the image to be recognized, thereby improving the accuracy of subsequent optical character recognition based on the image to be recognized.

[0058] Based on the above embodiment, the step 140 of obtaining an optical character recognition result of the image to be recognized based on the target text sequence and the image to be recognized includes: The target text sequence and the image to be recognized are input into a large visual language model to obtain the optical character recognition result output by the large visual language model.

[0059] Specifically, the target text sequence and the image to be recognized are input into the visual language model to obtain the optical character recognition result output by the visual language model.

[0060] It can be understood that the large model organizes the text sequence, restores the structured text display forms such as table formulas in the image to be recognized, and obtains the final text recognition result in HTML format, which improves the accuracy and reliability of optical character recognition.

[0061] Based on any of the above embodiments, Figure 2 This is the second flow chart of the optical character recognition method provided by the invention, such as Figure 2 As shown, the method includes: The first step is to obtain the original image, grayscale the original image to obtain a grayscale image of the original image, then filter the grayscale image to obtain a filtered image of the grayscale image, and finally, identify the text area in the filtered image, and rotate the filtered image based on the tilt angle in the text area to obtain the image to be identified.

[0062] The second step is to identify the image to be identified and obtain the initial recognition result of the image to be identified.

[0063] The third step is to segment the initial recognition results into text segments to obtain text sequences.

[0064] The fourth step is to input each text sequence into the large language model to obtain the perplexity of each text sequence output by the large language model. The perplexity of each text sequence is determined based on the length of each text sequence segment and the probability of each word in each text sequence appearing in the large language model.

[0065] The fifth step is to concatenate the current text sequence, the previous text sequence, and the next text sequence of the current text sequence into a concatenated text sequence when the perplexity of the current text sequence is greater than a preset threshold, and then input the concatenated text sequence into a large language model to obtain a modified text sequence of the current text sequence output by the large language model, and determine the target text sequence based on each modified text sequence.

[0066] The sixth step is to input the target text sequence and the image to be recognized into the visual language model to obtain the optical character recognition result output by the visual language model.

[0067] It can be understood that by introducing large model intelligent agent technology in the OCR process, an intelligent agent optimization model is constructed, which can be applied to the above-mentioned OCR recognition results with low semantic correlation to solve the problem that the recognition results are similar in form but not in meaning.

[0068] The method provided by the embodiment of the present invention can, 1. after being processed by a large model intelligent agent, basically solve the problem that the recognition results identify complex and similar traditional Chinese characters, and the sentences are completely unreadable; 2. through a relatively simple and low-cost optimization solution, effectively and significantly improve the accuracy of OCR, especially for scanned documents, handwritten documents, photos, etc.

[0069] The method provided in the embodiment of the present invention proposes a method for enhancing the recognition effect of the existing OCR system by combining a multimodal large model. By combining the multimodal large model's ability to understand the image structure, the OCR system recognizes the text in the image, and uses the multimodal large model for further analysis and sorting, optimizes the OCR text recognition results, and combines them into a text effect that restores the display form in the image, thereby achieving the goal of improving the recognition accuracy of the OCR system.

[0070] The optical character recognition device provided by the present invention is described below. The optical character recognition device described below and the optical character recognition method described above can be referred to each other.

[0071] Based on any of the above embodiments, the present invention provides an optical character recognition device, Figure 3 is a schematic diagram of the structure of the optical character recognition device provided by the present invention, such as Figure 3 As shown, the device comprises: The acquisition unit 301 is used to acquire an image to be recognized, and recognize the image to be recognized to obtain an initial recognition result of the image to be recognized; A text segmentation unit 302, used to segment the initial recognition result into text segments to obtain text sequences; A perplexity determination unit 303 is used to input each character sequence into a large language model to obtain the perplexity of each character sequence output by the large language model; The optical character recognition result determination unit 304 is used to determine a target character sequence based on the perplexity of each character sequence, and obtain an optical character recognition result of the image to be recognized based on the target character sequence and the image to be recognized.

[0072] The device provided by the embodiment of the present invention obtains an image to be recognized, recognizes the image to be recognized, obtains an initial recognition result of the image to be recognized, and then performs text segmentation on the initial recognition result to obtain each text sequence; each text sequence is input into a large language model to obtain the perplexity of each text sequence output by the large language model; based on the perplexity of each text sequence, a target text sequence is determined, and based on the target text sequence and the image to be recognized, an optical character recognition result of the image to be recognized is obtained. In this process, the large visual language model organizes the target text sequence, restores the structured text display form such as the table formula in the image to be recognized, and obtains the final optical character recognition result in HTML format, thereby optimizing the initial recognition result and improving the accuracy of optical character recognition.

[0073] Based on any of the above embodiments, the optical character recognition result determining unit 304 is specifically used for: When the perplexity of the current character sequence is greater than a preset threshold, the current character sequence, a character sequence before the current character sequence, and a character sequence after the current character sequence are concatenated into a concatenated character sequence; The concatenated character sequence is input into the large language model to obtain a modified character sequence of the current character sequence output by the large language model, and the target character sequence is determined based on each modified character sequence.

[0074] Based on any of the above embodiments, the perplexity of each text sequence is determined based on the length of each text sequence segment and the probability of each word in each text sequence appearing in a large language model.

[0075] Based on any of the above embodiments, the acquisition unit 301 is specifically used to: An original image acquisition unit is used to acquire an original image; A grayscale processing unit, used for performing grayscale processing on the original image to obtain a grayscale image of the original image; A filtering unit, used for filtering the grayscale image to obtain a filtered image of the grayscale image; A to-be-recognized image unit is determined, which is used to obtain the to-be-recognized image based on the filtered image.

[0076] Based on any of the above embodiments, the determining of the image unit to be identified is specifically used for: A text region in the filtered image is identified, and based on a tilt angle in the text region, the filtered image is rotated to obtain the image to be identified.

[0077] Based on any of the above embodiments, the optical character recognition result determining unit 304 is specifically used for: The target text sequence and the image to be recognized are input into a large visual language model to obtain the optical character recognition result output by the large visual language model.

[0078] Figure 4 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the optical character recognition method, which includes: acquiring an image to be recognized, and recognizing the image to be recognized to obtain an initial recognition result of the image to be recognized; segmenting the initial recognition result into characters to obtain each character sequence; inputting each character sequence into a large language model to obtain the perplexity of each character sequence output by the large language model; determining a target character sequence based on the perplexity of each character sequence, and obtaining an optical character recognition result of the image to be recognized based on the target character sequence and the image to be recognized.

[0079] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0080] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the optical character recognition method provided by the above-mentioned methods, which method includes: acquiring an image to be recognized, and recognizing the image to be recognized to obtain an initial recognition result of the image to be recognized; segmenting the initial recognition result into text segments to obtain text sequences; inputting the text sequences into a large language model to obtain the perplexity of the text sequences output by the large language model; determining a target text sequence based on the perplexity of each text sequence, and obtaining an optical character recognition result of the image to be recognized based on the target text sequence and the image to be recognized.

[0081] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the optical character recognition method provided by the above-mentioned methods, the method comprising: acquiring an image to be recognized, and recognizing the image to be recognized to obtain an initial recognition result of the image to be recognized; segmenting the initial recognition result into text segments to obtain text sequences; inputting the text sequences into a large language model to obtain the perplexity of the text sequences output by the large language model; determining a target text sequence based on the perplexity of the text sequences, and obtaining an optical character recognition result of the image to be recognized based on the target text sequence and the image to be recognized.

[0082] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0083] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An optical character recognition method, characterized in that: include: Acquire an image to be recognized, and recognize the image to be recognized to obtain an initial recognition result of the image to be recognized; Segmenting the initial recognition result into characters to obtain character sequences; Inputting each of the character sequences into a large language model to obtain the perplexity of each of the character sequences output by the large language model; Based on the perplexity of each character sequence, a target character sequence is determined, and based on the target character sequence and the image to be recognized, an optical character recognition result of the image to be recognized is obtained.

2. The optical character recognition method according to claim 1, characterized in that: The step of determining a target text sequence based on the perplexity of each text sequence comprises: When the perplexity of the current character sequence is greater than a preset threshold, the current character sequence, a character sequence before the current character sequence, and a character sequence after the current character sequence are concatenated into a concatenated character sequence; The concatenated character sequence is input into the large language model to obtain a modified character sequence of the current character sequence output by the large language model, and the target character sequence is determined based on each modified character sequence.

3. The optical character recognition method according to claim 1, characterized in that: The perplexity of each text sequence is determined based on the length of each text sequence segment and the probability of each word in each text sequence appearing in a large language model.

4. The optical character recognition method according to any one of claims 1 to 3, characterized in that: The step of obtaining the image to be identified comprises: Get the original image; Performing grayscale processing on the original image to obtain a grayscale image of the original image; Filtering the grayscale image to obtain a filtered image of the grayscale image; Based on the filtered image, the image to be recognized is obtained.

5. The optical character recognition method according to claim 4, characterized in that: The step of obtaining the image to be recognized based on the filtered image includes: A text region in the filtered image is identified, and based on a tilt angle in the text region, the filtered image is rotated to obtain the image to be identified.

6. The optical character recognition method according to any one of claims 1 to 3, characterized in that: The step of obtaining an optical character recognition result of the image to be recognized based on the target text sequence and the image to be recognized includes: The target text sequence and the image to be recognized are input into a large visual language model to obtain the optical character recognition result output by the large visual language model.

7. An optical character recognition device, characterized in that: include: An acquisition unit, used for acquiring an image to be recognized, and recognizing the image to be recognized to obtain an initial recognition result of the image to be recognized; A character segmentation unit, used for segmenting the initial recognition result into character sequences; A perplexity determination unit is used to input each of the character sequences into a large language model to obtain the perplexity of each of the character sequences output by the large language model; The optical character recognition result determination unit is used to determine a target character sequence based on the perplexity of each character sequence, and obtain an optical character recognition result of the image to be recognized based on the target character sequence and the image to be recognized.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the optical character recognition method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the optical character recognition method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the optical character recognition method according to any one of claims 1 to 6 is implemented.