Text recognition method, device and equipment

Extracting and identifying text areas and single character images through multi-layer neural networks solves the problem of high error rates in text recognition in complex scenes and achieves higher robustness and accuracy.

CN111753575BActive Publication Date: 2024-10-18SHENZHEN JINQIAO TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910234586.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-03-26
Publication Date
2024-10-18
Estimated Expiration
2039-03-26

AI Technical Summary

Technical Problem

In complex scenarios, existing text recognition technology is difficult to completely identify characters in messy text layouts, resulting in high recognition error rates and poor robustness.

Method used

By using a multi-layer neural network to extract text areas and single character images from the target image, calculate the confidence of candidate blocks respectively, and select areas with high confidence as input, and use feature extraction and classification calculation layers for character recognition.

Benefits of technology

It ensures complete recognition of characters, reduces text recognition error rates, improves robustness, and is suitable for text recognition in complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111753575B_ABST
    Figure CN111753575B_ABST
Patent Text Reader

Abstract

The present invention provides a text recognition method, device and equipment, the text recognition method comprising: extracting a text area image from a target image, the text area image comprising at least one character; extracting single character images from the text area image, each single character image comprising one character; recognizing the characters in each single character image to obtain a character recognition result. The integrity of the recognized characters is ensured, the error rate of text recognition is reduced, and robustness is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a text recognition method, device and equipment. Background Art

[0002] Text may appear in various scenarios, such as shopping mall logos, item brands, various books, videos, etc. Text can help us better understand the relevant circumstances of the scene and then help make corresponding decisions. Therefore, in many scenarios, it is necessary to collect text images and recognize the text in the images.

[0003] In related text recognition methods, after collecting the text image, the text area is extracted from the text image, and then the text area is semantically segmented, and the characters in the text area are recognized based on the semantic segmentation results. In some more complex scenes, the text layout will be messy and cannot form a regular "row". In the above method, in more complex scenes, such as scenes with skewed characters and messy backgrounds, some characters may not be fully recognized when recognizing characters in the text area based on the semantic segmentation results, resulting in text recognition errors and poor robustness. Summary of the invention

[0004] In view of this, the present invention provides a text recognition method, device and equipment to ensure the integrity of recognized characters, reduce the error rate of text recognition, and help improve robustness.

[0005] A first aspect of the present invention provides a text recognition method, comprising:

[0006] Extracting a text area image from a target image, wherein the text area image includes at least one character;

[0007] Extracting single character images from the text region image, each single character image including one character;

[0008] The characters in each single-character image are recognized to obtain a character recognition result.

[0009] According to one embodiment of the present invention, extracting a text area image from a target image includes:

[0010] Inputting the target image into a trained first neural network, so that the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to a text region;

[0011] A text region candidate block whose confidence level is greater than a first preset threshold is selected as the text region image.

[0012] According to an embodiment of the present invention, the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to the text region, including:

[0013] The first neural network extracts features of the input target image through a first feature calculation layer to obtain a first feature map, and outputs the first feature map to a first region candidate calculation layer and a first classification calculation layer of the first neural network respectively;

[0014] The first neural network determines a plurality of text region candidate blocks from the target image based on the first feature map through a first region candidate calculation layer;

[0015] The first neural network calculates the confidence that the text region candidate block belongs to the text region based on the feature regions corresponding to each text region candidate block in the first feature map through the first classification calculation layer.

[0016] According to one embodiment of the present invention, extracting a single character image from a text region image includes:

[0017] Inputting the text region image into a trained second neural network, so that the second neural network determines a plurality of single-character region candidate blocks from the text region image and calculates the confidence that each single-character region candidate block belongs to the single-character region;

[0018] A single-character region candidate block whose confidence level is greater than a second preset threshold is selected as the single-character image.

[0019] According to one embodiment of the present invention, the second neural network determines a plurality of single-character region candidate blocks from the text region image and calculates the confidence that each single-character region candidate block belongs to the single-character region, including:

[0020] The second neural network extracts features of the input text region image through a second feature calculation layer unit to obtain a second feature map, and outputs the second feature map to a second region candidate calculation layer and a second classification calculation layer of the second neural network respectively;

[0021] The second neural network determines a plurality of single-character region candidate blocks from the text region image based on the second feature map through a second region candidate calculation layer;

[0022] The second neural network calculates the confidence that the single-character region candidate block belongs to the single-character region based on the feature regions corresponding to each single-character region candidate block in the second feature map through the second classification calculation layer.

[0023] According to an embodiment of the present invention, recognizing characters in each single-character image to obtain a character recognition result includes:

[0024] Input each single character image into a trained third neural network, respectively, so that a third feature calculation layer of the third neural network extracts features of the input single character image to obtain a third feature map, and the third classification calculation layer calculates and outputs the confidence that the character in the single character image belongs to each preset character category based on the third feature map;

[0025] The character corresponding to the preset character category with the largest confidence is selected as the character recognition result of the corresponding single-character image.

[0026] A second aspect of the present invention provides a text recognition device, comprising:

[0027] A text area image extraction module, used to extract a text area image from a target image, wherein the text area image includes at least one character;

[0028] A single character image extraction module is used to extract single character images from the text area image, each single character image includes one character;

[0029] The character recognition module is used to recognize the characters in each single-character image to obtain a character recognition result.

[0030] According to one embodiment of the present invention, the text area image extraction module includes:

[0031] A target image processing unit, used for inputting the target image into a trained first neural network, so that the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to a text region;

[0032] The text area image determination unit is used to select a text area candidate block whose confidence is greater than a first preset threshold as the text area image.

[0033] According to an embodiment of the present invention, when the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to the text region, it is specifically used to:

[0034] The first neural network extracts features of the input target image through a first feature calculation layer to obtain a first feature map, and outputs the first feature map to a first region candidate calculation layer and a first classification calculation layer of the first neural network respectively;

[0035] The first neural network determines a plurality of text region candidate blocks from the target image based on the first feature map through a first region candidate calculation layer;

[0036] The first neural network calculates the confidence that the text region candidate block belongs to the text region based on the feature regions corresponding to each text region candidate block in the first feature map through the first classification calculation layer.

[0037] According to one embodiment of the present invention, the single character image extraction module includes:

[0038] A text region image processing unit, used for inputting the text region image into a trained second neural network, so that the second neural network determines a plurality of single-character region candidate blocks from the text region image and calculates the confidence that each single-character region candidate block belongs to the single-character region;

[0039] The single character image determination unit is used to select a single character region candidate block whose confidence is greater than a second preset threshold as the single character image.

[0040] According to one embodiment of the present invention, when the second neural network determines a plurality of single-character region candidate blocks from the text region image and calculates the confidence that each single-character region candidate block belongs to the single-character region, it is specifically used to:

[0041] The second neural network extracts features of the input text region image through a second feature calculation layer unit to obtain a second feature map, and outputs the second feature map to a second region candidate calculation layer and a second classification calculation layer of the second neural network respectively;

[0042] The second neural network determines a plurality of single-character region candidate blocks from the text region image based on the second feature map through a second region candidate calculation layer;

[0043] The second neural network calculates the confidence that the single-character region candidate block belongs to the single-character region based on the feature regions corresponding to each single-character region candidate block in the second feature map through the second classification calculation layer.

[0044] According to one embodiment of the present invention, the character recognition module includes:

[0045] A single character image processing unit, used for inputting each single character image into a trained third neural network, so that a third feature calculation layer of the third neural network performs feature extraction on the input single character image to obtain a third feature map, and the third classification calculation layer calculates and outputs the confidence that the character in the single character image belongs to each preset character category based on the third feature map;

[0046] The character determination unit is used to select the character corresponding to the preset character category with the greatest confidence as the character recognition result of the corresponding single-character image.

[0047] A third aspect of the present invention provides an electronic device, comprising a processor and a memory; the memory stores a program that can be called by the processor; wherein when the processor executes the program, the text recognition method as described in the above embodiment is implemented.

[0048] A fourth aspect of the present invention provides a machine-readable storage medium having a program stored thereon, which, when executed by a processor, implements the text recognition method as described in the above-mentioned embodiment.

[0049] The embodiments of the present invention have the following beneficial effects:

[0050] In an embodiment of the present invention, after extracting the text area image from the target image, a single character image is extracted from the text area image. Each single character image contains one character, which can ensure the integrity of the characters to be recognized. The complexity of the scene does not affect the recognition of the characters in the single character image, reducing the possibility of text character recognition errors, which is beneficial to improving robustness and can be applied to text recognition in more complex scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 is a flowchart of a text recognition method according to an embodiment of the present invention;

[0052] Figure 2 is a structural block diagram of a text recognition device according to an embodiment of the present invention;

[0053] Figure 3 is a structural block diagram of a first neural network according to an embodiment of the present invention;

[0054] Figure 4 is a structural block diagram of a second neural network according to an embodiment of the present invention;

[0055] Figure 5 is a structural block diagram of a third neural network according to an embodiment of the present invention;

[0056] Figure 6 It is a structural block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0057] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0058] The terms used in the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "the" and "the" used in the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0059] It should be understood that although the terms first, second, third, etc. may be used to describe various devices in the present invention, this information should not be limited to these terms. These terms are only used to distinguish devices of the same type from each other. For example, without departing from the scope of the present invention, a first device may also be referred to as a second device, and similarly, a second device may also be referred to as a first device. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0060] In order to make the description of the present invention clearer and more concise, some technical terms in the present invention are explained below:

[0061] Deep learning: The concept of deep learning originates from the study of artificial neural networks. It is a method that uses deeper neural networks to simulate human brain analysis and learning and establish corresponding data representation.

[0062] Neural network: A technology abstracted by imitating the structure of the brain. This technology connects a large number of simple functions in a complex way to form a network system. The system can fit extremely complex functional relationships, which generally include convolution / deconvolution operations, activation operations, pooling operations, addition, subtraction, multiplication, division, channel merging, element rearrangement, etc. Using specific input data and output data to train the network and adjust the connections in it can allow the neural network to learn to fit the mapping relationship between input and output.

[0063] End-to-end: The output result is directly obtained from the input data.

[0064] The text recognition method of the embodiment of the present invention can be applied to various scenarios where text recognition is required, such as video text recognition, card text recognition, poster text recognition, license plate text recognition, etc., without limitation.

[0065] The text recognition method of an embodiment of the present invention is described in more detail below, but the present invention should not be limited thereto. Figure 1 , a text recognition method may include the following steps:

[0066] S100: extracting a text area image from a target image, wherein the text area image includes at least one character;

[0067] S200: extracting single character images from the text region image, each single character image including one character;

[0068] S300: Recognize the characters in each single-character image to obtain a character recognition result.

[0069] The text recognition method of the embodiment of the present invention may be executed by an electronic device, and further may be a processor of the electronic device, wherein the processor may be one or more, and the processor may be a general-purpose processor or a dedicated processor. The electronic device may be, for example, an imaging device or other device with image processing capabilities.

[0070] The target image contains text, and may be an image captured from scenes with text, such as posters, license plates, and cards. The text contained in the target image may be Chinese text or English text, and the specific language category of the text is not limited. The target image may be captured by an electronic device, or may be captured by an external imaging device and then transmitted to the electronic device.

[0071] In step S100, a text region image is extracted from a target image, wherein the text region image includes at least one character.

[0072] When extracting a text region image from a target image, the region where the text is located in the target image can be detected, and the text region image can be extracted from the target image according to the position information of the detected text region.

[0073] There is no limit to the method of detecting the area where the text is located in the target image, and it can be implemented based on a deep learning method, for example, it can be implemented using a FASText (Fast Text Classification) model, as long as the text area in the target image can be detected. The position information of the text area can be represented by the position information of the text bounding box surrounding all the text in the text area, and specifically can be represented by the position information of the four vertices of the text bounding box. The shape of the text bounding box can be a quadrilateral or a polygon, and the shape can be regular or irregular.

[0074] According to the position information of the four vertices of the text enclosing box, the area enclosed by the text enclosing box can be extracted from the target image as a text area image.

[0075] The text area images extracted from the target image may be one or more than two, and each text area image contains at least one character. When the characters in the target image are concentrated in one place, the extracted text area image is one, and when the characters in the target image are relatively scattered, multiple text area images may be extracted.

[0076] In step S200, single-character images are extracted from the text region image, and each single-character image includes one character.

[0077] When extracting single-character images from the text region image, the regions where each character in the text region image is located can be detected, and single-character images are extracted from the text region image according to the position information of the detected single-character regions.

[0078] Detecting the regions where each character in the text region image is located can be achieved by means of deep learning, as long as the regions where each character is located in each character region can be detected. Similar to the position information of the text region, the position information of the single-character region can be represented by the position information of the character bounding box surrounding the character, and specifically can be represented by the position information of the four vertices of the character bounding box. The shape of the character bounding box can include regular or irregular shapes such as quadrilaterals and polygons, which can be determined according to the shape of the character in the text region image in the scene. For example, when the character is inclined, the character bounding box can be a parallelogram inclined in the same direction.

[0079] According to the position information of the four vertices of the character bounding box of each character, the region surrounded by the character bounding box is intercepted in the text region image as the single-character image. For example, the text in the text region image is "Martian", and single-character images containing "火", single-character images containing "星", and single-character images containing "人" are extracted from it.

[0080] There may of course be intersections between different single-character images. For example, there may be some strokes of "星" in the single-character image containing "火". However, each single-character image contains a complete character, and based on the single-character image, the recognition of the complete single character in it can be achieved.

[0081] In step S300, the characters in each single-character image are recognized to obtain the character recognition result.

[0082] The recognition of a single character can be achieved by means of deep learning. One character contained in each single-character image can be recognized as the character recognition result. After obtaining the character recognition structures of all single-character images, the recognition of all characters in the text is completed.

[0083] For example, "火" can be recognized from the single-character image containing "火", "星" can be recognized from the single-character image containing "星", and "人" can be recognized from the single-character image containing "人", to obtain all the characters "火星人" of the text.

[0084] In an embodiment of the present invention, after extracting the text area image from the target image, a single character image is extracted from the text area image. Each single character image contains one character, which can ensure the integrity of the characters to be recognized. The complexity of the scene does not affect the recognition of the characters in the single character image, reducing the possibility of text character recognition errors, which is beneficial to improving robustness and can be applied to text recognition in more complex scenes.

[0085] In the embodiments of the present invention, since single character images can be extracted for character recognition, when the scene is complex, the text layout is messy and cannot form regular "rows", or the characters to be recognized in the current scene include similar characters or rare characters (that is, the number of categories is large, greater than 20,000), or the text can be in rows but the number of characters contained in one row is large, such as greater than 100, it is still possible to accurately extract single character images and then accurately recognize text characters.

[0086] In one embodiment, the above method flow may be performed by a text recognition device, such as Figure 2 As shown, the text recognition device 100 may include three modules: a text area image extraction module 101, a single character image extraction module 102, and a character recognition module 103. The text area image extraction module 101 is used to perform the above step S100, the single character image extraction module 102 is used to perform the above step S200, and the character recognition module 103 is used to perform the above step S300.

[0087] In one embodiment, in step S100, extracting a text area image from a target image includes:

[0088] S101: inputting the target image into a trained first neural network, so that the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to a text region;

[0089] S102: Selecting a text region candidate block whose confidence level is greater than a first preset threshold as the text region image.

[0090] The confidence level output by the first neural network can indicate the possibility that the text region candidate block belongs to the text region. The higher the confidence level, the greater the possibility that the text region candidate block belongs to the text region.

[0091] After the target image is input into the first neural network, the first neural network will determine multiple text region candidate blocks from the target image. By analyzing the features of the text region candidate blocks, the confidence that the text region candidate blocks belong to the text region can be calculated. The first neural network can output the confidence that each text region candidate block belongs to the text region and the corresponding position information (i.e., the position information of the text region candidate block).

[0092] When selecting a text area candidate block with a confidence greater than a first preset threshold as the text area image, all confidences output by the first neural network can be traversed to determine whether the traversed confidence is greater than the first preset threshold. If so, the corresponding text area candidate block is used as the text area image, and the text area candidate block can be cut out from the target image as the text area image based on the position information corresponding to the confidence.

[0093] The first neural network is pre-trained and can be pre-stored in the electronic device or stored in an external device. When the above method needs to be executed, the electronic device can call the first neural network.

[0094] For training the first neural network, the text image samples and the position information samples of the text regions in the corresponding text image samples can be obtained as training sample sets, the text image samples are used as input, and the position information samples of the corresponding text regions are used as output to train the first neural network. The position information samples of the text regions in the text image samples can be manually calibrated, without limitation.

[0095] In one embodiment, in step S101, the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to the text region, including:

[0096] Step S1011: the first neural network extracts features of the input target image through the first feature calculation layer to obtain a first feature map, and outputs the first feature map to the first region candidate calculation layer and the first classification calculation layer of the first neural network respectively;

[0097] Step S1012: the first neural network determines a plurality of text region candidate blocks from the target image based on the first feature map through the first region candidate calculation layer;

[0098] Step S1013: The first neural network calculates the confidence that the text region candidate block belongs to the text region based on the feature regions corresponding to each text region candidate block in the first feature map through the first classification calculation layer.

[0099] See also Figure 3 The first neural network 200 may include at least one first feature calculation layer 201 for performing feature extraction, at least one first region candidate calculation layer 202 for performing determination of text region candidate blocks, and at least one first classification calculation layer 203 for performing confidence calculation. Of course, the first neural network may also include other layers, such as Figure 3 The first regression calculation layer 204 for performing position information regression is shown in FIG.

[0100] The first feature calculation layer 201 can be implemented by at least one convolutional layer, for example, by using CNN (Convolutional Neural Network, a feedforward artificial neural network whose neurons can respond to surrounding units within a limited coverage area and effectively extract feature information of the image through weight sharing and feature aggregation). Of course, other feature extraction networks can also be used.

[0101] After obtaining the first feature map, the first feature calculation layer 201 outputs the first feature map to the first region candidate calculation layer 202 and the first classification calculation layer 203 respectively.

[0102] The first region candidate calculation layer 202 can be implemented by algorithms such as RPN (Region Proposal Networks) and RRPN (Rotation Region Proposal Networks). In the first region candidate calculation layer 202, multiple anchor points and multiple candidate boxes can be preset. The shapes, sizes, and positions of each candidate box can be different. The anchor point can be used to locate the candidate box. When each candidate box is located in the first feature map through the anchor point, a feature area in the first feature map can be selected. When it is located in the target image, a region in the target image can be selected. The selected feature area can be used to determine whether the area corresponding to the position in the target image is likely to belong to the text area. For example, it can be determined by comparing the features in the selected feature area with the text features. If so, the area corresponding to the position in the target image is determined as a text area candidate block.

[0103] The anchor points in the first region candidate calculation layer 202 can be pre-calibrated, and the candidate boxes can be positioned in the target image so that they select the corresponding area in the target image, which is also applicable to the first feature map. Of course, the anchor points can also be determined in a random manner. Optionally, there is usually an intersection between the areas selected by these candidate boxes, and all the selected areas can cover the entire target image as a whole to avoid missing possible text areas.

[0104] The determined text region candidate blocks are not necessarily the desired text regions, because there may be the following situation: part of the text, such as 80%, falls within a certain text region candidate block, while another part, such as 20%, falls outside the text region candidate block. Therefore, it is necessary to continue to determine which text region candidate blocks belong to the text region.

[0105] The first region candidate calculation layer 202 may output the position information of the determined text region candidate block to the first classification calculation layer 203. When position information regression is required, the first region candidate calculation layer 202 may also output the position information of the text region candidate block to the first regression calculation layer 204. The position information of the text region candidate block may be represented by the coordinates of the vertices of the candidate box located by the anchor point in the target image.

[0106] The first classification calculation layer 203 can be implemented by at least one fully connected layer, such as 2 to 3 fully connected layers, as long as the confidence that the text area candidate block belongs to the text area can be calculated based on the feature area corresponding to each text area candidate block in the first feature map. The first classification calculation layer 203 has the function of calculating the confidence through training. If the text basically falls into a certain text area candidate block, then the confidence that the text area candidate block belongs to the text area will be higher, otherwise it will be lower. The first classification calculation layer 203 can output the confidence that each text area candidate block belongs to the text area as the output result of the first neural network.

[0107] The first regression calculation layer 204 may be a regression layer capable of implementing coordinate regression. The implementation of regression is generally to perform coordinate transformation on the position information, for example, including translation transformation and / or scale scaling transformation, to determine more accurate position information. After the first regression calculation layer 204 regresses the position information of each text region candidate block, the regressed position information may be output as another output result of the first neural network.

[0108] The confidence levels output by the first neural network 200 correspond to the position information. Thus, the corresponding text region candidate block in the target image can be determined based on the output position information, and whether the text region candidate block belongs to the text region can be determined based on the corresponding confidence level.

[0109] In one embodiment, in step S200, extracting a single character image from the text region image includes:

[0110] S201: inputting the text region image into a trained second neural network, so that the second neural network determines a plurality of single-character region candidate blocks from the text region image, and calculates the confidence that each single-character region candidate block belongs to the single-character region;

[0111] S202: Selecting a single-character region candidate block whose confidence is greater than a second preset threshold as the single-character image.

[0112] The confidence level output by the second neural network can indicate the possibility that the single-character region candidate block belongs to the single-character region. The higher the confidence level, the greater the possibility that the single-character region candidate block belongs to the single-character region.

[0113] After the text area image is input into the second neural network, the second neural network will determine multiple single-character area candidate blocks from the text area image. By analyzing the features of the single-character area candidate blocks, the confidence that the single-character area candidate blocks belong to the single-character area can be calculated. The second neural network can output the confidence that each single-character area candidate block belongs to the single-character area and the corresponding position information (i.e., the position information of the single-character area candidate block). The single-character area is an image area that contains only one character.

[0114] When selecting a single-character area candidate block with a confidence level greater than a second preset threshold as the single-character image, all confidence levels output by the second neural network can be traversed to determine whether the traversed confidence level is greater than the second preset threshold. If so, the corresponding single-character area candidate block is used as the single-character image, and the single-character area candidate block can be cut out from the text area image as the single-character image based on the position information corresponding to the confidence level.

[0115] The second neural network is pre-trained and can be pre-stored in the electronic device or stored in an external device. The electronic device can call the second neural network when the above method needs to be executed.

[0116] For training the second neural network, the single character image samples and the corresponding position information samples of the single character regions in the single character image samples can be obtained as training sample sets, the single character image samples can be used as input, and the corresponding position information samples of the single character regions can be used as output to train the second neural network. The position information samples of the single character regions in the single character image samples can be manually calibrated, without limitation.

[0117] In one embodiment, in step S201, the second neural network determines a plurality of single-character region candidate blocks from the text region image and calculates the confidence that each single-character region candidate block belongs to the single-character region, including:

[0118] S2011: the second neural network extracts features of the input text region image through a second feature calculation layer unit to obtain a second feature map, and outputs the second feature map to a second region candidate calculation layer and a second classification calculation layer of the second neural network respectively;

[0119] S2012: the second neural network determines a plurality of single-character region candidate blocks from the text region image based on the second feature map through the second region candidate calculation layer;

[0120] S2013: The second neural network calculates the confidence that the single-character region candidate block belongs to the single-character region based on the feature regions corresponding to each single-character region candidate block in the second feature map through the second classification calculation layer.

[0121] See also Figure 4 The second neural network 300 may include at least one second feature calculation layer 301 for performing feature extraction, at least one second region candidate calculation layer 302 for performing determination of text region candidate blocks, and at least one second classification calculation layer 303 for performing confidence calculation. Of course, the second neural network may also include other layers, such as Figure 4 The second regression calculation layer 304 for performing position information regression is shown in FIG.

[0122] The second feature calculation layer 301 can be implemented by at least one convolution layer, such as CNN, or other feature extraction networks. After the second feature calculation layer 301 obtains the second feature map, it outputs the second feature map to the second region candidate calculation layer 302 and the second classification calculation layer 303 respectively.

[0123] The second region candidate calculation layer 302 can also be implemented by algorithms such as RPN and RRPN. In the second region candidate calculation layer 302, multiple anchor points and multiple candidate boxes can be preset, and the shapes, sizes, and positions of each candidate box can be different. The anchor point can be used to locate the candidate box. When each candidate box is located in the second feature map through the anchor point, a feature area in the second feature map can be selected, and when it is located in the text area image, a region in the text area image can be selected. The selected feature area can be used to determine whether the area corresponding to the position in the text area image is likely to belong to a single character area. For example, it can be determined by comparing the features in the selected feature area with the character features. If so, the area corresponding to the position in the text area image is determined as a single character area candidate block.

[0124] The anchor points in the second region candidate calculation layer 302 can be pre-calibrated, and the candidate boxes can be positioned in the text region image so that they select the corresponding region in the text region image, which is also applicable to the second feature map. Of course, the anchor points can also be determined in a random manner. Optionally, there is usually an intersection between the regions selected by these candidate boxes, and all the selected regions can cover the entire text region image as a whole to avoid missing possible single-character regions.

[0125] The determined single-character region candidate blocks are not necessarily the desired single-character regions, because there may be a situation where part of a character, such as 80%, falls within a single-character region and another part, such as 20%, falls outside the single-character region. Therefore, it is necessary to continue to determine which single-character region candidate blocks belong to the single-character region.

[0126] The second region candidate calculation layer 302 may output the position information of the determined single-character region candidate block to the second classification calculation layer 303. When position information regression is required, the second region candidate calculation layer 302 may also output the position information of the single-character region candidate block to the second regression calculation layer 304. The position information of the single-character region candidate block may be represented by the coordinates of the vertices of the candidate box located by the anchor point in the text region image.

[0127] The second classification calculation layer 303 can be implemented with at least one fully connected layer, such as 2 to 3 fully connected layers, as long as the confidence that the single-character region candidate block belongs to the single-character region can be calculated based on the feature area corresponding to each single-character region candidate block in the second feature map. The second classification calculation layer 303 has the function of calculating the confidence through training. If a certain character basically falls in a certain single-character region candidate block, then the confidence that the single-character region candidate block belongs to the single-character region will be higher, otherwise it will be lower. The second classification calculation layer 303 can output the confidence that each single-character region candidate block belongs to the single-character region as the output result of the second neural network.

[0128] The second regression calculation layer 304 can use a regression layer that can implement coordinate regression. The implementation of regression is generally to perform coordinate transformation on the position information, such as translation transformation and / or scale scaling transformation, to determine more accurate position information. After the second regression calculation layer 304 regresses the position information of each single-character candidate block, the regressed position information can be output as another output result of the second neural network.

[0129] The confidence levels output by the second neural network 300 correspond to the position information. Thus, the corresponding single-character region candidate block in the text region image can be determined based on the output position information, and whether the single-character region candidate block belongs to the single-character region can be determined based on the corresponding confidence level.

[0130] The layer structures of the first neural network and the second neural network can be the same, but the network parameters are different.

[0131] In one embodiment, in step S300, the characters in each single-character image are recognized to obtain a character recognition result, including:

[0132] S301: Inputting each single character image into a trained third neural network respectively, so that a third feature calculation layer of the third neural network extracts features of the input single character image to obtain a third feature map, and the third classification calculation layer calculates and outputs the confidence that the character in the single character image belongs to each preset character category based on the third feature map;

[0133] S302: Selecting a character corresponding to a preset character category with the greatest confidence as a character recognition result of the corresponding single-character image.

[0134] See also Figure 5 The third neural network 400 may include at least one third feature calculation layer 401 for performing feature extraction, and at least one third classification calculation layer 402 for performing classification processing. Of course, the third neural network may also include other layers.

[0135] The third feature calculation layer 401 can use the Inception network (a type of convolutional neural network) or the Inception-Resnet network (a type of convolutional neural network) with outstanding performance, but is certainly not limited thereto, and can also be implemented using other feature extraction networks. The third feature calculation layer 401 extracts features from the single character image to obtain a third feature map, which can characterize the features of the characters in the single character image, and outputs the third feature map to the third classification calculation layer 402.

[0136] The third classification calculation layer 402 can be implemented by a convolution layer for performing convolution and a fully connected layer for performing full connection, without limitation. The third classification calculation layer 402 can calculate the confidence that the characters in the input single-character area belong to each preset character category based on the third feature map, and output the calculated confidences. For example, the third classification calculation layer 402 outputs the confidence that the character belongs to the preset character category corresponding to "fire", the confidence that the character belongs to the preset character category corresponding to "star", and the confidence that the character belongs to the preset character category corresponding to "person". Of course, more preset character categories can be preset in the third classification calculation layer 402 to meet a large number of character recognition needs.

[0137] For each input single character image, the maximum confidence can be determined from the confidences output by the third neural network 400, and the character corresponding to the preset character category with the maximum confidence is selected as the character recognition result of the single character image. For example, if the character corresponding to the preset character category with the maximum confidence is "fire", then the character recognition result of the single character image is determined to be "fire". The character corresponding to the preset character category with the maximum confidence can be obtained from the preset text character library to complete the recognition of the character.

[0138] The third neural network 400 is pre-trained and can be pre-stored in the electronic device or stored in an external device. When the above method needs to be executed, the electronic device calls the third neural network.

[0139] For the training of the third neural network 400, the third neural network 400 can be trained by obtaining single-character area image samples and the categories of characters in the corresponding single-character area image samples as training sample sets, taking the single-character area image samples as input, and taking the categories of corresponding characters as output.

[0140] The present invention also provides a text recognition device, see Figure 2 , the text recognition device 100 comprises:

[0141] A text area image extraction module 101 is used to extract a text area image from a target image, wherein the text area image includes at least one character;

[0142] A single character image extraction module 102 is used to extract single character images from the text area image, each single character image includes one character;

[0143] The character recognition module 103 is used to recognize the characters in each single-character image to obtain a character recognition result.

[0144] In one embodiment, the text area image extraction module includes:

[0145] A target image processing unit, used for inputting the target image into a trained first neural network, so that the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to a text region;

[0146] The text area image determination unit is used to select a text area candidate block whose confidence is greater than a first preset threshold as the text area image.

[0147] In one embodiment, when the first neural network determines multiple text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to the text region, it is specifically used to:

[0148] The first neural network extracts features of the input target image through a first feature calculation layer to obtain a first feature map, and outputs the first feature map to a first region candidate calculation layer and a first classification calculation layer of the first neural network respectively;

[0149] The first neural network determines a plurality of text region candidate blocks from the target image based on the first feature map through a first region candidate calculation layer;

[0150] The first neural network calculates the confidence that the text region candidate block belongs to the text region based on the feature regions corresponding to each text region candidate block in the first feature map through the first classification calculation layer.

[0151] In one embodiment, the single character image extraction module includes:

[0152] A text region image processing unit, used for inputting the text region image into a trained second neural network, so that the second neural network determines a plurality of single-character region candidate blocks from the text region image and calculates the confidence that each single-character region candidate block belongs to the single-character region;

[0153] The single character image determination unit is used to select a single character region candidate block whose confidence is greater than a second preset threshold as the single character image.

[0154] In one embodiment, when the second neural network determines a plurality of single-character region candidate blocks from the text region image and calculates the confidence that each single-character region candidate block belongs to the single-character region, it is specifically used to:

[0155] The second neural network extracts features of the input text region image through a second feature calculation layer unit to obtain a second feature map, and outputs the second feature map to a second region candidate calculation layer and a second classification calculation layer of the second neural network respectively;

[0156] The second neural network determines a plurality of single-character region candidate blocks from the text region image based on the second feature map through a second region candidate calculation layer;

[0157] The second neural network calculates the confidence that the single-character region candidate block belongs to the single-character region based on the feature regions corresponding to each single-character region candidate block in the second feature map through the second classification calculation layer.

[0158] In one embodiment, the character recognition module includes:

[0159] A single character image processing unit, used for inputting each single character image into a trained third neural network, so that a third feature calculation layer of the third neural network performs feature extraction on the input single character image to obtain a third feature map, and the third classification calculation layer calculates and outputs the confidence that the character in the single character image belongs to each preset character category based on the third feature map;

[0160] The character determination unit is used to select the character corresponding to the preset character category with the greatest confidence as the character recognition result of the corresponding single-character image.

[0161] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0162] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units.

[0163] The present invention also provides an electronic device, comprising a processor and a memory; the memory stores a program that can be called by the processor; wherein when the processor executes the program, the text recognition method as described in the above embodiment is implemented.

[0164] The text recognition device of the present invention can be applied to electronic devices. Taking software implementation as an example, as a device in a logical sense, the processor of the electronic device in which the text recognition device is implemented reads the corresponding computer program instructions in the non-volatile memory into the memory and runs the instructions. Figure 6 As shown, Figure 6 is a hardware structure diagram of an electronic device where a text recognition device 100 is located according to an exemplary embodiment of the present invention, except Figure 6 In addition to the processor 510, memory 530, interface 520, and non-volatile memory 540 shown, the electronic device where the device 100 is located in the embodiment may also include other hardware according to the actual function of the electronic device, which will not be described in detail.

[0165] The present invention also provides a machine-readable storage medium on which a program is stored. When the program is executed by a processor, the text recognition method as described in any one of the aforementioned embodiments is implemented.

[0166] The present invention may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Machine-readable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. The information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of machine-readable storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0167] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A text recognition method, characterized in that: include: Extracting a text area image from a target image, wherein the text area image includes at least one character; Inputting the text region image into a trained second neural network, wherein the second neural network includes at least one second feature calculation layer, at least one second region candidate calculation layer, at least one second classification calculation layer, and a second regression calculation layer; The second feature calculation layer unit extracts features from the input text region image to obtain a second feature map, and outputs the second feature map to the second region candidate calculation layer and the second classification calculation layer respectively; The second region candidate calculation layer determines position information of a plurality of single-character region candidate blocks from the text region image based on the second feature map, and outputs the determined position information of the single-character region candidate blocks to the second classification calculation layer; The second classification calculation layer calculates the confidence that the single-character region candidate block belongs to the single-character region based on the feature regions corresponding to each single-character region candidate block in the second feature map; the larger the portion of the single character falling in the single-character region candidate block, the higher the confidence that the single-character region candidate block belongs to the single-character region; The second regression calculation layer regresses the position information of each single-character candidate block; Selecting a single character region candidate block with a confidence greater than a second preset threshold as a single character image; each single character image includes a complete character, and there is or is no intersection between different single character images; Recognize the characters in each single-character image to obtain a character recognition result; Extracting text area images from target images, including: Inputting the target image into a trained first neural network, so that the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to a text region; Selecting a text region candidate block whose confidence is greater than a first preset threshold as the text region image; The first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to the text region, including: The first neural network extracts features of the input target image through a first feature calculation layer to obtain a first feature map, and outputs the first feature map to a first region candidate calculation layer and a first classification calculation layer of the first neural network respectively; The first neural network determines a plurality of text region candidate blocks from the target image based on the first feature map through a first region candidate calculation layer; The first neural network calculates the confidence that the text region candidate block belongs to the text region based on the feature regions corresponding to each text region candidate block in the first feature map through the first classification calculation layer.

2. The text recognition method according to claim 1, characterized in that: Recognize the characters in each single character image to obtain character recognition results, including: Inputting each single character image into a trained third neural network respectively, so that a third feature calculation layer of the third neural network extracts features of the input single character image to obtain a third feature map, and a third classification calculation layer of the third neural network calculates and outputs the confidence that the character in the single character image belongs to each preset character category based on the third feature map; The character corresponding to the preset character category with the largest confidence is selected as the character recognition result of the corresponding single-character image.

3. A text recognition device, characterized in that: include: A text area image extraction module, used to extract a text area image from a target image, wherein the text area image includes at least one character; A single character image extraction module is used to input the text area image into a trained second neural network, wherein the second neural network includes at least one second feature calculation layer, at least one second area candidate calculation layer, at least one second classification calculation layer, and a second regression calculation layer; the second feature calculation layer unit extracts features from the input text area image to obtain a second feature map, and outputs the second feature map to the second area candidate calculation layer and the second classification calculation layer respectively; the second area candidate calculation layer determines the position information of multiple single character area candidate blocks from the text area image based on the second feature map, and outputs the determined position information of the single character area candidate blocks to the second classification calculation layer; the second classification calculation layer calculates the confidence that the single character area candidate block belongs to the single character area based on the feature area corresponding to each single character area candidate block in the second feature map; the larger the part of a single character falling in the single character area candidate block, the higher the confidence that the single character area candidate block belongs to the single character area; The second regression calculation layer regresses the position information of each single character candidate block; selects a single character region candidate block whose confidence is greater than a second preset threshold as a single character image; each single character image includes a complete character, and there is or is no intersection between different single character images; A character recognition module is used to recognize characters in each single character image to obtain a character recognition result; The text area image extraction module comprises: A target image processing unit, used for inputting the target image into a trained first neural network, so that the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to a text region; A text area image determination unit, configured to select a text area candidate block having a confidence level greater than a first preset threshold as the text area image; When the first neural network determines a plurality of text region candidate blocks from the target image and calculates the confidence that each text region candidate block belongs to the text region, it is specifically used to: The first neural network extracts features of the input target image through a first feature calculation layer to obtain a first feature map, and outputs the first feature map to a first region candidate calculation layer and a first classification calculation layer of the first neural network respectively; The first neural network determines a plurality of text region candidate blocks from the target image based on the first feature map through a first region candidate calculation layer; The first neural network calculates the confidence that the text region candidate block belongs to the text region based on the feature regions corresponding to each text region candidate block in the first feature map through the first classification calculation layer.

4. An electronic device, characterized in that: It comprises a processor and a memory; the memory stores a program that can be called by the processor; wherein when the processor executes the program, the text recognition method as described in any one of claims 1-2 is implemented.

Citation Information

Patent Citations

  • Sprayed character online visual detection method based on convolutional neural network

    CN103927534A

  • End-to-end identification method for scene text with random shape

    CN108549893A