Handwriting trajectory recognition method, device, electronic device and storage medium
By clustering and feature extraction of handwriting trajectory data, combined with pre-training models and double-gated cyclic units, the problem of misrecognition of near-form characters in handwriting data recognition is solved, and the recognition accuracy and user experience are improved.
Patent Information
- Application Number
- CN202111153160.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-09-29
AI Technical Summary
In the existing technology, the problem of misrecognition of characters with similar shapes is common when recognizing handwritten data, resulting in low recognition efficiency. There is an urgent need for a method to reduce the probability of misrecognition of characters with similar shapes.
By clustering handwriting trajectory data, multiple character clusters are obtained, feature extraction is performed on each character cluster, recognition is performed using a pre-trained character recognition model, and the residual network is compiled using a double-gated recurrent unit and SE module. Decoding processing to improve matching and recognition accuracy.
It effectively reduces the probability of misrecognition of words with similar shapes, improves the accuracy of handwriting recognition, and makes the user experience better.
Smart Images

Figure CN114067334B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of handwriting recognition processing, and in particular to a handwriting trajectory recognition method, device and electronic equipment. Background Art
[0002] With the rapid development of Internet technology, in order to facilitate user input, multiple input methods are usually provided, such as voice input, handwriting input, and pinyin input. When the user uses handwriting input, the handwriting input data will be recognized by the handwriting recognition model to improve the recognition efficiency and provide a better user experience.
[0003] However, in the prior art, when recognizing handwritten data, misrecognition of similar characters is a common problem. For example, P and p, o and 0, u and v, a and α are usually confused in recognition. Therefore, there is an urgent need for a recognition method that can reduce the probability of misrecognition of similar characters. Summary of the invention
[0004] The embodiments of the present invention provide a handwriting trajectory recognition method, device and electronic device, which can effectively reduce the probability of misrecognition of similar characters and thus improve the accuracy of handwriting recognition.
[0005] A first aspect of an embodiment of the present invention provides a method for recognizing a handwriting trajectory, the method comprising:
[0006] Clustering the handwriting trajectory data to obtain multiple character clusters, where N is an integer greater than 1;
[0007] Performing feature extraction on each character cluster of the plurality of character clusters to extract a feature vector of each character cluster;
[0008] The feature vector of each character cluster and the trajectory formula of the handwriting trajectory data are input into a pre-trained character recognition model to obtain the target candidate words corresponding to the handwriting trajectory data.
[0009] Optionally, clustering the handwriting trajectory data to obtain multiple character clusters includes:
[0010] Performing stroke segmentation on the handwriting trajectory data to obtain a stroke sequence of the handwriting trajectory;
[0011] The stroke image corresponding to the stroke sequence is input into a pre-trained single character classification network to obtain the multiple character clusters.
[0012] Optionally, the step of inputting the stroke image corresponding to the stroke sequence into a pre-trained single character classification network to obtain the multiple character clusters includes:
[0013] Inputting the stroke image into the offline single-character classification network to obtain N classification results, wherein N is an integer greater than 1, and the confidence of each of the N classification results is not less than a set confidence;
[0014] The multiple character clusters are obtained according to the N classification results.
[0015] Optionally, acquiring the multiple character clusters according to the N classification results includes:
[0016] According to the stroke sequence, obtaining N groups of stroke combinations corresponding to the N classification results;
[0017] The N groups of stroke combinations are processed by removing structural characters to obtain M groups of stroke combinations after processing, and the M groups of stroke combinations after processing are used as the multiple character clusters, wherein M is an integer greater than 1 and not greater than N.
[0018] Optionally, the performing feature extraction on each character cluster of the multiple character clusters to extract a feature vector of each character cluster includes:
[0019] A residual network is used to perform feature extraction on each character cluster to extract a feature vector of each character cluster, wherein the residual network carries an SE module.
[0020] Optionally, before inputting the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into a pre-trained character recognition model, the method further includes:
[0021] Acquire a trajectory coordinate vector set of the handwriting trajectory data;
[0022] The trajectory coordinate vector set is encoded and decoded by a dual-gated recurrent unit to obtain the trajectory formula.
[0023] Optionally, the character recognition model training step includes:
[0024] Acquire a training sample set, wherein each training sample in the training sample set includes training handwriting trajectory data;
[0025] For each training sample in the training sample set, clustering the training sample to obtain N training character clusters of the training sample; performing feature extraction on each training character cluster in the N training character clusters to extract a feature vector of each training character cluster;
[0026] The character recognition model is obtained by performing model training using the trajectory formula of each training sample and the feature vector of each training character cluster of each training sample.
[0027] A second aspect of an embodiment of the present invention further provides a handwriting trajectory recognition device, characterized in that the device comprises:
[0028] A character clustering unit, used for clustering the handwriting trajectory data to obtain multiple character clusters;
[0029] A feature extraction unit, used to extract features from each of the multiple character clusters to obtain a feature vector for each character cluster;
[0030] The recognition unit is used to input the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into a pre-trained character recognition model to obtain the target candidate words corresponding to the handwriting trajectory data.
[0031] Optionally, the character clustering unit is used to perform stroke segmentation on the handwriting trajectory data to obtain a stroke sequence of the handwriting trajectory; and input a stroke image corresponding to the stroke sequence into a pre-trained single character classification network to obtain the multiple character clusters.
[0032] Optionally, the character clustering unit is used to input the stroke image into the offline single-character classification network to obtain N classification results, wherein N is an integer greater than 1, and the confidence of each of the N classification results is not less than a set confidence; based on the N classification results, the multiple character clusters are obtained.
[0033] A third aspect of an embodiment of the present invention provides an electronic device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute operation instructions corresponding to the handwriting trajectory recognition method provided in the first aspect.
[0034] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps corresponding to the handwriting trajectory recognition method provided in the first aspect.
[0035] The above one or at least one technical solution in the embodiments of the present application has at least the following technical effects:
[0036] Based on the above technical solution, the handwriting trajectory data is clustered to obtain multiple character clusters; feature extraction is performed on each of the multiple character clusters to extract a feature vector of each character cluster; the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data are input into a pre-trained character recognition model to obtain a target candidate word corresponding to the handwriting trajectory data; in this way, the multiple character clusters obtained by clustering the handwriting trajectory data make the multiple character clusters more closely matched with the user's handwriting input, and the feature vector of each character cluster carries the features of a single character, so that when the character recognition model is used for prediction, the prediction accuracy can be higher on the basis that each character cluster has a high degree of match with the user's handwriting input and carries the features of a single character, thereby effectively reducing the probability of misrecognition of similar characters, thereby improving the accuracy of handwriting recognition and providing a better user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of a flow chart of a handwriting trajectory recognition method provided in an embodiment of the present application;
[0038] Figure 2 A schematic diagram of the structure of a residual network with an SE module provided in an embodiment of the present application;
[0039] Figure 3 A flowchart of the character recognition model training steps provided in the embodiment of the present application;
[0040] Figure 4 A block diagram of a handwriting trajectory recognition device provided in an embodiment of the present application;
[0041] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The main implementation principles, specific implementation methods and corresponding beneficial effects of the technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0043] Example
[0044] Please refer to Figure 1 , an embodiment of the present application provides a method for recognizing a handwriting trajectory, the method comprising:
[0045] S101, clustering the handwriting trajectory data to obtain multiple character clusters;
[0046] S102, performing feature extraction on each character cluster of the multiple character clusters to extract a feature vector of each character cluster;
[0047] S103: Input the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into a pre-trained character recognition model to obtain target candidate words corresponding to the handwriting trajectory data.
[0048] In the embodiments of this specification, a method for recognizing handwriting trajectories can be applied to a user terminal or a server. The handwriting trajectory data is the handwriting data on the display screen of an electronic device. When applied to a server, after receiving the handwriting data on the display screen, the user terminal sends it to the server, so that the server obtains the handwriting data and uses it as the handwriting trajectory data. The user terminal can be, for example, a smart phone, a smart watch, a tablet computer, and a laptop computer. The following takes the application of the handwriting trajectory recognition method in a user terminal as an example.
[0049] Among them, in step S101, firstly, the handwriting trajectory data is obtained, and then the stroke set corresponding to the handwriting trajectory data is obtained, and the stroke set is input into a simple neural network for classification, and N classifications are obtained as multiple character clusters.
[0050] Specifically, in order to obtain a higher accuracy of the obtained multiple character clusters, the handwriting trajectory data can also be segmented into strokes to obtain a stroke sequence of the handwriting trajectory; and then the stroke image corresponding to the stroke sequence is input into the pre-trained single character classification network to obtain multiple character clusters. The multiple can be an integer greater than 1 such as 2, 4, 6 and 8.
[0051] Specifically, when performing stroke segmentation, the handwriting trajectory data can be segmented according to the coordinate identifier of each stroke in the handwriting trajectory data, so that the stroke sequence obtained by segmentation has a higher matching degree with the user input, thereby improving the accuracy of segmentation and the accuracy of the stroke sequence.
[0052] In actual application, when determining the coordinate points in the handwriting trajectory data, each stroke is written with (-1,0) as the coordinate identifier of the stroke. Therefore, according to the coordinate identifier (-1,0) of each stroke, the coordinate sequence of the handwriting trajectory data can be divided into a stroke sequence, and the stroke sequence contains multiple strokes. For example, if the handwriting trajectory contains coordinate points a1, a2, a3 and a4 corresponding to the coordinate identifier (-1,0) of the first stroke, and coordinate points b1, b2, b3, b4 and b5 corresponding to the coordinate identifier (-1,0) of the second stroke; then a1, a2, a3 and a4 are divided into the first stroke and represented by A1, and b1, b2, b3, b4 and b5 are divided into the second stroke and represented by B1, then A1 and B1 constitute the stroke sequence.
[0053] After obtaining the stroke sequence, if the single character classification network is stored in the user terminal, a stroke image of the stroke sequence is obtained by handwriting, and then the stroke image is input into the single character classification network to obtain N classification results, and the N groups of strokes corresponding to the N classification results are combined as multiple character clusters. Wherein, N is an integer greater than 1, and the single character classification network is a convolutional neural network CNN and a deep neural network DNN, etc., and CNN is taken as an example below.
[0054] Also, after obtaining the stroke sequence, if the single-character classification network is trained and stored offline, it is necessary to input the stroke image into the offline single-character classification network after obtaining the stroke image, and obtain N classification results, wherein the confidence of each of the N classification results is not less than the set confidence; and obtain multiple character clusters based on the N classification results. At this time, the N groups of strokes corresponding to the N classification results can be directly combined as multiple character clusters. The confidence setting can be set manually or by equipment, or can be set according to actual needs, for example, it can be 85%, 94%, 98%, etc.
[0055] In practical applications, some single characters can be written in one stroke, while some single characters require multiple strokes to write. In this way, through clustering through the single-character classification network, the stroke combination corresponding to the single character written in multiple strokes can be matched to a classification result, making the probability that each group of stroke combinations corresponds to a single character higher, so that the accuracy of the predicted multiple character clusters is also higher.
[0056] Specifically, the training steps of the single character classification network include: obtaining a training sample set, each training sample in the training sample set contains a historical stroke picture corresponding to the historical stroke data, and training the model according to the historical stroke picture and the annotation of the stroke combination of the single character in the historical stroke picture, and obtaining a model with a prediction accuracy not less than the set accuracy and other constraints as the single character classification network, so that the prediction accuracy of the single character classification network is higher. Among them, the set accuracy can be set manually or by equipment, and can also be set according to actual needs, for example, it can be 98%, 95% and 94%.
[0057] Specifically, when using a single-character classification network to predict a stroke image, you can first obtain the current stroke image corresponding to the current stroke, and input the current stroke image into the single-character classification network for classification. If the confidence of the output category label is lower than the set confidence, then the current stroke image and its adjacent stroke images are input into the single-character classification network for classification until the confidence obtained by classification is not lower than the set confidence or the confidence obtained by classification is the highest. The stroke combination corresponding to the classification result at this time is taken as a character cluster. In this way, each stroke in the stroke sequence can be used as the current stroke to execute the above steps, thereby obtaining multiple character clusters.
[0058] Of course, in order to improve the accuracy of multiple character clusters, N groups of stroke combinations corresponding to N classification results can also be obtained based on the stroke sequence; then the N groups of stroke combinations are processed by removing structural characters to obtain M groups of stroke combinations after processing, and the M groups of stroke combinations after processing are used as multiple character clusters, where M is an integer greater than 1 and not greater than N. In this way, multiple character clusters do not contain structural characters, making the accuracy of multiple character clusters higher, and the accuracy of subsequent calculations will also be improved accordingly.
[0059] Specifically, after obtaining N groups of stroke combinations, at this time, the single characters corresponding to one or more stroke combinations in the N groups of stroke combinations may be structural characters such as fractional horizontal lines or square roots. In this case, it is necessary to eliminate all stroke combinations corresponding to structural characters in the N groups of stroke combinations, and use the remaining stroke combinations as the processed M groups of stroke combinations. In this way, the probability of the single character corresponding to each stroke combination in the processed M groups of stroke combinations can be improved, so that the accuracy of subsequent predictions will also be improved accordingly.
[0060] After obtaining multiple character clusters, step S102 is executed.
[0061] In step S102, firstly, the coordinate set of each character cluster in the plurality of character clusters is obtained, and then the feature extraction network is used to extract features from the coordinate set of each character cluster to obtain a feature vector of each character cluster. The feature extraction network may be a residual network (resnet network), a convolutional neural network (CNN), a deep neural network (DNN), etc. The resnet network is specifically taken as an example below.
[0062] Specifically, before using the feature extraction network to extract features from the coordinate set of each character cluster, data preprocessing can be performed on each coordinate contained in each character cluster to obtain the coordinate set of each character cluster. The data preprocessing includes at least one of normalization processing, cleaning processing, and dimension conversion processing.
[0063] In one embodiment, when performing data preprocessing on each coordinate contained in a character cluster, each coordinate contained in the character cluster can be first normalized to obtain a normalized coordinate set of the character cluster; then, each coordinate in the normalized coordinate set of the character cluster can be dimensionally transformed to obtain each coordinate after dimension transformation, and based on each coordinate after dimension transformation, a coordinate set of the character cluster can be obtained; in this way, the above steps are performed for each character cluster to obtain a coordinate set of each character cluster.
[0064] Specifically, after normalizing each coordinate contained in each character cluster, for each character cluster, a cleaning process can also be performed based on the distance between each two adjacent coordinates, and the remaining coordinates after the coordinate cleaning are used as the normalized coordinate set of the character cluster. For example, a set distance can be set in advance. If the distance between the two trajectory coordinates after the normalization process is less than the set distance, one of the points can be discarded until each coordinate after the normalization process is cleaned, and all the coordinates that are not lost (i.e., the remaining coordinates) are used as the normalized coordinate set. Among them, the set distance can be set manually or between devices, or it can be set according to actual needs, for example, it can be 0.1, 0.2, and 0.3, etc. In this way, by cleaning the coordinates after the normalization process, the number of coordinates calculated subsequently can be effectively reduced, and the accuracy of the coordinates is ensured. In this way, the amount of calculation can be reduced while ensuring the calculation accuracy to improve the calculation efficiency.
[0065] Specifically, when each coordinate in the normalized coordinate set of the character cluster is dimensionally transformed, the actual dimension of each coordinate after the dimension transformation can be determined according to the vector dimension supported by the feature extraction network. Of course, the actual dimension of each coordinate after the dimension transformation can also be set manually or by the device. If the feature extraction network is a resnet network, the actual dimension of each coordinate after the dimension transformation can be 8×2, 16×2, 32×2, etc.
[0066] For example, taking a character cluster as an example, the coordinates of the character cluster are represented by S, S = [(x0, y0), (x1, y1), ... (xn, yn)], where (x0, y0), (x1, yi) to (xn, yn) represent each original coordinate contained in the character cluster. Each original coordinate in the character cluster is dimensionally transformed. At this time, each original coordinate point can be converted into an 8×2 dimensional vector. Taking the i-th coordinate point in S as an example, the i-th original coordinate is (x i ,y i ), the original coordinate of the i+1th is (x i+1 ,y i+1 ), the original coordinate of the i+2th is (x i+2 ,y i+2 ), and the coordinates after dimension conversion of the i-th original coordinates are (X i , Y i ) indicates that, where X i =[x i ,y i ,Δx i ,Δy i ,Δ 2 x i ,Δ 2 y i,sflag1,sflag2],Y i =[y i ,x i ,Δy i ,Δx i ,Δ 2 y i ,Δ 2 x i ,sflag1,sflag2], where Δx i =x i+1 -x i ,Δy i =y i+1 -y i ,Δ 2 x i =x i+2 -x i ,Δ 2 y i =y i+2 -y i , sflag1 and sflag2 are used to indicate the current handwriting state. If the current handwriting state indicates that handwriting is in progress, sflag1 is 1 and sflag2 is 0; if the current handwriting state indicates that the handwriting is stopped, sflag1 is 0 and sflag2 is 1. Of course, flag1 and sflag2 can also be set to other values, and this specification does not make specific restrictions. In this way, each coordinate in S is converted into a dimension to obtain V = [(X0, Y0), (X1, Y1), ... (X n ,Y n )]. In this way, after the dimension conversion of each coordinate in S, the 8×1×N-dimensional feature vectors X and Y corresponding to S can be obtained.
[0067] And, after obtaining the coordinate set of each character cluster, for each character cluster in the multiple character clusters, obtain each coordinate in the character cluster and input it into the resnet network for feature extraction to obtain the feature vector of each coordinate of the character cluster, and obtain the feature vector of the character cluster based on the feature vector of each coordinate of the character cluster; in this way, the above operation can usually obtain the feature vector of each character cluster.
[0068] In the embodiments of the present specification, when obtaining the feature vector of a character cluster based on the feature vector of each coordinate of the character cluster, the feature vectors of each coordinate of the character cluster can be directly concatenated, and the concatenated vector can be used as the feature vector of the character cluster; the feature vector of each coordinate of the character cluster can also be used as the feature vector of the character cluster; the feature vector of each coordinate of the character cluster can also be input into a simple neural network for feature extraction, and the extracted vector can be used as the feature vector of the character cluster.
[0069] Specifically, in order to make the feature vector of each coordinate in each character cluster match the residual network, the convolution structure of the residual network can be modified. For example, each cluster corresponds to 8×1×N-dimensional feature vectors X and Y. In order to make the residual network adapt to the 8×1×N-dimensional feature vector, the 3×3 convolution in the residual network can be modified to a 3×1 convolution.
[0070] In another embodiment, in order to improve the semantic information carried by the feature vector of each trajectory coordinate extracted by the feature extraction, the residual network can also carry an SE (Sequeeze-and-Excitation) module represented by SE-ResNet. The residual network with the SE module is specifically as follows: Figure 2 As shown. Among them, the input is represented by x and the output is represented by It indicates that SE-ResNet includes a Residual layer with a 3×1 convolution, a global pooling layer, two fully connected (FC) layers, and an activation function (Sigmoid).
[0071] And, after obtaining SE-ResNet, each trajectory coordinate vector in the trajectory coordinate vector set is input into SE-ResNet for feature extraction to obtain a feature vector of each trajectory coordinate. In this way, SE-ResNet performs feature extraction, so that the extracted feature vector of each trajectory coordinate also carries semantic information, so that the recognition accuracy can be effectively improved in subsequent recognition.
[0072] After the feature vector of each character cluster is obtained, step S103 is executed.
[0073] Also, before executing step S103, that is, before inputting the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into the pre-trained character recognition model, it is necessary to first obtain the trajectory coordinate vector set of the handwriting trajectory data; the trajectory coordinate vector set is encoded and decoded through a dual-gated cyclic unit to obtain the trajectory formula.
[0074] Specifically, when obtaining the trajectory coordinate vector set of the handwriting trajectory data, the handwriting trajectory data may be preprocessed to obtain the trajectory coordinate vector set, wherein the data preprocessing includes at least one of normalization processing, cleaning processing, and dimension conversion processing.
[0075] In one embodiment, when preprocessing handwriting trajectory data, the handwriting trajectory coordinate set of the handwriting trajectory data can be normalized first to obtain a target handwriting trajectory coordinate set; then, each handwriting trajectory coordinate in the target handwriting trajectory coordinate set can be dimensionally transformed to obtain each handwriting trajectory coordinate after dimension transformation, and a trajectory coordinate vector set can be obtained based on each handwriting trajectory coordinate after dimension transformation.
[0076] Specifically, after the handwriting trajectory coordinate set of the handwriting trajectory data is normalized, it is also possible to perform a cleaning process based on the distance between each two adjacent coordinates, and use the remaining trajectory coordinates after the coordinate cleaning as the target handwriting trajectory coordinate set. For example, a set distance can be pre-set, and if the distance between the two trajectory coordinates after the normalization process is less than the set distance, one of the points can be discarded until each trajectory coordinate after the normalization process is cleaned, and all the trajectory coordinates that are not lost (i.e., the remaining trajectory coordinates) are used as the target handwriting trajectory coordinate set.
[0077] In the embodiments of this specification, data preprocessing is performed on each coordinate contained in each character cluster, or the same method is used for data preprocessing of handwriting trajectory data, which will not be repeated here. If data preprocessing is performed on handwriting trajectory data first, when the coordinate set of each character cluster is obtained, the coordinate set of each character cluster can be directly obtained based on the trajectory coordinate vector set after data preprocessing of handwriting trajectory data, so as to reduce the number of data preprocessing and improve efficiency. Conversely, if data preprocessing is performed on each coordinate contained in each character cluster first, the trajectory coordinate vector set can be directly obtained based on the coordinate set of each character cluster after data preprocessing of each coordinate contained in each character cluster.
[0078] In this way, after obtaining the trajectory coordinate vector set, the trajectory coordinate vector set is encoded and decoded by a double gated recurrent unit (GRU) to obtain the trajectory formula.
[0079] And before inputting the trajectory formula and the feature vector of each character cluster into the pre-trained character recognition model, it is also necessary to obtain the pre-trained character recognition model, such as Figure 3 As shown in the figure, the training steps of the character recognition model include:
[0080] S301, obtaining a training sample set, where each training sample in the training sample set includes training handwriting trajectory data;
[0081] S302, for each training sample in the training sample set, clustering the training sample to obtain N training character clusters of the training sample; performing feature extraction on each training character cluster in the N training character clusters to extract a feature vector of each training character cluster;
[0082] The specific implementation process of step S302 can refer to the description of steps S101 and S102 above, and will not be described again for the sake of brevity.
[0083] S303, performing model training using the trajectory formula of each training sample and the feature vector of each training character cluster of each training sample to obtain a character recognition model.
[0084] Specifically, the original recognition model can be first trained using the trajectory formula of each training sample. When the accuracy of the trained model no longer improves or the improvement ratio is less than the set ratio, the feature vector of each training character cluster and the trajectory formula of each training sample are jointly trained until the trained model meets the constraints, such as achieving the set prediction accuracy. The model that meets the constraints is then used as the character recognition model.
[0085] In the actual application process, when the original recognition model is trained for the trajectory formula of each training sample, the loss function ce-loss can be used to optimize the model. When the accuracy of the trained model is no longer improved or the improvement ratio is less than the set ratio, the feature vector of each training character cluster is added for training. When the feature vector of each training character cluster is added for training, the loss functions center-loss and ce-loss can be used to optimize the model. At this time, Among them, c is the output result of the model, x i is the label; when using center-loss and ce-loss to optimize the model, loss = ce-loss + 0.1 × center-loss, until the model accuracy reaches the optimal again. At this time, the model with the optimal accuracy is used as the character recognition model. In this way, the prediction accuracy of the character recognition model can be effectively improved.
[0086] Thus, after obtaining the trajectory formula and the feature vector of each character cluster, the trajectory formula and the feature vector of each character cluster are input into the character recognition model trained by steps S301-S303, the target candidate words are determined, and the target candidate words are output.
[0087] Specifically, after the trajectory formula and the feature vector of each character cluster are input into the character recognition model, multiple candidate words are obtained, and then according to the confidence of each candidate word in the multiple candidate words, one or more candidate words with a confidence not less than the set confidence are selected from the multiple candidate words as target candidate words, and the target candidate words are displayed on the user terminal. The set confidence can be set manually or by the device, or according to actual needs. Of course, the candidate word with the highest confidence can also be directly selected as the target candidate word, and this specification does not make specific restrictions.
[0088] In this way, when the trajectory formula and the feature vector of each character cluster are predicted through the character recognition model, since each character cluster has a higher degree of match with the user's handwriting input, and the feature vector of each character cluster carries the characteristics of a single character, when the character recognition model is used for prediction, the prediction accuracy can be higher, and the probability of misrecognition of similar characters can be effectively reduced, thereby improving the accuracy of handwriting recognition and providing a better user experience.
[0089] In view of the above-mentioned embodiment, a method for recognizing a handwriting trajectory is provided. In the embodiment of the present application, a device for recognizing a handwriting trajectory is also provided. Figure 4 , the device comprises:
[0090] A character clustering unit 401 is used to cluster the handwriting trajectory data to obtain multiple character clusters;
[0091] A feature extraction unit 402 is used to extract features from each character cluster in the plurality of character clusters to obtain a feature vector for each character cluster;
[0092] The recognition unit 403 is used to input the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into a pre-trained character recognition model to obtain the target candidate words corresponding to the handwriting trajectory data.
[0093] In an optional implementation, the character clustering unit 401 is used to perform stroke segmentation on the handwriting trajectory data to obtain a stroke sequence of the handwriting trajectory; and input the stroke image corresponding to the stroke sequence into a pre-trained single character classification network to obtain the multiple character clusters.
[0094] In an optional embodiment, the character clustering unit 401 is used to input the stroke image into the offline single-character classification network to obtain N classification results, wherein N is an integer greater than 1, and the confidence of each of the N classification results is not less than a set confidence; based on the N classification results, the multiple character clusters are obtained.
[0095] In an optional embodiment, the character clustering unit 401 is used to obtain N groups of stroke combinations corresponding to the N classification results based on the stroke sequence; perform structural character elimination processing on the N groups of stroke combinations to obtain M groups of stroke combinations after processing, and use the M groups of stroke combinations after processing as the multiple character clusters.
[0096] In an optional implementation, the feature extraction unit 402 is used to perform feature extraction on each character cluster using a residual network to extract a feature vector of each character cluster, wherein the residual network carries a SE module.
[0097] In an optional implementation, it also includes:
[0098] The trajectory formula acquisition unit is used to obtain the trajectory coordinate vector set of the handwriting trajectory data before inputting the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into the pre-trained character recognition model; the trajectory coordinate vector set is encoded and decoded by a dual-gated cyclic unit to obtain the trajectory formula.
[0099] In an optional implementation, it also includes:
[0100] A model training unit is used to obtain a training sample set, each training sample in the training sample set includes training handwriting trajectory data; for each training sample in the training sample set, the training sample is clustered to obtain N training character clusters of the training sample; for each training character cluster in the N training character clusters, feature extraction is performed to extract a feature vector of each training character cluster; model training is performed using the trajectory formula of each training sample and the feature vector of each training character cluster of each training sample to obtain the character recognition model.
[0101] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0102] Figure 5 1 is a block diagram of an electronic device 800 for a handwriting trajectory recognition method according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0103] Reference Figure 5 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / display (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0104] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0105] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0106] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0107] The multimedia component 808 includes a screen that provides a display interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0108] The audio component 810 is configured to present and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for presenting audio signals.
[0109] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0110] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0111] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0112] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0113] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0114] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform a handwriting trajectory recognition method, the method comprising:
[0115] Clustering the handwriting trajectory data to obtain multiple character clusters, where N is an integer greater than 1;
[0116] Performing feature extraction on each character cluster of the plurality of character clusters to extract a feature vector of each character cluster;
[0117] The feature vector of each character cluster and the trajectory formula of the handwriting trajectory data are input into a pre-trained character recognition model to obtain the target candidate words corresponding to the handwriting trajectory data.
[0118] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0119] It should be understood that the present invention is not limited to the precise structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
[0120] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for recognizing handwriting trajectories, It is characterized in that The method comprises: Cluster the handwriting trajectory data to obtain multiple character clusters; Performing feature extraction on each of the multiple character clusters to extract a feature vector of each character cluster; inputting the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into a pre-trained character recognition model to obtain a target candidate word corresponding to the handwriting trajectory data; The handwriting trajectory data is clustered to obtain multiple character clusters, including: Obtain handwriting trajectory data, then obtain a stroke set corresponding to the handwriting trajectory data, input the stroke set into a simple neural network for classification, and obtain N classifications as multiple character clusters; Obtaining N groups of stroke combinations corresponding to the N classification results; The N groups of stroke combinations are subjected to structural character elimination processing to obtain M groups of stroke combinations after processing, and the M groups of stroke combinations after processing are used as the multiple character clusters, wherein M is an integer greater than 1 and not greater than N; Before inputting the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into the pre-trained character recognition model, the method further includes: Acquire a trajectory coordinate vector set of the handwriting trajectory data; The trajectory coordinate vector set is encoded and decoded by a dual-gated recurrent unit to obtain the trajectory formula.
2. The method according to claim 1, It is characterized in that The handwriting trajectory data is clustered to obtain multiple character clusters, including: Performing stroke segmentation on the handwriting trajectory data to obtain a stroke sequence of the handwriting trajectory; The stroke image corresponding to the stroke sequence is input into a pre-trained single character classification network to obtain the multiple character clusters.
3. The method according to claim 2, It is characterized in that The step of inputting the stroke image corresponding to the stroke sequence into a pre-trained single character classification network to obtain the multiple character clusters includes: Inputting the stroke image into the offline single-character classification network to obtain N classification results, wherein N is an integer greater than 1, and the confidence of each of the N classification results is not less than a set confidence; The multiple character clusters are obtained according to the N classification results.
4. The method according to claim 3, It is characterized in that The obtaining of the plurality of character clusters according to the N classification results includes: According to the stroke sequence, obtaining N groups of stroke combinations corresponding to the N classification results; The N groups of stroke combinations are subjected to structural character elimination processing to obtain M groups of stroke combinations after processing, and the M groups of stroke combinations after processing are used as the multiple character clusters.
5. The method according to claim 4, It is characterized in that The step of extracting features from each of the plurality of character clusters to obtain a feature vector for each character cluster includes: A residual network is used to perform feature extraction on each character cluster to extract a feature vector of each character cluster, wherein the residual network carries an SE module.
6. The method according to any one of claims 1 to 5, It is characterized in that The character recognition model training step includes: Acquire a training sample set, wherein each training sample in the training sample set includes training handwriting trajectory data; For each training sample in the training sample set, clustering the training sample to obtain N training character clusters of the training sample; performing feature extraction on each training character cluster in the N training character clusters to extract a feature vector of each training character cluster; The character recognition model is obtained by performing model training using the trajectory formula of each training sample and the feature vector of each training character cluster of each training sample.
7. A handwriting trajectory recognition device, It is characterized in that The device comprises: A character clustering unit, used for clustering the handwriting trajectory data to obtain multiple character clusters; The character clustering unit is further used to obtain handwriting trajectory data, and then obtain a stroke set corresponding to the handwriting trajectory data, input the stroke set into a simple neural network for classification, and obtain N classifications as multiple character clusters; Obtaining N groups of stroke combinations corresponding to the N classification results; The N groups of stroke combinations are subjected to structural character elimination processing to obtain M groups of stroke combinations after processing, and the M groups of stroke combinations after processing are used as the multiple character clusters, wherein M is an integer greater than 1 and not greater than N; A feature extraction unit, used to extract features from each of the multiple character clusters to obtain a feature vector for each character cluster; A recognition unit, used for inputting the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into a pre-trained character recognition model to obtain a target candidate word corresponding to the handwriting trajectory data; The trajectory formula acquisition unit is used to obtain the trajectory coordinate vector set of the handwriting trajectory data before inputting the feature vector of each character cluster and the trajectory formula of the handwriting trajectory data into the pre-trained character recognition model; the trajectory coordinate vector set is encoded and decoded by a dual-gated cyclic unit to obtain the trajectory formula.
8. The device according to claim 7, It is characterized in that The character clustering unit is used to perform stroke segmentation on the handwriting trajectory data to obtain a stroke sequence of the handwriting trajectory; and input the stroke image corresponding to the stroke sequence into a pre-trained single character classification network to obtain the multiple character clusters.
9. The device as claimed in claim 8, It is characterized in that The character clustering unit is used to input the stroke image into the offline single-character classification network to obtain N classification results, wherein N is an integer greater than 1, and the confidence of each of the N classification results is not less than a set confidence; based on the N classification results, the multiple character clusters are obtained.
10. An electronic device, It is characterized in that The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operation instructions corresponding to the method according to any one of claims 1 to 6 contained in the one or more programs.
11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the steps corresponding to the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Handwritten trajectory recognition method, handwritten trajectory recognition device and handwriting input device
CN105095830A
Handwriting recognition method based on handwriting coordinate sequence
CN106407874A
