Character recognition method based on text skeleton and key points

By extracting text skeletons and key points, combined with neural networks and hidden Markov models, the problem of identifying Chinese character radicals and interframe structures in the existing technology is solved, and high-accuracy Chinese character recognition under various interference environments is achieved.

CN118609142AActive Publication Date: 2024-09-06HUAZHONG UNIV OF SCI & TECH
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202410653436.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-06
Estimated Expiration
2044-05-24

AI Technical Summary

Technical Problem

Existing OCR technology based on text skeletons has difficulty in correctly identifying Chinese radicals, processing mixed Chinese and English texts, distinguishing different frame structures, and handling situations where handwriting, distortion, and tilt noise are high.

Method used

Extract text skeleton and key points, combine with neural network and hidden Markov model, calculate the core position and shelf structure of radicals, use probability chain and two-dimensional balance parameters to determine the structure and arrangement of Chinese characters, and judge the shelf through maximum value and probability sequence structure, and finally recognize Chinese characters.

Benefits of technology

Without significantly increasing the time consumption, it improves the accuracy of Chinese character recognition, reduces the misrecognition rate, adapts to various interference environments, and significantly improves the recognition efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118609142A
    Figure CN118609142A
Patent Text Reader

Abstract

The invention belongs to the technical field of optical character recognition, and particularly relates to a text skeleton and key point-based character recognition method, which comprises the following steps of: processing a grayscale image into a text skeleton and a text key point; separating each radical and each symbol in the text based on the text skeleton, and combining the text key points to obtain an upper bound and a lower bound of each line of text position and a core position of each radical; based on the core position, utilizing an HMM to obtain a placeholder parameter of each component; inputting the text skeleton and the upper and lower bound data of the text into a neural network containing HMM (Hidden Markov Model), and carrying out two steps of HMM to obtain an inter-frame structure of each component; and based on the core position, the occupation parameter and the inter-frame structure of each component, rearranging the inter-frame structure, and finally obtaining an image which is easy to identify. According to the method, the Chinese characters can be accurately recognized under various interferences under the condition of ensuring that the consumed time is not obviously increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of optical character recognition, and more specifically, relates to a character recognition method based on text skeleton and key points. Background Art

[0002] Optical Character Recognition (OCR) is a technology that can recognize characters printed or written on paper as text documents in computers. It is widely used in artificial intelligence, machine vision, automation, planning and management, etc. In recent years, OCR technology has developed rapidly, the overall performance of the system has continued to increase, and the stability and user-friendliness of the software have made great progress.

[0003] However, mainstream OCR systems work well when processing English, but have significant shortcomings when processing Chinese characters, especially handwritten Chinese characters, with high rejection and error recognition rates. This is because most mainstream OCR systems directly input the image to be recognized into the convolutional neural network for character segmentation, making it difficult to distinguish between radicals and entire Chinese characters, resulting in the system misrecognizing Chinese character radicals as Chinese characters, and misrecognizing multiple Chinese characters as one Chinese character.

[0004] The OCR technology based on text skeleton can construct the radicals of Chinese characters according to the continuity of Chinese character strokes, and can distinguish the radicals and Chinese punctuation marks of Chinese characters more accurately, providing a new idea for Chinese character OCR. For example, 1. In the invention patent with patent number CN115588211A, entitled A method for generating text images, a device, an electronic device and a storage medium, a method for generating text images is provided, which is more flexible and can generate target text images including texts that meet certain rules; 2. In the invention patent with patent number CN114241481A, a text detection method based on text skeleton is proposed to improve the accuracy of text detection.

[0005] However, the OCR technology based on text skeleton still has the following technical difficulties: 1. It is difficult to solve the problem of dividing radicals into individual Chinese characters, and it is difficult to correctly recognize text fragments mixed with Chinese and English. 2. It is difficult to distinguish Chinese characters with different structures, and radicals are difficult to combine into complete Chinese characters. 3. It is difficult to handle situations with high noise in handwritten, distorted, tilted and other images.

[0006] The main reasons for the above problems of text skeleton-based OCR technology are as follows: 1. It cannot use the continuity within Chinese characters to assist in text recognition, that is, it cannot correctly determine the character attributes. 2. It cannot use the continuity between Chinese characters to assist in text recognition, that is, it cannot correctly determine the core position and space occupation of the characters. 3. It cannot use the continuity of the text to assist in text recognition, that is, it cannot correctly determine the upper and lower boundaries of each line of text. Summary of the invention

[0007] In view of the defects and improvement needs of the prior art, the present invention provides a character recognition method based on text skeleton and key points, which aims to recognize Chinese characters more accurately under various interferences while ensuring that the time consumption is not significantly increased.

[0008] To achieve the above object, according to one aspect of the present invention, a character recognition method based on text skeleton and key points is provided, comprising:

[0009] Extract all text skeletons and text key points in the grayscale image containing the text to be recognized;

[0010] Based on all text skeletons, neural network classification is used to identify the radicals and symbols in the text to be identified; combining all text skeletons and text key points, the upper and lower bounds of the position of each line of text are obtained; according to the spatial arrangement of text key points, the core position of each radical in the text to be identified is determined;

[0011] The Hidden Markov Model (HMM) is used to calculate the matrix consisting of the core positions of each radical in each line of text as the result chain Y and the two-dimensional balance parameter The matrix formed is P(Y|X), and the probability chain X is calculated, and its elements correspond to the placeholder parameters L of each radical. o,i ,;

[0012] Based on the text skeleton, upper bound and lower bound of each line of text, a neural network is used to obtain the probability P of each radical appearing as a single Chinese character in the line of text. q,i , the probability of appearing as a left radical P l,i and the probability P of appearing as a right radical r,i ; Calculate P I,i =P q,i +P l,i +P r,i ; Using HMM, the P of each radical in the line of text q,i The matrix formed is used as the result chain Y, the probability of non-radicalization The constructed matrix is ​​P(Y|X), and the probability chain X is calculated, and each element of the probability chain corresponds to the extraction probability P of each radical. f,i ; Using HMM, the left attachment probability C of each radical in the line of text l,i =P r,i *P l,i+1 The matrix formed is used as the result chain Y, the probability of radicalization The constructed matrix is ​​taken as P(Y|X), and the probability chain X is calculated, and each element of which corresponds to the probability P of each radical being left radicalized. l,i ; Among them, the probability of right attachment C r,i =Pl,i *P r,i+1 , the probability of right radicalization P r,i =1-P f,i -P l,i ;

[0013] Find the probability sequence The maximum value of , and according to the left attachment probability, right attachment probability and extraction probability of each radical corresponding to the maximum value, the frame structure of the corresponding radical is determined;

[0014] According to the core position of each radical and L o,i The number of spaces between adjacent radicals is determined, and Chinese characters are extracted according to the structure of the radicals. The symbols are inserted into the middle of the Chinese characters to complete character recognition.

[0015] Further, the text skeleton is extracted in the following manner:

[0016] In each stroke area with a higher grayscale in the grayscale image, a continuous line with the highest grayscale point is found as the ridge line of the stroke area, and the linear regression line segments of each point on each ridge line are used as a text skeleton;

[0017] The method for extracting the text key points is:

[0018] The grayscale peak method is used to search for the points with the highest grayscale at both ends of each ridge line and at each intersection with other ridge lines with a certain search radius, as the key points of the text to be recognized; wherein the search radius is determined by experimental optimization.

[0019] Furthermore, the upper and lower bounds of the position of each line of text are determined as follows:

[0020] Based on the text skeleton, the upper and lower boundary position data of each radical in the line of text are calibrated to perform interpolation fitting of the upper boundary and the lower boundary respectively, so as to obtain the first upper boundary and the first lower boundary of the line of text;

[0021] Merge all key points connected by the same radical into a point group, fit all points with the largest ordinate in the point group in the line of text, and use the fitting result as the second upper bound of the line of text; fit all points with the smallest ordinate in the point group in the line of text, and use the fitting result as the second lower bound of the line of text;

[0022] The first upper bound and the second upper bound are weightedly merged, and the weighted result is used as the upper bound of the position of the text line; the first lower bound and the second lower bound are weightedly merged, and the weighted result is used as the lower bound of the position of the text line.

[0023] Furthermore, the core position of each radical is calculated as follows:

[0024] Average the coordinates of all key points in each point group As the core position of the radical corresponding to the point group, the key points connected by the same radical are merged into one point group.

[0025] Furthermore, based on the spatial arrangement of the key points of the text, the word density in the text to be recognized is also determined;

[0026] The word density is calculated as follows:

[0027]

[0028] In the formula, ρ represents the word density, S0 represents the area of ​​the figure surrounded by all the key points located at the outermost periphery of the grayscale image; N0 represents the total number of point groups of key points in the text to be recognized, and the key points connected by the same radical are merged into one point group;

[0029] Then, the hidden Markov model HMM is used to calculate the placeholder parameter L of each radical in each line of text. on , the sub-density is used as the verification parameter.

[0030] Furthermore, the number of spaces between adjacent radicals is determined as follows:

[0031] Using the core position and placeholder parameters of each radical, determine whether there is a space or vacancy between each adjacent radical. The determination method is: calculate If Δ>0, it is considered that there is a space before the character, and the value of Δ rounded up is the number of spaces before the character.

[0032] Furthermore, the second-order Viterbi algorithm is used to find the probability sequence The maximum value of

[0033] It is used to obtain P q,i , P l,i and P r,i The neural network is also used to identify the radicals as independent structures from the radicals of the text to be recognized, and reset the left attachment probability and right attachment probability of the radicals as independent structures to the minimum probability that can be calculated by the neural network.

[0034] Furthermore, before extracting the text skeleton and the text key points, the method further includes: pooling the grayscale image containing the to-be-recognized text by using an average value pooling method to obtain a new grayscale image;

[0035] Then extract the text skeleton and text key points from the new grayscale image.

[0036] The present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute a character recognition method based on key points and text skeleton as described above.

[0037] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:

[0038] (1) The present invention proposes to extract the text skeleton and text key points in the text image to be recognized, so as to determine the upper and lower bounds of the position of each line of text by combining the text skeleton and the text key points. At the same time, the radicals and symbols in the text to be recognized are recognized according to the text skeleton, and the core position of each radical is determined according to the text key points. Subsequently, the hidden Markov model HMM is used to calculate the placeholder parameters of each radical based on the core position, and a neural network is used to combine the text skeleton, the upper bound and the lower bound to determine the probability P of each radical appearing as a single Chinese character. q,i , the probability of appearing as a left radical P l,i and the probability P of appearing as a right radical r,i , to reintroduce HMM, perform two steps of HMM operations in succession, and obtain the extraction probability P of each radical f,i , the probability of attachment to the left and the probability of attachment to the right are used to determine the structure of each radical; finally, based on the core position, the placeholder parameter and the structure, each Chinese character is identified. The present invention can solve the problems that the existing OCR technology based on the text skeleton is difficult to divide into individual Chinese characters according to radicals, difficult to distinguish Chinese characters with different structure, difficult to handle the situation of large noise in handwritten, distorted, tilted and other pictures (i.e., it cannot correctly judge the character attributes), cannot correctly judge the core position and space placeholder of the character, and cannot correctly judge the upper and lower boundaries of each line of text. The present invention can more accurately recognize Chinese characters under various interferences while ensuring that the time consumption is not significantly increased.

[0039] (2) Before performing OCR, a pooling operation is introduced at the input, which has a significant noise reduction effect. At the same time, the number of parameters is reduced, which greatly speeds up the operation and significantly compensates for the slowdown in the operation speed of the neural network due to its high time complexity.

[0040] (3) The present invention expands the scope of single-word structure division, creatively adds a priori analysis to the OCR process, and uses common single-word structure characters to interrupt the Viterbi chain to speed up program operation, greatly improving recognition efficiency while reducing the error recognition rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A character recognition method based on text skeleton and key points is provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0043] Embodiment 1

[0044] A character recognition method based on text skeleton and key points, such as Figure 1 As shown, including:

[0045] Extract all text skeletons and text key points in the grayscale image containing the text to be recognized;

[0046] Based on all text skeletons, neural network classification is used to identify the radicals and symbols in the text to be identified; combining all text skeletons and text key points, the upper and lower bounds of the position of each line of text are obtained; according to the spatial arrangement of text key points, the core position of each radical in the text to be identified is determined;

[0047] The Hidden Markov Model (HMM) is used to calculate the matrix consisting of the core positions of each radical in each line of text as the result chain Y and the two-dimensional balance parameter The matrix formed is used as P(y|x), and the probability chain X is calculated, and its elements correspond to the placeholder parameters L of each radical. o,i ;

[0048] Based on the text skeleton, upper bound and lower bound of each line of text, a neural network is used to obtain the probability P of each radical appearing as a single Chinese character in the line of text. q,i , the probability of appearing as a left radical P l,i and the probability P of appearing as a right radical r,i ; Calculate P I,i =P q,i +P l,i +P r,i ; Using HMM, the P of each radical in the line of text q,i The matrix formed is used as the result chain Y, the probability of non-radicalization The constructed matrix is ​​P(Y|X), and the probability chain X is calculated, and each element of the probability chain corresponds to the extraction probability P of each radical. f,i , the probability of extracting certain radicals P f is approximately equal to the probability of the radical appearing in a single structure; using HMM, the left attachment probability C of each radical in the line of text is l,i =P r,i *P l,i+1 The matrix formed is used as the result chain Y, the probability of radicalization The constructed matrix is ​​taken as P(Y|X), and the probability chain X is calculated, and each element of which corresponds to the probability P of each radical being left radicalized. l,i ; Among them, the probability of right attachment C r,i =P l,i *P r,i+1 , the probability of right radicalization P r,i =1-P f,i -P l,i ;

[0049] Find the probability sequence The maximum value of , and according to the left attachment probability, right attachment probability and extraction probability of each radical corresponding to the maximum value, the frame structure of the corresponding radical is determined;

[0050] According to the core position of each radical and L o,i Determine the number of spaces between adjacent radicals, extract each Chinese character according to the structure of each radical, and finally obtain an image matrix consisting of a series of Chinese character images with equal spacing and correct radical positions to be recognized. Insert the symbols into the middle of each Chinese character image to obtain a sentence framework and complete character recognition.

[0051] It should be noted that the result chain Y consists of Y1, Y2, ..., Y n Composition, n represents the total number of radicals in each line of text.

[0052] The principle of the Hidden Markov Model HMM is: input a probability chain X1, X2, ..., X where all variables are unknown n , and the observed result chain Y1,Y2,...,Y n If the probability chain X1,X2,...,X n It has the following properties:

[0053] P(X n+1 =x|X1=x1,X2=x2...,X n =x n )=P(X n+1 =x|X n =x n )

[0054] and

[0055] P(X1=x1,X2=x2...,X n =x n )>0

[0056] Then the result chain Y1,Y2,...,Y n It has the following properties:

[0057] P(Y)=∑ X P(Y|X)P(X)

[0058] Using this formula, we can get the n Chain, calculate X n Chain. By Y n Chain Build X n The chain process is called HMM.

[0059] When using the hidden Markov model HMM to determine the placeholder parameter, the placeholder parameter of each radical is obtained based on the core position of each radical. Specifically, the matrix composed of the core positions of each radical in each line of text is used as the result chain Y1, Y2, ..., Y in the HMM. n Based on the result chain property formula in HMM, the two-dimensional balance parameters of each radical are The matrix formed is used as P(Y|X) in the formula of this property, and the probability chain X1,X2,...,X is calculated. n , and use it as the placeholder parameter L for each radical in the line of text n,i As a further preference, the left edge position Y of the ith radical is i -(Y i -Y i-1 )L o,i and right boundary position Y i +(Y i+1 -Y i )L o,i The space occupied by the i-th radical can be reused in the neural network to achieve self-learning of the neural network.

[0060] In the neural network, P q,i , P l,i and P r,i In the process, the role of the neural network used is to learn P I , P l , P r The upper and lower bounds of each line of text obtained in the previous step will significantly affect the C output by the HMM corresponding to this neural network. l,i and C r,i Parameters, specifically, if the upper or lower bound is tangent upward at a certain point, the neural network should give the obtained C l,i A positive correction, and give C r,iA negative value correction, the specific functional relationship is determined by the samples learned by the neural network. The text skeleton, upper bound and lower bound of each line of text are input into the neural network containing HMM, the radical continuity between radicals is judged, and the frame structure of each radical is obtained. The frame structure has three types: left radical, single structure or upper and lower structure, and right radical. That is, this embodiment finds the relationship between the upper and lower boundary tangents and the character connection, uses the neural network to fit it, and corrects the desired result to make it tend to the correct value, avoiding the situation where the recognition result is inaccurate due to paper folding, crumpling, etc., and successfully uses the continuity of the text to enhance the accuracy of OCR.

[0061] It should be noted that upper-lower structures, semi-enclosed structures, etc. are neither left-right structures nor single-body structures, but the commonly used characters of this type of structure are far less than left-right structures and single-body structures, and the neural network will hardly mistake their radicals as single words, which proves that the neural network has enough computing power to include them in the single-body structure. Therefore, upper-lower structures, semi-enclosed structures, etc. are all classified as single-body structures.

[0062] In addition, this embodiment uses the HMM model to determine character attributes (i.e., structure), and innovatively uses a series of parameters such as extraction probability, radicalization probability, left (right) radicalization probability, left (right) attachment probability, etc., and successfully uses the continuity of the characters themselves and the continuity between characters to determine the character attributes, thereby greatly improving the recognition accuracy of the OCR system.

[0063] As a preferred implementation, the second-order Viterbi algorithm is used to find the probability sequence The maximum value. Since there are many commonly used characters (such as "I", "also", "not", etc.) in the single-character structure, and the single-character structure will interrupt the probability chain in the Viterbi algorithm used in this embodiment, a large number of models of such characters can be pre-stored in the neural network containing HMM, and such characters can be recognized first. If these characters are recognized, the sentence is truncated, and probability calculations are performed before and after respectively, which can almost completely make up for the defect of high time complexity of the Viterbi algorithm, and at the same time, it can also avoid its overfitting, with excellent results. After application, the recognition efficiency increased by 160%, and the error recognition rate was reduced to the original 65%. Based on this consideration, it can be used as a preferred implementation method to obtain P q,i , P l,i and P r,i The neural network is also used to identify the radicals as independent structures from the radicals of the text to be recognized, and reset the left-attachment probability and right-attachment probability of the independent structures to the minimum probability that can be calculated by the neural network. In this way, when the sentence is truncated and the second-order Viterbi algorithm is executed, the effect of performing probability calculations before and after can be achieved.

[0064] As an example, the neural network used to identify each radical and each symbol in the text to be recognized is a convolutional neural network, and the network structure can be Faster R-CNN; q,i , P l,i and P r,i The neural network can be HCNN.

[0065] As a preferred implementation, the text skeleton is extracted in the following manner:

[0066] In each stroke area with higher grayscale in the grayscale image, a continuous line with the highest grayscale is found as the ridge line of the stroke area, and the linear regression line segments of each point on each ridge line are used as a text skeleton;

[0067] The key points of the above text are extracted as follows:

[0068] The grayscale peak method is used to search for the points with the highest grayscale at both ends of each ridge line and at each intersection with other ridge lines with a certain search radius, as the key points of the text to be recognized; the search radius is determined by experimental optimization, for example, the search radius is 2 / 13 of the corresponding ridge line length.

[0069] As a preferred implementation, the upper and lower bounds of the position of each line of text are determined as follows:

[0070] (1) Based on the text skeleton, the upper and lower boundary position data of each radical in the line of text are calibrated to perform interpolation fitting of the upper boundary and the lower boundary respectively, so as to obtain the first upper boundary and the first lower boundary of the line of text.

[0071] Among them, the upper and lower boundary position data of each radical in the text to be recognized can be specifically calibrated as follows: the midpoint of the upper and lower boundaries of each radical is calibrated as the upper and lower boundary position data of the radical. When performing interpolation fitting, the interpolation ratio can be 3, and after the interpolation is completed, linear, quadratic, and triangular fitting can be performed respectively. Take R 2 The one with the largest value is taken as the final fitting result of the corresponding boundary.

[0072] (2) All key points connected by the same radical are merged into a point group, and the point with the largest ordinate in all the point groups in the line of text is fitted, and the fitting result is used as the second upper bound of the line of text; and all the points with the smallest ordinate in all the point groups in the line of text are fitted, and the fitting result is used as the second lower bound of the line of text.

[0073] This operation is to calculate the second upper bound and the second lower bound of each line of text according to the spatial arrangement of the key points of the text in the grayscale image. As an example, the second upper bound and the second lower bound of each line of text are calculated by performing linear, quadratic, and triangular fitting on the points with the largest and smallest ordinates of all point groups, and taking R 2 The largest value is used as the second upper bound and the second lower bound.

[0074] (3) Weightedly combine the first upper bound and the second upper bound, and use the weighted result as the upper bound of the position of the text line; weightedly combine the first lower bound and the second lower bound, and use the weighted result as the lower bound of the position of the text line. The weighting coefficient can be determined by experimental optimization.

[0075] As a preferred implementation, the calculation method of the core position of each radical is:

[0076] Average the coordinates of all key points in each point group As the core position of the radical corresponding to the point group, the key points connected by the same radical are merged into one point group.

[0077] As a preferred implementation, the word density in the text to be recognized is also determined according to the spatial arrangement of the text key points, and the calculation method is:

[0078]

[0079] In the formula, ρ represents the word density, S0 represents the area of ​​the figure surrounded by all the key points located at the outermost periphery of the grayscale image; N0 represents the total number of point groups of key points in the text to be recognized, and the key points connected by the same radical are merged into one point group;

[0080] Then, the hidden Markov model HMM is used to calculate the placeholder parameter L of each radical in each line of text. oi , the sub-density is used as the verification parameter.

[0081] As a preferred implementation, the number of spaces between adjacent radicals is determined as follows:

[0082] Using the core position and placeholder parameters of each radical, determine whether there is a space or vacancy between each adjacent radical. The determination method is: calculate If Δ>0, it is considered that there is a space before the character, and the value of Δ is rounded up to the number of spaces before the character. After the calculation is completed, leave the corresponding number of space marks before the character and output it.

[0083] As a preferred implementation, before extracting the text skeleton and text key points, the method further includes: pooling the grayscale image containing the text to be identified by using average value pooling to obtain a new grayscale image. Then extract the text skeleton and text key points from the new grayscale image. The pooling operation can be specifically as follows: divide the grayscale image into n*n blocks, take the average value of the grayscale of each pixel in each block to form a new pixel as the pixel of the block, shorten the length and width of the original image to 1 / n of the original, and obtain a new image to eliminate noise, while reducing the amount of data, which is convenient for calculation and skeleton construction.

[0084] In order to implement the above method, the present invention provides specific examples:

[0085] Using a PDA with Microsoft Windows 10 operating system as the terminal, Pycharm and Visual Studio as the development platform, using Python and C++ programming languages, loading the pytorch image processing neural network library, using computer fonts and handwritten text as training sets, and handwritten text as the test set; after the above steps, 1,000 handwritten characters were successfully distinguished with an accuracy rate of 100%.

[0086] It should be noted that the above devices are not the best models for the present invention, and the devices that can be used with the present invention are not limited to the above models. The present invention can use computer programming languages ​​including but not limited to C++, Java, Python, etc., can be installed on main control systems such as PDAs and multi-function platforms using Windows, Linux, etc., and can be used with various word processing systems.

[0087] Due to its extremely low rejection rate and false recognition rate, it is extremely suitable for scanning, desensitizing and transferring important and confidential paper documents.

[0088] In general, this embodiment contains artificial intelligence and deep learning modules and algorithms such as Hidden Markov Model (HMM), Artificial Neural Networks (ANN), and Convolutional Neural Networks (CNN), which can simulate the human reading and comprehension process of Chinese characters, deeply learn the continuity of text and characters, solve the problem of dividing radicals into individual Chinese characters, correctly identify the structure of Chinese characters, and adapt to situations with high noise in handwritten, distorted, tilted, etc. images.

[0089] Embodiment 2

[0090] A computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute a character recognition method based on key points and text skeleton as described in the first embodiment above.

[0091] The relevant technical solution is the same as that in Embodiment 1 and will not be described in detail here.

[0092] It will be easily understood by those skilled in the art that 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 and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A character recognition method based on text skeleton and key points, characterized in that: include: Extract all text skeletons and text key points in the grayscale image containing the text to be recognized; Based on all text skeletons, neural network classification is used to identify the radicals and symbols in the text to be identified; combining all text skeletons and text key points, the upper and lower bounds of the position of each line of text are obtained; according to the spatial arrangement of text key points, the core position of each radical in the text to be identified is determined; The Hidden Markov Model (HMM) is used to calculate the matrix consisting of the core positions of each radical in each line of text as the result chain Y and the two-dimensional balance parameter The matrix formed is used as P(Y|x), and the probability chain X is calculated, and its elements correspond to the placeholder parameters L of each radical. o,i ; Based on the text skeleton, upper bound and lower bound of each line of text, a neural network is used to obtain the probability P of each radical appearing as a single Chinese character in the line of text. q,i , the probability of appearing as a left radical P l,i and the probability P of appearing as a right radical r,i ; Calculate P I,i =P q,i +P l,i +P r,i ; Using HMM, the P of each radical in the line of text q,i The matrix formed is used as the result chain Y, the probability of non-radicalization The constructed matrix is ​​P(Y|X), and the probability chain X is calculated, and each element of the probability chain corresponds to the extraction probability P of each radical. f,i ; Using HMM, the left attachment probability C of each radical in the line of text l,i =P r,i *P l,i+1 The matrix formed is used as the result chain Y, the probability of radicalization The constructed matrix is ​​taken as P(Y|X), and the probability chain X is calculated, and each element of which corresponds to the probability P of each radical being left radicalized. l,i ; Among them, the probability of right attachment C r,i =P l,i *P r,i+1 , the probability of right radicalization P r,i =1-P f,i -P l,i ; Find the probability sequence The maximum value of n represents the total number of radicals. According to the C of each radical corresponding to the maximum value l,i , C r,i and P f,i , determine the structure of the corresponding radical; According to the core position of each radical and L o,i The number of spaces between adjacent radicals is determined, and Chinese characters are extracted according to the structure of the radicals. The symbols are inserted into the middle of the Chinese characters to complete character recognition.

2. The character recognition method according to claim 1, characterized in that: The text skeleton is extracted in the following manner: In each stroke area with a higher grayscale in the grayscale image, a continuous line with the highest grayscale point is found as the ridge line of the stroke area, and the linear regression line segments of each point on each ridge line are used as a text skeleton; The method for extracting the text key points is: The grayscale peak method is used to search for the points with the highest grayscale at both ends of each ridge line and at each intersection with other ridge lines with a certain search radius, as the key points of the text to be recognized; wherein the search radius is determined by experimental optimization.

3. The character recognition method according to claim 1, characterized in that: The upper and lower bounds of each line of text are determined as follows: Based on the text skeleton, the upper and lower boundary position data of each radical in the line of text are calibrated to perform interpolation fitting of the upper boundary and the lower boundary respectively, so as to obtain the first upper boundary and the first lower boundary of the line of text; Merge all key points connected by the same radical into a point group, fit all points with the largest ordinate in the point group in the line of text, and use the fitting result as the second upper bound of the line of text; fit all points with the smallest ordinate in the point group in the line of text, and use the fitting result as the second lower bound of the line of text; The first upper bound and the second upper bound are weighted and combined, and the weighted result is used as the upper bound of the position of the text line; The first lower bound and the second lower bound are weighted and merged, and the weighted result is used as the lower bound of the position of the text line.

4. The character recognition method according to claim 1, characterized in that: The core position of each radical is calculated as: Average the coordinates of all key points in each point group As the core position of the radical corresponding to the point group, the key points connected by the same radical are merged into one point group.

5. The character recognition method according to claim 1, characterized in that: Based on the spatial arrangement of the key points of the text, the word density in the text to be recognized is also determined; The word density is calculated as follows: In the formula, ρ represents the word density, S0 represents the area of ​​the figure surrounded by all the key points located at the outermost periphery of the grayscale image; N0 represents the total number of point groups of key points in the text to be recognized, and the key points connected by the same radical are merged into one point group; Then, the hidden Markov model HMM is used to calculate the placeholder parameter L of each radical in each line of text. oi , the sub-density is used as a verification parameter.

6. The character recognition method according to claim 1, characterized in that: The number of spaces between adjacent radicals is determined as follows: Using the core position and placeholder parameters of each radical, determine whether there is a space or vacancy between each adjacent radical. The determination method is: calculate If Δ>0, it is considered that there is a space before the character, and the value of Δ rounded up is the number of spaces before the character.

7. The character recognition method according to claim 1, characterized in that: Using the second-order Viterbi algorithm to find the probability sequence The maximum value of It is used to obtain P q,i , P l,i and P r,i The neural network is also used to identify the radicals as independent structures from the radicals of the text to be recognized, and reset the left attachment probability and right attachment probability of the radicals as independent structures to the minimum probability that can be calculated by the neural network.

8. The character recognition method according to any one of claims 1 to 7, characterized in that: Before extracting the text skeleton and the text key points, the method further includes: pooling the grayscale image containing the to-be-recognized text by using an average value pooling method to obtain a new grayscale image; Then extract the text skeleton and text key points from the new grayscale image.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute a character recognition method based on text skeleton and key points as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Radical set determination for hmm based east asian character recognition

    CN101971192A

  • License plate recognition method based on Hidden Markov models

    CN104200207A

  • Complex image and text sequence identification method based on CNN-RNN

    CN105678293A

  • CSI-based fine-granularity gesture recognition method and system

    CN107633227A

  • Chinese character recognition method and device, computer readable medium and electronic equipment

    CN110659639A