CN109086651B - Handwriting model training method, handwritten character recognition method, device, equipment and medium - Google Patents

Handwriting model training method, handwritten character recognition method, device, equipment and medium Download PDF

Info

Publication number
CN109086651B
CN109086651B CN201810563507.6A CN201810563507A CN109086651B CN 109086651 B CN109086651 B CN 109086651B CN 201810563507 A CN201810563507 A CN 201810563507A CN 109086651 B CN109086651 B CN 109086651B
Authority
CN
China
Prior art keywords
chinese
recognition model
chinese character
training
character recognition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810563507.6A
Other languages
Chinese (zh)
Other versions
CN109086651A (en
Inventor
黄春岑
周罡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810563507.6A priority Critical patent/CN109086651B/en
Priority to PCT/CN2018/094249 priority patent/WO2019232856A1/en
Publication of CN109086651A publication Critical patent/CN109086651A/en
Application granted granted Critical
Publication of CN109086651B publication Critical patent/CN109086651B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/32Digital ink
    • G06V30/333Preprocessing; Feature extraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/049Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/32Digital ink
    • G06V30/36Matching; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/28Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet
    • G06V30/287Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet of Kanji, Hiragana or Katakana characters

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Character Discrimination (AREA)

Abstract

The invention discloses a handwriting model training method, a handwritten character recognition device, equipment and a medium. The handwriting model training method comprises the following steps: acquiring a standard Chinese character training sample, training a bidirectional long-and-short term memory neural network, updating network parameters of the bidirectional long-and-short term memory neural network by adopting a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-and-short term memory neural network, and acquiring a standard Chinese character recognition model; acquiring and adopting non-standard Chinese character training samples, training and acquiring an adjusted Chinese handwriting recognition model; acquiring and adopting a Chinese character sample to be tested to obtain an error character training sample; based on a batch gradient descent time correlation back propagation algorithm, updating network parameters of the Chinese handwritten character recognition model by adopting error character training samples, and obtaining a target Chinese handwritten character recognition model. By adopting the handwriting model training method, a target Chinese handwriting character recognition model with high recognition rate of the recognized handwriting character can be obtained.

Description

Handwriting model training method, handwritten character recognition method, device, equipment and medium
Technical Field
The invention relates to the field of Chinese character recognition, in particular to a handwriting model training method, a handwritten character recognition method, a device, equipment and a medium.
Background
The traditional handwritten word recognition method mostly comprises the steps of binarization processing, character segmentation, feature extraction, support vector machine and the like for recognition, and when the traditional handwritten word recognition method is adopted to recognize comparatively illegible non-standard words (Chinese handwriting), the recognition accuracy is not high, so that the recognition effect is not ideal. The traditional handwritten character recognition method can only recognize standard characters to a great extent, and has low accuracy when various handwritten characters in actual life are recognized.
Disclosure of Invention
The embodiment of the invention provides a handwriting model training method, a handwriting model training device, handwriting model training equipment and a handwriting model training medium, and aims to solve the problem that the recognition accuracy of current handwritten characters is low.
A handwriting model training method, comprising:
acquiring a standard Chinese character training sample, training a bidirectional long-and-short-term memory neural network by using the standard Chinese character training sample, acquiring the forward output of the bidirectional long-and-short-term memory neural network, updating the network parameters of the bidirectional long-and-short-term memory neural network by using a time-dependent back propagation algorithm based on random gradient descent according to the forward output of the bidirectional long-and-short-term memory neural network, and acquiring a standard Chinese character recognition model;
acquiring an irregular Chinese character training sample, training the regular Chinese character recognition model by adopting the irregular Chinese character training sample, acquiring the forward output of the regular Chinese character recognition model, updating the network parameters of the regular Chinese character recognition model by adopting a time-dependent back propagation algorithm based on random gradient descent according to the forward output of the regular Chinese character recognition model, and acquiring an adjusted Chinese handwritten character recognition model;
acquiring a Chinese character sample to be tested, adopting the adjusted Chinese handwriting character recognition model to recognize the Chinese character sample to be tested, acquiring error characters with recognition results not consistent with real results, and taking all the error characters as error character training samples;
and training the adjusted Chinese handwritten character recognition model by adopting the error character training sample, acquiring forward output of the adjusted Chinese handwritten character recognition model, updating and adjusting network parameters of the Chinese handwritten character recognition model by adopting a time-dependent back propagation algorithm based on batch gradient descent according to the forward output of the adjusted Chinese handwritten character recognition model, and acquiring a target Chinese handwritten character recognition model.
A handwriting model training apparatus, comprising:
the standard Chinese character recognition model acquisition module is used for acquiring a standard Chinese character training sample, training a bidirectional long-time and short-time memory neural network by adopting the standard Chinese character training sample, acquiring the forward output of the bidirectional long-time and short-time memory neural network, updating the network parameters of the bidirectional long-time and short-time memory neural network by adopting a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-time and short-time memory neural network, and acquiring a standard Chinese character recognition model;
an acquisition module of an adjusted Chinese handwriting character recognition model, which is used for acquiring an irregular Chinese character training sample, training the regular Chinese character recognition model by adopting the irregular Chinese character training sample, acquiring the forward output of the regular Chinese character recognition model, updating the network parameters of the regular Chinese character recognition model by adopting a time-dependent back propagation algorithm based on random gradient descent according to the forward output of the regular Chinese character recognition model, and acquiring the adjusted Chinese handwriting character recognition model;
the error character training sample acquisition module is used for acquiring a Chinese character sample to be tested, adopting the adjusted Chinese handwriting character recognition model to recognize the Chinese character sample to be tested, acquiring error characters with recognition results not consistent with real results, and taking all the error characters as error character training samples;
and the target Chinese handwritten character recognition model acquisition module is used for training the adjusted Chinese handwritten character recognition model by adopting the error character training sample, acquiring the forward output of the adjusted Chinese handwritten character recognition model, and updating and adjusting the network parameters of the Chinese handwritten character recognition model by adopting a time-dependent back propagation algorithm based on batch gradient descent according to the forward output of the adjusted Chinese handwritten character recognition model to acquire the target Chinese handwritten character recognition model.
The embodiment of the invention also provides a handwritten character recognition method, a handwritten character recognition device, handwritten character recognition equipment and a handwritten character recognition medium, so as to solve the problem that the current handwritten character recognition accuracy is not high.
A handwritten word recognition method, comprising:
acquiring a Chinese character to be recognized, recognizing the Chinese character to be recognized by adopting a target Chinese handwritten character recognition model, and acquiring an output value of the Chinese character to be recognized in the target Chinese handwritten character recognition model; the target Chinese handwritten character recognition model is obtained by adopting the handwriting model training method;
and acquiring a target probability output value according to the output value and a preset Chinese semantic word library, and acquiring the recognition result of the Chinese character to be recognized based on the target probability output value.
An embodiment of the present invention provides a handwritten character recognition apparatus, including:
the system comprises an output value acquisition module, a target Chinese handwritten character recognition module and a recognition module, wherein the output value acquisition module is used for acquiring Chinese characters to be recognized, recognizing the Chinese characters to be recognized by adopting a target Chinese handwritten character recognition model and acquiring an output value of the Chinese characters to be recognized in the target Chinese handwritten character recognition model; the target Chinese handwritten character recognition model is obtained by adopting the handwriting model training method;
and the recognition result acquisition module is used for acquiring a target probability output value according to the output value and a preset Chinese semantic word library and acquiring a recognition result of the Chinese character to be recognized based on the target probability output value.
A computer device comprising a memory, a processor and a computer program stored in said memory and executable on said processor, said processor implementing the steps of the above-mentioned handwriting model training method when executing said computer program.
A computer device comprising a memory, a processor and a computer program stored in said memory and executable on said processor, said processor implementing the steps of the above-mentioned handwritten word recognition method when executing said computer program.
An embodiment of the present invention provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the handwriting model training method.
An embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps of the above-mentioned handwritten word recognition method.
In the handwriting model training method, device, equipment and medium provided by the embodiment of the invention, the standard Chinese character training sample is adopted to train the bidirectional long-and-short-term memory neural network, the forward output of the bidirectional long-and-short-term memory neural network is obtained, and according to the forward output of the bidirectional long-and-short-term memory neural network, the network parameters of the bidirectional long-and-short-term memory neural network are updated by adopting a time-dependent back propagation algorithm based on random gradient descent, so that the standard Chinese character recognition model is obtained, and the standard Chinese character recognition model has the capacity of recognizing standard Chinese handwriting. And then based on a time-dependent back propagation algorithm with random gradient descent, the non-standard Chinese characters are used for carrying out adjustment updating on the standard Chinese character recognition model, so that the adjusted Chinese character recognition model obtained after updating learns deep features of the handwritten Chinese characters in a training updating mode on the premise of having the capability of recognizing the standard Chinese characters, and the adjusted Chinese character recognition model can better recognize the handwritten Chinese characters. And then, recognizing the Chinese character sample to be tested by adopting the adjusted Chinese handwritten character recognition model, acquiring error characters of which the recognition result is not consistent with the real result, inputting all the error characters serving as error character training samples into the adjusted Chinese handwritten character recognition model for training and updating, updating and adjusting network parameters of the Chinese handwritten character recognition model by adopting a time-dependent back propagation algorithm based on batch gradient descent, and acquiring the target Chinese handwritten character recognition model. The adoption of the error word training sample can further optimize the recognition accuracy rate, and can further reduce the influence of over-learning and over-weakening generated during model training. The training of each model adopts a bidirectional long-time and short-time memory neural network, the neural network can combine the sequence characteristics of Chinese characters, and from the angles of the forward direction of the sequence and the reverse direction of the sequence, the deep characteristics of the Chinese characters are learned, and the function of identifying different Chinese handwritten words is realized. The Chinese character recognition model is normalized and the Chinese handwriting recognition model is adjusted by adopting a time correlation back propagation algorithm based on random gradient during training, so that the training efficiency and the training effect are better under the condition of a large number of training samples. The target Chinese handwritten character recognition model adopts a time-dependent back propagation algorithm based on batch gradient descent during training, so that parameters in the model can be fully updated, the parameters can be comprehensively updated according to generated errors, and the recognition accuracy of the obtained model is improved.
In the handwritten character recognition method, device, equipment and medium provided by the embodiment of the invention, the Chinese character to be recognized is input into the target Chinese handwritten character recognition model for recognition, and the recognition result is obtained by combining the preset Chinese semantic word library. When the target Chinese handwritten character recognition model is adopted to recognize the Chinese handwritten character, an accurate recognition result can be obtained.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a diagram of an application environment of a handwriting model training method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a handwriting model training method according to an embodiment of the present invention;
FIG. 3 is a detailed flowchart of step S10 in FIG. 2;
FIG. 4 is another detailed flowchart of step S10 in FIG. 2;
FIG. 5 is a detailed flowchart of step S30 in FIG. 2;
FIG. 6 is a diagram illustrating a handwriting model training apparatus according to an embodiment of the present invention;
FIG. 7 is a flow chart of a handwritten word recognition method in one embodiment of the invention;
FIG. 8 is a schematic diagram of a handwritten character recognition apparatus in an embodiment of the invention;
FIG. 9 is a schematic diagram of a computing device in accordance with an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
Fig. 1 illustrates an application environment of a handwriting model training method provided by an embodiment of the present invention. The application environment of the handwriting model training method comprises a server and a client, wherein the server and the client are connected through a network, the client is equipment capable of performing man-machine interaction with a user and comprises but is not limited to equipment such as a computer, a smart phone and a tablet, and the server can be specifically realized by an independent server or a server cluster consisting of a plurality of servers. The handwriting model training method provided by the embodiment of the invention is applied to a server.
As shown in fig. 2, fig. 2 is a flowchart illustrating a handwriting model training method according to an embodiment of the present invention, where the handwriting model training method includes the following steps:
s10: obtaining a standard Chinese character training sample, training a bidirectional long-time and short-time memory neural network by adopting the standard Chinese character training sample, obtaining the forward output of the bidirectional long-time and short-time memory neural network, updating the network parameters of the bidirectional long-time and short-time memory neural network by adopting a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-time and short-time memory neural network, and obtaining a standard Chinese character recognition model.
The standard Chinese character training sample refers to a training sample obtained according to a standard character (such as a character belonging to a regular script, a song script, an clerical script and the like, and a regular script or a song script is selected as a common font). A Bi-directional Long Short-Term Memory (BILSTM) is a time-recursive neural network used for training data with sequence characteristics from both the sequence forward direction and the sequence reverse direction. The bidirectional long-and-short time memory neural network can not only be associated with the preceding data, but also be associated with the following data, so that deep features of the data related to the sequence can be learned according to the context of the sequence. The data with the sequence characteristics are memorized in a neural network model for training in a bidirectional long-term and short-term manner, and a recognition model corresponding to the data can be obtained. The random Gradient Descent (SGD) is a processing method for acquiring an error generated in a training process of each training sample when updating a network parameter, and randomly adopting the error generated in the training process of a single sample for many times to update the network parameter. A Back Propagation Time (BPTT algorithm) is a training and learning method in neural network learning, and is used to update and adjust network parameters between nodes in a neural network. When the time-dependent back propagation algorithm is used to adjust the network parameters in the neural network, the minimum value of the error function needs to be obtained, and in this embodiment, the minimum value of the error function is specifically obtained by a processing method of random gradient descent.
In this embodiment, a standard chinese character training sample is obtained, where the training sample is obtained from a standard chinese character belonging to a chinese font such as a regular script, a song body, or an clerical script, and the song body is taken as an example in this embodiment for explanation. It should be understood that the standard word herein refers to a word belonging to a mainstream font in a current chinese font, such as a word of a default font song body in an input method of a computer device, a word of a mainstream font regular font commonly used for copying, and the like; characters with Chinese characters, such as cursive script characters and round characters, which are rarely used in daily life, are not included in the standard characters. After a standard Chinese character training sample is obtained, a two-way long-and-short term memory neural network is trained by the standard Chinese character training sample, the forward output of the two-way long-and-short term memory neural network is obtained, and according to the forward output of the two-way long-and-short term memory neural network, network parameters of the two-way long-and-short term memory neural network are updated by a time-dependent back propagation algorithm based on stochastic gradient descent, so that a standard Chinese character recognition model is obtained. The standard Chinese character recognition model learns deep features of a standard Chinese character training sample in a training process, so that the model can accurately recognize standard characters and has recognition capability on the standard characters. It should be noted that, no matter what the standard Chinese character training sample adopts the standard characters corresponding to other Chinese characters such as regular script, song script, clerical script and the like, because the standard characters have small differences in the aspect of character recognition, the standard Chinese character recognition model can accurately recognize the standard characters corresponding to the characters such as regular script, song script, clerical script and the like, and obtain a more accurate recognition result.
S20: acquiring an irregular Chinese character training sample, training a regular Chinese character recognition model by adopting the irregular Chinese character training sample, acquiring the forward output of the regular Chinese character recognition model, updating the network parameters of the regular Chinese character recognition model by adopting a time-dependent back propagation algorithm based on random gradient descent according to the forward output of the regular Chinese character recognition model, and acquiring an adjusted Chinese handwriting recognition model.
The non-standard Chinese character training sample refers to a training sample obtained according to a handwritten Chinese character, and the handwritten Chinese character can be a character obtained in a handwriting mode according to the font form of a standard character corresponding to a font such as a regular script, a song script, an clerical script and the like. It will be appreciated that the non-canonical Chinese training sample differs from the canonical Chinese training sample in that the non-canonical Chinese training sample is obtained from handwritten Chinese, and since it is handwritten, of course contains a variety of different font styles.
In the embodiment, the server side obtains an irregular Chinese character training sample which contains the characteristics of the handwritten Chinese character, inputs the irregular Chinese character training sample into the standard Chinese character recognition model for training and adjustment, obtains the forward output of the standard Chinese character recognition model, updates the network parameters of the standard Chinese character recognition model by adopting a time-dependent back propagation algorithm based on random gradient descent according to the forward output of the standard Chinese character recognition model, and obtains the adjusted Chinese handwritten character recognition model. It will be appreciated that the canonical Chinese recognition model has the ability to recognize standard canonical Chinese, but does not have high recognition accuracy when recognizing handwritten Chinese. Therefore, the embodiment trains by adopting the non-standard Chinese character training sample, so that the standard Chinese handwritten character recognition model adjusts parameters (weight and bias) in the model on the basis of the existing recognition standard Chinese character, and obtains the adjusted Chinese handwritten character recognition model. The adjusted Chinese handwriting recognition model learns deep features of handwritten Chinese characters on the basis of the original recognition standard characters, the Chinese handwritten character recognition model is combined with deep features of standard characters and handwritten Chinese characters, the standard characters and the handwritten Chinese characters can be effectively recognized at the same time, and a recognition result with high accuracy is obtained.
When the character recognition is carried out by the bidirectional long-short time memory neural network, judgment is carried out according to the pixel distribution of the character, the handwritten Chinese character in real life is different from the standard character, but the difference is much smaller than the difference of the handwritten Chinese character and the standard character, for example, the difference of the 'I' of the handwritten Chinese character and the 'I' of the standard character is different in pixel distribution, but the difference is much smaller than the difference of the 'I' of the handwritten Chinese character and the 'I' of the standard character. It can be considered that even though there is a certain difference between the handwritten Chinese character and the corresponding standard word, the difference is much smaller than that of the standard word which does not correspond, and therefore, the recognition result can be determined by the most similar (i.e. the difference is the smallest) principle. The Chinese character handwriting character adjusting recognition model is obtained by training a bidirectional long-and-short memory neural network, and can effectively recognize handwritten Chinese characters according to deep features of standard characters and the handwritten Chinese characters.
For steps S10 and S20, the time-dependent back propagation algorithm based on the stochastic gradient descent is used to update the error back propagation, so that model training can be performed smoothly even when the number of training samples is large, the efficiency and effect of network training can be improved, and training is more effective.
It should be noted that the order of step S10 and step S20 in this embodiment is not interchangeable, and step S10 is executed first and then step S20 is executed. Firstly, a standard Chinese training sample is adopted to train the bidirectional long-time memory neural network, so that the obtained standard Chinese character recognition model has good recognition capability, and the standard Chinese character recognition model has an accurate recognition result on the standard characters. And the fine tuning of the step S20 is performed on the basis of good recognition capability, so that the adjusted Chinese handwriting recognition model obtained by training can effectively recognize the handwritten Chinese according to the deep features of the learned handwritten Chinese, and the handwritten Chinese recognition model has a relatively accurate recognition result. If step S20 is executed first or only step S20 is executed, because the handwritten Chinese characters have various forms, the features learned by directly training the handwritten Chinese characters cannot well reflect the features of the handwritten Chinese characters, so that the model is "bad" initially, and it is difficult to have an accurate recognition result for the handwritten Chinese character recognition after how to adjust the model. Although everyone has different handwritten Chinese characters, most of the handwritten Chinese characters are similar to standard characters (for example, the handwritten Chinese characters imitate the standard characters). Therefore, the model training according to the standard characters at first is more in line with objective conditions, the effect is better than that of directly performing the model training on the handwritten Chinese characters, corresponding adjustment can be performed under a 'good' model, and the adjusted Chinese handwritten character recognition model with high handwritten Chinese character recognition rate is obtained.
S30: acquiring a Chinese character sample to be tested, identifying the Chinese character sample to be tested by adopting an adjusted Chinese character handwriting identification model, acquiring error characters with identification results not consistent with real results, and taking all the error characters as error character training samples.
The Chinese character sample to be tested is a training sample for testing obtained according to the standard characters and the handwritten Chinese characters, and the standard characters adopted in the step are the same as the standard characters used for training in the step S10 (because each character corresponding to the fonts such as regular script, song' S style and the like is uniquely determined); the handwritten Chinese characters used may be different from the handwritten Chinese characters used in the training in step S20 (the handwritten Chinese characters of different people are not identical, each character corresponding to the handwritten Chinese characters may correspond to a plurality of font forms, and in order to distinguish from the non-standard Chinese character training samples used in the training in step S20 and avoid the situation of over-fitting of model training, the handwritten Chinese characters different from step S20 are generally used in this step).
In this embodiment, the trained adjusted chinese handwriting recognition model is used to recognize a chinese sample to be tested, where the chinese sample to be tested includes a standard word and a preset label value (i.e., a real result) thereof, and a handwritten chinese word and a preset label value thereof. The standard characters and the handwritten Chinese characters can be input into the adjusted Chinese handwritten character recognition model in a mixed mode during training. When the Chinese character sample to be tested is recognized by adopting the adjusted Chinese handwritten character recognition model, the corresponding recognition result is obtained, and all wrong characters of which the recognition result is not consistent with the label value (real result) are taken as the wrong character training samples. The error character training sample reflects the problem that the recognition precision of the Chinese character handwriting recognition model is still insufficient, so that the Chinese character handwriting recognition model can be further updated, optimized and adjusted according to the error character training sample.
Since the recognition accuracy of the adjusted chinese handwritten character recognition model is actually affected by both the normative chinese character training samples and the non-normative chinese character training samples, on the premise that the network parameters (weight and offset) are updated by the normative chinese character training samples, and then the network parameters (weight and offset) are updated by the non-normative chinese character training samples, the obtained adjusted chinese handwritten character recognition model can be caused to excessively learn the characteristics of the non-normative chinese character training samples, so that the obtained adjusted chinese handwritten character recognition model has very high recognition accuracy for the non-normative chinese character training samples (including handwritten chinese characters), but excessively learns the characteristics of the non-normative chinese character samples, which affects the recognition accuracy of handwritten chinese characters other than the non-normative chinese character training samples, therefore, the step S30 uses the chinese character samples to be tested to recognize the adjusted chinese character recognition model, and can largely eliminate the excessive learning of the non-normative chinese character samples used during training. The Chinese handwriting recognition model is adjusted to recognize the Chinese character sample to be tested so as to find out the error generated by over learning, and the error can be reflected by the error word, so that the network parameters of the Chinese handwriting recognition model can be further updated, optimized and adjusted according to the error word.
S40: training and adjusting the Chinese handwritten character recognition model by adopting an error character training sample, acquiring forward output of the adjusted Chinese handwritten character recognition model, updating and adjusting network parameters of the Chinese handwritten character recognition model by adopting a time-dependent back propagation algorithm based on batch gradient descent according to the forward output of the adjusted Chinese handwritten character recognition model, and acquiring a target Chinese handwritten character recognition model.
In the embodiment, the error word training sample is input into the adjusted Chinese handwritten character recognition model for training, and the error word training sample reflects the problem that when the adjusted Chinese handwritten character recognition model is trained, due to the fact that the characteristics of the non-standard Chinese character training sample are over-learned, the adjusted Chinese handwritten character recognition model is inaccurate in recognition of the handwritten Chinese characters except the non-standard Chinese character training sample. Moreover, due to the fact that the standard Chinese character training sample is adopted firstly and then the non-standard Chinese character training sample is adopted to train the model, the characteristics of the originally learned standard characters can be weakened excessively, and the 'frame' which is initially set up by the model and used for identifying the standard characters can be influenced. The problems of over-learning and over-weakening can be well solved by utilizing the error word training sample, and the adverse effects caused by over-learning and over-weakening generated in the original training process can be eliminated to a great extent according to the problem of recognition accuracy reflected by the error word training sample. Specifically, a time-dependent back propagation algorithm based on batch gradient descent is adopted when the training is performed by adopting the error word training sample, network parameters of the Chinese handwritten character recognition model are updated and adjusted according to the algorithm, and the target Chinese handwritten character recognition model is obtained and is a model which is finally trained and can be used for recognizing Chinese handwritten characters. When network parameters are updated, the sample capacity of error word training samples is small (error words are small), forward output of the adjusted Chinese handwritten word recognition model is obtained, errors generated by all error word training samples during bidirectional long-time memory neural network training can be updated in a reverse transmission mode by adopting a time-dependent reverse propagation algorithm based on batch gradient descent according to the adjusted forward output of the Chinese handwritten word recognition model, the network can be adjusted and updated by all generated errors, the bidirectional long-time memory neural network can be trained comprehensively, and the recognition accuracy of the target Chinese handwritten word recognition model is improved.
It can be understood that the bidirectional long-short term memory neural network used for training each model can be combined with the sequence characteristics of the Chinese characters, and from the angles of the forward direction and the reverse direction of the sequence, the deep features of the Chinese characters can be learned, so that the function of identifying different Chinese handwritten words can be realized.
It should be noted that, in this embodiment, the steps S10 and S20 adopt a time-dependent back propagation algorithm based on random gradient descent; step S40 employs a time-dependent back-propagation algorithm based on batch gradient descent.
In step S10, the process of updating the network parameters of the bidirectional long-and-short term memory neural network by using the time-dependent back propagation algorithm based on stochastic gradient descent specifically includes the following steps:
obtaining a binarization pixel value feature matrix corresponding to each training sample (each character) in a standard Chinese character training sample, randomly inputting each binarization pixel value feature matrix into a bidirectional long-time and short-time memory neural network to obtain each corresponding forward output, calculating an error between each forward output and a corresponding label value (a real result), and correspondingly performing gradient descent back propagation once every error is obtained to update network parameters of the network. Repeating the above process of calculating each error and updating the network parameters of the network with each error until the error is less than the stop iteration threshold epsilon 1 And ending the circulation to obtain the updated network parameters, namely obtaining the standard Chinese character recognition model.
The process of updating the network parameters of the bidirectional long-time memory neural network by adopting the time-dependent back propagation algorithm based on stochastic gradient descent in the step S20 is similar to the process of the step S10, and is not described again here.
In step S40, the process of updating the network parameters of the bidirectional long-and-short term memory neural network by using the batch gradient descent-based time-dependent back propagation algorithm specifically includes the following steps:
obtaining a binary pixel value characteristic matrix corresponding to one training sample in error word training samples, inputting the binary pixel value characteristic matrix into an adjusted Chinese handwritten word recognition model (essentially, the model is also a bidirectional long-time memory neural network) to obtain a forward output, calculating the error between the forward output and a real result, and obtaining and sequentially inputting the rest training samplesCalculating the error between the corresponding forward output and the real result, accumulating the error to obtain the total error of the Chinese handwriting character recognition model to the error character training sample, performing gradient descent based back propagation by using the total error, updating the network parameters of the network, and repeating the process of calculating the total error and updating the network parameters of the network by using the total error until the error is less than the iteration stop threshold value epsilon 2 And then, ending the circulation to obtain updated network parameters, thus obtaining the target Chinese handwritten character recognition model.
It can be understood that, for steps S10 and S20, because the number of training samples used for performing model training is huge, if a time-dependent back propagation algorithm based on batch gradient descent is used, the efficiency and effect of network training will be affected, and even model training cannot be performed normally, and it is difficult to perform efficient training. The time correlation back propagation algorithm based on the stochastic gradient descent is adopted to update the error back propagation, so that the efficiency and effect of network training can be improved, and the training is more effective.
In step S40, the sample capacity of the training samples of the erroneous word is small (the number of erroneous words is small), and the time-dependent back propagation algorithm based on batch gradient descent is adopted to perform back propagation updating on errors generated by all the training samples of the erroneous word during the training of the bidirectional long-and-short term memory neural network, so that it is ensured that all the generated errors can adjust and update the network, and the bidirectional long-and-short term memory neural network can be comprehensively trained. Compared with a time-dependent back propagation algorithm based on random gradient descent, the time-dependent back propagation algorithm based on batch gradient descent is standard in gradient and can comprehensively train a bidirectional long-time and short-time memory neural network; the latter randomly extracts one training sample from the training samples each time to update the parameters of the network, and the gradient of the latter is approximate and not standard, and is not as accurate as the former in training. The accuracy of model training can be improved by adopting a batch gradient descent-based time correlation back propagation algorithm, so that a target Chinese handwritten character recognition model obtained by training has accurate recognition capability.
In the steps S10-S40, the standard Chinese character training samples are adopted for training and obtaining the standard Chinese character recognition model, and then the standard Chinese character recognition model is updated in an adjusting mode through the non-standard Chinese characters, so that the adjusted Chinese handwritten character recognition model obtained after updating can learn the deep features of the handwritten Chinese characters in a training and updating mode on the premise of having the capability of recognizing standard characters, and the adjusted Chinese handwritten character recognition model can better recognize the handwritten Chinese characters. And then, recognizing the Chinese character sample to be tested by adopting the adjusted Chinese handwritten character recognition model, acquiring error characters of which the recognition result is not consistent with the real result, inputting all the error characters serving as error character training samples into the adjusted Chinese handwritten character recognition model for training and updating, and acquiring the target Chinese handwritten character recognition model. By adopting the error word training sample, the adverse effects caused by over-learning and over-weakening generated in the original training process can be eliminated to a great extent, and the recognition accuracy can be further optimized. In the steps S10-S40, a bidirectional long-time and short-time memory neural network is adopted for training each model, and the neural network can be combined with the sequence characteristics of the font to learn the deep features of the font from the angles of the forward direction of the sequence and the reverse direction of the sequence; the training standard Chinese character recognition model and the adjusting Chinese character handwriting recognition model adopt a time correlation back propagation algorithm based on random gradient descent, so that a better training effect can be still achieved under the condition of a large number of training samples; the Chinese handwritten character recognition model for the training target adopts a time-dependent back propagation algorithm based on batch gradient descent, the full updating of parameters in the model can be guaranteed by adopting the batch gradient descent, the back propagation updating is carried out on errors generated by a training sample in the training process, the parameters are comprehensively updated according to the generated errors, and the recognition accuracy of the obtained model is improved.
In an embodiment, as shown in fig. 3, in step S10, obtaining a canonical chinese character training sample specifically includes the following steps:
s101: obtaining a pixel value feature matrix of each Chinese character in a Chinese character training sample to be processed, and carrying out processing on each pixel value in the pixel value feature matrixNormalization processing, namely acquiring a normalized pixel value characteristic matrix of each Chinese character, wherein the formula of the normalization processing is
Figure BDA0001683880410000101
MaxValue is the maximum value of the pixel values in the pixel value characteristic matrix of each Chinese character, minValue is the minimum value of the pixel values in the pixel value characteristic matrix of each Chinese character, x is the pixel value before normalization, and y is the pixel value after normalization.
The Chinese character training sample to be processed is an initially obtained and unprocessed training sample.
In this embodiment, a pixel value feature matrix of each chinese character in a chinese character training sample to be processed is obtained, where the pixel value feature matrix of each chinese character represents a feature of a corresponding word, and here, a pixel value represents a feature of a word, and since a word is represented based on two dimensions (generally, one word is represented by an m × n image), a pixel value can be represented by a matrix, that is, a pixel value feature matrix is formed. The computer device can identify the form of the pixel value feature matrix and read the numerical values in the pixel value feature matrix. After the server side obtains the pixel value characteristic matrix, the server side performs normalization processing on the pixel value of each Chinese character in the characteristic matrix by adopting a normalization processing formula to obtain the normalization pixel value characteristic of each Chinese character. In this embodiment, each pixel value feature matrix can be compressed in the same range interval by adopting a normalization processing mode, so that the calculation related to the pixel value feature matrix can be accelerated, and the training efficiency of the character recognition model in the training specification can be improved.
S102: dividing pixel values in the normalized pixel value feature matrix of each Chinese character into two types of pixel values, establishing a binarization pixel value feature matrix of each Chinese character based on the two types of pixel values, and combining the binarization pixel feature matrices of each Chinese character to serve as a standard Chinese character training sample.
In this embodiment, the pixel values in the normalized pixel value feature matrix of each chinese character are divided into two types of pixel values, where the two types of pixel values refer to that the pixel values only include a pixel value a or a pixel value B. Specifically, the pixel value greater than or equal to 0.5 in the normalized pixel feature matrix may be taken as 1, and the pixel value less than 0.5 may be taken as 0, to establish a corresponding binarized pixel value feature matrix of each chinese character, where the original pixel value in the binarized pixel feature matrix of each chinese character only contains 0 or 1. After the binarization pixel value feature matrix of each Chinese character is established, chinese character combinations corresponding to the binarization pixel value feature matrix are used as standard Chinese character training samples. For example, in an image containing a word, a portion containing a word pixel and a portion containing a blank pixel. The pixel values on a word are typically darker in color, with a "1" in the binary pixel value feature matrix representing a portion of a word pixel and a "0" representing a portion of a blank pixel in the image. It can be understood that the feature representation of the Chinese characters can be further simplified by establishing the binarization pixel value feature matrix, each Chinese character can be represented and distinguished by only adopting the matrices of 0 and 1, the speed of processing the feature matrix of the Chinese characters by a computer can be increased, and the training efficiency of the Chinese character recognition model in the training specification can be further improved.
S101-S102 carry out normalization processing on Chinese character training samples to be processed and carry out classification of two types of values, obtain a binarization pixel value feature matrix of each Chinese character, and take characters corresponding to the binarization pixel value feature matrix of each Chinese character as standard Chinese character training samples, so that the time for training the standard Chinese character recognition model can be obviously shortened.
It can be understood that what is input to the bidirectional long-and-short-term memory neural network for training is actually each different binarization pixel feature matrix, and each binarization pixel feature matrix represents each corresponding Chinese character. The Chinese characters are respectively ordered in space and have the characteristics which can be reflected in the binary pixel characteristic matrix, so that the deep characteristics of the Chinese characters can be trained and learned from the perspective of the front-back correlation of the sequence on the binary pixel characteristic matrix by adopting the bidirectional long-time and short-time memory neural network.
In an embodiment, as shown in fig. 4, in step S10, training a bidirectional long-and-short term memory neural network by using a standard chinese character training sample, obtaining a forward output of the bidirectional long-and-short term memory neural network, updating a network parameter of the bidirectional long-and-short term memory neural network by using a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-and-short term memory neural network, and obtaining a standard chinese character recognition model specifically includes the following steps:
s111: the standard Chinese character training sample is input to the bidirectional long-time and short-time memory neural network in sequence forward direction to obtain forward output F o Inputting the standard Chinese character training sample into the bidirectional long-time and short-time memory neural network in sequence and reverse direction to obtain reverse output B o Adding the forward output and the backward output to obtain a forward output T o And is expressed as T o =F o +B o
The bidirectional long-and-short-term memory neural network model comprises an input layer, an output layer and a hidden layer. The hidden layer comprises an input gate, a forgetting gate, an output gate, a neuron state and a hidden layer output. Forgetting gates determine the information to discard in the state of the neuron. The input gate determines the information to be added in the neuron. The output gate determines the information to be output in the neuron. The neuron state determines the information discarded, added and output by each gate, and is specifically represented as the weight value connected with each gate. The hidden layer output determines the connection weight of the next layer (hidden layer or output layer) connected to the hidden layer. The network parameters of the bidirectional long-short time memory neural network model refer to weights and bias connected among neurons in the neural network model, and the network parameters (the weights and the bias) determine the properties of the network, so that the network has a memory function on a sequence, and data input into the bidirectional long-short time memory neural network is output correspondingly through calculation processing of the network parameters. The network parameters mentioned in this embodiment take the weight as an example, and the bias is the same as the method for updating the weight at the stage of updating the adjustment, and the bias is not described again.
In this embodiment, the normalized chinese character training sample is input to the bidirectional long-short term memory neural network for training, and the output values of the layers of the network are calculated respectively in the bidirectional long-short term memory neural network through response processing of network parameters, including calculating the output of the normalized chinese character training sample at the input gate, the forgetting gate, the output gate, and the neuron state (also called cell state, and the state of the hidden layer to which the neuron belongs is recorded and represented according to the neuron through a specially set neuron) of the hidden layer, and the hidden layer output. Specifically, three activation functions f (sigmoid), g (tanh) and h (softmax) are adopted for calculating output. The weight result can be converted into a classification result by adopting an activation function, and some nonlinear factors can be added into the neural network, so that the neural network can better solve the more complex problem.
The data received and processed by the neurons in the bidirectional long-short-time memory neural network comprises the following data: input canonical chinese training samples: x, neuronal status: and S. Furthermore, the following parameters are also mentioned: the input of the neuron is denoted by a and the output by b. Subscripts l, phi, and w denote input gate, forgetting gate, and output gate, respectively. t represents the time of day. The weights of the neuron connected with the input gate, the forgetting gate and the output gate are respectively recorded as w cl 、w And w 。S c Representing the state of the neuron. I denotes the number of neurons of the input layer, H denotes the number of neurons of the hidden layer, and C denotes the number of neurons corresponding to the neuron state (I denotes the I-th neuron of the input layer, H denotes the H-th neuron of the hidden layer, and C denotes the neuron corresponding to the C-th neuron state).
The input gate receives the input sample (input standard Chinese character training sample)
Figure BDA0001683880410000131
Output value b of the previous moment t-1 h And neuron state S at the last time t-1 c By connecting the input standard Chinese character training sample with the weight w of the input gate il Connecting the output value of the previous moment and the weight w of the input gate hl And a weight w connecting the neuron and the input gate cl According to the formula->
Figure BDA0001683880410000132
Calculate the output of the input door->
Figure BDA0001683880410000133
Acting an activation function f on->
Figure BDA0001683880410000134
By formula>
Figure BDA00016838804100001317
A scalar is obtained in the interval 0-1. This scalar controls the proportion of current information received by the neuron based on a composite determination of the current state and past states.
Forgetting to receive sample at current moment
Figure BDA0001683880410000136
Output value b of last moment t-1 h And status data S of the previous moment t-1 c Through connecting the input standard Chinese character training sample with the weight w of the forgetting gate The output value at the previous moment of connection and the weight w of the forgetting gate And weight w connecting neuron and forget gate According to the formula>
Figure BDA0001683880410000137
Calculates the output of the forgetting door>
Figure BDA0001683880410000138
Acting an activation function f on->
Figure BDA0001683880410000139
By formula>
Figure BDA00016838804100001310
A scalar in the interval of 0-1 is obtained, and the scalar controls the proportion of the forgotten past information which is judged by the neuron according to the combination of the current state and the past state.
Receiving a sample of a current time by a neuron
Figure BDA00016838804100001311
Output value b of last moment t-1 h And status data S of the previous moment t -1 c Weight w of standard Chinese training sample for connecting neuron and input ic Connecting the neuron with the weight w of the output value at the previous moment hc And the output scalar of the input gate and the forgetting gate based on the formula->
Figure BDA00016838804100001312
Figure BDA00016838804100001313
Calculating the neuron state at the current moment>
Figure BDA00016838804100001314
Wherein, it is based on>
Figure BDA00016838804100001315
Is selected by the term->
Figure BDA00016838804100001316
The state of the hidden layer is shown and is needed when the network parameters are updated.
The output gate receives the sample of the current time
Figure BDA0001683880410000141
Output value b of last moment t-1 h And the neuron state at the current time->
Figure BDA0001683880410000142
Through connecting input standard Chinese character training sample and weight w of output gate iw The output value at the previous moment is connected with the weight w of the output gate hw And the weight w connecting the neuron and the output gate cw According to the formula>
Figure BDA0001683880410000143
Counting the output of an output gate>
Figure BDA0001683880410000144
Acting an activation function f on->
Figure BDA0001683880410000145
Is based on the formula>
Figure BDA0001683880410000146
A scalar is obtained in the interval 0-1.
Hidden layer output
Figure BDA0001683880410000147
Based on the output of the output gate processed with the activation function->
Figure BDA0001683880410000148
And neuron state may be derived and formulated as >>
Figure BDA0001683880410000149
And (6) calculating. The output values of each layer of the long-time memory neural network model can be obtained through the calculation of the standard Chinese character training samples among each layer.
According to the calculation processing process, the output of each layer in the bidirectional long-time memory neural network can be calculated layer by layer, and the output value of the final output layer is obtained. Since the neural network is bi-directional, the output values include a forward output and a reverse output, respectively, with F o And B o Is shown (F) o I.e. Forward output, B o Namely Backward output), specifically, a standard Chinese character training sample is forwardly input into a bidirectional long-time and short-time memory neural network according to a sequence to obtain a forward output F o Inputting the standard Chinese character training samples into the bidirectional long-and-short-term memory neural network in sequence and reverse direction to obtain reverse output B o . It will be appreciated that assuming that the feature matrix has N columns, the sequence forward direction represents from column 1 to column N and the sequence reverse direction represents from column N to column 1. Output value of output layer, i.e. forward output T o (i.e., total output), outputting in the forward direction and outputting in the reverse directionThe forward output T can be obtained by adding and outputting o Is formulated as T o =F o +B o . The forward output shows the output obtained after the input standard Chinese character training sample is subjected to the response processing of the network parameters, and the error caused in the training process can be measured according to the forward output and the real result so as to update the network parameters according to the error.
S112: constructing an error function according to the forward output and the real result, wherein the expression of the error function is
Figure BDA00016838804100001410
Wherein N represents the total number of samples of the standard Chinese character training sample, x i Representing the forward output of the i-th training sample, y i Is represented by the formula i The corresponding real result of the ith training sample.
Wherein, the real result, i.e. the objective fact (also called label value), is used to calculate the error with the forward output.
In this embodiment, since the forward output obtained after the bidirectional long-short term memory neural network processes the standard chinese character training sample has an error with the real result, a corresponding error function may be constructed according to the error, so as to train the bidirectional long-short term memory neural network using the error function, and update the network parameters, so that the forward output that is the same as or more similar to the real result can be obtained when the updated network parameters process the input training sample. Specifically, an appropriate error function may be constructed according to actual conditions, and the error function constructed in this embodiment is
Figure BDA0001683880410000151
The error between the forward output and the real result can be better reflected.
S113: according to an error function, updating network parameters of a bidirectional long-time memory neural network by adopting a time-dependent back propagation algorithm based on random gradient descent to obtain a standard Chinese character recognition model, wherein the gradient output by a hidden layer is
Figure BDA0001683880410000152
A gradient of neuronal state of ^ 5>
Figure BDA0001683880410000153
The gradient of the input door is->
Figure BDA0001683880410000154
The gradient of the forgetting gate is->
Figure BDA0001683880410000155
The gradient of the output gate is->
Figure BDA0001683880410000156
The gradient of the hidden layer state is ^ h>
Figure BDA0001683880410000157
In this embodiment, after a suitable error function is constructed, the network parameters are updated by using a time-dependent back propagation algorithm based on stochastic gradient descent, and the updated bidirectional long-and-short-term memory neural network is used as a standard Chinese character recognition model. First defining the gradient of the hidden layer output
Figure BDA0001683880410000158
Is formulated as->
Figure BDA0001683880410000159
And determining the gradient of the state of the neuron
Figure BDA00016838804100001510
Is formulated as->
Figure BDA00016838804100001511
With these two gradients, the gradient of the input gate can be determined accordingly>
Figure BDA00016838804100001512
Gradient of forgetting door->
Figure BDA00016838804100001513
The gradient of the output door is greater or less than>
Figure BDA00016838804100001514
And a gradient of the hidden layer state->
Figure BDA00016838804100001515
The definition of the gradient of the hidden layer output and the gradient of the neuron state allows the calculation of the gradient of the hidden layer output>
Figure BDA00016838804100001516
And gradient of neuronal state
Figure BDA00016838804100001517
Can be based on>
Figure BDA00016838804100001518
And &>
Figure BDA00016838804100001519
Calculating to obtain: gradient of input gate
Figure BDA00016838804100001520
Gradient of forgetting door->
Figure BDA00016838804100001521
The gradient of the output door is greater or less than>
Figure BDA00016838804100001522
Gradient of hidden layer state->
Figure BDA00016838804100001523
The meaning of the parameters of the above formula can refer to step S111, and is not described herein again. After each gradient is obtained, when the weight is updated, the product of the gradient and the learning rate is subtracted from the original weight, and the updated weight is obtained.
Steps S111-S113 can be performed in both directions according to the standard chinese character training samplesForward output construction error function obtained by time memory neural network
Figure BDA0001683880410000161
And the network parameters are updated according to the error function in a back-propagation mode, so that a standard Chinese character recognition model can be obtained, deep features of a standard Chinese character training sample are learned by the model, and standard characters can be recognized accurately.
In an embodiment, as shown in fig. 5, in step S30, a Chinese handwritten character recognition model is adjusted to recognize a Chinese character sample to be tested, obtain an error word whose recognition result does not match the real result, and use all the error words as error word training samples, which specifically includes the following steps:
s31: and inputting the Chinese character sample to be tested into the adjusted Chinese handwritten character recognition model, and acquiring the output value of each character in the Chinese character sample to be tested in the adjusted Chinese handwritten character recognition model.
In this embodiment, the Chinese handwriting recognition model is adjusted to recognize a Chinese character sample to be tested, where the Chinese character sample to be tested includes a plurality of Chinese characters. In the Chinese character library, the number of commonly used Chinese characters is about three thousand, a probability value of the similarity degree of each character in the Chinese character library and an input Chinese character sample to be tested is set in an output layer for adjusting the Chinese character recognition model, the probability value is an output value of each character in the Chinese character sample to be tested in the Chinese character recognition model, and the probability value can be realized through a softmax function. In short, when inputting the word "me", the output value (expressed by probability) corresponding to each word in the Chinese character library is obtained in adjusting the Chinese character handwriting recognition model, for example, the output value corresponding to "me" in the Chinese character library is 99.5%, and the output values of the rest of the words are added up to 0.5%. By setting the Chinese character sample to be tested, the output value corresponding to each character in the Chinese character library after the Chinese character handwriting character recognition model is adjusted to recognize can obtain a reasonable recognition result according to the output value.
S32: and selecting the maximum output value in the output values corresponding to each character, and acquiring the recognition result of each character according to the maximum output value.
In this embodiment, the maximum output value of all the output values corresponding to each word is selected, and the recognition result of the word can be obtained according to the maximum output value. It can be understood that the output value directly reflects the similarity degree between the input word in the Chinese character sample to be tested and each word in the Chinese character library, and the maximum output value indicates that the word sample to be tested is closest to a certain word in the Chinese character library, and the word corresponding to the maximum output value can be the recognition result of the word, for example, the recognition result output at the end of inputting the word "i" is "i".
S33: and acquiring error words with the recognition result not consistent with the real result according to the recognition result, and taking all the error words as error word training samples.
In this embodiment, the obtained recognition result is compared with a real result (objective fact), and an error word whose comparison recognition result does not match the real result is used as an error word training sample. It can be understood that the recognition result is only the result of the Chinese character training sample to be tested in the process of adjusting the Chinese handwritten character recognition model, and is possibly different from the real result, which reflects that the model still has defects in recognition accuracy, and the defects can be optimized through the error character training sample to achieve more accurate recognition effect.
S31-S33, according to the output value of each character in the Chinese handwritten character recognition model in the Chinese character sample to be tested, selecting the maximum output value capable of reflecting the similarity degree between the characters from the output values; and obtaining a recognition result through the maximum output value, and obtaining an error word training sample according to the recognition result, thereby providing an important technical premise for further optimizing the recognition accuracy by using the error word training sample.
In an embodiment, before step S10, that is, before the step of obtaining the training samples of the normative Chinese characters, the handwriting model training method further includes the following steps: and initializing a bidirectional long-time memory neural network.
In one embodiment, initializing the bi-directional long and short term memory neural network initializes the network parameters of the network and assigns initial values to the network parameters. If the initialized weight is in a relatively gentle region of the error curved surface, the convergence speed of the bidirectional long-time memory neural network model training may be abnormally slow. The network parameters may be initialized to be evenly distributed over a relatively small interval having a mean value of 0, such as an interval of [ -0.30, +0.30 ]. The method has the advantages that the bidirectional long-and-short term memory neural network is initialized reasonably, so that the network has flexible adjusting capacity in the initial stage, the network can be adjusted effectively in the training process, the minimum value of an error function can be found quickly and effectively, the updating and the adjustment of the bidirectional long-and-short term memory neural network are facilitated, and the model obtained by model training based on the bidirectional long-and-short term memory neural network has an accurate recognition effect when the handwritten Chinese character is recognized.
In the handwriting model training method provided in this embodiment, the network parameters of the two-way long-short time memory neural network are initialized to be uniformly distributed in a relatively small interval with a 0-mean value, such as [ -0.30, +0.30 [)]In such an interval, the minimum value of the error function can be quickly and effectively found by adopting the initialization mode, and the updating and the adjustment of the bidirectional long-time and short-time memory neural network are facilitated. The Chinese character recognition method based on the binary pixel value feature matrix comprises the steps of carrying out normalization processing on a Chinese character training sample to be processed, carrying out classification on two types of values, obtaining the binary pixel value feature matrix, taking characters corresponding to the feature matrix as a standard Chinese character training sample, and being capable of obviously shortening the time length of training a standard Chinese character recognition model. Constructing an error function according to the forward output obtained by memorizing a neural network in two-way long and short time according to a standard Chinese character training sample
Figure BDA0001683880410000171
And the network parameters are updated according to the error function in a back-propagation mode, so that a standard Chinese character recognition model can be obtained, deep features of a standard Chinese character training sample are learned by the model, and standard characters can be recognized accurately. Then, the standard Chinese character recognition model is updated in an adjusting mode through the non-standard Chinese characters, so that the updated adjusted Chinese handwritten character recognition model learns the non-standard Chinese handwritten character through a training updating mode on the premise that the updated adjusted Chinese handwritten character recognition model has the capacity of recognizing the standard Chinese handwritten characterThe deep characteristics of the characters enable the Chinese handwriting recognition model to be adjusted to better recognize non-standard Chinese handwriting. And then, according to the output value of each character in the Chinese character samples to be tested in the Chinese handwritten character recognition model, selecting a maximum output value capable of reflecting the similarity degree between the characters from the output values, obtaining a recognition result by using the maximum output value, obtaining an error character training sample according to the recognition result, inputting all error characters serving as error character training samples into the Chinese handwritten character recognition model to be adjusted for training and updating, and obtaining a target Chinese handwritten character recognition model. By adopting the error word training sample, the adverse effects caused by over-learning and over-weakening generated in the original training process can be eliminated to a great extent, and the recognition accuracy can be further optimized. In addition, in the handwriting model training method provided by this embodiment, each model is trained by using a bidirectional long-and-short-term memory neural network, and the neural network can learn deep features of a word from the angles of the forward direction and the reverse direction of the sequence by combining sequence characteristics of the word, thereby realizing the function of recognizing different Chinese handwriting; the time-dependent back propagation algorithm based on random gradient is adopted in training for standardizing the Chinese character recognition model and adjusting the Chinese handwriting recognition model, and the training efficiency and the training effect are still better under the condition of large number of training samples. The target Chinese handwritten character recognition model adopts a time-dependent back propagation algorithm based on batch gradient descent during training, so that the parameters in the model can be fully updated, the parameters are comprehensively updated according to generated errors, and the recognition accuracy of the obtained model is improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 6 is a schematic block diagram of a handwriting model training apparatus corresponding to the handwriting model training method in one-to-one embodiment. As shown in fig. 6, the handwriting model training apparatus includes a standard chinese character recognition model obtaining module 10, an adjusted chinese character recognition model obtaining module 20, an erroneous character training sample obtaining module 30, and a target chinese character recognition model obtaining module 40. The implementation functions of the standard Chinese character recognition model obtaining module 10, the adjusted Chinese handwritten character recognition model obtaining module 20, the error character training sample obtaining module 30, and the target Chinese handwritten character recognition model obtaining module 40 correspond to the steps corresponding to the handwriting model training method in the embodiment one to one, and for avoiding redundancy, detailed description is not provided in this embodiment.
The standard Chinese character recognition model obtaining module 10 is configured to train a bidirectional long-and-short term memory neural network by using a standard Chinese character training sample, obtain a forward output of the bidirectional long-and-short term memory neural network, update a network parameter of the bidirectional long-and-short term memory neural network by using a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-and-short term memory neural network, and obtain a standard Chinese character recognition model.
The adjusted Chinese handwriting recognition model obtaining module 20 is configured to train a standard Chinese recognition model using an irregular Chinese training sample, obtain forward output of the standard Chinese recognition model, update network parameters of the standard Chinese recognition model using a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the standard Chinese recognition model, and obtain an adjusted Chinese handwriting recognition model.
The error character training sample obtaining module 30 is configured to identify a Chinese character sample to be tested by using the adjusted Chinese handwritten character recognition model, obtain error characters whose recognition results do not match the real results, and use all the error characters as error character training samples.
And the target Chinese handwritten character recognition model obtaining module 40 is used for training and adjusting the Chinese handwritten character recognition model by adopting the error character training sample, obtaining the forward output of the adjusted Chinese handwritten character recognition model, updating and adjusting the network parameters of the Chinese handwritten character recognition model by adopting a time-dependent back propagation algorithm based on batch gradient descent according to the forward output of the adjusted Chinese handwritten character recognition model, and obtaining the target Chinese handwritten character recognition model.
Preferably, the canonical Chinese character recognition model obtaining module 10 includes a normalized pixel value feature matrix obtaining unit 101, a canonical Chinese character training sample obtaining unit 102, a forward output obtaining unit 111, an error function constructing unit 112, and a canonical Chinese character recognition model obtaining unit 113.
A normalized pixel value feature matrix obtaining unit 101, configured to obtain a pixel value feature matrix of each Chinese character in a Chinese character training sample to be processed, and perform normalization processing on each pixel value in the pixel value feature matrix to obtain a normalized pixel value feature matrix of each Chinese character, where a formula of the normalization processing is
Figure BDA0001683880410000191
MaxValue is the maximum value of the pixel values in the pixel value characteristic matrix of each Chinese character, minValue is the minimum value of the pixel values in the pixel value characteristic matrix of each Chinese character, x is the pixel value before normalization, and y is the pixel value after normalization.
The canonical Chinese character training sample obtaining unit 102 is configured to divide pixel values in the normalized pixel value feature matrix of each Chinese character into two types of pixel values, establish a binarization pixel value feature matrix of each Chinese character based on the two types of pixel values, and combine the binarization pixel value feature matrices of each Chinese character as a canonical Chinese character training sample.
A forward output obtaining unit 111, configured to forward input the standard Chinese character training samples into the bidirectional long-and-short term memory neural network according to the sequence to obtain a forward output F o Inputting the standard Chinese character training samples into the bidirectional long-and-short-term memory neural network in sequence and reverse direction to obtain reverse output B o Adding the forward output and the backward output to obtain a forward output T o Is expressed as T o =F o +B o
An error function construction unit 112 for constructing an error function based on the forward output and the real result, the expression of the error function being
Figure BDA0001683880410000192
Where N represents the total number of training samples, x i Denotes the ithForward output of each training sample, y i Is represented by the formula i True result of the corresponding ith training sample.
A normalized Chinese character recognition model obtaining unit 113, configured to obtain a normalized Chinese character recognition model by updating network parameters of the bidirectional long-term memory neural network by using a time-dependent back propagation algorithm based on stochastic gradient descent according to the error function, where a gradient output by the hidden layer is
Figure BDA0001683880410000193
Gradient of neuronal state is
Figure BDA0001683880410000201
The gradient of the input door is->
Figure BDA0001683880410000202
The gradient of the forgetting gate is->
Figure BDA0001683880410000203
The gradient of the output gate is->
Figure BDA0001683880410000204
The gradient of the hidden layer state is ^ h>
Figure BDA0001683880410000205
Preferably, the error word training sample acquisition module 30 includes a model output value acquisition unit 31, a model recognition result acquisition unit 32, and an error word training sample acquisition unit 33.
The model output value obtaining unit 31 is configured to input the Chinese character sample to be tested to the adjusted Chinese handwritten character recognition model, and obtain an output value of each character in the Chinese character sample to be tested in the adjusted Chinese handwritten character recognition model.
The model identification result obtaining unit 32 is configured to select a maximum output value of the output values corresponding to each word, and obtain an identification result of each word according to the maximum output value.
And an error word training sample obtaining unit 33, configured to obtain, according to the recognition result, error words whose recognition result does not match the real result, and use all the error words as error word training samples.
Preferably, the handwriting model training device further comprises an initialization module 50 for initializing the bidirectional long-time and short-time memory neural network.
Fig. 7 shows a flowchart of the handwritten word recognition method in the present embodiment. The handwritten character recognition method can be applied to computer equipment configured by organizations such as banks, investments, insurance and the like, and is used for recognizing handwritten Chinese characters to achieve the purpose of artificial intelligence. As shown in fig. 7, the handwritten word recognition method includes the steps of:
s50: the method comprises the steps of obtaining a Chinese character to be recognized, recognizing the Chinese character to be recognized by adopting a target Chinese handwritten character recognition model, and obtaining an output value of the Chinese character to be recognized in the target Chinese handwritten character recognition model, wherein the target Chinese handwritten character recognition model is obtained by adopting the handwriting model training method.
The Chinese characters to be recognized refer to the Chinese characters to be recognized.
In this embodiment, a Chinese character to be recognized is obtained, the Chinese character to be recognized is input into the target Chinese handwritten character recognition model for recognition, an output value of the Chinese character to be recognized in the target Chinese handwritten character recognition model is obtained, one Chinese character to be recognized corresponds to more than three thousand output values (the specific number is based on the Chinese character library), and a recognition result of the Chinese character to be recognized can be determined based on the output value. Specifically, the Chinese character to be recognized is represented by a binary pixel value feature matrix which can be directly recognized by a computer.
S60: and acquiring a target probability output value according to the output value and a preset Chinese semantic word library, and acquiring a recognition result of the Chinese character to be recognized based on the target probability output value.
The preset Chinese semantic word library is a preset word library which describes semantic relations among Chinese words based on word frequency. For example, in the Chinese semantic word library, for the words of two words such as "X Yang", the probability of occurrence of "Sun" is 30.5%, the probability of occurrence of "Dayang" is 0.5%, and the sum of the probabilities of occurrence of the remaining words of two words such as "X Yang" is 69%. The target probability output value is a probability value which is obtained by combining the output value with a preset Chinese semantic word bank and is used for obtaining the recognition result of the Chinese character to be recognized.
Specifically, the step of obtaining the target probability output value by using the output value and a preset Chinese semantic word library comprises the following steps: (1) Selecting the maximum value of the output values corresponding to each character in the Chinese characters to be recognized as a first probability value, and acquiring a preliminary recognition result of the Chinese characters to be recognized according to the first probability value. (2) And acquiring the left semantic probability value and the right semantic probability value of the word to be identified according to the initial identification result and the Chinese semantic word library. It is understood that for a text, the words in the text are sequential, such as "red X positive", and for the "X" word, there are probability values corresponding to the words "red X" and "X positive" in the left-to-right directions, i.e. left semantic probability value and right semantic probability value. (3) And respectively setting a weight of an output value corresponding to each character in the Chinese characters to be recognized, a weight of a left semantic probability value and a weight of a right semantic probability value. Specifically, a weight of 0.4 may be assigned to an output value corresponding to each word in the Chinese character to be recognized, a weight of 0.3 may be assigned to the left semantic probability value, and a weight of 0.3 may be assigned to the right semantic probability value. (4) And multiplying the set weights by the corresponding probability values respectively to obtain the probability values after the weighted operation, adding the probability values after the weighted operation to obtain target probability output values (the target probability output values are multiple, and the specific number can be based on a Chinese character library), and selecting a character corresponding to the maximum value in the target probability output values as the recognition result of the Chinese character to be recognized. In fact, the first 5 probability values with the largest value in the output values can be selected first, the first 5 probability values represent the most possible 5 characters (recognition results), and only the 5 characters are combined with the Chinese semantic word library to calculate the target probability output value, so that only 5 target probability output values are obtained, and the recognition efficiency can be greatly improved. By combining the output value with a preset Chinese semantic word library, an accurate recognition result can be obtained. It can be understood that for the recognition of a single word (non-text), the corresponding recognition result can be obtained directly according to the maximum value in the output values, and the recognition based on the Chinese semantic meaning is not required to be added.
And S50-S60, recognizing the Chinese character to be recognized by adopting the target Chinese handwritten character recognition model, and acquiring a recognition result of the Chinese character to be recognized by combining the output value and a preset Chinese semantic word bank. The target Chinese handwritten character recognition model has high recognition accuracy, and the recognition accuracy of Chinese handwriting is further improved by combining the Chinese semantic word library.
In the handwritten character recognition method provided by the embodiment of the invention, the Chinese character to be recognized is input into the target Chinese handwritten character recognition model for recognition, and a recognition result is obtained by combining a preset Chinese semantic word library. When the target Chinese handwritten character recognition model is adopted to recognize the Chinese handwritten character, an accurate recognition result can be obtained.
Fig. 8 shows a functional block diagram of a handwritten word recognition apparatus in one-to-one correspondence with the handwritten word recognition method in the embodiment. As shown in fig. 8, the handwritten word recognition apparatus includes an output value acquisition module 60 and a recognition result acquisition module 70. The implementation functions of the output value obtaining module 60 and the recognition result obtaining module 70 correspond to the steps corresponding to the handwritten word recognition method in the embodiment one by one, and for avoiding redundancy, a detailed description is not provided in this embodiment.
The handwritten character recognition device comprises an output value acquisition module 60, which is used for acquiring Chinese characters to be recognized, recognizing the Chinese characters to be recognized by adopting a target Chinese handwritten character recognition model and acquiring the output values of the Chinese characters to be recognized in the target Chinese handwritten character recognition model; the target Chinese handwritten character recognition model is obtained by adopting a handwriting model training method.
And the recognition result obtaining module 70 is configured to obtain a target probability output value according to the output value and a preset chinese semantic word library, and obtain a recognition result of the chinese character to be recognized based on the target probability output value.
The present embodiment provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the handwriting model training method in the embodiments is implemented, and for avoiding repetition, details are not repeated here. Alternatively, the computer program, when executed by the processor, implements the functions of each module/unit of the handwriting model training apparatus in the embodiments, and is not described herein again to avoid redundancy. Alternatively, the computer program is executed by the processor to implement the functions of the steps in the handwritten character recognition method in the embodiments, and is not repeated here to avoid repetition. Alternatively, the computer program is executed by the processor to implement the functions of the modules/units in the handwritten character recognition apparatus in the embodiments, which are not described herein again to avoid repetition.
Fig. 9 is a schematic diagram of a computer device provided by an embodiment of the invention. As shown in fig. 9, the computer device 80 of this embodiment includes: a processor 81, a memory 82, and a computer program 83 stored in the memory 82 and capable of running on the processor 81, where the computer program 83 is executed by the processor 81 to implement the handwriting model training method in the embodiment, and details are not repeated herein to avoid repetition. Alternatively, the computer program is executed by the processor 81 to implement the functions of each model/unit in the handwriting model training apparatus in the embodiment, which are not repeated herein to avoid repetition. Alternatively, the computer program is executed by the processor 81 to implement the functions of the steps in the handwritten character recognition method in the embodiments, and is not repeated here to avoid repetition. Alternatively, the computer program realizes the functions of each module/unit in the handwritten word recognition apparatus in the embodiments when executed by the processor 81. To avoid repetition, it is not repeated herein.
The computing device 80 may be a desktop computer, a notebook, a palm top computer, a cloud server, or other computing device. The computer device may include, but is not limited to, a processor 81, a memory 82. Those skilled in the art will appreciate that fig. 9 is merely an example of a computing device 80 and is not intended to limit computing device 80 and may include more or fewer components than those shown, or some of the components may be combined, or different components, e.g., the computing device may also include input output devices, network access devices, buses, etc.
The Processor 81 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 82 may be an internal storage unit of the computer device 80, such as a hard disk or a memory of the computer device 80. The memory 82 may also be an external storage device of the computer device 80, such as a plug-in hard disk provided on the computer device 80, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 82 may also include both internal storage units and external storage devices of the computer device 80. The memory 82 is used to store computer programs and other programs and data required by the computer device. The memory 82 may also be used to temporarily store data that has been output or is to be output.
It should be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional units and modules is only used for illustration, and in practical applications, the above function distribution may be performed by different functional units and modules as needed, that is, the internal structure of the apparatus may be divided into different functional units or modules to perform all or part of the above described functions.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The above-mentioned embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein.

Claims (10)

1. A handwriting model training method is characterized by comprising the following steps:
acquiring a standard Chinese character training sample, training a bidirectional long-and-short term memory neural network by using the standard Chinese character training sample, acquiring the forward output of the bidirectional long-and-short term memory neural network, updating the network parameters of the bidirectional long-and-short term memory neural network by using a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-and-short term memory neural network, and acquiring a standard Chinese character recognition model;
acquiring an irregular Chinese character training sample, training the regular Chinese character recognition model by adopting the irregular Chinese character training sample, acquiring the forward output of the regular Chinese character recognition model, updating the network parameters of the regular Chinese character recognition model by adopting a time-dependent back propagation algorithm based on random gradient descent according to the forward output of the regular Chinese character recognition model, and acquiring an adjusted Chinese handwritten character recognition model;
acquiring a Chinese character sample to be tested, adopting the adjusted Chinese handwritten character recognition model to recognize the Chinese character sample to be tested, acquiring error characters with recognition results not consistent with real results, and taking all the error characters as error character training samples;
and training the adjusted Chinese handwritten character recognition model by adopting the error character training sample, acquiring forward output of the adjusted Chinese handwritten character recognition model, updating and adjusting network parameters of the Chinese handwritten character recognition model by adopting a time-dependent back propagation algorithm based on batch gradient descent according to the forward output of the adjusted Chinese handwritten character recognition model, and acquiring a target Chinese handwritten character recognition model.
2. The handwriting model training method according to claim 1, wherein said obtaining canonical chinese character training samples comprises:
acquiring a pixel value feature matrix of each Chinese character in a Chinese character training sample to be processed, and performing normalization processing on each pixel value in the pixel value feature matrix to acquire a normalized pixel value feature matrix of each Chinese character, wherein the normalization processing formula is
Figure QLYQS_1
MaxValue is the maximum value of the pixel values in the pixel value characteristic matrix of each Chinese character, minValue is the minimum value of the pixel values in the pixel value characteristic matrix of each Chinese character, x is the pixel value before normalization, and y is the pixel value after normalization;
dividing pixel values in the normalized pixel value feature matrix of each Chinese character into two types of pixel values, establishing a binarization pixel value feature matrix of each Chinese character based on the two types of pixel values, and combining the binarization pixel feature matrix of each Chinese character to serve as a standard Chinese character training sample.
3. The handwriting model training method according to claim 1, wherein said training bidirectional long-short term memory neural network using said normative Chinese character training sample, obtaining the forward output of the bidirectional long-short term memory neural network, updating the network parameters of the bidirectional long-short term memory neural network using a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-short term memory neural network, obtaining normative Chinese character recognition model, comprises:
the standard Chinese character training samples are input into a bidirectional long-time and short-time memory neural network in a sequence forward direction to obtain a forward output F o Inputting the standard Chinese character training sample into a bidirectional long-time and short-time memory neural network in sequence and reverse direction to obtain reverse output B o Adding the forward output and the backward output to obtain a forward output T o Is expressed as T o =F o +B o
Constructing an error function from said forward output and said true resultThe expression of the error function is
Figure QLYQS_2
Where N represents the total number of training samples, x i Representing the forward output of the i-th training sample, y i Is represented by the formula i The real result of the corresponding ith training sample;
according to the error function, updating network parameters of a bidirectional long-time memory neural network by adopting a time-dependent back propagation algorithm based on random gradient descent to obtain a standard Chinese character recognition model, wherein the gradient output by a hidden layer is
Figure QLYQS_5
A gradient of neuronal state of ^ 5>
Figure QLYQS_6
The gradient of the input door is->
Figure QLYQS_15
Forgetting gate gradient is->
Figure QLYQS_9
The gradient of the output gate is->
Figure QLYQS_13
Gradient of hidden layer state being->
Figure QLYQS_8
Wherein K represents the number of output layer neurons, K represents the kth output layer neuron, H represents the number of hidden layer neurons, H represents the H-th hidden layer neuron, C represents the number of neurons corresponding to the neuron state, w ck Representing the connection weights, w, of neurons and kth output layer neurons ch Represents the connection weights of neurons and h hidden layer neurons, < >>
Figure QLYQS_16
Representing output layer neurons at the current timeThe gradient of (a) is determined,
Figure QLYQS_7
represents the gradient of hidden layer neurons at the next moment in time,. Sup.>
Figure QLYQS_12
Controlling the ratio of neuron output current information, based on the comparison of the neuron's current information and the measured value>
Figure QLYQS_3
Controlling the ratio of the forgotten information of the neuron to be greater or smaller>
Figure QLYQS_17
Representing the state of the neuron at the current time, w cl Weight, w, representing the connection of the neuron to the input gate Weight, w, representing the connection of neuron and forget gate cw Weights representing the connection of a neuron to an output gate, or>
Figure QLYQS_10
Indicates that the c-th neuron state at the present time corresponds to input to a neuron, based on the predicted neural state>
Figure QLYQS_11
Indicates input of the input door, and>
Figure QLYQS_14
represents the input of a forgetting door, and>
Figure QLYQS_18
indicates the input of the output gate, and>
Figure QLYQS_4
the proportion of the current information received by the neuron is controlled.
4. The handwriting model training method of claim 1, wherein said recognizing a Chinese character sample to be tested by using the adjusted Chinese handwriting recognition model, obtaining an error word whose recognition result does not match the true result, and using all the error words as error word training samples comprises:
inputting a Chinese character sample to be tested into an adjusted Chinese handwritten character recognition model, and acquiring an output value of each character in the Chinese character sample to be tested in the adjusted Chinese handwritten character recognition model;
selecting the maximum output value in the output values corresponding to each word, and acquiring the identification result of each word according to the maximum output value;
and acquiring error words with the recognition result not consistent with the real result according to the recognition result, and taking all the error words as error word training samples.
5. The handwriting model training method according to claim 1, wherein before the step of obtaining canonical chinese character training samples, the handwriting model training method further comprises:
and initializing a bidirectional long-time memory neural network.
6. A method for handwritten word recognition, comprising:
acquiring a Chinese character to be recognized, recognizing the Chinese character to be recognized by adopting a target Chinese handwritten character recognition model, and acquiring an output value of the Chinese character to be recognized in the target Chinese handwritten character recognition model; the target Chinese handwritten character recognition model is obtained by adopting the handwriting model training method of any one of claims 1 to 5;
and acquiring a target probability output value according to the output value and a preset Chinese semantic word library, and acquiring the recognition result of the Chinese character to be recognized based on the target probability output value.
7. A handwriting model training apparatus, comprising:
the standard Chinese character recognition model acquisition module is used for acquiring a standard Chinese character training sample, training a bidirectional long-time and short-time memory neural network by adopting the standard Chinese character training sample, acquiring the forward output of the bidirectional long-time and short-time memory neural network, updating the network parameters of the bidirectional long-time and short-time memory neural network by adopting a time-dependent back propagation algorithm based on stochastic gradient descent according to the forward output of the bidirectional long-time and short-time memory neural network, and acquiring a standard Chinese character recognition model;
an adjusting Chinese handwriting character recognition model obtaining module, which is used for obtaining an nonstandard Chinese character training sample, adopting the nonstandard Chinese character training sample to train the standard Chinese character recognition model, obtaining the forward output of the standard Chinese character recognition model, updating the network parameters of the standard Chinese character recognition model by adopting a time-dependent back propagation algorithm based on random gradient descent according to the forward output of the standard Chinese character recognition model, and obtaining an adjusting Chinese handwriting character recognition model;
the error character training sample acquisition module is used for acquiring a Chinese character sample to be tested, adopting the adjusted Chinese handwriting character recognition model to recognize the Chinese character sample to be tested, acquiring error characters with recognition results not consistent with real results, and taking all the error characters as error character training samples;
and the target Chinese handwritten character recognition model acquisition module is used for training the adjusted Chinese handwritten character recognition model by adopting the error character training sample, acquiring the forward output of the adjusted Chinese handwritten character recognition model, updating and adjusting the network parameters of the Chinese handwritten character recognition model by adopting a time-dependent back propagation algorithm based on batch gradient descent according to the forward output of the adjusted Chinese handwritten character recognition model, and acquiring the target Chinese handwritten character recognition model.
8. A handwritten word recognition device, comprising:
the system comprises an output value acquisition module, a target Chinese handwritten character recognition module and a recognition module, wherein the output value acquisition module is used for acquiring Chinese characters to be recognized, recognizing the Chinese characters to be recognized by adopting a target Chinese handwritten character recognition model and acquiring the output value of the Chinese characters to be recognized in the target Chinese handwritten character recognition model; the target Chinese handwritten character recognition model is obtained by adopting the handwriting model training method of any one of claims 1-5;
and the recognition result acquisition module is used for acquiring a target probability output value according to the output value and a preset Chinese semantic word library and acquiring a recognition result of the Chinese character to be recognized based on the target probability output value.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the handwriting model training method according to any of claims 1 to 5 when executing the computer program; alternatively, the processor when executing the computer program performs the steps of the method for handwriting recognition as claimed in claim 6.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the handwriting model training method according to any one of claims 1 to 5; alternatively, the processor realizes the steps of the method for handwriting recognition according to claim 6 when executing the computer program.
CN201810563507.6A 2018-06-04 2018-06-04 Handwriting model training method, handwritten character recognition method, device, equipment and medium Active CN109086651B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810563507.6A CN109086651B (en) 2018-06-04 2018-06-04 Handwriting model training method, handwritten character recognition method, device, equipment and medium
PCT/CN2018/094249 WO2019232856A1 (en) 2018-06-04 2018-07-03 Handwriting model training method, handwritten character recognition method and apparatus, and device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810563507.6A CN109086651B (en) 2018-06-04 2018-06-04 Handwriting model training method, handwritten character recognition method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN109086651A CN109086651A (en) 2018-12-25
CN109086651B true CN109086651B (en) 2023-04-18

Family

ID=64839355

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810563507.6A Active CN109086651B (en) 2018-06-04 2018-06-04 Handwriting model training method, handwritten character recognition method, device, equipment and medium

Country Status (2)

Country Link
CN (1) CN109086651B (en)
WO (1) WO2019232856A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113807430B (en) * 2021-09-15 2023-08-08 网易(杭州)网络有限公司 Model training method, device, computer equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101785030A (en) * 2007-08-10 2010-07-21 微软公司 Hidden markov model based handwriting/calligraphy generation
CN107316054A (en) * 2017-05-26 2017-11-03 昆山遥矽微电子科技有限公司 Non-standard character recognition methods based on convolutional neural networks and SVMs

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102024139A (en) * 2009-09-18 2011-04-20 富士通株式会社 Device and method for recognizing character strings
US20150317336A1 (en) * 2014-04-30 2015-11-05 Hewlett-Packard Development Company, L.P. Data reconstruction
CN105184226A (en) * 2015-08-11 2015-12-23 北京新晨阳光科技有限公司 Digital identification method, digital identification device, neural network training method and neural network training device
CN107844740A (en) * 2017-09-05 2018-03-27 中国地质调查局西安地质调查中心 A kind of offline handwriting, printing Chinese character recognition methods and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101785030A (en) * 2007-08-10 2010-07-21 微软公司 Hidden markov model based handwriting/calligraphy generation
CN107316054A (en) * 2017-05-26 2017-11-03 昆山遥矽微电子科技有限公司 Non-standard character recognition methods based on convolutional neural networks and SVMs

Also Published As

Publication number Publication date
WO2019232856A1 (en) 2019-12-12
CN109086651A (en) 2018-12-25

Similar Documents

Publication Publication Date Title
CN108764195B (en) Handwriting model training method, handwritten character recognition method, device, equipment and medium
CN109086653B (en) Handwriting model training method, handwritten character recognition method, device, equipment and medium
CN109086654B (en) Handwriting model training method, text recognition method, device, equipment and medium
CN109002461B (en) Handwriting model training method, text recognition method, device, equipment and medium
CN109034280B (en) Handwriting model training method, handwriting character recognition method, device, equipment and medium
CN110472675B (en) Image classification method, image classification device, storage medium and electronic equipment
CN108985442B (en) Handwriting model training method, handwritten character recognition method, device, equipment and medium
JP2022141931A (en) Method and device for training living body detection model, method and apparatus for living body detection, electronic apparatus, storage medium, and computer program
EP3620982B1 (en) Sample processing method and device
CN111738351A (en) Model training method and device, storage medium and electronic equipment
US11868440B1 (en) Statistical model training systems
CN111222638A (en) Network anomaly detection method and device based on neural network
CN111652264B (en) Negative migration sample screening method based on maximum mean value difference
CN108985151B (en) Handwriting model training method, handwritten character recognition method, device, equipment and medium
CN109034279B (en) Handwriting model training method, handwriting character recognition method, device, equipment and medium
CN110490306A (en) A kind of neural metwork training and object identifying method, device and electronic equipment
CN111079837A (en) Method for detecting, identifying and classifying two-dimensional gray level images
CN108496174B (en) Method and system for face recognition
CN109086651B (en) Handwriting model training method, handwritten character recognition method, device, equipment and medium
US20210365719A1 (en) System and method for few-shot learning
CN111507396B (en) Method and device for relieving error classification of unknown class samples by neural network
CN111401440A (en) Target classification recognition method and device, computer equipment and storage medium
Lim et al. More powerful selective kernel tests for feature selection
CN116109853A (en) Task processing model training method, task processing method, device and equipment
CN112183336A (en) Expression recognition model training method and device, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant