[go: up one dir, main page]

CN108764195B - 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
CN108764195B
CN108764195B CN201810564062.3A CN201810564062A CN108764195B CN 108764195 B CN108764195 B CN 108764195B CN 201810564062 A CN201810564062 A CN 201810564062A CN 108764195 B CN108764195 B CN 108764195B
Authority
CN
China
Prior art keywords
chinese
chinese character
training
character
recognition model
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
CN201810564062.3A
Other languages
Chinese (zh)
Other versions
CN108764195A (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 CN201810564062.3A priority Critical patent/CN108764195B/en
Priority to PCT/CN2018/094193 priority patent/WO2019232847A1/en
Publication of CN108764195A publication Critical patent/CN108764195A/en
Application granted granted Critical
Publication of CN108764195B publication Critical patent/CN108764195B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/22Character recognition characterised by the type of writing
    • G06V30/226Character recognition characterised by the type of writing of cursive writing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

Landscapes

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

Abstract

本发明公开了一种手写模型训练方法、手写字识别方法、装置、设备及介质。该手写模型训练方法包括:获取规范中文字训练样本,初始化卷积神经网络,将所述规范中文字训练样本输入到卷积神经网络中进行训练,采用基于随机梯度下降的后向传播算法更新卷积神经网络的权值和偏置,获取规范中文字识别模型;获取并采用非规范中文字训练样本,训练获取调整中文手写字识别模型;获取并采用待测试中文字样本得到出错字训练样本;基于批量梯度下降的后向传播算法,采用出错字训练样本更新中文手写字识别模型的权值和偏置,获取目标中文手写字识别模型。采用该手写模型训练方法,能够得到识别手写字识别率高的目标中文手写字识别模型。

Figure 201810564062

The invention discloses a handwriting model training method, a handwriting character recognition method, a device, a device and a medium. The handwriting model training method includes: obtaining standardized Chinese character training samples, initializing a convolutional neural network, inputting the standardized Chinese character training samples into the convolutional neural network for training, and updating the convolutional neural network using a backpropagation algorithm based on stochastic gradient descent. Acquire the weight and bias of the neural network to obtain a standardized Chinese character recognition model; obtain and use non-standard Chinese character training samples to train and adjust the Chinese handwritten character recognition model; obtain and use the Chinese character samples to be tested to obtain error word training samples; Based on the backpropagation algorithm of batch gradient descent, the weight and bias of the Chinese handwritten character recognition model are updated by using the wrong word training samples to obtain the target Chinese handwritten character recognition model. By adopting the handwriting model training method, a target Chinese handwritten character recognition model with a high recognition rate of handwritten characters can be obtained.

Figure 201810564062

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 character recognition method mostly comprises the steps of binarization processing, character segmentation, feature extraction, support vector machine and the like, and when the traditional handwritten character recognition method is adopted to recognize comparatively illegible non-standard characters (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 the accuracy is low 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 pixel value characteristic matrix of each Chinese character in a Chinese character training sample to be processed by adopting an optical character recognition technology;
acquiring a standard Chinese character training sample based on a pixel value feature matrix of each Chinese character in a Chinese character training sample to be processed;
initializing a convolutional neural network;
inputting the standard Chinese character training sample into a convolutional neural network for training, updating the weight and the bias of the convolutional neural network by adopting a back propagation algorithm based on random gradient descent, and acquiring a standard Chinese character recognition model;
acquiring an irregular Chinese character training sample, inputting the irregular Chinese character training sample into the standard Chinese character recognition model for training, updating the weight and the bias of the standard Chinese character recognition model by adopting a back propagation algorithm based on random gradient descent, and acquiring an adjusted Chinese handwriting 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 inputting the error word training sample into the adjusted Chinese handwritten word recognition model for training, updating and adjusting the weight and the bias of the Chinese handwritten word recognition model by adopting a back propagation algorithm based on batch gradient descent, and obtaining a target Chinese handwritten word recognition model.
A handwriting model training apparatus, comprising:
the pixel value feature matrix acquisition module is used for acquiring a pixel value feature matrix of each Chinese character in a Chinese character training sample to be processed by adopting an optical character recognition technology;
the standard Chinese character training sample acquisition module is used for acquiring a standard Chinese character training sample based on a pixel value feature matrix of each Chinese character in the Chinese character training sample to be processed;
the initialization module is used for initializing the convolutional neural network;
the standard Chinese character recognition model acquisition module is used for inputting the standard Chinese character training sample into a convolutional neural network for training, updating the weight and the bias of the convolutional neural network by adopting a back propagation algorithm based on random gradient descent, and acquiring a standard Chinese character recognition model;
an acquisition module for adjusting the Chinese handwriting recognition model, which is used for acquiring an irregular Chinese character training sample, inputting the irregular Chinese character training sample into the standard Chinese character recognition model for training, updating the weight and the bias of the standard Chinese character recognition model by adopting a back propagation algorithm based on random gradient descent, and acquiring the adjusted Chinese handwriting 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 inputting the error character training sample into the adjusted Chinese handwritten character recognition model for training, updating the weight and the bias of the adjusted Chinese handwritten character recognition model by adopting a back propagation algorithm based on batch gradient descent, and acquiring 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 handwritten character recognition media, 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 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;
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, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the handwritten word recognition method.
In the handwriting model training method, device, equipment and medium provided by the embodiment of the invention, the optical character recognition technology is adopted to obtain the pixel value characteristic matrix of each Chinese character in the Chinese character training sample to be processed, and the standard Chinese character training sample is obtained based on the pixel value characteristic matrix of each Chinese character in the Chinese character training sample to be processed, and can be directly recognized and read by a computer. And then initializing the convolutional neural network, which is beneficial to improving the training efficiency of the neural network. And then training by adopting a standard Chinese character training sample based on a back propagation algorithm with random gradient descent and obtaining a standard Chinese character recognition model, wherein the standard Chinese character recognition model has the capacity of recognizing standard Chinese handwriting. And then based on a back propagation algorithm with random gradient descent, the regulated Chinese character recognition model is updated in an adjustable manner through the non-regulated Chinese characters, so that the regulated Chinese character recognition model obtained after updating learns deep features of the handwritten Chinese characters in a training and updating manner on the premise of having the capability of recognizing standard and standard characters, and the regulated Chinese character recognition model can better recognize the handwritten Chinese characters. And then, recognizing a Chinese character sample to be tested by adopting the adjusted Chinese character handwriting recognition model, acquiring error characters with recognition results not consistent with real results, inputting all the error characters serving as error character training samples into the adjusted Chinese character handwriting recognition model for training and updating, updating the weight and the offset of the adjusted Chinese character handwriting recognition model by adopting a back propagation algorithm based on batch gradient descent, and acquiring a target Chinese character handwriting 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 Chinese character recognition model is normalized and the Chinese handwriting recognition model is adjusted by adopting a backward 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 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.
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 characters, accurate recognition results 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 S20 in FIG. 2;
FIG. 4 is a detailed flowchart of step S40 in FIG. 2;
FIG. 5 is a detailed flowchart of step S60 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 computer device according to an embodiment of the 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, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope 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 flow chart of a handwriting model training method in the embodiment of the present invention, where the handwriting model training method includes the following steps:
s10: and acquiring a pixel value characteristic matrix of each Chinese character in the Chinese character training sample to be processed by adopting an optical character recognition technology.
The Optical Character Recognition technology (OCR) refers to converting characters on an image into computer-editable Character contents, and a to-be-processed Chinese Character training sample refers to an initially-obtained and unprocessed training sample. The pixel value feature matrix is a matrix that uses pixel values as features and is expressed in a matrix manner.
In this embodiment, an OCR technology is adopted to perform operations such as positioning, segmentation, feature extraction, and the like on characters on an image, and obtain a pixel value feature matrix of each character in a training sample of characters to be processed, where the pixel value feature matrix can be directly read and recognized by a computer, and can extract pixel value features of the training sample of characters to be processed, and represent the extracted pixel value features by using a matrix.
S20: and acquiring a standard Chinese character training sample based on the pixel value characteristic matrix of each Chinese character in the Chinese character training sample to be processed.
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 or the like, and a regular script or a song script is selected as a common font), and the character in the Chinese character training sample to be processed belongs to the standard character.
In this embodiment, based on the pixel value feature matrix of each Chinese character in the Chinese character training samples to be processed, a standard Chinese character training sample for training a convolutional neural network is obtained, so as to improve the efficiency of network training. The standard Chinese character training sample is obtained from a standard character belonging to a Chinese character font such as a regular script, a song script or an clerical script, and the song script is taken as an example for explanation in the embodiment. 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 listed in the standard characters.
S30: a convolutional neural network is initialized.
In one embodiment, initializing a convolutional neural network comprises: make the weight value initialized by the convolution neural network satisfy the formula
Figure BDA0001684045510000051
Wherein n is l Represents the number of samples of training samples input at the l-th layer, S () represents a variance operation, W l Represents the weight of the l-th layer, is>
Figure BDA0001684045510000052
Denoted arbitrary, l denotes the l-th layer in a convolutional neural network.
The Convolutional Neural Network (CNN) is a feed-forward Neural Network, and its artificial neurons can respond to peripheral units in a part of coverage range, and can perform image processing and recognition. The convolutional Neural network is mainly different from a general Deep Neural Network (DNN) in that the convolutional Neural network includes a convolutional layer and a pooling layer, which provides an important technical support for the convolutional Neural network to process and identify images with texts.
The convolutional neural network comprises the weight and the bias of the connection of each neuron between each layer, and the weight and the bias determine the recognition effect of the convolutional neural network.
In this embodiment, the convolutional neural network is initialized, and the initialization operation is to set initial values of weights and biases in the convolutional neural network. Specifically, let C l The convolution of the l-th layer in the convolutional neural network of (1), C is known from the properties of the convolutional neural network l =W l x l +b l Wherein W is l Represents the weight, x, of the l-th layer l Training samples for initialization representing the l-th layer input, b l Indicating the bias of the l-th layer. Then C is l The variance of (C) can be found to be S (C) l )=n l S(W l x l ) Where S () represents a variance operation, n l The number of samples of the training samples input at the l-th layer is represented. When the convolutional neural network is trained, the average value of the weight values is too large, which may result in too large gradient, and the minimum value of the error function cannot be found effectively, so that if the weight value W is set to satisfy the average value 0, C is described above l The variance expression of (C) can be further written as S (C) l )=n l S(W l )E((x l ) 2 ) Where E () represents the mathematically expected operation.
In particular, the convolutional layer in the convolutional neural network uses a recirculation (Rectified Linear Unit, which is called Linear rectification function) as an activation function, which is also called a modified Linear Unit, and is a commonly used activation function in an artificial neural network, and usually refers to a nonlinear function represented by a ramp function and a variant thereof. X can be derived from the activation function ReLU l =ReLU(C l-1 ) And
Figure BDA0001684045510000061
substituting these two equations into C l Variance expression of (C) l )=n l S(W l )E((x l ) 2 ) Get->
Figure BDA0001684045510000062
During the training of the convolutional neural network, the variance should be kept consistent as much as possible, so that the problem that the gradient convergence is too fast or too slow due to the fact that the variance becomes larger and smaller in the training process cannot be caused, and therefore the problem that the minimum value of the error function cannot be found effectively or the training speed is too slow can not be caused. Therefore, in order to keep the variance consistent, it is based on the above equation @>
Figure BDA0001684045510000063
It can be known that the weights should beSatisfy +>
Figure BDA0001684045510000064
Figure BDA0001684045510000065
Representing arbitrary, the weights of the convolutional neural network can be set accordingly according to the formula. The offset may be set to a smaller value at initial setup, such as in the interval [ -0.3,0.3]In the meantime.
The convolutional neural network is initialized reasonably, so that the network has flexible adjustment capability 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 convolutional neural network are facilitated, and the model obtained by model training based on the convolutional neural network has accurate recognition effect when Chinese handwriting recognition is carried out.
S40: and inputting the standard Chinese character training sample into a convolutional neural network for training, updating the weight and the bias of the convolutional neural network by adopting a back propagation algorithm based on random gradient descent, and obtaining a standard Chinese character recognition model.
The random Gradient Descent (SGD for short) is a processing method for acquiring an error generated by each training sample in a training process when updating a network parameter, and randomly adopting the error generated by a single sample in the training process for multiple times to update the network parameter. A Back Propagation algorithm (BP algorithm for short) is a training and learning method in neural network learning, and is used to adjust the weight and bias between nodes in the neural network. When the weight and the bias in the neural network are adjusted by using the back propagation algorithm, the minimum value of the error function needs to be obtained, and in the embodiment, the minimum value of the error function is specifically obtained by using a processing method of random gradient descent.
In this embodiment, the standard chinese character training samples are input to the convolutional neural network for training, and the weight and bias of the convolutional neural network are updated by using a back propagation algorithm based on stochastic gradient descent, so as to obtain a standard chinese character recognition model. The standard Chinese character recognition model learns deep characteristics of a standard Chinese character training sample in a training process, so that the model can accurately recognize standard characters and has the recognition capability of 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.
S50: acquiring an irregular Chinese character training sample, inputting the irregular Chinese character training sample into a standard Chinese character recognition model for training, updating the weight and the bias of the standard Chinese character recognition model by adopting a backward propagation algorithm based on random gradient descent, and acquiring and adjusting the Chinese handwritten character 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 this embodiment, the server obtains an irregular chinese character training sample, where the training sample includes characteristics of a handwritten chinese character, inputs the irregular chinese character training sample into a standard chinese character recognition model for training and adjustment, and updates a weight and an offset of the standard chinese character recognition model by using a back propagation algorithm based on stochastic gradient descent to obtain an adjusted chinese character handwriting recognition model. It will be appreciated that the canonical Chinese character recognition model has the ability to recognize standard canonical Chinese characters, but does not have high recognition accuracy when recognizing handwritten Chinese characters. 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.
The convolutional neural network judges according to the pixel distribution of the character when recognizing the character, the handwritten Chinese character in real life has a difference with the standard character, but the difference is much smaller than the difference of the handwritten Chinese character and the standard character which does not correspond to the standard character, for example, the difference between the pixel distribution of the handwritten Chinese character and the pixel distribution of the standard character is much smaller than the difference between the pixel distribution of the handwritten Chinese character and the pixel distribution of the standard character. It can be considered that even if there is a certain difference between the handwritten Chinese character and the corresponding standard character, the difference is much smaller than that of the standard character 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 handwriting character adjusting recognition model is obtained by convolutional neural network training, combines the deep characteristics of standard characters and handwritten Chinese characters, and can effectively recognize the handwritten Chinese characters according to the deep characteristics.
For steps S40 and S50, the back propagation algorithm based on stochastic gradient descent is used to update the error back propagation, so that model training can be performed smoothly even if the number of training samples is large, and the efficiency and effect of network training can be improved, so that training is more effective.
It should be noted that the order of step S40 and step S50 in this embodiment is not interchangeable, and step S40 is executed first and then step S50 is executed. The convolutional neural network is trained by adopting the standard Chinese training sample, so that the obtained standard Chinese character recognition model has better recognition capability, and has accurate recognition result on the standard character. The fine tuning of the step S50 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 S50 is executed first or only step S50 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" at the beginning, 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.
S60: obtaining a Chinese character sample to be tested, adopting an adjusted Chinese character handwriting recognition model to recognize the Chinese character sample to be tested, obtaining error characters of which the recognition results do not accord with the 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 S40 (because each character corresponding to the fonts such as regular script, song script and the like is uniquely determined); the handwritten Chinese characters used may be different from the handwritten Chinese characters used for training in step S50 (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 for training in step S50 and avoid the situation of over-fitting of model training, the handwritten Chinese characters different from step S50 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 influenced by both the normalized Chinese character training samples and the non-normalized Chinese character training samples, on the premise that the network parameters (weight and offset) are updated by the normalized Chinese character training samples, and then the network parameters (weight and offset) are updated by the non-normalized Chinese character training samples, the obtained adjusted Chinese handwritten character recognition model can be caused to excessively learn the characteristics of the non-normalized Chinese character training samples, so that the obtained adjusted Chinese handwritten character recognition model has very high recognition accuracy on the non-normalized Chinese character training samples (including handwritten Chinese characters), but excessively learns the characteristics of the non-normalized Chinese character samples, and influences the recognition accuracy of the handwritten Chinese characters except the non-normalized Chinese character training samples, therefore, the step S60 adopts the Chinese character samples to be tested to recognize the adjusted Chinese handwritten character recognition model, and can greatly eliminate the excessive learning of the non-normalized Chinese character training samples adopted 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.
S70: and inputting the error word training sample into the adjusted Chinese handwritten word recognition model for training, and updating the weight and the bias of the adjusted Chinese handwritten word recognition model by adopting a back propagation algorithm based on batch gradient descent to obtain a target Chinese handwritten word recognition model.
In this embodiment, the training samples of the erroneous character are input to the adjusted chinese handwritten character recognition model for training, and the training samples of the erroneous character reflect the problem of inaccurate recognition when the adjusted chinese handwritten character recognition model recognizes handwritten chinese characters other than the non-standard chinese handwritten character training samples due to the fact that the characteristics of the non-standard chinese character training samples are over-learned when the adjusted chinese handwritten character recognition model is trained. Moreover, due to the fact that the standard Chinese character training samples are adopted firstly and then the non-standard Chinese character training samples are adopted to train the model, the characteristics of the originally learned standard characters can be weakened excessively, and therefore the 'frame' which is initially built 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 backward propagation algorithm based on batch gradient descent is adopted when the error character training sample is adopted for training, the weight and the bias 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), errors generated by all error word training samples during convolutional neural network training can be updated in a back propagation mode based on batch gradient descent, the fact that all generated errors can adjust and update the network is guaranteed, the convolutional neural network can be trained comprehensively, and the recognition accuracy of a target Chinese handwritten word recognition model is improved.
It should be noted that, in this embodiment, steps S40 and S50 adopt a back propagation algorithm based on random gradient descent; step S70 employs a back propagation algorithm based on batch gradient descent.
In step S40, the process of updating the weight and bias of the convolutional neural network by using the back propagation algorithm based on stochastic gradient descent specifically includes the following steps:
acquiring 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 convolutional neural network to obtain each corresponding forward output, calculating an error between each forward output and a corresponding label value (real result), and correspondingly performing gradient descent back propagation once each error is acquired, and updating the weight and the bias of the network. Repeating the process of calculating each error and adopting each error to update the weight and the bias of the network until the error is less than the iteration stop threshold epsilon 1 And ending the circulation to obtain the updated weight and bias to obtain the standard Chinese character recognition model.
The process of updating the weight and the bias of the convolutional neural network by adopting the back propagation algorithm based on the stochastic gradient descent in the step S50 is similar to the process of the step S40, and is not described again here.
In step S70, the process of updating the weight and the bias of the convolutional neural network by using the back propagation algorithm based on the batch gradient descent specifically includes the following steps:
obtaining a binarization pixel value characteristic matrix corresponding to one training sample in error word training samples, inputting the binarization pixel value characteristic matrix into an adjusted Chinese handwritten word recognition model (essentially also a convolutional neural network) to obtain forward output, calculating the error between the forward output and a real result, obtaining and sequentially inputting the binarization pixel value characteristic matrices corresponding to the rest training samples into the adjusted Chinese handwritten word recognition model, calculating the error between the corresponding forward output and the real result, accumulating the errors to obtain the total error of the adjusted Chinese handwritten word recognition model for the error word training samples, adopting the total error to perform one-time gradient-descent-based back propagation, and updating the weight and bias of the networkRepeating the above processes of calculating total error and updating weight and bias of network by using total error until the error is less than stop iteration threshold epsilon 2 And then ending the circulation to obtain the updated weight and bias, thus obtaining the target Chinese handwritten character recognition model.
It can be understood that, for steps S40 and S50, because the number of training samples used for model training is huge, if a 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 effective training. The efficiency and effect of network training can be improved by adopting a back propagation algorithm based on random gradient descent to update error back propagation, so that the training is more effective.
In step S70, the error word training samples have a small sample capacity (fewer error words), and the back propagation algorithm based on batch gradient descent can update the back propagation of all errors generated by the error word training samples during the convolutional neural network training, so that it is ensured that all errors generated can adjust and update the network, and the convolutional neural network can be trained comprehensively. Compared with a back propagation algorithm based on random gradient descent, the back propagation algorithm based on batch gradient descent is standard in gradient and can train a convolutional neural network comprehensively; 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 parameters 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 back propagation algorithm based on batch gradient descent, so that a target Chinese handwritten character recognition model obtained by training has accurate recognition capability.
In steps S10-S70, an optical character recognition technology is adopted to obtain a pixel value feature matrix of each Chinese character in the Chinese character training sample to be processed, and a standard Chinese character training sample is obtained based on the pixel value feature matrix of each Chinese character in the Chinese character training sample to be processed, wherein the standard Chinese character training sample can be directly recognized and read by a computer. And then initializing the convolutional neural network, which is favorable for improving the training efficiency of the neural network. The method is characterized in that a standard Chinese character training sample is adopted for training and acquiring a standard Chinese character recognition model, and then the standard Chinese character recognition model is updated in an adjusting mode through non-standard Chinese characters, so that the adjusted Chinese handwritten character recognition model acquired after updating learns deep features of 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 excessive learning and excessive weakening generated in the original training process can be eliminated to a great extent, and the recognition accuracy can be further optimized. The training of the standard Chinese character recognition model and the adjustment of the Chinese character handwriting recognition model adopt a backward propagation algorithm based on random gradient descent, and a better training effect can still be achieved under the condition of a large number of training samples. The Chinese handwritten character recognition model of the training target adopts a back propagation algorithm based on batch gradient descent, the parameters in the model can be fully updated by adopting the batch gradient descent, errors generated by the training sample in the training process are updated in a back propagation mode, 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 S20, the method for obtaining a standard chinese character training sample based on a pixel value feature matrix of each chinese character in a chinese character training sample to be processed specifically includes the following steps:
s21: acquiring a pixel value characteristic matrix of each Chinese character in a Chinese character training sample to be processed, and carrying out normalization processing on each pixel value in the pixel value characteristic matrix to acquire a normalized pixel value characteristic matrix of each Chinese character, wherein the formula of the normalization processing is
Figure BDA0001684045510000121
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.
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, the normalization processing mode is adopted to compress the pixel value feature matrix of each Chinese character in the same range interval, so that the calculation related to the pixel value feature matrix can be accelerated, and the training efficiency of the Chinese character recognition model in the training specification can be improved.
S22: 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 pixel values that 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 character can be further simplified by establishing the binary pixel value feature matrix, each Chinese character can be represented and distinguished only by adopting the matrices of 0 and 1, the speed of processing the feature matrix of the Chinese character by a computer can be increased, and the training efficiency of the Chinese character recognition model in the training specification can be further improved.
S21-S22, normalization processing is carried out on Chinese character training samples to be processed, binary pixel value feature matrixes of each Chinese character are obtained, characters corresponding to the binary pixel value feature matrixes of each Chinese character are used as standard Chinese character training samples, and the time for training the standard Chinese character recognition model can be shortened remarkably.
In an embodiment, as shown in fig. 4, in step S40, the standard chinese character training sample is input into the convolutional neural network for training, and the weight and bias of the convolutional neural network are updated by using a back propagation algorithm based on stochastic gradient descent, so as to obtain a standard chinese character recognition model, which specifically includes the following steps:
s41: and inputting the standard Chinese character training sample into the convolutional neural network, and obtaining the forward output of the standard Chinese character training sample in the convolutional neural network.
The convolutional neural network is a feed-forward neural network, and artificial neurons of the convolutional neural network can respond to peripheral units in a part of coverage range and can perform image processing and identification. Convolutional neural networks generally comprise at least two nonlinear trainable convolutional layers, at least two nonlinear pooling layers and at least one fully-connected layer, i.e. comprising at least five hidden layers, in addition to an input layer and an output layer.
In this embodiment, the standard chinese character training sample is input to the convolutional neural network for training, and after each layer of the convolutional neural network is processed by the standard chinese character training sample (specifically, the response processing of the weight and the offset to the standard chinese character training sample), a corresponding processed output value is obtained at each layer of the convolutional neural network. Because convolutional neural networks contain a large number of layers and the functions of the layers are different, the outputs of the layers are different.
Specifically, if the first layer is a convolutional layer, the output of the convolutional layer can be represented as a l =σ(z l )=σ(a l-1 *W l +b l ) Wherein a is l Represents the output of the l-th layer, z l Representing the output before processing with an activation function, a l-1 Represents the output of the l-1 layer (i.e., the output of the previous layer), σ represents the activation function (the activation function σ used for the convolutional layer is ReLU, which is more effective than other activation functions), and W represents the convolution operation l Represents the weight of the l-th layer, b l Indicating the bias of the l-th layer. If the l-th layer is a pooling layer, the output of the pooling layer may be represented as a l =pool(a l-1 ) Wherein pool refers to a down-sampling calculation, and the down-sampling calculation can select a method of maximum pooling, and the maximum pooling actually is to take the maximum value in n × n samples as a sample value after sampling. In addition to maximum pooling, average pooling is also commonly used, i.e., taking the average of each sample taken over n × n samples as the sampled sample value. If the l-th layer is a full-connection layer, the output of the full-connection layer is calculated in the same way as the output of the traditional deep neural network, and the formula is expressed as a l =σ(z l )=σ(W l a l-1 +b l ) The meaning of the parameters is the same as the above-mentioned explanation, and the description thereof is omitted. In particular, for the output layer L, the activation function σ is a softmax function, and the formula for calculating the output of the output layer L is a L =softmax(z l )=softmax(W L a L-1 +b L ). According to the calculation formula of each layer of the convolutional neural network, the output of each layer of the convolutional neural network can be obtained, and finally the output a of the output layer is obtained L The output is the forward output. Understandably, the forward output obtained in step S111The output condition of the standard Chinese character training sample in the convolutional neural network can be reflected, and the output condition can be compared with objective facts (real results) so as to adjust the convolutional neural network according to errors between the output condition and the objective facts.
S42: constructing an error function according to the forward output and the real result, wherein the expression of the error function is
Figure BDA0001684045510000141
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 corresponding real result of the ith training sample.
The real result is an objective fact, for example, if the input word is a regular script "too", the result of the forward output may be other results such as "big", and the real result is the original input "too", and the real result may be understood as a label value of the training sample for calculating an error with the forward output.
In this embodiment, because the forward output obtained after the convolutional neural network processes the standard chinese character training sample is erroneous with the real result, a corresponding error function may be constructed according to the error, so as to train the convolutional neural network using the error function, and update the weight and the bias, so that the forward output that is the same as or more similar to the real result can be obtained when the updated weight and the bias 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 BDA0001684045510000142
The error between the forward output and the real result can be better reflected.
S43: according to the error function, updating the weight and the bias of the convolutional neural network by adopting a back propagation algorithm based on random gradient descent to obtain a standard Chinese character recognition model, wherein in a full-connection layer of the convolutional neural network, the formula for updating the weight is as follows
Figure BDA0001684045510000143
In the convolution layer of the convolution neural network, the formula for updating the weight is as follows
Figure BDA0001684045510000144
W l ' represents the updated weight, W l Representing the weight before updating, alpha representing the learning rate, m representing the standard Chinese character training sample, i representing the ith input Chinese character sample, delta i,l Indicating the sensitivity of the input ith Chinese character sample at the l layer, a i,l-1 The method comprises the steps of representing the output of an input ith Chinese character sample on the l-1 layer, wherein T represents matrix transposition operation, x represents convolution operation, and rot180 represents operation of turning a matrix by 180 degrees; at the fully-connected layer of the convolutional neural network, the formula for updating the bias is ≥>
Figure BDA0001684045510000145
At the convolution layer of the convolutional neural network, the formula for updating the bias is
Figure BDA0001684045510000146
b l ' denotes an updated bias, b l Represents the bias before update, alpha represents the learning rate, m represents the canonical Chinese training sample, i represents the ith input Chinese sample, delta i,l And (u, v) represents the sensitivity of the input ith Chinese character sample in the ith layer, and refers to the position of a small block in each convolution feature map obtained when the convolution operation is carried out.
In this embodiment, after a suitable error function is constructed, a back propagation algorithm based on stochastic gradient descent is used to update network parameters, and the updated convolutional neural network is used as a standard chinese character recognition model. Specifically, in the backward propagation process, because each layer of the convolutional neural network has a large difference, the network parameters should be updated by performing backward propagation according to the actual condition of each layer. In the process of back propagation, firstly, the weight and the bias of the updated output layer are calculated, the error function is adopted to respectively calculate the bias derivative of the weight W and the bias b, a common factor can be obtained,i.e. the sensitivity delta of the output layer L (L represents an output layer) with the sensitivity δ L The sensitivity δ of the first layer can be sequentially obtained l According to delta l And obtaining the gradient of the l layer in the neural network, and updating the weight and the offset of the convolutional neural network by utilizing the gradient. Specifically, if the current is a fully connected layer, then
Figure BDA0001684045510000151
Wherein, W l+1 Represents the weight of l +1 layer, T represents the matrix transposition operation, delta l+1 Represents the sensitivity of layer l +1, is present>
Figure BDA0001684045510000152
Representing the operation of multiplication of corresponding elements of two matrices (Hadamard product), sigma representing the activation function, z l Representing the output before processing with no activation function in the calculation of forward propagation. If the current is a convolutional layer, then
Figure BDA0001684045510000153
Wherein, denotes convolution operation, rot180 denotes operation of inverting the matrix by 180 degrees, and the meanings of the rest parameters in the formula refer to the content explained by the above parameter meanings, which is not described herein again. If it is currently the pooling level, then->
Figure BDA0001684045510000154
upsample represents an upsampling operation. Calculating corresponding sensitivity delta according to each layer of the convolutional neural network l According to the sensitivity delta l The weights and biases for layer l are updated. The pooling layer has no weight and offset, so the weight and offset of the fully-connected layer and the convolutional layer only need to be updated.
Specifically, in step S43, if the current layer is the full connection layer, the formula for updating the weight is expressed as
Figure BDA0001684045510000155
Wherein, W l ' represents the updated weight, W l Representing the weight before updating, alpha representing the learning rate, m representing the standard Chinese character training sample, i tableIndicating the ith Chinese character sample of the input, delta i,l Indicating the sensitivity of the input ith Chinese character sample at the l layer, a i,l-1 Represents the output of the ith Chinese character sample at the l-1 level, T represents the matrix transposition operation, and/or the judgment of the rank of the sample>
Figure BDA0001684045510000156
I.e. the gradient of the layer l weight W; the formula for updating the bias is expressed as +>
Figure BDA0001684045510000157
b l ' denotes an updated bias, b l Representing the bias before updating alpha represents the learning rate, m represents the standard Chinese character training sample, i represents the ith input Chinese character sample, delta i,l Indicating the sensitivity of the input ith Chinese character sample at the l layer. If the current is convolution layer, the formula for updating the weight is ^ 4>
Figure BDA0001684045510000161
The formula for updating the bias is
Figure BDA0001684045510000162
Wherein, (u, v) refers to the position of a small block (an element constituting the convolution feature map) in each convolution feature map obtained when the convolution operation is performed. And correspondingly updating the weight and the bias of each layer in the convolutional neural network by adopting a back propagation algorithm of random gradient descent to obtain a standard Chinese character recognition model.
Steps S41-S43 can construct an error function from the forward output obtained from the convolutional neural network of the canonical chinese character training sample
Figure BDA0001684045510000163
And updating the weight and the bias according to the error function in a back-propagation manner, 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 S60, recognizing a chinese character sample to be tested by using an adjusted chinese handwritten character recognition model, obtaining an error word whose recognition result does not match the real result, and using all the error words as error word training samples, specifically includes the following steps:
s61: 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.
S62: 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".
S63: and acquiring error words with the recognition result not in accordance 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.
S61-S63, 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 the handwriting model training method provided by this embodiment, an optical character recognition technology is used to obtain a pixel value feature matrix of each Chinese character in a Chinese character training sample to be processed, and a standard Chinese character training sample is obtained based on the pixel value feature matrix of each Chinese character in the Chinese character training sample to be processed, and the standard Chinese character training sample can be directly recognized and read by a computer. According to the formula
Figure BDA0001684045510000171
Initializing weights of convolutional neural network by using smaller values such as interval [ -0.3,0.3]And initializing the bias, wherein 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 convolutional neural network are facilitated. Normalizing the Chinese character training sample to be processed, dividing the two types of values to obtain a binary pixel value characteristic matrix, and dividing the characteristic matrixThe characters corresponding to the matrix are used as standard Chinese character training samples, and the time for training the standard Chinese character recognition model can be obviously shortened. Constructing an error function based on the forward output of the normalized Chinese character training sample obtained by the convolutional neural network>
Figure BDA0001684045510000172
And the weight and the bias are updated in a back-propagation manner according to the error function, 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. And then, the standard Chinese character recognition model is updated in an adjusting way through the non-standard Chinese characters, so that the deep features of the non-standard Chinese characters can be learned through a training and updating way on the premise that the updated adjusted Chinese character recognition model has the capacity of recognizing the standard Chinese characters, and the adjusted Chinese character recognition model can better recognize the non-standard Chinese characters. And then, according to the output value of each character in the Chinese handwritten character recognition model 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 excessive learning and excessive 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 the embodiment, a backward propagation algorithm based on random gradient is adopted during training for standardizing the Chinese character recognition model and adjusting the Chinese character handwriting recognition model, so that the training efficiency and the training effect are still better under the condition of a large number of training samples. The target Chinese handwritten character recognition model adopts a back propagation algorithm based on batch gradient descent during training, can ensure the full update of parameters in the model, carries out back propagation update on errors generated by a training sample in the training process, and comprehensively carries out back propagation update according to the generated errorsAnd updating the parameters and improving the identification accuracy of the obtained model.
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 pixel value feature matrix obtaining module 10, a normative chinese character training sample obtaining module 20, an initialization module 30, a normative chinese character recognition model obtaining module 40, an adjusted chinese character handwriting recognition model obtaining module 50, an error character training sample obtaining module 60, and a target chinese character recognition model obtaining module 70. The implementation functions of the pixel value feature matrix obtaining module 10, the normative Chinese character training sample obtaining module 20, the initialization module 30, the normative Chinese character recognition model obtaining module 40, the adjusted Chinese handwritten character recognition model obtaining module 50, the error character training sample obtaining module 60, and the target Chinese handwritten character recognition model obtaining module 70 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 needed in this embodiment.
The pixel value feature matrix obtaining module 10 is configured to obtain a pixel value feature matrix of each chinese character in a chinese character training sample to be processed by using an optical character recognition technology.
And a standard Chinese character training sample obtaining module 20, configured to obtain a standard Chinese character training sample based on a pixel value feature matrix of each Chinese character in the Chinese character training sample to be processed.
And an initialization module 30 for initializing the convolutional neural network.
And the standard Chinese character recognition model acquisition module 40 is used for inputting the standard Chinese character training samples into the convolutional neural network for training, updating the weight and the bias of the convolutional neural network by adopting a back propagation algorithm based on random gradient descent, and acquiring a standard Chinese character recognition model.
And the adjusted Chinese handwriting recognition model obtaining module 50 is used for obtaining the non-standard Chinese character training sample, inputting the non-standard Chinese character training sample into the standard Chinese character recognition model for training, updating the weight and the bias of the standard Chinese character recognition model by adopting a backward propagation algorithm based on random gradient descent, and obtaining the adjusted Chinese handwriting recognition model.
The error word training sample obtaining module 60 is configured to obtain a Chinese word sample to be tested, identify the Chinese word sample to be tested by using the adjusted Chinese handwriting recognition model, obtain error words with a recognition result not matching the real result, and use all the error words as error word training samples.
And a target Chinese handwritten character recognition model obtaining module 70, configured to input the error character training sample into the adjusted Chinese handwritten character recognition model for training, update the weight and bias of the adjusted Chinese handwritten character recognition model by using a batch gradient descent-based back propagation algorithm, and obtain the target Chinese handwritten character recognition model.
Preferably, the canonical chinese training sample acquisition module 20 includes a normalized pixel value feature matrix acquisition unit 21 and a canonical chinese training sample acquisition unit 22.
A normalized pixel value feature matrix obtaining unit 21, 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 BDA0001684045510000191
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 normalized Chinese character training sample obtaining unit 22 is configured to divide the pixel values in the normalized pixel value feature matrix of each Chinese character into two types of pixel values, establish a binarized pixel value feature matrix of each Chinese character based on the two types of pixel values, and combine the binarized pixel value feature matrices of each Chinese character as the normalized Chinese character training sample.
Preferably, the initialization module 30 is configured to initialize the convolutional neural network, wherein the initialized weights of the convolutional neural network satisfy the formula
Figure BDA0001684045510000192
n l Represents the number of training samples input at the l-th layer, S () represents a variance operation, W l Represents the weight of the l-th layer, is>
Figure BDA0001684045510000193
Denoted arbitrary, l denotes the l-th layer in a convolutional neural network.
Preferably, the canonical chinese character recognition model acquisition module 40 includes a forward output acquisition unit 41, an error function construction unit 42, and a canonical chinese character recognition model acquisition unit 43.
A forward output obtaining unit 41, configured to input the standard chinese character training sample into the convolutional neural network, and obtain a forward output of the standard chinese character training sample in the convolutional neural network.
An error function construction unit 42 for constructing an error function based on the forward output and the real result, the expression of the error function being
Figure BDA0001684045510000194
Where n represents the total number of training samples, x i Represents 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.
A normalized Chinese character recognition model obtaining unit 43, configured to obtain a normalized Chinese character recognition model by updating the weight and the bias of the convolutional neural network according to the error function by using a back propagation algorithm based on stochastic gradient descent, where in a full connection layer of the convolutional neural network, a formula for updating the weight is
Figure BDA0001684045510000201
Convolution in a convolutional neural networkLayer, update formula of weight is->
Figure BDA0001684045510000202
W l ' represents the updated weight, W l Representing the weight before updating, alpha representing the learning rate, m representing the standard Chinese character training sample, i representing the ith input Chinese character sample, delta i,l Indicating the sensitivity of the input ith Chinese character sample at the l layer, a i,l-1 The method comprises the steps of representing the output of an input ith Chinese character sample on the l-1 layer, wherein T represents matrix transposition operation, x represents convolution operation, and rot180 represents operation of turning a matrix by 180 degrees; at the fully-connected layer of the convolutional neural network, the formula for updating the bias is ≥>
Figure BDA0001684045510000203
At the convolutional layer of the convolutional neural network, the formula for updating the bias is ≥>
Figure BDA0001684045510000204
b l ' denotes an updated bias, b l Represents the bias before update, alpha represents the learning rate, m represents the canonical Chinese training sample, i represents the ith input Chinese sample, delta i,l And (u, v) represents the sensitivity of the input ith Chinese character sample in the ith layer, and refers to the position of a small block in each convolution feature map obtained when the convolution operation is carried out.
Preferably, the error word training sample acquisition module 60 includes a model output value acquisition unit 61, a model recognition result acquisition unit 62, and an error word training sample acquisition unit 63.
The model output value obtaining unit 61 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 62 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 63, 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.
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:
s80: 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, wherein the target Chinese handwritten character recognition model is acquired by adopting the handwriting model training method.
Wherein, the Chinese character to be recognized refers to the Chinese character 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.
S90: 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 words of two words such as "yang X", the probability of occurrence of "sun" is 30.5%, the probability of occurrence of "yang" is 0.5%, and the sum of the probabilities of occurrence of the remaining words of two words such as "yang X", such as "sun pride" is 69%. The target probability output value is a probability value for acquiring a recognition result of the Chinese character to be recognized by combining the output value and a preset Chinese semantic word library.
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) And selecting the maximum value in the output values corresponding to each character in the Chinese characters to be recognized as a first probability value, and acquiring the primary 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 word 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 directly obtained according to the maximum value in the output values, and the recognition based on Chinese semantics is not required to be added.
And S80-S90, recognizing the Chinese character to be recognized by adopting a 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 library. 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 arrangement in one-to-one correspondence with the handwritten word recognition method in an embodiment. As shown in fig. 8, the handwritten word recognition apparatus includes an output value acquisition module 80 and a recognition result acquisition module 90. The implementation functions of the output value obtaining module 80 and the recognition result obtaining module 90 correspond to the steps corresponding to the handwritten character recognition method in the embodiment one by one, and for avoiding repeated descriptions, detailed descriptions are not provided in this embodiment.
The handwritten character recognition device comprises an output value acquisition module 80, 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 acquisition module 90 is configured to acquire a target probability output value according to the output value and a preset chinese semantic word library, and acquire 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 herein 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 apparatus 100 of this embodiment includes: the handwriting training method includes a processor 101, a memory 102, and a computer program 103 stored in the memory 102 and capable of running on the processor 101, where the computer program 103 implements the handwriting training method in the embodiment when executed by the processor 101, and details are not repeated herein to avoid repetition. Alternatively, the computer program is executed by the processor 101 to implement the functions of each model/unit in the handwriting model training apparatus in the embodiment, which are not described herein again to avoid repetition. Alternatively, the computer program is executed by the processor 101 to implement the functions of the steps in the handwritten character recognition method in the embodiment, and is not repeated here to avoid repetition. Alternatively, the computer program realizes the functions of the modules/units in the handwritten word recognition apparatus in the embodiments when executed by the processor 101. To avoid repetition, it is not repeated herein.
The computing device 100 may be a desktop computer, a notebook, a palm top computer, a cloud server, or other computing devices. The computer device may include, but is not limited to, a processor 101, a memory 102. Those skilled in the art will appreciate that fig. 9 is merely an example of a computing device 100 and is not intended to limit the computing device 100 and that it may include more or less 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 101 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 102 may be an internal storage unit of the computer device 100, such as a hard disk or a memory of the computer device 100. The memory 102 may also be an external storage device of the computer device 100, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc., provided on the computer device 100. Further, the memory 102 may also include both internal storage units and external storage devices of the computer device 100. The memory 102 is used for storing computer programs and other programs and data required by the computer device. The memory 102 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned 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 for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will 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, comprising:
acquiring a pixel value characteristic matrix of each Chinese character in a Chinese character training sample to be processed by adopting an optical character recognition technology;
acquiring a standard Chinese character training sample based on a pixel value feature matrix of each Chinese character in a Chinese character training sample to be processed;
initializing a convolutional neural network;
inputting the standard Chinese character training sample into a convolutional neural network for training, updating the weight and the bias of the convolutional neural network by adopting a back propagation algorithm based on random gradient descent, and acquiring a standard Chinese character recognition model;
acquiring an irregular Chinese character training sample, inputting the irregular Chinese character training sample into the regular Chinese character recognition model for training, updating the weight and the bias of the regular Chinese character recognition model by adopting a back propagation algorithm based on random gradient descent, and acquiring an adjusted Chinese handwriting 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 inputting the error word training sample into the adjusted Chinese handwritten word recognition model for training, and updating the weight and the bias of the adjusted Chinese handwritten word recognition model by adopting a back propagation algorithm based on batch gradient descent to obtain a target Chinese handwritten word recognition model.
2. The handwriting model training method according to claim 1, wherein said obtaining a canonical chinese character training sample based on the pixel value feature matrix of each chinese character in the chinese character training samples to be processed 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 inputting said standard chinese character training sample into a convolutional neural network for training, updating the weight and bias of the convolutional neural network by using a back propagation algorithm based on stochastic gradient descent, and obtaining a standard chinese character recognition model comprises:
inputting a standard Chinese character training sample into a convolutional neural network, and acquiring the forward output of the standard Chinese character training sample in the convolutional neural network;
constructing an error function according to the forward output and the real result, wherein the 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 x i The real result of the corresponding ith training sample;
according to the error function, a back propagation algorithm based on random gradient descent is adoptedObtaining a standard Chinese character recognition model by the weight and the bias of the new convolutional neural network, wherein the formula for updating the weight at the full connection layer of the convolutional neural network is as follows
Figure QLYQS_3
In the convolution layer of the convolution neural network, the formula for updating the weight is as follows
Figure QLYQS_4
W l' Represents the updated weight, W l Representing the weight before updating, alpha representing the learning rate, m representing the standard Chinese character training sample, i representing the ith input Chinese character sample, delta i,l Indicating the sensitivity of the input ith Chinese character sample at the l layer, a i,l-1 The method comprises the steps of representing the output of an input ith Chinese character sample on the l-1 layer, wherein T represents matrix transposition operation, x represents convolution operation, and rot180 represents operation of turning a matrix by 180 degrees; at a fully connected layer of the convolutional neural network, the formula for updating bias is ≥>
Figure QLYQS_5
At the convolutional layer of the convolutional neural network, the formula for updating the bias is ≥>
Figure QLYQS_6
b l’ Representing updated bias, b l Represents the bias before update, alpha represents the learning rate, m represents the canonical Chinese training sample, i represents the ith input Chinese sample, delta i,l And (u, v) represents the sensitivity of the input ith Chinese character sample in the ith layer, and refers to the position of a small block in each convolution feature map obtained when the convolution operation is carried out.
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 of the output values corresponding to each word, and acquiring the recognition 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 initializing the convolutional neural network comprises:
make the weight value initialized by the convolution neural network satisfy the formula
Figure QLYQS_7
Wherein n is l Represents the number of samples of training samples input at the l-th layer, S () represents a variance operation, W l Represents the weight of the l-th layer, is>
Figure QLYQS_8
Representing arbitrary, l represents the l-th layer in a convolutional 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-5;
and acquiring a target probability output value according to the output value and a preset Chinese semantic word bank, 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 pixel value characteristic matrix acquisition module is used for acquiring a pixel value characteristic matrix of each Chinese character in a Chinese character training sample to be processed by adopting an optical character recognition technology;
the standard Chinese character training sample acquisition module is used for acquiring a standard Chinese character training sample based on a pixel value feature matrix of each Chinese character in the Chinese character training sample to be processed;
the initialization module is used for initializing the convolutional neural network;
the standard Chinese character recognition model acquisition module is used for inputting the standard Chinese character training sample into a convolutional neural network for training, updating the weight and the bias of the convolutional neural network by adopting a back propagation algorithm based on random gradient descent, and acquiring a standard Chinese character recognition model;
an acquisition module for adjusting the Chinese handwriting recognition model, which is used for acquiring an irregular Chinese character training sample, inputting the irregular Chinese character training sample into the standard Chinese character recognition model for training, updating the weight and the bias of the standard Chinese character recognition model by adopting a back propagation algorithm based on random gradient descent, and acquiring the adjusted Chinese handwriting 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 inputting the error character training sample into the adjusted Chinese handwritten character recognition model for training, updating and adjusting the weight and the bias of the Chinese handwritten character recognition model by adopting a back propagation algorithm based on batch gradient descent, and acquiring the target Chinese handwritten character recognition model.
8. A handwritten word recognition apparatus, 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 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 of any one of claims 1 to 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 realizes the steps of the method for handwriting recognition according to claim 6 when executing the computer program.
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.
CN201810564062.3A 2018-06-04 2018-06-04 Handwriting model training method, handwritten character recognition method, device, equipment and medium Active CN108764195B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810564062.3A CN108764195B (en) 2018-06-04 2018-06-04 Handwriting model training method, handwritten character recognition method, device, equipment and medium
PCT/CN2018/094193 WO2019232847A1 (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
CN201810564062.3A CN108764195B (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
CN108764195A CN108764195A (en) 2018-11-06
CN108764195B true CN108764195B (en) 2023-04-18

Family

ID=64002667

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810564062.3A Active CN108764195B (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) CN108764195B (en)
WO (1) WO2019232847A1 (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109685968A (en) * 2018-12-15 2019-04-26 西安建筑科技大学 A kind of the identification model building and recognition methods of the banknote image defect based on convolutional neural networks
US10846553B2 (en) * 2019-03-20 2020-11-24 Sap Se Recognizing typewritten and handwritten characters using end-to-end deep learning
CN113785305B (en) * 2019-05-05 2024-04-16 华为云计算技术有限公司 A method, device and apparatus for detecting tilted text
CN110399912B (en) * 2019-07-12 2023-04-07 广东浪潮大数据研究有限公司 Character recognition method, system, equipment and computer readable storage medium
CN110378318B (en) * 2019-07-30 2022-07-15 腾讯科技(深圳)有限公司 Character recognition method and device, computer equipment and storage medium
CN110688997B (en) * 2019-09-24 2023-04-18 北京猎户星空科技有限公司 Image processing method and device
CN111680690B (en) * 2020-04-26 2023-07-11 泰康保险集团股份有限公司 Character recognition method and device
CN111476237A (en) * 2020-04-28 2020-07-31 有米科技股份有限公司 Character recognition method, device, server and storage medium
CN111950548B (en) * 2020-08-10 2023-07-28 河南大学 A Chinese Character Recognition Method Using Font Image for Deep Template Matching
CN111738269B (en) * 2020-08-25 2020-11-20 北京易真学思教育科技有限公司 Model training method, image processing device, model training apparatus, and storage medium
CN114120336B (en) * 2020-08-25 2023-08-08 本源量子计算科技(合肥)股份有限公司 Handwriting digital recognition method, system, equipment and computer readable storage medium
CN112308058B (en) * 2020-10-25 2023-10-24 北京信息科技大学 Method for recognizing handwritten characters
CN112766051B (en) * 2020-12-29 2024-09-06 有米科技股份有限公司 Attention-based image character recognition method and device
CN112801085A (en) * 2021-02-09 2021-05-14 沈阳麟龙科技股份有限公司 Method, device, medium and electronic equipment for recognizing characters in image
CN113449726B (en) * 2021-07-08 2025-03-11 中国工商银行股份有限公司 Text matching and recognition method and device
CN116012860B (en) * 2022-12-29 2024-01-16 华南师范大学 Teacher blackboard writing design level diagnosis method and device based on image recognition
CN116311543B (en) * 2023-02-03 2024-03-08 汇金智融(深圳)科技有限公司 Handwriting analysis method and system based on image recognition technology

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 (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101630368B (en) * 2009-08-25 2011-09-14 华南理工大学 Self-adaptive method of user writing style for recognizing handwritten Chinese characters
US9390370B2 (en) * 2012-08-28 2016-07-12 International Business Machines Corporation Training deep neural network acoustic models using distributed hessian-free optimization
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
CN105654135A (en) * 2015-12-30 2016-06-08 成都数联铭品科技有限公司 Image character sequence recognition system based on recurrent neural network
CN106599941A (en) * 2016-12-12 2017-04-26 西安电子科技大学 Method for identifying handwritten numbers based on convolutional neural network and support vector machine

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
WO2019232847A1 (en) 2019-12-12
CN108764195A (en) 2018-11-06

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
CN108985442B (en) Handwriting model training method, handwritten character recognition method, device, equipment and medium
CN109002461B (en) Handwriting model training method, text recognition method, device, equipment and medium
CN111860674A (en) Sample class identification method and device, computer equipment and storage medium
WO2022042123A1 (en) Image recognition model generation method and apparatus, computer device and storage medium
CN107909101A (en) Semi-supervised transfer learning character identifying method and system based on convolutional neural networks
EP3620982B1 (en) Sample processing method and device
CN109034280B (en) Handwriting model training method, handwriting character recognition method, device, equipment and medium
WO2021042505A1 (en) Note generation method and apparatus based on character recognition technology, and computer device
Ahmad et al. Offline Urdu Nastaleeq optical character recognition based on stacked denoising autoencoder
CN113987236B (en) Unsupervised training method and unsupervised training device for visual retrieval model based on graph convolution network
CN108734673A (en) Descreening systematic training method, descreening method, apparatus, equipment and medium
CN108021908B (en) Face age group identification method and device, computer device and readable storage medium
CN114548218B (en) Image matching method, device, storage medium and electronic device
JP2019508803A (en) Method, apparatus and electronic device for training neural network model
CN109034279B (en) Handwriting model training method, handwriting character recognition method, device, equipment and medium
CN112183336A (en) Expression recognition model training method and device, terminal equipment and storage medium
CN111507396B (en) Method and device for relieving error classification of unknown class samples by neural network
CN108985151B (en) Handwriting model training method, handwritten character recognition method, device, equipment and medium
TWI803243B (en) Method for expanding images, computer device and storage medium
CN112529029A (en) Information processing method, neural network training method, device and storage medium
CN109101984B (en) Image identification method and device based on convolutional neural network
CN109086651B (en) Handwriting model training method, handwritten character recognition method, device, equipment and 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