CN103310237B - Handwritten Numeral Recognition Method and system - Google Patents
Handwritten Numeral Recognition Method and system Download PDFInfo
- Publication number
- CN103310237B CN103310237B CN201310286449.4A CN201310286449A CN103310237B CN 103310237 B CN103310237 B CN 103310237B CN 201310286449 A CN201310286449 A CN 201310286449A CN 103310237 B CN103310237 B CN 103310237B
- Authority
- CN
- China
- Prior art keywords
- vector data
- vector
- subset
- data
- ith
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 239000013598 vector Substances 0.000 claims abstract description 611
- 239000011159 matrix material Substances 0.000 claims abstract description 57
- 238000012549 training Methods 0.000 claims abstract description 26
- 238000012545 processing Methods 0.000 claims description 13
- 238000000354 decomposition reaction Methods 0.000 claims description 8
- 238000010276 construction Methods 0.000 claims description 7
- JOCBASBOOFNAJA-UHFFFAOYSA-N N-tris(hydroxymethyl)methyl-2-aminoethanesulfonic acid Chemical compound OCC(CO)(CO)NCCS(O)(=O)=O JOCBASBOOFNAJA-UHFFFAOYSA-N 0.000 claims 2
- 238000012360 testing method Methods 0.000 description 14
- 238000005457 optimization Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000017105 transposition Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Landscapes
- Image Analysis (AREA)
- Character Discrimination (AREA)
Abstract
The embodiment of the invention discloses a kind of Handwritten Numeral Recognition Method and system, during handwriting digital is carried out dimensionality reduction, by K neighbour, linear expression is come for each view data, each view data is obtained by the most orthogonal matching algorithm of weight coefficient during K neighbour's linear expression, and, by structure weighting coefficient matrix, training image data are carried out dimensionality reduction, image to be identified is then carried out dimensionality reduction by the vector data after the dimensionality reduction of weight vector and K neighbour thereof, by experiment, the Handwritten Numeral Recognition Method that the embodiment of the present application provides, improve the discrimination of Handwritten Digital Recognition.
Description
Technical Field
The invention relates to the field of pattern recognition, in particular to a handwritten digit recognition method and system.
Background
With the rapid development of computer technology and digital image processing technology, handwritten digit recognition has been practically applied in electronic commerce, automatic machine input and other fields.
However, handwritten numbers are high-dimensional data, and if the handwritten numbers are directly recognized, not only is the time long, but also the computational complexity is large, so that the handwritten numbers are frequently recognized after dimensionality reduction, and based on the fact, saul et al propose a number recognition method based on linearization and local linear embedding. However, in this method, the local linear representation coefficient of the data is solved by using the least square method, which involves solving the inverse of the matrix, and if the matrix is a singular matrix and the singular matrix does not have an inverse matrix, there is no solution when the local linear representation coefficient of the data is solved by using the least square method, so that the recognition rate of the handwritten form digital recognition is low.
Therefore, how to improve the recognition rate of handwritten digit recognition is a problem to be solved urgently.
Disclosure of Invention
The invention aims to provide a method and a system for recognizing handwritten form numbers, which are used for improving the recognition rate of handwritten form number recognition.
In order to achieve the purpose, the invention provides the following technical scheme:
a method for handwritten digit recognition, comprising:
acquiring an image data set, wherein the image data set comprises a training image data subset and an image data subset to be identified;
stretching each image data in the image data set to obtain a vector data set, wherein the vector data set comprises a first vector data subset corresponding to the training image data subset and a second vector data subset corresponding to the image data subset to be identified;
acquiring K neighbor vector data of the ith vector data according to the distance between the ith vector data in the vector data set and each vector data in the first vector data subset;
linearly representing the ith vector data with the K neighbor vector data:
wherein, XiThe ith vector data;is the jth vector data in the K adjacent vector data;is the jth vector data of the K adjacent vector dataThe corresponding weight coefficient of the weight is,obtaining through an orthogonal matching pursuit algorithm;
when the ith vector data belongs to the first vector data subset, acquiring a first weighting coefficient vector corresponding to the ith vector dataM element of (2)Corresponding to an mth vector data in the first vector data subset, wherein when the mth vector data in the first vector data subset is a jth vector data in K neighboring vector data of the ith vector data,when the m-th vector data does not belong to K neighbor vector data of the i-th vector data,
reducing the dimension of the first vector data subset according to the first weighting coefficient vector, comprising:
obtaining a weighting coefficient matrix Wherein,(M =1, 2.. said, M) is a weighting coefficient vector corresponding to the mth vector data in the first vector subset;
construction matrix Wherein I is an identity matrix;
for matrix MtrainPerforming characteristic decomposition to obtain characteristic values, wherein the qth characteristic value is lambdaqThe feature vector corresponding to the qth feature value is vq,vqA column vector of dimension M × 1;
sorting the eigenvalues according to the values, acquiring eigenvectors corresponding to 2 nd to d +1 th eigenvalues from small to large, and forming a vector data matrix Y by the acquired eigenvectorstrain=[v2,v3,…,vd+1]Where d is a preset dimensionality reduced dimensionality, and the m-th vector data X in the first vector data subsetmThe corresponding reduced vector data is xmThe vector data matrix YtrainThe m-th row vector of (1);
when the ith vector data belongs to the second vector data subset, acquiring a second weighting coefficient vector corresponding to the ith vector dataThe jth element of (1)A jth vector data out of K neighboring vector data corresponding to the ith vector data,
reducing the dimension of the second vector data subset according to the second weighting coefficient vector, comprising:
according to a second weighting coefficient vector corresponding to the nth vector data in the second vector data subsetAnd K neighbors to the nth vector data in the second subset of vector dataVector data corresponding to reduced dimension vector data setObtaining the nth vector data X in the second vector data subsetnCorresponding reduced-dimension vector data xnThe method specifically comprises the following steps:
acquiring K neighbor vector data of the nth vector data in the second vector data subset after dimensionality reduction according to the distance between any vector data in the first vector data subset after dimensionality reduction and the nth vector data in the second vector data subset after dimensionality reduction;
and determining the digital type of the image data to be identified corresponding to the nth vector data in the dimensionality reduced second vector data subset according to the digital type of the image data corresponding to the K adjacent vector data of the nth vector data.
The above method, preferably, the obtaining K neighboring vector data of the ith vector data according to the distance between the ith vector data in the vector data set and each vector data in the first vector data subset includes:
and acquiring K adjacent vector data of the ith vector data according to the Euclidean distance between the ith vector data in the vector data set and each vector data in the first vector data subset.
The above method, preferably, said obtaining by orthogonal matching pursuit algorithmComprises at least one iterative operation:
in each iteration operation, selecting vector data with undetermined weight value from K adjacent vector data of the ith vector dataSo thatMinimum to determine
Wherein,vector data selected for the j-th iterationThe corresponding weight value; f =1,2, …, u, u is a preset number of iterations.
In the above method, it is preferable that the stretching each image data in the image data set includes:
stretching each image data in the image data set by rows or by columns.
In the above method, preferably, the preset dimensionality after dimensionality reduction is 2 or 3.
The above method, preferably, further comprises:
and displaying each vector data in the second vector data subset after dimensionality reduction in a d-dimensional coordinate system.
A handwritten number recognition system, comprising:
the image data processing module is used for acquiring an image data set, and the image data set comprises a training image data subset and an image data subset to be identified; stretching each image data in the image data set to obtain a vector data set, wherein the vector data set comprises a first vector data subset corresponding to the training image data subset and a second vector data subset corresponding to the image data subset to be identified; acquiring K neighbor vector data of the ith vector data according to the distance between the ith vector data in the vector data set and each vector data in the first vector data subset; linearly representing the ith vector data with the K neighbor vector data:
wherein, XiThe ith vector data;is the jth vector data in the K adjacent vector data;is the jth vector data of the K adjacent vector dataThe corresponding weight coefficient of the weight is,obtaining through an orthogonal matching pursuit algorithm;
a first dimension reduction processing module for obtaining a first weighting coefficient vector corresponding to the ith vector dataM element of (2)Corresponding to an mth vector data in the first vector data subset, wherein when the mth vector data in the first vector data subset is a jth vector data in K neighboring vector data of the ith vector data,when the m-th vector data does not belong to K neighbor vector data of the i-th vector data,reducing the dimension of the first vector data subset according to the first weighting coefficient vector, comprising: obtaining a weighting coefficient matrixWherein,(M =1, 2.. said, M) is a weighting coefficient vector corresponding to the mth vector data in the first vector subset; construction matrixWherein I is an identity matrix; for matrix MtrainPerforming characteristic decomposition to obtain characteristic values, wherein the qth characteristic value is lambdaqThe feature vector corresponding to the qth feature value is vq,vqThe characteristic values are sorted according to the value size, the characteristic vectors corresponding to the 2 nd to the d +1 th characteristic values are obtained according to the sequence from small to large, and the obtained characteristic vectors form a vector data matrix Ytrain=[v2,v3,…,vd+1]Where d is a preset dimensionality reduced dimensionality, and the m-th vector data X in the first vector data subsetmThe corresponding reduced vector data is xmThe vector data matrix YtrainThe m-th row vector of (1);
a second dimension reduction processing module for obtaining a second weighting coefficient vector corresponding to the ith vector dataThe jth element of (1)A jth vector data out of K neighboring vector data corresponding to the ith vector data,reducing the dimension of the second vector data subset according to the second weighting coefficient vector, comprising: according to a second weighting coefficient vector corresponding to the nth vector data in the second vector data subsetAnd a reduced-dimension vector data set corresponding to K neighbor vector data of the nth vector data in the second vector data subsetObtaining the nth vector data X in the second vector data subsetnCorresponding reduced-dimension vector data xnThe method specifically comprises the following steps:
the identification module is used for acquiring K neighbor vector data of the nth vector data in the second vector data subset after dimensionality reduction according to the distance between any vector data in the first vector data subset after dimensionality reduction and the nth vector data in the second vector data subset after dimensionality reduction; and determining the digital type of the image data to be identified corresponding to the nth vector data in the dimensionality reduced second vector data subset according to the digital type of the image data corresponding to the K adjacent vector data of the nth vector data.
According to the scheme, in the process of dimension reduction of the handwritten form figures, each image data is linearly represented by K neighbors, weighting coefficients of each image data in the linear representation of the K neighbors are obtained through an orthogonal matching algorithm, a weighting coefficient matrix is constructed to reduce the dimension of training image data, and an image to be recognized is subjected to dimension reduction through a weighting coefficient vector and vector data of the K neighbors after dimension reduction.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a handwritten digit recognition method provided in an embodiment of the present application;
FIG. 2 is a flowchart of a method for dimensionality reduction of a first vector data subset according to a first weighting coefficient vector according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a handwritten number recognition system according to an embodiment of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be practiced otherwise than as specifically illustrated.
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 only a part of the embodiments of the present invention, and not all of the embodiments. 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.
Referring to fig. 1, fig. 1 is a flowchart of a handwritten digit recognition method according to an embodiment of the present application, including:
step S101: acquiring an image data set, wherein the image data set comprises a training image data subset and an image data subset to be identified;
in the embodiment of the present application, the image data set includes two types of image data, namely training image data and image data to be recognized, where the training image data is of a known number type, that is, which number each training image data represents is known.
Step S102: stretching each image data in the image data set to obtain a vector data set, wherein the vector set comprises a first vector data subset corresponding to the training image data subset and a second vector data subset corresponding to the image data subset to be identified;
assuming that the original image data is a × b-dimensional, the vector data obtained after stretching is ab × 1-dimensional.
The image data may be stretched in rows or columns, and all the image data are stretched in the same stretching method.
The following illustrates how to stretch image data, since one image data is a two-dimensional matrix, assuming that one image data is
Then, stretching the image data by rows specifically includes, starting from the first row of the two-dimensional matrix, sequentially connecting the rows into a vector to obtain vector data: [111222333]T;
Stretching the image data in columns specifically, starting from the first column of the two-dimensional matrix, connecting each column in sequence into a vector to obtain vector data: [123123123]T。
Step S103: acquiring K neighbor vector data of the ith vector data according to the distance between the ith vector data in the vector data set and each vector data in the first vector data subset; that is, K neighbor vector data of the ith vector data are sought from the first vector data subset regardless of whether the ith vector data belongs to the first vector data subset or the second vector data subset.
The distance may be an absolute distance, i.e.,
where s (x, y) denotes the distance between vector data x and vector data y, xkRepresenting the kth element, y, of the vector data xkRepresents the kth element of the vector data y;
preferably, in the embodiment of the present application, the distance is an euclidean distance, that is,
where s (x, y) denotes the distance between vector data x and vector data y, xkRepresenting the kth element, y, of the vector data xkRepresenting the kth element of the vector data y.
The K neighboring vector data of the ith vector data may be all vector data in the first vector data subset whose distance from the ith vector data is less than a preset value;
the K neighboring vector data of the ith vector data may also be K vector data of the first subset of vector data having the smallest distance to the ith vector data.
The K is a positive integer, the value of the K can be determined according to an empirical value or can be determined through simulation, and preferably, the value of the K can be between 3 and 20.
Step S104: linearly representing the ith vector data with the K neighbor vector data:
wherein, XiThe ith vector data;is the jth vector data in the K adjacent vector data;is the jth vector data of the K adjacent vector dataThe corresponding weight coefficient of the weight is,obtaining through an orthogonal matching pursuit algorithm;
step S105: when the ith vector data belongs to the first vector data subset, acquiring a first weighting coefficient vector corresponding to the ith vector dataIs a vector of dimension M × 1 (dimension M ×),m element of (2)Corresponding to the mth vector data in the first vector data subset, wherein when the first vector data subset is reachedWhen the m-th vector data in the set is the j-th vector data in the K adjacent vector data of the i-th vector data,when the m-th vector data does not belong to K neighbor vector data of the i-th vector data,
in this embodiment of the application, when the mth vector data in the first vector data subset is a certain vector among the K neighboring vector data of the ith vector data, the weighting coefficient corresponding to the mth vector data in the first vector data subsetIs the weighting coefficient obtained by the above orthogonal matching algorithm, otherwise, the weighting coefficient corresponding to the mth vector data in the first vector data subsetIs 0.
Step S106: the dimension reduction of the first vector data subset according to the first weighting coefficient vector may include, as shown in fig. 2:
step S1061: obtaining a weighting coefficient matrix A matrix of dimension M × M, wherein,(M =1, 2.. said, M) is a weighting coefficient vector corresponding to the mth vector data in the first vector subset;
step S1062: construction matrix Wherein I is an identity matrix;
step S1063: for matrix MtrainPerforming characteristic decomposition to obtain characteristic values, wherein the qth characteristic value is lambdaqThe feature vector corresponding to the qth feature value is vq,vqA column vector of dimension M × 1;
it is common knowledge in the art to perform feature decomposition specifically, and further obtain a feature value and a feature vector corresponding to the feature value, which are not described herein again.
Step S1064: sorting the eigenvalues according to the values, acquiring eigenvectors corresponding to 2 nd to d +1 th eigenvalues from small to large, and forming a vector data matrix Y by the acquired eigenvectorstrain=[v2,v3,…,vd+1],YtrainA matrix of dimension M × d, wherein d is a predetermined dimension reduced dimension, and the M-th vector data X in the first vector data subsetmThe corresponding reduced vector data is xmThe vector data matrix YtrainThe m-th row vector of (1);
preferably, in this embodiment of the application, in order to facilitate analysis of the image data, a value of the dimensionality d after the dimensionality reduction may be 2 or 3; of course, it may be 4, 5, 6, or other integer values.
For example, when d =2, Ytrain=[v2,v3](ii) a When d =3, Ytrain=[v2,v3,v4]。
Step S107: when the ith vector data belongs to the second vector numberWhen the data is sub-set, obtaining a second weighting coefficient vector corresponding to the ith vector dataIs a vector of dimension K × 1 (dimension K ×),the jth element of (1)A jth vector data out of K neighboring vector data corresponding to the ith vector data,
that is, in the embodiment of the present application, there are only K elements in the second weighting coefficient vector.
Step S108: according to a second weighting coefficient vector corresponding to the nth vector data in the second vector data subsetDimensionality reduction of the nth vector data in the second subset of vector data may include:
according to a second weighting coefficient vector corresponding to the nth vector data in the second vector data subsetAnd a reduced-dimension vector data set corresponding to K neighbor vector data of the nth vector data in the second vector data subsetObtaining the nth vector data X in the second vector data subsetnCorresponding reduced-dimension vector data xnThe method specifically comprises the following steps:
wherein T represents a pair vectorA transposition operation is performed.
Step S109: acquiring K neighbor vector data of the nth vector data in the second vector data subset after dimensionality reduction according to the distance between any vector data in the first vector data subset after dimensionality reduction and the nth vector data in the second vector data subset after dimensionality reduction;
that is, in this step, K neighboring data vectors of the nth vector data in the second vector data subset after dimensionality reduction are searched from the first vector data subset after dimensionality reduction;
the distance may be an absolute distance or an euclidean distance, and the specific method for obtaining the K neighboring vector data may refer to the foregoing contents, which is not described herein again.
Step S110: and determining the digital type of the image data to be identified corresponding to the nth vector data in the dimensionality reduced second vector data subset according to the digital type of the image data corresponding to the K adjacent vector data of the nth vector data.
In this embodiment of the application, when the number types of the image data corresponding to the vector data satisfying the preset ratio in the K neighboring vector data are all the same number type, it is determined that the number type corresponding to the nth vector data is the number type of the image data of the preset data.
For example, if the number types of the image data corresponding to the preset number of data are all 6, that is, the handwritten numbers represented by the image data corresponding to the preset number of data are all 6, the number type of the image data to be recognized corresponding to the nth vector data is 6, that is, the handwritten number represented by the image data to be recognized is 6.
According to the handwritten form number recognition method, in the process of dimension reduction of handwritten form numbers, each image data is linearly represented through K neighbors, weighting coefficients of each image data in the process of linear representation through the K neighbors are obtained through an orthogonal matching algorithm, in addition, the dimension reduction of training image data is carried out through constructing a weighting coefficient matrix, and the dimension reduction of an image to be recognized is carried out through a weighting coefficient vector and the dimension reduced vector data of the K neighbors of the image to be recognized.
In the foregoing embodiment, preferably, the obtaining of the weighting coefficients by the orthogonal matching pursuit algorithmMay include at least one iterative operation:
in each iteration operation, selecting vector data with undetermined weight value from K adjacent vector data of the ith vector dataSo thatMinimum to determineVector data selected for the j-th iterationThe corresponding weight value; f =1,2, …, u, u is a preset number of iterations.
And after all iterative operations are completed, the weight value corresponding to the selected vector data in the K adjacent vector data of the ith vector data is 0.
For example, suppose that the ith vector data has 3 neighboring vector data, which are respectivelyAndthe preset iteration number is 2;
on the first iteration, the data is processed by an optimization algorithm The one with the minimum two-norm operation value is selected, and the hypothesis is thatThe value is minimum, then, determineThe corresponding weight isFor the convenience of description, willIs marked asI.e. the vector data selected in the 1 st iteration.
In the second iteration, the data is processed by an optimization algorithm The one with the minimum two-norm operation value is selected, and the hypothesis is thatThe value is minimum, then, determineThe corresponding weight is
The iteration times reach the preset iteration times, so that the value corresponding to the residual vector data in the 3 neighbors is determined to be 0, namelyThe corresponding weight is 0.
The specific optimization algorithm to select the smallest one of the two norm operation values to determine the weight belongs to the common general knowledge in the art, and is not described herein again.
As another example, assume that the ith vector data has 3 neighboring vector data, respectivelyAndthe preset iteration number is 1; only one iteration is then needed, and, in particular,
on the first iteration, the data is processed by an optimization algorithm The one with the minimum two-norm operation value is selected, and the hypothesis is thatThe value is minimum, then, determineThe corresponding weight isFor the convenience of description, willIs marked asI.e. the vector data selected in the 1 st iteration.
After one iteration operation is carried out, the iteration times are larger than the iteration times preset by the director, so that the weights corresponding to other two vector data in 3 neighbors are determined to be 0, namelyThe corresponding weight value is 0, and the weight value is,the corresponding weight is also 0.
In the above embodiment, preferably, the preset number of iterations is 2, that is, u =2, that is, the weighting coefficients of two vector data of the K neighboring vector data are obtained through two iterations, and the weighting values of the other vector data of the K neighboring vector data are 0.
In the foregoing embodiment, preferably, to further facilitate the observation and analysis of the image data by the staff, when the preset dimensionality d after dimensionality reduction is 2 or 3, each vector data in the second vector data subset after dimensionality reduction is displayed in the d-dimensional coordinate system.
Corresponding to the method embodiment, a schematic structural diagram of a handwritten digit recognition system provided in the embodiment of the present application is shown in fig. 3, and includes:
an image data processing module 301, a first dimension reduction processing module 302, a second dimension reduction processing module 303 and a recognition module 304; wherein,
the image data processing module 301 is configured to obtain an image data set, where the image data set includes a training image data subset and an image data subset to be identified; stretching each image data in the image data set to obtain a vector data set, wherein the vector data set comprises a first vector data subset corresponding to the training image data subset and a second vector data subset corresponding to the image data subset to be identified; acquiring K neighbor vector data of the ith vector data according to the distance between the ith vector data in the vector data set and each vector data in the first vector data subset; linearly representing the ith vector data with the K neighbor vector data:
wherein, XiThe ith vector data;is the jth vector data in the K adjacent vector data;is the jth vector data of the K adjacent vector dataThe corresponding weight coefficient of the weight is,obtaining through an orthogonal matching pursuit algorithm;
the first dimension reduction processing module 302 is configured to obtain a first weighting coefficient vector corresponding to the ith vector dataM element of (2)Corresponding to an mth vector data in the first vector data subset, wherein when the mth vector data in the first vector data subset is a jth vector data in K neighboring vector data of the ith vector data,when the m-th vector data does not belong to K neighbor vector data of the i-th vector data,reducing the dimension of the first vector data subset according to the first weighting coefficient vector, comprising: obtaining a weighting coefficient matrixWherein,(M =1, 2.. said, M) is a weighting coefficient vector corresponding to the mth vector data in the first vector subset; construction matrixWherein I is an identity matrix; for matrix MtrainPerforming characteristic decomposition to obtain characteristic values, wherein the qth characteristic value is lambdaqThe feature vector corresponding to the qth feature value is vq,vqThe characteristic values are sorted according to the value size, the characteristic vectors corresponding to the 2 nd to the d +1 th characteristic values are obtained according to the sequence from small to large, and the obtained characteristic vectors form a vector data matrix Ytrain=[v2,v3,…,vd+1]Where d is a preset dimensionality reduced dimensionality, and the m-th vector data X in the first vector data subsetmThe corresponding reduced vector data is xmThe vector data matrix YtrainThe m-th row vector of (1);
the second dimension reduction processing module 303 is configured to obtain a second weighting coefficient vector corresponding to the ith vector dataThe jth element of (1)A jth vector data out of K neighboring vector data corresponding to the ith vector data,reducing the dimension of the second vector data subset according to the second weighting coefficient vector, comprising: according to a second weighting coefficient vector corresponding to the nth vector data in the second vector data subsetAnd a reduced-dimension vector data set corresponding to K neighbor vector data of the nth vector data in the second vector data subsetObtaining the nth vector data X in the second vector data subsetnCorresponding reduced-dimension vector data xnThe method specifically comprises the following steps:
the identification module 304 is configured to obtain K neighboring vector data of the nth vector data in the second vector data subset after the dimensionality reduction according to a distance between any vector data in the first vector data subset after the dimensionality reduction and the nth vector data in the second vector data subset after the dimensionality reduction; and determining the digital type of the image data to be identified corresponding to the nth vector data in the dimensionality reduced second vector data subset according to the digital type of the image data corresponding to the K adjacent vector data of the nth vector data.
The following verification and explanation of the scheme of the application are given by specific examples:
the application tests in MATLAB (MATrix LABoratory) software, and verifies the image data in an MNIST handwriting database, wherein the MNIST handwriting database contains ten handwriting numbers of 0-9, total 60000 training samples (the number types are known) and 10000 testing samples (the number types are unknown), and each number corresponds to a plurality of training samples and a plurality of testing samples.
In the present example, 200 training samples and 500 test samples were randomly selected per digit in the MNIST handwriting database, so there were a total of 2000 training samples and 5000 test samples.
For convenience of description, an image data set consisting of 2000 training samples and 5000 test samples is hereinafter referred to as { I }iIn which Ii∈Rm×nIs the ith image data, m represents the number of pixels in a row of the image data, and n represents the number of pixels in a column of the image data, in the example of the present application, m = n = 28.
In { IiOf these, the first 2000 are labeled, i.e.li∈ {1, 2.., 10} is IiCorresponding labels, for indicating IiOf the first 2000 constituting the training image data subsetThe last 5000 are unlabeled, constituting a subset of the test image dataIn the present embodiment, the image data subset is reduced to 3 dimensions, and the specific process of the present embodiment is as follows:
acquiring a set of image data Ii};
Set of image data IiStretching each image data in the image data to obtain a vector data setWherein x isi∈Rmn×1Is to the image data IiAnd performing in-line stretching. Wherein the vector data set comprises a first vector data subset corresponding to the training image data subsetAnd a second vector data subset corresponding to the data image subset to be tested
For a first vector data subset XtrainEach element x in (1)iAccording to xiWith a first vector data subset XtrainThe Euclidean distance between other elements in the sequence is determined to be xiThe K vector data with the minimum Euclidean distance are xiK neighbors of (a), for ease of description, the K vector data are denoted as a first vector data subset XtrainElement x in (1)iNeighbor point set ofIn this applicationIn the example, K = 9.
Using neighbor point setsTo linearly represent the element x in the first vector data subsetiI.e. byWherein,is thatThe weighting coefficient is obtained by an orthogonal matching algorithm, specifically, the weighting coefficient comprises two iterative operations:
in the first iteration operation, the vector data selected from K adjacent vector data of the ith vector data isSo thatMinimum to determine the sumCorresponding weight value
Selecting one vector data from the remaining K-1 neighboring vector data in the second iteration budgetSo thatMinimum to determine the sumCorresponding weight value
The weights corresponding to the remaining K-2 vector data are all 0.
Obtaining an element x from the first vector data subsetiCorresponding first weight coefficient vectorThe method comprises 2000 elements and the following steps of,the jth element of (1)Corresponding to the jth element in the first vector data subset,the values of (A) are as follows:
subset X of first vector datatrainSynthesizing weighting coefficient matrix by using weighting coefficient vectors corresponding to each element in the matrixIt is clear that,Wtraina 2000 × 2000 dimensional matrix.
Construction matrix Mtrain=(I-Wtrain)T(I-Wtrain) Wherein I is an identity matrix;
to MtrainPerforming characteristic decomposition to make the jth characteristic value thereof be lambdajThe feature vector corresponding to the jth feature value is vj,vjThe method comprises 2000 elements, supposing that the eigenvalues are arranged from small to large, and forming a first vector data matrix Y with reduced dimension by the eigenvectors corresponding to the 2 nd to the 4 th eigenvaluestrain=[v2,v3,v4]Obviously, YtrainA 2000 × 3 dimensional matrix.
Element x in the first vector data subsetiIs YtrainThe ith row vector of (1).
The above describes the process of performing dimension reduction on the training image data subset, and the following describes the process of performing dimension reduction on the image data subset to be identified:
for the second vector data subset XtestEach element x in (1)iAccording to xiWith a first vector data subset XtrainThe Euclidean distance between each element in the set, and x is determinediThe 9 vector data with the minimum Euclidean distance are xi9 neighbors of (a), for ease of description, the 9 vector data are denoted as a second vector data subset XtestMiddle element xiNeighbor point set of
Using neighbor point setsTo linearly represent the element x in the second vector data subsetiI.e. byWherein,is thatThe weighting coefficients are obtained by an orthogonal matching algorithm, which may be referred to in the foregoing method, and are not described herein again.
Obtaining the element x in the second vector data subsetiCorresponding second weight coefficient vectorThe number of the elements in the Chinese character 'Zhonghuan' is 9,the jth element of (1)Corresponding to element x in the second vector data subsetiThe jth vector data of the 9 neighboring vector data,
according to the second weight coefficient vectorAnd element x in the second vector data subseti9 neighboring vector data of the same vector data setObtaining element x in the second vector data subsetiReduced-dimension vector data xiThe method specifically comprises the following steps:
where T denotes a transposition operation.
After all the image data are subjected to dimensionality reduction, 9 neighbor vector data of nth vector data in a second vector data subset subjected to dimensionality reduction are obtained according to the Euclidean distance between any vector data in the first vector data subset subjected to dimensionality reduction and the nth vector data in the second vector data subset subjected to dimensionality reduction;
and determining the digital type of the image data to be identified corresponding to the nth vector data in the dimensionality reduced second vector data subset according to the digital type of the image data corresponding to the 9 adjacent vector data of the nth vector data.
In the following, by comparing the recognition rate of the handwritten digit recognition method provided by the present application with the recognition rate of the digit recognition method based on the local linear embedding based on linearization, see table 1 for details, it can be found that the handwritten digit recognition method provided by the embodiment of the present application improves the recognition rate of the handwritten digit recognition under the condition that the recognition number is basically unchanged.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
TABLE 1 identification Rate comparison
Claims (6)
1. A method for handwritten digit recognition, comprising:
acquiring an image data set, wherein the image data set comprises a training image data subset and an image data subset to be identified;
stretching each image data in the image data set to obtain a vector data set, wherein the vector data set comprises a first vector data subset corresponding to the training image data subset and a second vector data subset corresponding to the image data subset to be identified;
acquiring K neighbor vector data of the ith vector data according to the distance between the ith vector data in the vector data set and each vector data in the first vector data subset;
linearly representing the ith vector data with the K neighbor vector data:
wherein, XiThe ith vector data;is the jth vector data in the K adjacent vector data;is the jth vector data of the K adjacent vector dataThe corresponding weight coefficient of the weight is,obtaining through an orthogonal matching pursuit algorithm;
when the ith vector data belongs to the first vector data subset, acquiring a first weighting coefficient vector corresponding to the ith vector data M element of (2)Corresponding to an mth vector data in the first vector data subset, wherein when the mth vector data in the first vector data subset is a jth vector data in K neighboring vector data of the ith vector data,when the m-th vector data does not belong to K neighbor vector data of the i-th vector data,
reducing the dimension of the first vector data subset according to the first weighting coefficient vector, comprising:
obtaining a weighting coefficient matrixWherein,(M ═ 1, 2.. said, M) is a weighting coefficient vector corresponding to the mth vector data in the first vector subset;
construction matrixWherein I is an identity matrix;
for matrix MtrainPerforming characteristic decomposition to obtain characteristic values, wherein the qth characteristic value is lambdaqThe feature vector corresponding to the qth feature value is vq,vqA column vector of dimension M × 1;
sorting the eigenvalues according to the values, acquiring eigenvectors corresponding to 2 nd to d +1 th eigenvalues from small to large, and forming a vector data matrix Y by the acquired eigenvectorstrain=[v2,v3,…,vd+1]Wherein d is a preset dimensionality reduced dimensionality, andm-th vector data X in the first subset of vector datamThe corresponding reduced vector data is xmThe vector data matrix YtrainThe m-th row vector of (1);
when the ith vector data belongs to the second vector data subset, acquiring a second weighting coefficient vector corresponding to the ith vector data The jth element of (1)A jth vector data out of K neighboring vector data corresponding to the ith vector data,
reducing the dimension of the second vector data subset according to the second weighting coefficient vector, comprising:
according to a second weighting coefficient vector corresponding to the nth vector data in the second vector data subsetAnd a reduced-dimension vector data set corresponding to K neighbor vector data of the nth vector data in the second vector data subsetObtaining the nth vector data X in the second vector data subsetnCorresponding reduced-dimension vector data xnThe method specifically comprises the following steps:
acquiring K neighbor vector data of the nth vector data in the second vector data subset after dimensionality reduction according to the distance between any vector data in the first vector data subset after dimensionality reduction and the nth vector data in the second vector data subset after dimensionality reduction;
determining the digital type of the image data to be identified corresponding to the nth vector data in the dimensionality reduced second vector data subset according to the digital type of the image data corresponding to the K adjacent vector data of the nth vector data;
wherein the obtaining by orthogonal matching pursuit algorithmComprises at least one iterative operation:
in each iteration operation, selecting vector data with undetermined weight value from K adjacent vector data of the ith vector dataSo thatMinimum to determine
Wherein,vector data selected for the j-th iterationThe corresponding weight value; f is 1,2, …, u, u is the preset number of iterations.
2. The method of claim 1, wherein the obtaining K neighbor vector data of the ith vector data as a function of the distance between the ith vector data in the set of vector data and each vector data in the first subset of vector data comprises:
and acquiring K adjacent vector data of the ith vector data according to the Euclidean distance between the ith vector data in the vector data set and each vector data in the first vector data subset.
3. The method of claim 1, wherein stretching each image data of the set of image data comprises:
stretching each image data in the image data set by rows or by columns.
4. The method of claim 1, wherein the predetermined dimensionality reduction is 2 or 3.
5. The method of claim 4, further comprising:
and displaying each vector data in the second vector data subset after dimensionality reduction in a d-dimensional coordinate system.
6. A handwritten number recognition system, comprising:
the image data processing module is used for acquiring an image data set, and the image data set comprises a training image data subset and an image data subset to be identified; stretching each image data in the image data set to obtain a vector data set, wherein the vector data set comprises a first vector data subset corresponding to the training image data subset and a second vector data subset corresponding to the image data subset to be identified; acquiring K neighbor vector data of the ith vector data according to the distance between the ith vector data in the vector data set and each vector data in the first vector data subset; linearly representing the ith vector data with the K neighbor vector data:
wherein, XiThe ith vector data;is the jth vector data in the K adjacent vector data;is the jth vector data of the K adjacent vector dataThe corresponding weight coefficient of the weight is,obtaining through an orthogonal matching pursuit algorithm;
a first dimension reduction processing module for obtaining a first weighting coefficient vector corresponding to the ith vector data M element of (2)Corresponding to the mth vector data in the first vector data subsetWherein, when the mth vector data in the first vector data subset is the jth vector data in the K neighboring vector data of the ith vector data,when the m-th vector data does not belong to K neighbor vector data of the i-th vector data,reducing the dimension of the first vector data subset according to the first weighting coefficient vector, comprising: obtaining a weighting coefficient matrixWherein,(M ═ 1, 2.. said, M) is a weighting coefficient vector corresponding to the mth vector data in the first vector subset; construction matrixWherein I is an identity matrix; for matrix MtrainPerforming characteristic decomposition to obtain characteristic values, wherein the qth characteristic value is lambdaqThe feature vector corresponding to the qth feature value is vq,vqThe characteristic values are sorted according to the value size, the characteristic vectors corresponding to the 2 nd to the d +1 th characteristic values are obtained according to the sequence from small to large, and the obtained characteristic vectors form a vector data matrix Ytrain=[v2,v3,…,vd+1]Where d is a preset dimensionality reduced dimensionality, and the m-th vector data X in the first vector data subsetmThe corresponding reduced vector data is xmThe vector data matrix YtrainThe m-th row vector of (1);
a second dimension reduction processing module for obtaining a second weighting coefficient vector corresponding to the ith vector data The jth element of (1)A jth vector data out of K neighboring vector data corresponding to the ith vector data,reducing the dimension of the second vector data subset according to the second weighting coefficient vector, comprising: according to a second weighting coefficient vector corresponding to the nth vector data in the second vector data subsetAnd a reduced-dimension vector data set corresponding to K neighbor vector data of the nth vector data in the second vector data subsetObtaining the nth vector data X in the second vector data subsetnCorresponding reduced-dimension vector data xnThe method specifically comprises the following steps:
the identification module is used for acquiring K neighbor vector data of the nth vector data in the second vector data subset after dimensionality reduction according to the distance between any vector data in the first vector data subset after dimensionality reduction and the nth vector data in the second vector data subset after dimensionality reduction; determining the digital type of the image data to be identified corresponding to the nth vector data in the dimensionality reduced second vector data subset according to the digital type of the image data corresponding to the K adjacent vector data of the nth vector data;
wherein the obtaining by orthogonal matching pursuit algorithmComprises at least one iterative operation:
in each iteration operation, selecting vector data with undetermined weight value from K adjacent vector data of the ith vector dataSo thatMinimum to determine
Wherein,vector data selected for the j-th iterationThe corresponding weight value; f is 1,2, …, u, u is the preset number of iterations.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310286449.4A CN103310237B (en) | 2013-07-09 | 2013-07-09 | Handwritten Numeral Recognition Method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310286449.4A CN103310237B (en) | 2013-07-09 | 2013-07-09 | Handwritten Numeral Recognition Method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103310237A CN103310237A (en) | 2013-09-18 |
CN103310237B true CN103310237B (en) | 2016-08-24 |
Family
ID=49135431
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310286449.4A Expired - Fee Related CN103310237B (en) | 2013-07-09 | 2013-07-09 | Handwritten Numeral Recognition Method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103310237B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103400161A (en) * | 2013-07-18 | 2013-11-20 | 苏州大学 | Handwritten numeral recognition method and system |
CN103679207A (en) * | 2014-01-02 | 2014-03-26 | 苏州大学 | Handwriting number identification method and system |
CN104778478A (en) * | 2015-04-22 | 2015-07-15 | 中国石油大学(华东) | Handwritten numeral identification method |
CN106257495A (en) * | 2015-06-19 | 2016-12-28 | 阿里巴巴集团控股有限公司 | A kind of digit recognition method and device |
CN106650820B (en) * | 2016-12-30 | 2020-04-24 | 山东大学 | Matching and recognizing method for handwritten electric component symbol and standard electric component symbol |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102722713A (en) * | 2012-02-22 | 2012-10-10 | 苏州大学 | Handwritten numeral recognition method based on lie group structure data and system thereof |
CN103164701A (en) * | 2013-04-10 | 2013-06-19 | 苏州大学 | Method and device for recognizing handwritten numbers |
-
2013
- 2013-07-09 CN CN201310286449.4A patent/CN103310237B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102722713A (en) * | 2012-02-22 | 2012-10-10 | 苏州大学 | Handwritten numeral recognition method based on lie group structure data and system thereof |
CN103164701A (en) * | 2013-04-10 | 2013-06-19 | 苏州大学 | Method and device for recognizing handwritten numbers |
Non-Patent Citations (3)
Title |
---|
A Classification Algorithm in Li-K Nearest Neighbor;Bangjun-Wang 等;《2013 Fourth Global Congress on Intelligent Systems》;20131204;185-189 * |
Density-induced margin support vector machines;Li Zhang 等;《Pattern Recognition》;20110731;第44卷(第7期);1448-1460 * |
基于DFS的手写数字识别模型及其应用研究;苗壮;《中国优秀硕士学位论文全文数据库 信息科技辑》;20080515(第5期);I138-640 * |
Also Published As
Publication number | Publication date |
---|---|
CN103310237A (en) | 2013-09-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107451614B (en) | Hyperspectral classification method based on fusion of space coordinates and space spectrum features | |
CN103310237B (en) | Handwritten Numeral Recognition Method and system | |
CN113657425B (en) | Multi-label image classification method based on multi-scale and cross-modal attention mechanism | |
CN105740912B (en) | The recognition methods and system of low-rank image characteristics extraction based on nuclear norm regularization | |
CN107292225B (en) | Face recognition method | |
CN109190643A (en) | Based on the recognition methods of convolutional neural networks Chinese medicine and electronic equipment | |
CN103064941B (en) | Image search method and device | |
CN105335756A (en) | Robust learning model and image classification system | |
CN103699523A (en) | Product classification method and device | |
CN105989368A (en) | Target detection method and apparatus, and mobile terminal | |
Badrinarayanan et al. | Understanding symmetries in deep networks | |
CN104573729A (en) | Image classification method based on kernel principal component analysis network | |
CN103699874B (en) | Crowd abnormal behavior identification method based on SURF (Speed-Up Robust Feature) stream and LLE (Locally Linear Embedding) sparse representation | |
CN105095863A (en) | Similarity-weight-semi-supervised-dictionary-learning-based human behavior identification method | |
CN109063555B (en) | Multi-pose face recognition method based on low-rank decomposition and sparse representation residual error comparison | |
CN110414587A (en) | Depth convolutional neural networks training method and system based on progressive learning | |
Li et al. | Dating ancient paintings of Mogao Grottoes using deeply learnt visual codes | |
CN109816030A (en) | A kind of image classification method and device based on limited Boltzmann machine | |
CN104715266A (en) | Image characteristics extracting method based on combination of SRC-DP and LDA | |
CN106778714A (en) | LDA face identification methods based on nonlinear characteristic and model combination | |
Zhang et al. | Deep manifold-to-manifold transforming network | |
CN103455826A (en) | Efficient matching kernel body detection method based on rapid robustness characteristics | |
CN112257600B (en) | Face recognition method and system | |
Hajihashemi et al. | A pattern recognition based Holographic Graph Neuron for Persian alphabet recognition | |
CN106951509A (en) | Multi-tag coring canonical correlation analysis search method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CP02 | Change in the address of a patent holder |
Address after: Suzhou City, Jiangsu province 215123 Xiangcheng District Ji Road No. 8 Patentee after: SOOCHOW University Address before: 215123 Suzhou Industrial Park, Jiangsu Road, No. 199 Patentee before: Soochow University |
|
CP02 | Change in the address of a patent holder | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160824 |
|
CF01 | Termination of patent right due to non-payment of annual fee |