Summary of the invention
In order to solve the technical problem existing for prior art, the invention provides the end that text based on degree of depth study is unrelated
To the person's handwriting recognition methods of end, the method can automatically process online line of text, it is not necessary to artificially extracts character feature, efficiently
Achieve the unrelated online writer of text and identify.
The present invention adopts the following technical scheme that and realizes: the person's handwriting identification side end to end that text based on degree of depth study is unrelated
Method, it is characterised in that comprise the steps: A, hand script Chinese input equipment text carries out pretreatment, generates pseudo-character sample;
B, the path integral characteristic image of the pseudo-character sample of calculating;C, train the deep neural network mould of known writer's sample
Type;D, utilize the deep neural network model of step C, the sample of uncertain writer is identified automatically.
Preferably, described step A, particularly as follows: A1, each stroke to hand script Chinese input equipment text carry out resampling, is adopted
Sampling point density uniform hand script Chinese input equipment text chunk;
A2, the hand script Chinese input equipment text after resampling is carried out stroke segmentation, obtain the path collection of the most broken little stroke section composition
Close;
A3, stroke is split after text carry out Character segmentation, generate pseudo-character;
A4, the pseudo-character after each segmentation is carried out stroke section remove at random;
A5, the size of normalization puppet character;
A6, affine transformation, generate pseudo-character sample.
Preferably, in described step A1, resampling is to calculate new according to set tracing point density parameter and original stroke number
The quantity of the tracing point of sample;
In described step A2, stroke segmentation is first to carry out Corner Detection, then this stroke is cut off from corner point, generates new
Comparatively short stroke section;
In described step A3, Character segmentation is to take out stroke section the most successively, when these stroke sections of being extracted into are combined into
The when that the width of character being just above character average height, currently last stroke section is taken as a fresh character
Start;
In described step A4, the quantity removing the pseudo-character obtained at random of each character stroke section is total stroke hop count si's
Function;
In described step A5, normalization is to be zoomed in and out by the figure that each pseudo-character is mapped to two dimensional surface, relatively wide and
High length, longest edge is transformed to fixing needed for length value, and keep the ratio of width to height constant in the case of, to short
Multiple is scaled accordingly while be multiplied by;
In described step A6, affine transformation includes the rotation to whole character path, stretches and tilt.
Preferably, described step B is particularly as follows: B1, calculate one group of path integral feature to each pseudo-character sample;
B2, reassemble into different path integral characteristic patterns by often organizing path integral feature according to the feature of identical dimensional;
B3, path integral characteristic pattern is carried out margin pixel fill up.
Preferably, when described step B1 calculates path integral feature, it is assumed that finite length stroke section P is two-dimensional spacePath, the time that track moves meet0 < τ1< ... < τk< T, τiIn the middle of representing the
I time point, and positive integer i meets 1≤i≤k, then calculates the k rank path integral at time [0, T] interior P special
LevyWhen P is straight line, use Δ0,TRepresent path displacement,Can be calculated by segmentation and try to achieve;Calculate n rank road
Footpath integration feature, it is simply that path integral feature is done k rank and blocks, the feature set obtained is
Obtain 2n+1The path integral feature of dimension;
In described step B2, each dimension of path integral feature is individually become a path integral characteristic pattern, so
Each pseudo-character sample has 2n+1Open path integral characteristic pattern, including the two-dimensional image in path itself;
In described step B3, first path integral characteristic pattern is set as the size that pixel value is z × z, is placed on a pixel value
For the center of the figure of Z × Z, then these path integral characteristic patterns are input to the deep neural network model described in step C
In be trained, z < Z≤3z.
Preferably, described step C particularly as follows:
C1, the projected depth neutral net number of plies, the template number of convolutional layer and the neuron number of full articulamentum;
C2, whole sample extraction characteristic images of training set are trained as the input of deep neural network model;
C3, when network converge in training set accuracy rate no longer rise time, deconditioning, preserve deep neural network mould
Shape parameter.
Preferably, in described step C1, deep neural network includes five convolutional layers, has one after each convolutional layer
Great Chiization layer;
In described step C2, the training of deep neural network includes the successive ignition of two steps of forward and backward, first with front
After network obtains network error, using back-propagation algorithm to be updated network parameter, continuous iteration optimization network is joined
Number.
Preferably, described step D is particularly as follows: D1, that the path integral characteristic image through pretreatment is inputted the degree of depth is neural
Network model, is calculated and each removes the candidate item probability tables that the pseudo-character sample after stroke is corresponding at random;
D2, the candidate item probability tables that the multiple pseudo-character samples of each character are corresponding is added and asks probability average, obtain this puppet
The candidate item probability tables of character, is added the candidate item probability tables of all characters of text and asks probability averagely to obtain the text
Candidate item probability tables;
D3, the candidate item probability tables of foundation text are selected the candidate item of highest scoring and are judged to writer.
Preferably, in described step D1, each text dividing is multiple character, and each pseudo-character produces multiple pseudo-character
Sample, these pseudo-character samples have identical label, calculate candidate item probability tables respectively as an independent sample;
In described step D2, probability averagely includes that the many character probabilities of text are average and multiple puppet character sample probability of character
Averagely;The candidate item that each pseudo-character sample candidate item probability tables each dimension addition of one character is obtained this character is put down
All probability tableses, obtain the text by being added the candidate item each dimension of average probability table of each character of a text chunk
Candidate item probability tables;
In described step D3, the candidate item selecting highest scoring according to the character average candidate item probability tables of text is judged to this
The writer of text.
From above technical scheme, the person's handwriting recognition methods end to end that text that the present invention learns based on the degree of depth is unrelated,
Mainly include the preprocessing process of hand script Chinese input equipment text, deep neural network model training process and automatically identify process.
Stroke section dividing method that wherein pretreatment is used, remove stroke phase method and first path integral feature is used for book at random
Writer's identification is the innovation emphasis of the present invention.Compared with prior art, the invention have the advantages that and beneficial effect:
1, the method for pretreatment includes the generalization ability enhancing that text dividing, sample augmentation and text are unrelated;Pretreatment operation
Make the present invention be applicable to the text of various length, can be long text or short text, it might even be possible to be individual character.
2, remove stroke section and generate abundant training sample, prevent over-fitting when of being used for training deep neural network, also
Generate multiple pseudo-character during for testing to be identified improving discrimination.
3, the present invention proposes for the first time a path integral feature for writer's identification mission, is also that the first time degree of depth is rolled up
Long-pending neural fusion writer identifies.Path integral feature can be extracted and can be used for the validity feature that writer identifies,
Being learnt by the supplemental characteristic of deep neural network, discrimination is up to 95.72% (Chinese), 98.51% (English).Based on
Deep neural network, it is possible to be identified the handwriting samples of the different length of writer, has higher accuracy and Shandong
Rod.
Embodiment
Present invention mainly solves the identification of online text written person and implement, have employed and online text is carried out cutting
The preprocess method removed at random with stroke section, establishes unrelated end-to-end of complete text based on degree of depth study
Person's handwriting recognition methods.The character types that user is inputted by the present invention do not limit, and the most not limit text, it is possible to
Allowing user to carry out free text written in big degree, overall flow is as shown in Figure 1.
Seeing Fig. 1, the present invention includes following four process: A, the preprocessing process of hand script Chinese input equipment text;B, known write
The deep neural network model training process of person's sample;C, calculating path integral feature;D, the sample of uncertain writer
Automatically process is identified.Specifically, first have to the line of text of hand script Chinese input equipment long text is carried out resampling, become sampled point
The online line of text that spacing is equal, then the line of text after resampling is divided into smaller stroke section set, by these pens
Draw section and be divided into single character based on the ratio of width to height.Then the stroke section of each character is removed at random, generate multiple pseudo-word
Symbol.Calculate afterwards after each pseudo-character carries out affine transformation and generate one group of path integral characteristic pattern, and fill null value around
Point.It is input in deep neural network carry out degree of depth network model by the path integral characteristic pattern of the pseudo-character sample of training set
Training, to close to saturated, preserves degree of depth network training parameter.Test time, training set hand script Chinese input equipment long text is carried out on
The degree of depth network model that data prediction described in literary composition being input to preserves calculates, exports each pseudo-character sample
Candidate probability table, then calculates the probability tables of each character.Afterwards the probability tables correspondence from same text fragment is waited
Option is sued for peace, and obtains final probability tables, and selects, according to this probability tables, the candidate item that probit is maximum, it is determined that for
Writer.The labeling requirement of the test item of native system occurred in training set.
Individually below each key step of the present invention is described in detail:
Step A data prediction
The purpose of step A data prediction is that the hand script Chinese input equipment line of text data to user's input are split, and is formed permissible
The form utilized, and extract some features, help deep neural network preferably to learn and processing feature, in efficiency and knowledge
Good auxiliaring effect is had in other accuracy.The sample method resampling by linear interpolation, by local buckling degree meter
Calculate detection angle point.Stroke section after segmentation is combined into character, then the stroke section inside each character is moved at random
Removing, obtain substantial amounts of pseudo-character, these pseudo-characters obtain more diversified pseudo-word through size normalization and affine transformation
Symbol sample.
A1, sample resampling
Resampling is the quantity of the tracing point calculating new samples according to set tracing point density parameter and original stroke number;Root
Calculate the total length of a stroke according to original tracing point, divided by the quantity of the tracing point of new samples, obtain dot density,
And then determine whether former tracing point retains and need the number of interpolation two-by-two on line so that it is determined that the tracing point of new samples is sat
Mark.
If a stroke has the sampled point { (x of p constant duration1,x2),...,(xp,kp)}.Due to the difference of writing speed,
The Euclidean distance of these points is the most different.When integer i meets 1≤i≤p, it is assumed that (xi,yi) and (xi+1,yi+1) point-to-point transmission
Euclidean distance be di, (x0,y0) arrive (xi,yi) inter-two-point path is a length ofIf the puppet after interpolation to be obtained
Specimen sample point sum is l, and l is the integral multiple of p.After interpolation, first point of each stroke keeps constant, from second
Individual point starts, and the position coordinates of i-th point is:
(xi×α+xi+1×(1-α),yi×α+yi+1×(1-α)), (1)
Wherein
The set of the point after each resampling still falls within this stroke.
A2, stroke section are split
Stroke segmentation is first to carry out Corner Detection, then this stroke is cut off from corner point, generates new comparatively short stroke
Section;Judging that a point is angle point, need to be calculated its flexibility by the coordinate of the point before and after this point, local buckling degree is
Big point is considered as angle point;Assume (xi,yi) be the i-th trajectory coordinates point after interpolation, respectively with before this point and after
Kth point (the x in facei-k,yi-k) and (xi+k,yi+k) coordinate figure calculate flexibility.
The segmentation of stroke section is first to carry out stroke end points identification according to storage data.Run through end point mark or one online
The first coordinate of hand-written long text file, is just defaulted as the starting point of a stroke, i.e. end points.Corner Detection judges angle
The principle of point is that local buckling degree is maximum.Its flexibility is calculated: assume (x by the coordinate of point before and after each pointi,yi) it is interpolation
After trajectory coordinates point, the kth point of this front and back is (xi-k,yi-k) and (xi+k,yi+k), flexibility is defined as:
β=max (| xi+k+xi-k-2xi|,|yi+k+yi-k-2yi|)/2k, (3)
Then this stroke is cut off from corner point, generate new comparatively short stroke section;For training data, if each character
It is highly ymax-ymin, then estimate average height y of each character of a documentaverFor Character segmentation.For
Each character of test data traversal text, it is thus achieved that the maximum of local vertical coordinate, minima are ymaxAnd ymin, and then estimate
Go out character height y that the text is averageaver。
A3, Character segmentation, pseudo-character generates
Character segmentation is the character fixing in order to obtain length-width ratio.Character segmentation is to take out stroke section the most successively, and remembers
Record the maximum x of its abscissa occurredmaxWith minima xmin.Width when the character that these stroke sections being extracted into are combined into
Just above character average height yaverWhen, last stroke section is taken as the beginning of a fresh character;Character
Average height be calculated cutting stroke section when.
A4, stroke section remove at random
Assume that a total stroke number of character is m, the stroke hop count s of i-th strokei, stroke section remove the word obtained at random
The sample size of symbol is siFunction with m.If each character is removed d at randomi(0≤di< si) pen, these are remaining
Stroke section is reassembled into pseudo-character sample according to original sequencing, then the pseudo-character sample sum obtained is exactly:
Fig. 2 is shown in by schematic diagram.
A5, size normalization
Normalization is to be zoomed in and out by the figure that each pseudo-character is mapped to two dimensional surface, and relatively wide and high length will be
Long limit transforms to fixing required length value, and in the case of keeping the ratio of width to height constant, minor face is multiplied by corresponding contracting
Put multiple.
Size normalization is the coordinate (x of the first path point of one character of traversali,yi), find out width w=xmax-xminAnd height
H=ymax-ymin, then by long limit max, (w, h) is stretched to fixed value Q, and minor face expands corresponding multiple, obtains normalizing
Path point coordinate after change
A6, affine transformation
Affine transformation include the rotation to whole character path, stretch, inclination etc.;The angle rotated depends on certain interval
The twiddle factor w of interior random size, the coordinate of postrotational point is:
(xi×cos(w)+yi×sin(w),-xi×sin(w)+yi×cos(x)), (6)
Stretching is the abscissa to path coordinate points or vertical coordinate carries out linear transformation, and drawing coefficient is set to α and β,
((α, β) ∈ [-1,1]), coordinate (xi,yi) coordinate after stretching conversion is:
(xi×(1+α),yi×(1+β)), (7)
Tilt variation includes the tilt variation to horizontal direction and vertical direction.Coordinate (xi,yi) inclination in the horizontal direction
Coordinate after change is:
(xi×(1+αx),yi), (8)
Coordinate (xi,yi) in the vertical direction tilt variation after coordinate:
(xi,yi×(1+αy)), (9)
Step B calculates path integral characteristic pattern
B1, calculating path integral feature
Calculating path integral feature is by the method for path integral feature.Assume that finite length stroke section P is that two dimension is empty
BetweenPath, middle i-th time point is τi, positive integer i meets 1≤i≤k, the time that track movesAnd 0 < τ1< ... < τk< T, then the k rank path integral feature of P is exactly:
When P is straight line, use Δ0,TRepresenting path displacement, segmentation calculates:
Calculating n rank path integral feature, the feature set obtained is expressed as
The dimension of the path integral feature including path itself obtained is 2n+1。
B2, generation path integral characteristic pattern
Generating the multidimensional path integral feature of image in step bl is determined., each dimension can corresponding one-tenth one width path integral
Characteristic pattern.Removing path image itself, the quantity of the characteristic pattern that each pseudo-character sample obtains is 2n+1-1.Generate path
Integration schematic diagram is as shown in Figure 3.
B3, margin pixel are filled up
In order to keep image not lose the rim path integration feature of image because of convolution operation, input layer image is carried out
Blank pixel is filled up.The detailed description of the invention filled up is first path integral characteristic pattern to be converted into the big of 54 × 54 pixels
Little, then surrounding fills the blank pixel point of 21 layers of pixel, becomes the figure of 96 × 96.
Deep neural network is trained by step C
C1, projected depth neural network model
In the present invention, the deep neural network of setting comprises convolutional layer and maximum pond layer;Its structure is five convolutional layers,
Maximum pond layer (MP) is had after each convolutional layer;The size of ground floor convolution kernel is 3 × 3 (being expressed as C3), after
The size of the four layers of convolution kernel in face is 2 × 2 (being expressed as C2);Step-length is 2;Finally there are two full articulamentums, are respectively
480 and 512 neurons.Whole network structure is collectively expressed as:
M×96×96Input-80C3-MP2-160C2-MP2-240C2-MP2-320C2-MP2-400C2-MP2-480FC-512FC-
Output,
Wherein M represents the port number of input layer, equal with the quantity of the integration characteristic pattern of each pseudo-character sample.
C2, training deep neural network
It is used for training deep neural network by the data of training set.Classification problem is done the when of training.Deep neural network
Training includes the successive ignition of two steps of forward and backward.After first obtaining network error with feedforward network, use reversely biography
Broadcast algorithm network parameter is updated, continuous iteration optimization network parameter, test for training data after every suboptimization
Classification accuracy.
C3, preservation deep neural network model parameter
The accuracy rate of training data presents the trend that concussion rises.When the accuracy rate of training data almost no longer rises, recognize
For training close to saturated, then preservation model Parameter File, it is used for testing.
Step D identifies writer automatically
D1, candidate probability calculate
Can generate tens to thousand of pseudo-character samples for each long text, the writer of text is exactly each
The label of pseudo-character sample.Each pseudo-character sample can generate 2n+1Path integral characteristic pattern, 2n+1It it is input layer simultaneously
Port number.Input layer image is input in the deep neural network model that step C3 preserves carry out forward calculation, obtains deep
The output of degree neutral net;I-th that in long text, i-th character generatesjThe probability of individual pseudo-character sample is:
D2, probability are average
Probability averagely includes that average and character the multiple pseudo-character sample probability of the many character probabilities of text is average.Assume total η class
Hands writer's long text, each long text can generate r character, and each character can generate N number of pseudo-character sample, often
Individual pseudo-character sample can obtain the character puppet sample probability average out to of a candidate item probability column i-th character:
The character candidates item average probability table of each text chunk is:
Finding the most probable value in formula (14) is λ item
D3, writer judge
The candidate item selecting highest scoring according to the candidate item probability tables of pseudo-character is judged to writer;Being understood by step D2 should
The classification results of long text is the λ class of candidate item.
Embodiments of the present invention are also not restricted to the described embodiments, other any spirit without departing from the present invention with
The change made under principle, modify, substitute, combine, simplify, all should be the substitute mode of equivalence, be included in this
Within bright protection domain.