A character recognition method and device

By generating prediction values ​​for each pixel in the image to be processed and identifying its relationship with characters, the problem of difficulty in character recognition in images with irregular text areas is solved, and accurate recognition of curved and irregular text is achieved.

CN112784830BActive Publication Date: 2024-08-27LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110117911.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-28
Publication Date
2024-08-27
Estimated Expiration
2041-01-28

AI Technical Summary

Technical Problem

Existing character recognition technology has difficulty processing images with irregular text areas, making character recognition more difficult.

Method used

By processing each pixel in the image to be processed, a predicted value is generated to determine its relationship with the character, and the position information of the character is identified based on these predicted values, thereby achieving character-based recognition.

Benefits of technology

It reduces the difficulty of character recognition, especially for images with curved text and irregular text, and can accurately locate and identify characters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112784830B
    Figure CN112784830B
Patent Text Reader

Abstract

The present application provides a character recognition method and device, which obtain an image to be processed for character recognition, process each pixel in the image to be processed, obtain a predicted value for each pixel, the predicted value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed, determine the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel, identify the character in the image to be processed according to the position information of the pixel corresponding to the character in the image to be processed, and realize identifying the character in the image to be processed according to the relationship between each pixel and the character in the image to be processed, thereby converting character recognition in units of text lines into recognition in units of characters, and converting the positioning of text lines in the image to be processed into the positioning of characters. In this way, for the image to be processed where there are curved texts and irregular texts that are difficult to locate text lines, character positioning is sufficient, thereby reducing the difficulty of character recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular, relates to a character recognition method and device. Background Art

[0002] At present, character recognition is performed in units of text lines. The text box to be recognized is marked in the image to be processed, and then each character in the text box to be recognized is recognized through the text recognition algorithm. However, the area where the text is located in the image to be processed may be an irregular area. For such an image to be processed, it is difficult to mark the text box to be recognized from the image to be processed, thereby increasing the difficulty of character recognition. Summary of the invention

[0003] The present application provides a character recognition method and device.

[0004] On the one hand, the present application provides a character recognition method, comprising:

[0005] Obtaining an image to be processed for character recognition;

[0006] Processing each pixel in the image to be processed to obtain a predicted value of each pixel, wherein the predicted value of the pixel is used to indicate a relationship between the pixel and a character in the image to be processed;

[0007] Determine the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel;

[0008] The characters in the image to be processed are identified according to the position information of the pixel points corresponding to the characters in the image to be processed.

[0009] Optionally, the identifying the characters in the image to be processed according to the position information of the pixel points corresponding to the characters in the image to be processed includes:

[0010] Determine the position information of the pixel points belonging to the same character according to the position information of the pixel points corresponding to the character in the image to be processed;

[0011] Obtaining target pixel points belonging to the edge of the character from the pixel points belonging to the same character;

[0012] According to the position information of the target pixel point, the position information of the character in the image to be processed is obtained to identify the character in the image to be processed.

[0013] Optionally, determining the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel includes:

[0014] Classifying each pixel point according to the predicted value and the preset classification value of each pixel point to obtain the type of each pixel point, wherein the type of the pixel point is used to indicate whether the pixel point is located in the character area;

[0015] The pixel points whose type is determined to be located in the character area are pixel points corresponding to the characters in the image to be processed.

[0016] Optionally, classifying each pixel point according to the predicted value and the preset classification value of each pixel point to obtain the type of each pixel point includes:

[0017] If the predicted value of the pixel point matches the first preset classification value, the pixel point is determined to be a first type pixel point, and the first type pixel point is used to indicate that the pixel point is located in the edge area of ​​the character;

[0018] If the predicted value of the pixel point matches the second preset classification value, the pixel point is determined to be a second type pixel point, and the second type pixel point is used to indicate that the pixel point is located in the inner area of ​​the character;

[0019] If the predicted value of the pixel point matches the third preset classification value, determining that the pixel point is a third type pixel point, the third type pixel point is used to indicate that the pixel point is located outside the character area;

[0020] Among them, the first preset classification value is smaller than the second preset classification value, but the first preset classification value is larger than the third preset classification value.

[0021] Optionally, the method further comprises: identifying a target form of the text composed of the characters in the image to be processed according to position information of the characters in the image to be processed;

[0022] According to the target morphology, the image to be processed is morphologically marked.

[0023] Optionally, the identifying, according to the position information of the characters in the image to be processed, the target form of the text composed of the characters in the image to be processed comprises:

[0024] Determining the direction and curvature of the text composed of the characters according to the position information of the characters in the image to be processed;

[0025] According to the direction and curvature of the text, the target shape of the text in the image to be processed is obtained.

[0026] On the other hand, the present application provides a character recognition device, comprising:

[0027] An obtaining unit, used for obtaining an image to be processed for character recognition;

[0028] A prediction value obtaining unit, used for processing each pixel in the image to be processed to obtain a prediction value of each pixel, wherein the prediction value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed;

[0029] A determination unit, used to determine the pixel point corresponding to the character in the image to be processed according to the predicted value of each pixel point;

[0030] The recognition unit is used to recognize the characters in the image to be processed according to the position information of the pixel points corresponding to the characters in the image to be processed.

[0031] Optionally, the recognition unit is used to determine the position information of pixel points belonging to the same character based on the position information of pixel points corresponding to the character in the image to be processed; obtain target pixel points belonging to the edge of the character from the pixel points belonging to the same character; and obtain the position information of the character in the image to be processed based on the position information of the target pixel points to identify the character in the image to be processed.

[0032] Optionally, the determination unit is used to classify each pixel point according to the predicted value and a preset classification value of each pixel point to obtain the type of each pixel point, and the type of the pixel point is used to indicate whether the pixel point is located in the character area; the determination type indicates that the pixel point located in the character area is a pixel point corresponding to the character in the image to be processed.

[0033] Optionally, the recognition unit is further used to recognize the target form of the text composed of the characters in the image to be processed according to the position information of the characters in the image to be processed;

[0034] The device further includes: a marking unit, configured to mark the image to be processed in terms of its morphology according to the target morphology.

[0035] In another aspect, the present application provides an electronic device, comprising: a processor;

[0036] a memory for storing instructions executable by the processor;

[0037] Wherein, the processor is configured to execute the instructions to implement the above-mentioned character recognition method.

[0038] On the other hand, the present application provides a storage medium, in which instructions are stored, and when the instructions in the storage medium are executed, the above-mentioned character recognition method is implemented.

[0039] The above-mentioned character recognition method and device obtain an image to be processed for character recognition, process each pixel in the image to be processed, obtain a predicted value of each pixel, the predicted value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed, determine the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel, identify the character in the image to be processed according to the position information of the pixel corresponding to the character in the image to be processed, and realize identifying the character in the image to be processed according to the relationship between each pixel and the character in the image to be processed, thereby converting character recognition in units of text lines into recognition in units of characters, and converting the positioning of text lines in the image to be processed into the positioning of characters. In this way, for the image to be processed where it is difficult to locate text lines due to curved text and irregular text, character positioning is sufficient, thereby reducing the difficulty of character recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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.

[0041] Figure 1 is a flow chart of a character recognition method provided by an embodiment of the present application;

[0042] Figure 2 is a schematic diagram of a deformation of characters in an image to be processed provided by an embodiment of the present application;

[0043] Figure 3 is a schematic diagram of the relationship between pixels and characters provided in an embodiment of the present application;

[0044] Figure 4 is a schematic diagram of another relationship between pixels and characters provided in an embodiment of the present application;

[0045] Figure 5 is a flow chart of another character recognition method provided by an embodiment of the present application;

[0046] Figure 6 is a schematic diagram of a target form provided in an embodiment of the present application;

[0047] Figure 7 is a schematic diagram of another target form provided in an embodiment of the present application;

[0048] Figure 8 is a schematic diagram of a prediction model training process provided in an embodiment of the present application;

[0049] Fig. 9 is a structural schematic diagram of a character recognition device provided in an embodiment of the present application;

[0050] Fig.10 It is a structural schematic diagram of another character recognition device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0052] See also Figure 1 , which shows a flowchart of a character recognition method provided by an embodiment of the present application, which may include the following steps:

[0053] 101: Obtain an image to be processed for character recognition.

[0054] Among them, there is at least one character in the image to be processed, and the image to be processed can be from different scenes. For example, there is a need for character recognition in an industrial scene, and the image to be processed is obtained by photographing objects containing characters in the industrial scene. Because the characters and texts in the objects in the industrial scene may be bent, rotated, twisted, and irregular in shape, the characters and texts in the image to be processed are irregularly distributed and the area where the characters are located may also be an irregular area.

[0055] For example Figure 2 The image to be processed in the industrial scene shown in FIG. 1 is an image to be processed. In the image to be processed, multiple characters are rotated and the area where the text composed of multiple characters is located is an irregular area, such as Figure 2 The area where the Chinese text is located is a curve-like area. For this type of text, it is difficult to locate the text line when locating the text line in units of text lines. For this reason, this embodiment proposes a character recognition method that locates characters in units of characters. For the images to be processed in industrial scenarios and other scenarios, character positioning is performed in units of characters, so as to recognize the characters in the images to be processed.

[0056] The method for obtaining the image to be processed may be, but is not limited to: photographing an object containing characters through a photographing device, or obtaining the image to be processed for character recognition from a locally stored image, or obtaining the image to be processed sent by other devices, such as photographing an object containing characters through a photographing device of other devices to obtain the image to be processed, and other devices send the image to be processed to the device implementing the character recognition method through a transmission channel. This embodiment does not limit the application scenario corresponding to the image to be processed. For example, the above-mentioned image to be processed corresponds to an industrial scenario. For images to be processed in other application scenarios, character positioning and recognition can also be performed based on the character recognition method of this embodiment.

[0057] 102: Process each pixel in the image to be processed to obtain a prediction value of each pixel, wherein the prediction value of the pixel is used to indicate a relationship between the pixel and the character in the image to be processed.

[0058] The relationship between a pixel and a character in the image to be processed can characterize whether the pixel is located in the character area, wherein a pixel located in the character area can be regarded as a pixel belonging to the character area, and a pixel belonging to the character area defines the position of a character in the image to be processed, thereby being able to locate the character in the image to be processed through the predicted value of the pixel.

[0059] by Figure 3 The characters B and C shown in the figure are used as examples to illustrate. Figure 3 Each small square in represents a pixel point. There is at least one column of pixels between characters B and C. These pixels serve as the interval between characters B and C (through the analysis of characters in different images to be processed, there are intervals between characters). This means that the pixels used as the interval between characters B and C do not belong to either character B or character C. Then, for these pixels, the predicted values ​​of these pixels are different from the predicted values ​​of the pixels located at characters B and C (belonging to characters B and C), such as Figure 3 Medium gray corresponds to one prediction value, white corresponds to another prediction value, and the two colors correspond to two different prediction values, so that an edge of the character, that is, a boundary of the character, is determined according to the difference between the prediction values ​​of different pixels.

[0060] A character has at least four edges, such as Figure 3 In addition to the adjacent edges of character B and character C, character B and character C each have three edges. For these three edges, the predicted values ​​of the pixels outside the edges are different from the predicted values ​​of the pixels inside the characters, and the edges of the characters are determined based on the differences between the predicted values ​​of different pixels.

[0061] In this embodiment, the predicted value of the pixel point located in the character area is different from the predicted value of the pixel point located outside the character area. If the relationship between the pixel point and the character in the image to be processed indicates that the pixel point is located in the character area, the predicted values ​​of the pixel points at different positions in the character area may also be different. For example, the character area includes: the character edge area and the character internal area. For the character edge area and the character internal area, the predicted values ​​of the pixels in these two areas may also be different. Figure 4 As shown, Figure 4 Medium gray corresponds to one prediction value, white corresponds to another prediction value, and black corresponds to another prediction value. The three colors correspond to three different prediction values. The colors show that the prediction values ​​of the pixels located in the edge area and the internal area of ​​the characters shown in characters B and C are different. The edge of the character can still be determined based on the difference between the prediction values ​​of different pixels.

[0062] One point that needs to be explained here is: for a character, some pixels in the area located by the pixels belonging to the edge area of ​​the character may correspond to the strokes of the character, and some pixels may not correspond to the strokes of the character. Then, for the pixels located in the area located by the pixels belonging to the edge area of ​​the character, the predicted values ​​of the pixels corresponding to the strokes of the character may be different from the predicted values ​​of the pixels not corresponding to the strokes of the character, and this is not limited in this embodiment. Similarly, this embodiment does not limit the value of the predicted value of the pixels that have different relationships with the characters, for example, the predicted value of the pixel located in the character area is 1, and the predicted value of the pixel located outside the character area is 0, or the predicted value of the pixel located in the character area is greater than the preset classification value, and the predicted value of the pixel located outside the character area is less than or equal to the preset classification value, wherein the preset classification value is the value used to segment the character area, and this embodiment does not limit the value of the preset classification value.

[0063] 103: Determine the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel.

[0064] In this embodiment, the predicted value of a pixel point is used to indicate the relationship between the pixel point and the character in the image to be processed. The relationship between the pixel point and the character in the image to be processed can characterize whether the pixel point is located in the character area. Thus, according to the predicted value of each pixel point, the pixel point located in the character area is obtained. These pixel points located in the character area are the pixel points corresponding to the character in the image to be processed. A feasible way to determine the pixel points corresponding to the character in the image to be processed is as follows:

[0065] According to the predicted value and preset classification value of each pixel point, each pixel point is classified to obtain the type of each pixel point, and the type of the pixel point is used to indicate whether the pixel point is located in the character area; the pixel point whose type indicates that it is located in the character area is the pixel point corresponding to the character in the image to be processed, so that the pixels in the image to be processed are classified according to the predicted value and preset classification value of each pixel point, so as to determine the pixel point corresponding to the character in the image to be processed according to the type of the pixel point.

[0066] The types of pixels in an image to be processed include: located in the character area and located outside the character area. The types of pixels located in the character area include located in the character edge area and located in the character internal area. The type of pixels located in the character edge area indicates the edge of the character, and the type of pixels located in the character internal area indicates the inside of the character, that is, located within the edge of the character. Therefore, in the process of classifying the pixels in the image to be processed, it can be determined which of the above three types the pixel belongs to based on the predicted value of the pixel. For example, one classification method is as follows:

[0067] If the predicted value of the pixel point matches the first preset classification value, the pixel point is determined to be a first type pixel point, and the first type pixel point is used to indicate that the pixel point is located in the edge area of ​​the character; if the predicted value of the pixel point matches the second preset classification value, the pixel point is determined to be a second type pixel point, and the second type pixel point is used to indicate that the pixel point is located in the internal area of ​​the character; if the predicted value of the pixel point matches the third preset classification value, the pixel point is determined to be a third type pixel point, and the third type pixel point is used to indicate that the pixel point is located outside the character area; wherein the first preset classification value is less than the second preset classification value, but the first preset classification value is greater than the third preset classification value.

[0068] For example, for a character, the predicted value of a pixel located in the edge area of ​​the character is 0.5, the predicted value of a pixel located in the inner area of ​​the character is 1, and the predicted value of a pixel located outside the character area is 0. The corresponding first preset classification value, second preset classification value, and third preset classification value are 0.5, 1, and 0, respectively. If the predicted value of a pixel matches one of the three preset classification values ​​(such as the same), the pixel is determined to be the type indicated by the matching preset classification value. In this embodiment, the first preset classification value, the second preset classification value, and the third preset classification value are 0.5, 1, and 0, respectively, which is only an example, and this embodiment does not limit the values ​​of these three preset classification values.

[0069] 104: Identify the characters in the image to be processed according to the position information of the pixels corresponding to the characters in the image to be processed. In this embodiment, the pixels corresponding to the characters in the image to be processed are located in the character area, so the position of the pixels corresponding to the characters in the image to be processed is the position of the characters in the image to be processed. Therefore, the characters in the image to be processed can be identified according to the position information of the pixels corresponding to the characters in the image to be processed, such as locating the characters in the image to be processed according to the position information of the pixels corresponding to the characters in the image to be processed to obtain the position information of the characters in the image to be processed. After obtaining the position information of the characters in the image to be processed, the OCR (Optical Character Recognition) algorithm is used to identify the characters.

[0070] Among them, one way to obtain the position information of characters in the image to be processed is: determine the position information of pixel points belonging to the same character based on the position information of pixel points corresponding to the characters in the image to be processed; obtain target pixel points belonging to the edge of the character from the pixel points belonging to the same character; obtain the position information of the characters in the image to be processed based on the position information of the target pixel points, so as to identify the characters in the image to be processed.

[0071] There are multiple characters in an image to be processed, and different characters are segmented by pixels that do not belong to any character. In this embodiment, the pixels of the characters in the image to be processed are segmented according to the pixels located in the character area and the pixels located outside the character area, and the pixels belonging to the same character are determined to obtain the position information of the pixels belonging to the same character. In the process of locating the characters in the image to be processed, the position information of the pixels belonging to the edge of the character can be used. Based on this, after obtaining the position information of the pixels belonging to the same character, for any character, the target pixels belonging to the edge of the character are obtained from the pixels belonging to the character, so as to obtain the position information of the character in the image to be processed according to the position information of the target pixels belonging to the edge of the character.

[0072] For example, according to the position information of the target pixel points belonging to the edge of a character, the boundary of the character is obtained, and the position information of the pixel points corresponding to the boundary of the character is determined as the position information of the character. The pixel points belonging to the edge of the character can be but are not limited to the pixel points of the four boundary points of the character, and the pixel points corresponding to the boundary of the character can delineate the area where the character is located, such as using but not limited to a box, such as Figure 4 As shown, the area where the character is located is demarcated by a rectangular frame. If the area where the character is located is an irregular area, the boundary of the corresponding character is also an irregular shape.

[0073] In the process of obtaining the boundary of the character, a threshold operation is performed on the predicted values ​​of the character edge and each pixel point inside the character, such as comparing the predicted values ​​of the character edge and each pixel point inside the character with the threshold to obtain the comparison result of each predicted value, such as setting the predicted value greater than the threshold to 1, and setting the predicted value less than or equal to the threshold to 0; a closing operation is performed based on the comparison result to connect the pixel points that can serve as the outline of the character, and then an edge detection algorithm (such as the Canny algorithm) is used to perform edge detection to obtain the boundary of the character.

[0074] The above-mentioned character recognition method obtains an image to be processed for character recognition, processes each pixel in the image to be processed, obtains a predicted value for each pixel, the predicted value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed, determines the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel, identifies the character in the image to be processed according to the position information of the pixel corresponding to the character in the image to be processed, and realizes identifying the character in the image to be processed according to the relationship between each pixel and the character in the image to be processed, thereby converting character recognition in units of text lines into recognition in units of characters, and converting the positioning of text lines in the image to be processed into the positioning of characters. In this way, for the image to be processed where there are curved texts and irregular texts that are difficult to locate text lines, character positioning is sufficient, thereby reducing the difficulty of character recognition.

[0075] See also Figure 5 , which shows a flowchart of another character recognition method provided by an embodiment of the present application, which may include the following steps:

[0076] 201: Obtain an image to be processed for character recognition.

[0077] 202: Process each pixel in the image to be processed to obtain a prediction value of each pixel, wherein the prediction value of the pixel is used to indicate a relationship between the pixel and the character in the image to be processed.

[0078] 203: Determine the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel.

[0079] 204: Identify characters in the image to be processed according to the position information of the pixel points corresponding to the characters in the image to be processed.

[0080] In this embodiment, steps 201 to 204 are the same as the above steps 101 to 104, and the execution process thereof can be referred to the above description of steps 101 to 104.

[0081] 205: According to the position information of the characters in the image to be processed, identify the target form of the text composed of the characters in the image to be processed.

[0082] The target morphology is used to indicate the shape of the text composed of characters in the image to be processed, such as the target morphology is used to indicate whether the text composed of characters is an ordered shape or a disordered shape in the image to be processed, wherein the ordered shape and the disordered shape are used to indicate whether the distribution of the characters in the image to be processed is regular. If the distribution of the characters in the image to be processed is regular, the target morphology is used to indicate that the text composed of characters is an ordered shape in the image to be processed; if the distribution of the characters in the image to be processed is irregular (such as scattered and irregular), the target morphology is used to indicate that the text composed of characters is a disordered shape in the image to be processed.

[0083] When the text composed of characters is an ordered shape in the image to be processed, the ordered shape can also be distinguished, such as whether the ordered shape is a curved shape or a straight shape, and the curved shape and the straight shape depend on whether the text is curved.

[0084] In this embodiment, a method for identifying the target shape includes: determining the direction and curvature of the text composed of characters according to the position information of the characters in the image to be processed; and obtaining the target shape of the text in the image to be processed according to the direction and curvature of the text. The direction of the text composed of characters is used to determine whether the characters are distributed regularly in the image to be processed. For example, if the characters form multiple text areas in the image to be processed, and the starting point and end point of the direction indicated by each text area are respectively on straight lines or the starting point of the direction indicated by one text area coincides with the end point of the direction indicated by another text area, it is determined to be an ordered shape, otherwise it is determined to be a disordered shape.

[0085] On the basis of determining that it is an ordered shape, it is determined whether it is a curved shape or a straight shape according to the degree of curvature of the text (i.e., whether there is curvature). Figure 2 For the characters in the image to be processed, the text area where these characters are located is as follows: Figure 6 As shown, the starting point of the direction indicated by one of the text regions coincides with the end point of the direction indicated by another text region and there is a certain curvature, so that the target form is determined to be an ordered form and a curved form in the ordered form. Figure 7 For the characters in the image to be processed shown, the starting point and the end point of the direction indicated by the text area where the text composed of the characters is located are scattered, thereby determining that the target shape is a disordered shape.

[0086] In this embodiment, during the process of identifying the target morphology, the position information of the characters in the image to be processed may be screened to obtain the position information used for morphology recognition. The screening process may be random screening or screening of similar position information.

[0087] In addition to identifying the target morphology of the text composed of characters in the image to be processed based on the direction and curvature, this embodiment can also perform target morphology recognition in other ways, such as calling a morphology recognition model to identify the target morphology of the text composed of characters in the image to be processed based on the position information of the characters in the image to be processed. The morphology recognition model is trained based on the position information of each character in the historical image and the morphology of the text composed of characters in the historical image, so that the morphology recognition model has the ability of morphology recognition. The training process of the morphology recognition model is not described in this embodiment.

[0088] 206: Performing morphological marking on the image to be processed according to the target morphology, so as to obtain the target morphology of the characters constituting the text through the morphological marking of the image to be processed.

[0089] The above-mentioned character recognition method, when obtaining the position information of the characters in the image to be processed, identifies the target form of the text composed of the characters in the image to be processed according to the position information of the characters in the image to be processed, and morphologically marks the image to be processed according to the target form, so as to obtain the target form of the text composed of the characters in the image to be processed through the morphological marking, thereby eliminating the manual analysis and viewing process.

[0090] For the above-mentioned character recognition method, the prediction value of each pixel point can be obtained by using a prediction model. The prediction model is trained based on the relationship between each pixel point and the character in the historical image and the prediction value of each pixel point in the historical image, so that the prediction model has the ability to identify the relationship between each pixel point and the character, thereby enabling the prediction model to output a prediction value indicating the relationship between the pixel point and the character.

[0091] The prediction model includes: a feature extraction layer and a prediction layer. The feature extraction layer is used to extract features from the image to be processed to obtain feature data of each pixel in the image to be processed, and the prediction layer is used to obtain the predicted value of each pixel based on the feature data of each pixel. The feature extraction layer sequentially performs convolution, downsampling, deconvolution and upsampling on the image to be processed, so that the feature data of each character with different distances can be accurately identified, so as to segment each character with different distances.

[0092] In the process of training the prediction model, some historical images of known text areas can be used for training, such as Figure 8The training process is shown. In the process of training with historical images of known text areas, the text area is determined in the historical image by the position coordinates of the known text area. Since the text area has tilt and other phenomena, the text area can be corrected and extracted. For the corrected and extracted text area, the predicted value of each pixel point in the text area is predicted, so as to determine the pixel point of the corresponding character in the historical image according to the predicted value of each pixel point; then, according to the position information of the pixel point of the character in the corresponding historical image, the character in the historical image is identified and mapped to the historical image to determine whether the position information of the character located according to the predicted value of the pixel point matches the position information of the character in the historical image. If it does not match, the model parameters of the prediction model are adjusted. If it matches and the number of matches reaches a certain number, the training of the prediction model is completed.

[0093] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0094] Corresponding to the above method embodiment, the present application embodiment also provides a character recognition device, whose optional structure is as follows: Fig. 9 As shown, it may include: an obtaining unit 10 , a prediction value obtaining unit 20 , a determining unit 30 and a recognizing unit 40 .

[0095] The obtaining unit 10 is used to obtain an image to be processed for character recognition.

[0096] The prediction value obtaining unit 20 is used to process each pixel in the image to be processed to obtain a prediction value of each pixel. The prediction value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed.

[0097] The relationship between a pixel and a character in the image to be processed can characterize whether the pixel is located in the character area, wherein a pixel located in the character area can be regarded as a pixel belonging to the character area, and the pixel belonging to the character area defines the position of a character in the image to be processed, so that the character in the image to be processed can be located by the predicted value of the pixel. For the method of obtaining the predicted value of each pixel, please refer to the relevant instructions in the above method embodiment.

[0098] The determination unit 30 is used to determine the pixel points corresponding to the characters in the image to be processed according to the predicted value of each pixel point. In this embodiment, the predicted value of the pixel point is used to indicate the relationship between the pixel point and the character in the image to be processed. The relationship between the pixel point and the character in the image to be processed can characterize whether the pixel point is located in the character area. Therefore, according to the predicted value of each pixel point, the pixel points located in the character area are obtained, and these pixel points located in the character area are the pixel points corresponding to the characters in the image to be processed. A feasible way for the determination unit 30 to determine the pixel points corresponding to the characters in the image to be processed is as follows:

[0099] According to the predicted value and preset classification value of each pixel point, each pixel point is classified to obtain the type of each pixel point, and the type of the pixel point is used to indicate whether the pixel point is located in the character area; the pixel point whose type indicates that it is located in the character area is the pixel point corresponding to the character in the image to be processed, so as to classify the pixel points in the image to be processed according to the predicted value and preset classification value of each pixel point, so as to determine the pixel point corresponding to the character in the image to be processed according to the type of the pixel point. For example, one classification method is as follows:

[0100] If the predicted value of the pixel point matches the first preset classification value, the pixel point is determined to be a first type pixel point, and the first type pixel point is used to indicate that the pixel point is located in the edge area of ​​the character; if the predicted value of the pixel point matches the second preset classification value, the pixel point is determined to be a second type pixel point, and the second type pixel point is used to indicate that the pixel point is located in the internal area of ​​the character; if the predicted value of the pixel point matches the third preset classification value, the pixel point is determined to be a third type pixel point, and the third type pixel point is used to indicate that the pixel point is located outside the character area; wherein the first preset classification value is less than the second preset classification value, but the first preset classification value is greater than the third preset classification value.

[0101] The recognition unit 40 is used to recognize the characters in the image to be processed according to the position information of the pixels corresponding to the characters in the image to be processed. In this embodiment, the pixels corresponding to the characters in the image to be processed are located in the character area, so the position of the pixels corresponding to the characters in the image to be processed is the position of the characters in the image to be processed. Therefore, the characters in the image to be processed can be recognized according to the position information of the pixels corresponding to the characters in the image to be processed, such as locating the characters in the image to be processed according to the position information of the pixels corresponding to the characters in the image to be processed, so as to obtain the position information of the characters in the image to be processed. After obtaining the position information of the characters in the image to be processed, the OCR algorithm is used to recognize the characters.

[0102] Among them, one way for the recognition unit 40 to obtain the position information of the characters in the image to be processed is: according to the position information of the pixel points corresponding to the characters in the image to be processed, determine the position information of the pixel points belonging to the same character; obtain the target pixel points belonging to the edge of the character from the pixel points belonging to the same character; according to the position information of the target pixel points, obtain the position information of the characters in the image to be processed, so as to identify the characters in the image to be processed.

[0103] The above-mentioned character recognition device obtains an image to be processed for character recognition, processes each pixel in the image to be processed, obtains a predicted value for each pixel, the predicted value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed, determines the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel, identifies the character in the image to be processed according to the position information of the pixel corresponding to the character in the image to be processed, and realizes identifying the character in the image to be processed according to the relationship between each pixel and the character in the image to be processed, thereby converting character recognition in units of text lines into recognition in units of characters, and converting the positioning of text lines in the image to be processed into the positioning of characters. In this way, for the image to be processed where there are curved texts and irregular texts that are difficult to locate text lines, character positioning is sufficient, thereby reducing the difficulty of character recognition.

[0104] See also Fig.10 , which shows an optional structure of another character recognition device provided by an embodiment of the present application, and may further include: a marking unit 50. The recognition unit 40 is further used to recognize the target form of the text composed of characters in the image to be processed according to the position information of the characters in the image to be processed; the marking unit 50 is used to perform morphological marking on the image to be processed according to the target form, so as to obtain the target form of the text composed of characters through the morphological marking of the image to be processed.

[0105] The recognition unit 40 recognizes the target shape in the following manner: determining the direction and curvature of the text composed of characters according to the position information of the characters in the image to be processed; and obtaining the target shape of the text in the image to be processed according to the direction and curvature of the text. For details, please refer to the above method embodiment.

[0106] An embodiment of the present application also provides an electronic device, comprising: a processor and a memory for storing processor executable instructions; wherein the processor is configured to execute instructions to implement the above-mentioned character recognition method.

[0107] An embodiment of the present application also provides a storage medium, in which instructions are stored. When the instructions in the storage medium are executed, the above-mentioned character recognition method is implemented.

[0108] It should be noted that the various embodiments in this specification can be described in a progressive manner, and the features recorded in the various embodiments in this specification can be replaced or combined with each other. Each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0109] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0110] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

[0111] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A character recognition method, include: Obtaining an image to be processed for character recognition; Processing each pixel in the image to be processed to obtain a predicted value of each pixel, wherein the predicted value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed, and the predicted value of the pixel is obtained by a prediction model, wherein the prediction model is trained based on the relationship between each pixel and the character in the historical image and the predicted value of each pixel in the historical image, and the predicted value of the pixel can locate the character in the image to be processed; Determine the pixel corresponding to the character in the image to be processed according to the predicted value of each pixel; Identify characters in the image to be processed according to the position information of the pixel points corresponding to the characters in the image to be processed; Among them, identifying the characters in the image to be processed according to the position information of the pixel points corresponding to the characters in the image to be processed includes: determining the position information of the pixel points belonging to the same character according to the position information of the pixel points corresponding to the characters in the image to be processed; obtaining the target pixel points belonging to the edge of the character from the pixel points belonging to the same character; and obtaining the position information of the characters in the image to be processed according to the position information of the target pixel points, so as to identify the characters in the image to be processed.

2. The method according to claim 1, wherein the pixel corresponding to the character in the image to be processed is determined according to the predicted value of each pixel. include: Classifying each pixel point according to the predicted value and the preset classification value of each pixel point to obtain the type of each pixel point, wherein the type of the pixel point is used to indicate whether the pixel point is located in the character area; The pixel points whose type is determined to be located in the character area are pixel points corresponding to the characters in the image to be processed.

3. The method according to claim 2, wherein each pixel is classified according to the predicted value and the preset classification value of each pixel to obtain the type of each pixel include: If the predicted value of the pixel point matches the first preset classification value, the pixel point is determined to be a first type pixel point, and the first type pixel point is used to indicate that the pixel point is located in the edge area of ​​the character; If the predicted value of the pixel point matches the second preset classification value, the pixel point is determined to be a second type pixel point, and the second type pixel point is used to indicate that the pixel point is located in the inner area of ​​the character; If the predicted value of the pixel point matches the third preset classification value, determining that the pixel point is a third type pixel point, the third type pixel point is used to indicate that the pixel point is located outside the character area; Among them, the first preset classification value is smaller than the second preset classification value, but the first preset classification value is larger than the third preset classification value.

4. The method according to claim 1, further comprising: include: According to the position information of the characters in the image to be processed, identifying the target form of the text composed of the characters in the image to be processed; According to the target morphology, the image to be processed is morphologically marked.

5. The method according to claim 4, wherein the target form of the text composed of the characters in the image to be processed is identified according to the position information of the characters in the image to be processed. include: Determining the direction and curvature of the text composed of the characters according to the position information of the characters in the image to be processed; According to the direction and curvature of the text, the target shape of the text in the image to be processed is obtained.

6. A character recognition device, include: An obtaining unit, used for obtaining an image to be processed for character recognition; A prediction value obtaining unit, used for processing each pixel in the image to be processed to obtain a prediction value of each pixel, wherein the prediction value of the pixel is used to indicate the relationship between the pixel and the character in the image to be processed, and the prediction value of the pixel is obtained by a prediction model, wherein the prediction model is obtained by training based on the relationship between each pixel and the character in the historical image and the prediction value of each pixel in the historical image, and the prediction value of the pixel can locate the character in the image to be processed; A determination unit, used to determine the pixel point corresponding to the character in the image to be processed according to the predicted value of each pixel point; A recognition unit, used for recognizing characters in the image to be processed according to the position information of the pixel points corresponding to the characters in the image to be processed; The recognition unit is used to determine the position information of the pixel points belonging to the same character according to the position information of the pixel points corresponding to the character in the image to be processed; and obtain the target pixel points belonging to the edge of the character from the pixel points belonging to the same character; According to the position information of the target pixel point, the position information of the character in the image to be processed is obtained to identify the character in the image to be processed.

7. According to the device according to claim 6, the determination unit is used to classify each pixel point according to the predicted value and preset classification value of each pixel point to obtain the type of each pixel point, and the type of the pixel point is used to indicate whether the pixel point is located in the character area; the determination type indicates that the pixel point located in the character area is the pixel point corresponding to the character in the image to be processed.

8. The device according to claim 6, wherein the recognition unit is further configured to recognize the target form of the text composed of the characters in the image to be processed according to the position information of the characters in the image to be processed; The device also include: The marking unit is used to mark the image to be processed according to the target morphology.