A text recognition method, device, computer equipment and storage medium

By using text detection and recognition models based on differentiable binary networks and CRNN algorithms in optical character recognition, combined with preprocessing and mobilenet networks, the problem of low efficiency of traditional methods in massive image processing is solved, achieving high efficiency and accuracy. text recognition.

CN113920527BActive Publication Date: 2024-09-17CHINA PING AN LIFE INSURANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111193518.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-13
Publication Date
2024-09-17
Estimated Expiration
2041-10-13

AI Technical Summary

Technical Problem

Traditional optical character recognition methods are inefficient when processing massive images and cannot quickly and accurately identify the text of each image.

Method used

A text detection model based on differentiable binary network algorithm and a text recognition model based on CRNN algorithm are used, combined with preprocessing operations and mobilenet network, to detect and identify text lines, reducing the amount of model calculations and improving processing efficiency.

Benefits of technology

When processing massive images, the processing efficiency of text recognition is significantly improved, maintaining efficient and accurate recognition results, and the average processing time of each image is shortened from 8 seconds to 160 milliseconds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113920527B
    Figure CN113920527B
Patent Text Reader

Abstract

The embodiments of the present application belong to the field of image processing technology in artificial intelligence, and relate to a text recognition method, device, computer equipment and storage medium applied to massive images. In addition, the present application also relates to blockchain technology, and the user's text recognition results can be stored in the blockchain. The present application pre-processes the text image to be recognized, reduces the amount of calculation of the model from the data volume level, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model is not much different, and ultimately greatly improving the processing efficiency of text recognition, while processing massive images, still maintaining efficient and accurate recognition effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology in artificial intelligence, and in particular to a text recognition method, device, computer equipment and storage medium applied to massive images. Background Art

[0002] Optical character recognition, or OCR for short, is an image recognition technology that can convert images into text. With the rapid development of social economy and the Internet, the use of information technology to optimize products and upgrade user experience has been widely used in all walks of life. In particular, in the financial industry, such as the insurance field, there is a great demand for using OCR technology to convert many business image materials (such as insurance applications, underwriting materials, claims documents, etc.) into text and store them in a structured manner. In addition, how to quickly process a large number of images and accurately and comprehensively recognize the text in each image is an important challenge and difficulty for OCR recognition.

[0003] There is an existing optical character recognition method, which first performs text line detection on the input image, detects all the text lines in the image one by one, and then uses the text line set obtained from the previous module as the input of the recognition model according to the text recognition module, and performs text recognition in sequence to obtain all the text information of the image.

[0004] However, the applicant found that in actual applications, optical character recognition technology often needs to process massive amounts of images, and when traditional optical character recognition methods are used to comprehensively and accurately recognize the text in each image, low efficiency will occur. This shows that traditional optical character recognition methods are not suitable for quickly and accurately processing massive amounts of images. Summary of the invention

[0005] The purpose of the embodiments of the present application is to propose a text recognition method, apparatus, computer equipment and storage medium for massive images, so as to solve the problem that traditional optical character recognition methods cannot be applied to quickly and accurately process massive images.

[0006] In order to solve the above technical problems, the present application embodiment provides a text recognition method applied to massive images, which adopts the following technical solution:

[0007] Get the text image to be recognized;

[0008] Performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data;

[0009] Inputting the preprocessed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network;

[0010] The text block image data is input into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result.

[0011] In order to solve the above technical problems, the embodiment of the present application further provides a text recognition device applied to massive images, which adopts the following technical solution:

[0012] An acquisition module, used for acquiring a text image to be recognized;

[0013] A preprocessing module, used for performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data;

[0014] A text line detection module, used for inputting the pre-processed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network;

[0015] The text recognition module is used to input the text block image data into a text recognition model based on the CRNN algorithm to perform text recognition operations and obtain text recognition results.

[0016] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0017] The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the text recognition method applied to massive images as described above when executing the computer-readable instructions.

[0018] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0019] The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the text recognition method applied to massive images as described above are implemented.

[0020] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0021] The present application provides a text recognition method applied to massive images, including: obtaining a text image to be recognized; performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data; inputting the preprocessed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network; inputting the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result. The present application reduces the amount of calculation of the model from the data volume level by preprocessing the text image to be recognized, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model is not much different, and ultimately greatly improving the processing efficiency of text recognition, and still maintaining efficient and accurate recognition effects when processing massive images. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0024] Figure 2 is a flowchart of the implementation of the text recognition method applied to massive images provided in the first embodiment of the present application;

[0025] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S202;

[0026] Figure 4 yes Figure 2 A flowchart of a specific implementation of step S203;

[0027] Figure 5 yes Figure 2 A flowchart of a specific implementation of step S204;

[0028] Figure 6 This is a schematic diagram of the structure of a text recognition device applied to massive images provided in Example 1 of the present application:

[0029] Figure 7 yes Figure 6A schematic diagram of a specific implementation of the preprocessing module 620;

[0030] Figure 8 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0032] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0033] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0034] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0035] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0036] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.

[0037] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0038] It should be noted that the text recognition method applied to massive images provided in the embodiments of the present application is generally executed by a server / terminal device, and accordingly, the text recognition device applied to massive images is generally set in the server / terminal device.

[0039] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0040] Continue to refer Figure 2 , shows an implementation flow chart of the text recognition method applied to massive images provided in Example 1 of the present application. For the sake of convenience of explanation, only the parts related to the present application are shown.

[0041] The above-mentioned text recognition method applied to massive images includes the following steps: step S201, step S202, step S203 and step S204.

[0042] Step S201: Obtain a text image to be recognized.

[0043] In an embodiment of the present application, obtaining the text image to be recognized may be by taking a photo of the bank card to be recognized by a camera device to obtain the text image to be recognized; the text image to be recognized may also be by sending an already taken image by a user terminal to obtain the text image to be recognized. It should be understood that the example of obtaining the text image to be recognized here is only for the convenience of understanding and is not used to limit the present application.

[0044] Step S202: performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data.

[0045] In the embodiment of the present application, the preprocessing operation may be to perform grayscale processing on the text image to be recognized to obtain grayscale image data; and to perform resolution standardization processing on the grayscale image data to obtain the obtained data.

[0046] Step S203: input the preprocessed image data into a text detection model based on a differentiable binarization network (DBNET) algorithm to perform text line detection operations to obtain text block image data. The backbone network of the text detection model is a mobilenet network.

[0047] In an embodiment of the present application, the text line detection operation can be to obtain the text detection probability corresponding to each pixel point in the text image to be identified output by the text detection model; to perform a screening operation on the pixel points of the text image to be identified according to the text detection probability and a preset pixel threshold to obtain a text detection image; to perform a connected domain calculation on the text detection image according to the opencv toolkit to obtain a connected domain set; to calculate the minimum circumscribed matrix of each connected domain in the connected domain set according to the findcontours function, and to use each vertex of the minimum circumscribed matrix as text block image data.

[0048] Step S204: input the text block image data into a text recognition model based on the CRNN algorithm to perform a text recognition operation to obtain a text recognition result.

[0049] In an embodiment of the present application, the text recognition operation may be to standardize the text block images according to a standard resolution, and combine them to obtain a standard text block combination that meets the standard resolution; input the standard text block combination into the text recognition model according to the batch operation of TensorRT to obtain an output text combination; and perform a restoration operation on the output text combination to obtain a text recognition result.

[0050] The present application provides a text recognition method applied to massive images, including: obtaining a text image to be recognized; performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data; inputting the preprocessed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network; inputting the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result. The present application reduces the amount of calculation of the model from the data volume level by preprocessing the text image to be recognized, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model is not much different, and ultimately greatly improving the processing efficiency of text recognition, and still maintaining efficient and accurate recognition effects when processing massive images.

[0051] Continue reading Figure 3 , showing Figure 2 A flowchart of a specific implementation of step S202 is shown in FIG. 1 . For ease of explanation, only the part related to the present application is shown.

[0052] In some optional implementations of this embodiment, the above step S202 specifically includes: step S301 and step S302.

[0053] Step S301: grayscale processing is performed on the text image to be recognized to obtain grayscale image data.

[0054] In the embodiment of the present application, the images uploaded by users are generally color images, but the subsequent algorithm processing of the present invention must be grayscale images, so the input image will be converted into a grayscale image.

[0055] In the embodiment of the present application, the grayscale processing refers to converting the three channels (RGB) of the text to be recognized into one channel. Specifically, the grayscale processing can be:

[0056] (1) Averaging method, that is, averaging the RGB values ​​of the three channels at the same pixel position. The averaging is expressed as:

[0057]

[0058] Wherein, x and y represent the two-dimensional coordinate values ​​of pixel point I respectively;

[0059] (2) Maximum-minimum average method, that is, taking the average of the maximum and minimum brightness of the RGB at the same pixel position;

[0060] (3) Weighted average method, expressed as:

[0061] I(x,y)=α×I R(x,y) +β×I G(x,y) +ρ×I B(x,y)

[0062] Among them, α, β, and ρ represent weighting parameters respectively. Specifically, α, β, and ρ may be parameters 0.3, 0.59, and 0.11 adjusted by a human brightness perception system respectively.

[0063] Step S302: performing resolution standardization processing on the grayscale image data to obtain pre-processed image data.

[0064] In the embodiment of the present application, the resolution standardization process refers to adjusting the resolution of the image by the same proportion. Specifically, the resolution standardization process can be uniformly scaled to between [600, 1000].

[0065] In an embodiment of the present application, before sending the input image to the text detection model for text line detection, we preprocess the input image and scale the resolution. The purpose of this is to reduce the amount of calculation of the model from the perspective of data volume, thereby improving the model processing time.

[0066] In some optional implementations of this embodiment, in the above step S302, the following steps are specifically included:

[0067] If the grayscale image data after resolution standardization processing does not meet the preset width standard value or length standard value, the area that does not meet the width standard value or the length standard value is filled with black edges to obtain the pre-processed image data.

[0068] In an embodiment of the present application, the source of the black border filling is the black border of the three color channels of the recognized text image to make up for the standard width value or the standard length value, so that in subsequent batch processing, each batch of input images has the same specifications.

[0069] Continue reading Figure 4 , showing Figure 2 A flowchart of a specific implementation of step S203 is shown in FIG. 1 . For ease of explanation, only the part related to the present application is shown.

[0070] In some optional implementations of this embodiment, the above step S203 specifically includes: step S401, step S402, step S403 and step S404.

[0071] Step S401: Obtain the text detection probability corresponding to each pixel point in the text image to be recognized output by the text detection model.

[0072] In the embodiment of the present application, the result output by the text detection model is the probability (0-1) of each pixel in the image. For example, for a 100 pixel x 100 pixel image, after calculation by dbnet, the output is the probability value of these 10,000 pixels belonging to text, that is, how many of the 10,000 pixels correspond to the text in the image, and how many correspond to the blank part or non-text part in the image.

[0073] Step S402: Filtering the pixels of the text image to be identified according to the text detection probability and the preset pixel threshold to obtain a text detection image.

[0074] In an embodiment of the present application, the user can pre-set the pixel threshold according to the specific situation, and divide the above 10,000 pixels into text pixels and non-text pixels by probability value. The non-text pixels can be pixels belonging to the blank part of the picture. In this way, the text detection image can be formed.

[0075] Step S403: Calculate the connected domain of the text detection image according to the opencv toolkit to obtain a connected domain set.

[0076] In the embodiments of the present application, OpenCV is a cross-platform computer vision and machine learning software library released under the BSD license (open source), which can run on Linux, Windows, Android and MacOS operating systems. [1] It is lightweight and efficient - consisting of a series of C functions and a small number of C++ classes, while providing interfaces for languages ​​such as Python, Ruby, and MATLAB, and implementing many common algorithms in image processing and computer vision.

[0077] Step S404: Calculate the minimum circumscribed matrix of each connected domain in the connected domain set according to the findcontours function, and use each vertex of the minimum circumscribed matrix as text block image data.

[0078] In the embodiment of the present application, the text behavior output by the text detection model includes at least one text line of text, which can be understood as a text outline image or a text line / column outline image. In a possible implementation, the text line can also be a sub-image including text segmented from the target image.

[0079] In an embodiment of the present application, a text line is a bounding box with specific content as a unit, wherein the specific content may be a word, a line of text, or a single word, etc. The text detection model may generate different text lines based on the type of text in the picture to be identified. For example, when the picture contains English text, the text detection model may frame the English text of the picture in units of words line by line, and generate multiple text lines. It is understandable that the text in the text line determined by this embodiment is a single English word. For another example, when the picture to be identified contains Chinese, the text detection model may frame the Chinese text of the picture in units of lines, and generate multiple text lines. It is understandable that the text in the text line determined by this embodiment is a line of Chinese text. For another example, when the picture to be identified contains Chinese, the text detection model may frame the Chinese text of the picture in units of single words, and generate multiple text lines. It is understandable that the text in the text line determined by this embodiment is a word.

[0080] In the embodiment of the present application, since the text content in the text image is regularly arranged based on straight lines, the difference lies in the size of the gaps between the text content. Therefore, the shape of the minimum circumscribed matrix of the connected domain calculated is generally a four-sided rectangle or a slightly distorted rectangle. Therefore, the vertices of the minimum circumscribed matrix can be used as the four vertex positions of the text box of the text block image data.

[0081] In some optional implementations of this embodiment, the text recognition model is a CNN network with the BiLSTM network omitted.

[0082] In the embodiment of the present application, the recurrent neural network part (BiLSTM) of the original CRNN is removed, and only the backbone network part of the CNN is retained, so as to slim down the network structure and improve the processing time of the model.

[0083] In some optional implementations of this embodiment, the computational model for computing and processing network output data is integrated into the second half of the model, thereby simplifying post-processing operations and reducing the data flow of output results, thereby reducing data flow transmission in actual deployment, saving bandwidth, and preventing network congestion under high concurrency.

[0084] Continue reading Figure 5 , showing Figure 2 A flowchart of a specific implementation of step S204 is shown in FIG. 1 . For ease of explanation, only the part related to the present application is shown.

[0085] In some optional implementations of this embodiment, the above step S204 specifically includes: step S501, step S502 and step S503.

[0086] Step S501: Standardizing the text block images according to the standard resolution, and combining them to obtain a standard text block combination that meets the standard resolution.

[0087] In the embodiment of the present application, since the text line detected by the text detection model is a rectangular text line, there will be coordinate information of the four vertices of the rectangular line, and the width and height of the text line can be calculated from the values ​​of these vertices.

[0088] In an embodiment of the present application, since the batch processing requirement of TensorRT is that the resolution of each batch of images must be consistent, that is, the above-mentioned standard resolution, and the resolutions of the text block images detected by the text detection model are various, it is necessary to perform a scaling operation on all detected text block images. At the same time, since the widths of each text block image are different, and the standard resolution requires width and height, the scaled text block images need to be combined according to the width of the standard resolution to meet the requirements of the standard resolution.

[0089] In some optional implementations of the present embodiment, in the process of combining the scaled text block images according to the width of the standard resolution, it is inevitable that the combined text block combination will be smaller than the width of the standard resolution. For the missing part, a black border of the corresponding width can be added to fill it, so as to further meet the requirements of the standard resolution.

[0090] Step S502: Input the standard text block combination into the text recognition model according to the batch processing operation of TensorRT to obtain the output text combination.

[0091] In the embodiments of the present application, TensorRT is a high-performance deep learning inference optimizer that can provide low-latency, high-throughput deployment inference for deep learning applications. TensorRT can be used to accelerate inference for hyperscale data centers, embedded platforms, or autonomous driving platforms. TensorRT now supports almost all deep learning frameworks such as TensorFlow, Caffe, Mxnet, Pytorch, etc. Combining TensorRT with NVIDIA's GPU can quickly and efficiently deploy inference in almost all frameworks.

[0092] Step S503: performing a restoration operation on the output text combination to obtain a text recognition result.

[0093] In an embodiment of the present application, the text block image data obtained in the above-mentioned text line detection operation carries the two-dimensional position information of each text block image data corresponding to the text image to be recognized. At the same time, when combining the text block images after the above-mentioned standardization processing, the two-dimensional position information of each text block image corresponding to the text image to be recognized will be marked. Therefore, the restoration operation refers to marking each output text in the output text combination in the text image to be recognized according to the two-dimensional position information marked by each text block image, so as to obtain the text recognition result.

[0094] In the embodiments of the present application, some features of TensorRT are used to accelerate the model, and the text box combination designed in the text recognition module is used for disguised batch processing, so that the efficiency of the entire OCR is improved by 30%.

[0095] In summary, the present application provides a text recognition method applied to massive images, including: obtaining a text image to be recognized; performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data; inputting the preprocessed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network; inputting the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result. The present application reduces the amount of calculation of the model from the data volume level by preprocessing the text image to be recognized, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model is not much different, and ultimately greatly improving the processing efficiency of text recognition, and still maintaining efficient and accurate recognition effects when processing massive images. At the same time, before sending the input image to the text detection model for text line detection, we preprocess the input image and scale the resolution. The purpose of this is to reduce the amount of calculation of the model from the data volume level, thereby improving the model processing time; the recurrent neural network part (BiLSTM) of the original CRNN is removed, and only the backbone network part of the CNN is retained to slim down the network structure and improve the processing time of the model; the computational model for computing the network output data is integrated into the second half of the model, thereby simplifying the post-processing operation and reducing the data flow of the output results, thereby reducing the transmission of data flow in actual deployment, saving bandwidth, and preventing network congestion under high concurrency; some features of TensorRT are used to accelerate the model, and the text box combination method we designed in the text recognition module is used for disguised batch processing, which improves the efficiency of the entire OCR by 30%. Finally, the average processing time per image of the entire OCR solution is shortened from about 8 seconds to about 160 milliseconds.

[0096] It should be emphasized that in order to further ensure the privacy and security of the above text recognition results, the above text recognition results can also be stored in a blockchain node.

[0097] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0098] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0099] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed, they can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0100] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0101] Embodiment 2

[0102] Further references Figure 6 , as a response to the above Figure 2 The present application provides an embodiment of a text recognition device for massive images. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0103] like Figure 6 As shown, the text recognition device 600 applied to massive images of this embodiment includes: an acquisition module 610 , a preprocessing module 620 , a text line detection module 630 and a text recognition module 640 .

[0104] in:

[0105] An acquisition module 610 is used for acquiring a text image to be recognized;

[0106] A preprocessing module 620 is used to perform a preprocessing operation on the text image to be recognized to obtain preprocessed image data;

[0107] The text line detection module 630 is used to input the pre-processed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data. The backbone network of the text detection model is a mobilenet network.

[0108] The text recognition module 640 is used to input the text block image data into the text recognition model based on the CRNN algorithm to perform text recognition operations and obtain text recognition results.

[0109] In an embodiment of the present application, obtaining the text image to be recognized may be by taking a photo of the bank card to be recognized by a camera device to obtain the text image to be recognized; the text image to be recognized may also be by sending an already taken image by a user terminal to obtain the text image to be recognized. It should be understood that the example of obtaining the text image to be recognized here is only for the convenience of understanding and is not used to limit the present application.

[0110] In the embodiment of the present application, the preprocessing operation may be to perform grayscale processing on the text image to be recognized to obtain grayscale image data; and to perform resolution standardization processing on the grayscale image data to obtain the obtained data.

[0111] In an embodiment of the present application, the text line detection operation can be to obtain the text detection probability corresponding to each pixel point in the text image to be identified output by the text detection model; to perform a screening operation on the pixel points of the text image to be identified according to the text detection probability and a preset pixel threshold to obtain a text detection image; to perform a connected domain calculation on the text detection image according to the opencv toolkit to obtain a connected domain set; to calculate the minimum circumscribed matrix of each connected domain in the connected domain set according to the findcontours function, and to use each vertex of the minimum circumscribed matrix as text block image data.

[0112] In an embodiment of the present application, the text recognition operation may be to standardize the text block images according to a standard resolution, and combine them to obtain a standard text block combination that meets the standard resolution; input the standard text block combination into the text recognition model according to the batch operation of TensorRT to obtain an output text combination; and perform a restoration operation on the output text combination to obtain a text recognition result.

[0113] The present application provides a text recognition device 600 for mass images, including: an acquisition module 610, for acquiring a text image to be recognized; a preprocessing module 620, for performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data; a text line detection module 630, for inputting the preprocessed image data into a text detection model based on a differentiable binary network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network; a text recognition module 640, for inputting the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result. The present application reduces the amount of calculation of the model from the data volume level by preprocessing the text image to be recognized, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model is not much different, and ultimately greatly improving the processing efficiency of text recognition, and still maintaining efficient and accurate recognition effects when processing massive images.

[0114] Continue reading Figure 7 , showing Figure 6 The schematic diagram of the structure of a specific implementation of the preprocessing module 620 is shown in the figure. For the convenience of explanation, only the part related to the present application is shown.

[0115] In some optional implementations of this embodiment, the pre-processing module 620 includes: a grayscale processing sub-module 621 and a resolution standardization processing sub-module 622. Among them:

[0116] Grayscale processing submodule 621, used for performing grayscale processing on the text image to be recognized to obtain grayscale image data;

[0117] The resolution standardization processing submodule 622 is used to perform resolution standardization processing on the grayscale image data to obtain pre-processed image data.

[0118] In the embodiment of the present application, the images uploaded by users are generally color images, but the subsequent algorithm processing of the present invention must be grayscale images, so the input image will be converted into a grayscale image.

[0119] In the embodiment of the present application, the grayscale processing refers to converting the three channels (RGB) of the text to be recognized into one channel. Specifically, the grayscale processing can be:

[0120] (1) Averaging method, that is, averaging the RGB values ​​of the three channels at the same pixel position. The averaging is expressed as:

[0121]

[0122] Wherein, x and y represent the two-dimensional coordinate values ​​of pixel point I respectively;

[0123] (2) Maximum-minimum average method, that is, taking the average of the maximum and minimum brightness of the RGB at the same pixel position;

[0124] (3) Weighted average method, expressed as:

[0125] I(x,y)=α×I R(x,y) +β×I G(x,y) +ρ×I B(x,y)

[0126] Among them, α, β, and ρ represent weighting parameters respectively. Specifically, α, β, and ρ may be parameters 0.3, 0.59, and 0.11 adjusted by a human brightness perception system respectively.

[0127] In the embodiment of the present application, the resolution standardization process refers to adjusting the resolution of the image by the same proportion. Specifically, the resolution standardization process can be uniformly scaled to between [600, 1000].

[0128] In an embodiment of the present application, before sending the input image to the text detection model for text line detection, we preprocess the input image and scale the resolution. The purpose of this is to reduce the amount of calculation of the model from the perspective of data volume, thereby improving the model processing time.

[0129] In some optional implementations of this embodiment, the text line detection module 630 includes: a text probability acquisition submodule, a screening operation submodule, a connected domain calculation submodule, and an external matrix calculation submodule.

[0130] A text probability acquisition submodule is used to obtain the text detection probability corresponding to each pixel point in the text image to be recognized output by the text detection model;

[0131] A screening operation submodule is used to perform a screening operation on the pixel points of the text image to be identified according to the text detection probability and a preset pixel threshold to obtain a text detection image;

[0132] The connected domain calculation submodule is used to calculate the connected domain of the text detection image according to the opencv toolkit to obtain a connected domain set;

[0133] The circumscribed matrix calculation submodule is used to calculate the minimum circumscribed matrix of each connected domain in the connected domain set according to the findcontours function, and use each vertex of the minimum circumscribed matrix as text block image data.

[0134] In some optional implementations of this embodiment, the text recognition model is a CNN network with the BiLSTM network omitted.

[0135] In some optional implementations of this embodiment, the text recognition module 640 includes: a standardization processing submodule, a data input submodule, and a restoration operation submodule.

[0136] A standardization processing submodule is used to perform standardization processing on the text block images according to the standard resolution, and combine them to obtain a standard text block combination that meets the standard resolution;

[0137] The data input submodule is used to input the standard text block combination into the text recognition model according to the batch operation of TensorRT to obtain the output text combination;

[0138] The restoration operation submodule is used to perform a restoration operation on the output text combination to obtain a text recognition result.

[0139] In summary, the present application provides a text recognition device 600 for massive images, including: an acquisition module 610, for acquiring a text image to be recognized; a preprocessing module 620, for performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data; a text line detection module 630, for inputting the preprocessed image data into a text detection model based on a differentiable binary network algorithm to perform a text line detection operation to obtain text block image data, the backbone network of the text detection model is a mobilenet network; a text recognition module 640, for inputting the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result. The present application reduces the amount of calculation of the model from the data volume level by preprocessing the text image to be recognized, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model is not much different, and ultimately greatly improving the processing efficiency of text recognition, and still maintaining efficient and accurate recognition effects when processing massive images. At the same time, before sending the input image to the text detection model for text line detection, we preprocess the input image and scale the resolution. The purpose of this is to reduce the amount of calculation of the model from the data volume level, thereby improving the model processing time; the recurrent neural network part (BiLSTM) of the original CRNN is removed, and only the backbone network part of the CNN is retained to slim down the network structure and improve the processing time of the model; the computational model for computing the network output data is integrated into the second half of the model, thereby simplifying the post-processing operation and reducing the data flow of the output results, thereby reducing the transmission of data flow in actual deployment, saving bandwidth, and preventing network congestion under high concurrency; some features of TensorRT are used to accelerate the model, and the text box combination method we designed in the text recognition module is used for disguised batch processing, which improves the efficiency of the entire OCR by 30%. Finally, the average processing time per image of the entire OCR solution is shortened from about 8 seconds to about 160 milliseconds.

[0140] To solve the above technical problems, the present application also provides a computer device. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.

[0141] The computer device 200 includes a memory 210, a processor 220, and a network interface 230 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 200 having components 210-230, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0142] The computer device may be a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with the user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0143] The memory 210 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 210 can be an internal storage unit of the computer device 200, such as a hard disk or memory of the computer device 200. In other embodiments, the memory 210 can also be an external storage device of the computer device 200, such as a plug-in hard disk equipped on the computer device 200, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. Of course, the memory 210 can also include both the internal storage unit of the computer device 200 and its external storage device. In this embodiment, the memory 210 is generally used to store an operating system and various application software installed on the computer device 200, such as computer-readable instructions for a text recognition method applied to massive images, etc. In addition, the memory 210 can also be used to temporarily store various data that have been output or are to be output.

[0144] The processor 220 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 220 is generally used to control the overall operation of the computer device 200. In this embodiment, the processor 220 is used to run the computer-readable instructions stored in the memory 210 or process data, such as running the computer-readable instructions of the text recognition method applied to massive images.

[0145] The network interface 230 may include a wireless network interface or a wired network interface. The network interface 230 is generally used to establish a communication connection between the computer device 200 and other electronic devices.

[0146] The computer device provided by the present application reduces the amount of calculation of the model from the data volume level by preprocessing the text image to be recognized, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model does not differ much, and ultimately greatly improving the processing efficiency of text recognition. When processing massive images, it still maintains efficient and accurate recognition effects.

[0147] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the text recognition method applied to massive images as described above.

[0148] The computer-readable storage medium provided by the present application reduces the amount of calculation of the model from the data volume level by preprocessing the text image to be recognized, thereby improving the processing time of the model, and replaces the backbone network of the text detection model for text line detection with a mobilenet network, thereby further improving the processing efficiency of the model while ensuring that the detection performance of the model does not differ much, and ultimately greatly improving the processing efficiency of text recognition. When processing massive images, it still maintains efficient and accurate recognition effects.

[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0150] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A text recognition method applied to massive images, characterized in that: The steps include: Get the text image to be recognized; Performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data; Inputting the preprocessed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network; Input the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result, wherein the text recognition model is a CNN network omitting a BiLSTM network, and a calculation model for calculating and processing the output data of the CNN network is integrated into the second half of the text recognition model; The step of inputting the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result specifically includes the following steps: Standardizing the text block images according to a standard resolution, and combining them to obtain a standard text block combination that meets the standard resolution; Inputting the standard text block combination into the text recognition model according to the batch processing operation of TensorRT to obtain an output text combination; The output text combination is restored to obtain the text recognition result, wherein the restoration operation refers to marking each output text in the output text combination in the text image to be recognized according to the two-dimensional position information marked by each text block image.

2. The text recognition method applied to massive images according to claim 1, characterized in that: The step of performing a preprocessing operation on the to-be-recognized text image to obtain preprocessed image data specifically comprises the following steps: Performing grayscale processing on the text image to be recognized to obtain grayscale image data; The grayscale image data is subjected to resolution standardization processing to obtain the preprocessed image data.

3. The text recognition method applied to massive images according to claim 2, characterized in that: The step of performing resolution standardization processing on the grayscale image data to obtain the preprocessed image data specifically includes the following steps: If the grayscale image data after resolution standardization processing does not meet the preset width standard value or length standard value, the area that does not meet the width standard value or the length standard value is filled with black edges to obtain the pre-processed image data.

4. The text recognition method applied to massive images according to claim 1, characterized in that: The step of inputting the pre-processed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data specifically includes the following steps: Obtaining the text detection probability corresponding to each pixel point in the to-be-recognized text image output by the text detection model; Performing a screening operation on the pixel points of the to-be-recognized text image according to the text detection probability and a preset pixel threshold to obtain a text detection image; Performing connected domain calculation on the text detection image according to the opencv toolkit to obtain a connected domain set; The minimum circumscribed matrix of each connected domain in the connected domain set is calculated according to the findcontours function, and each vertex of the minimum circumscribed matrix is ​​used as the text block image data.

5. A text recognition device applied to massive images, characterized in that: include: An acquisition module, used for acquiring a text image to be recognized; A preprocessing module, used for performing a preprocessing operation on the text image to be recognized to obtain preprocessed image data; A text line detection module, used for inputting the pre-processed image data into a text detection model based on a differentiable binarization network algorithm to perform a text line detection operation to obtain text block image data, wherein the backbone network of the text detection model is a mobilenet network; A text recognition module, used for inputting the text block image data into a text recognition model based on a CRNN algorithm to perform a text recognition operation to obtain a text recognition result, wherein the text recognition model is a CNN network omitting a BiLSTM network, and a computing model for computing and processing the output data of the CNN network is integrated into the latter half of the text recognition model; The text recognition module includes: a standardization processing submodule, a data input submodule and a restoration operation submodule, wherein: The standardization processing submodule is used to perform standardization processing on the text block images according to a standard resolution, and combine them to obtain a standard text block combination that meets the standard resolution; The data input submodule is used to input the standard text block combination into the text recognition model according to the batch processing operation of TensorRT to obtain an output text combination; The restoration operation submodule is used to perform a restoration operation on the output text combination to obtain the text recognition result, wherein the restoration operation refers to marking each output text in the output text combination in the text image to be recognized according to the two-dimensional position information marked by each text block image.

6. The text recognition device for massive images according to claim 5, characterized in that: The preprocessing module comprises: A grayscale processing submodule, used for performing grayscale processing on the text image to be recognized to obtain grayscale image data; The resolution standardization processing submodule is used to perform resolution standardization processing on the grayscale image data to obtain the pre-processed image data.

7. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the text recognition method applied to massive images as claimed in any one of claims 1 to 4 when executing the computer-readable instructions.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the text recognition method applied to massive images as claimed in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Certificate text detection method and device, and electronic equipment

    CN111783761A

  • Character recognition method and device, intelligent meal taking cabinet, electronic equipment and storage medium

    CN112560845A

  • Picture text recognition method and system, equipment and storage medium

    CN112926565A