Summary of the invention
The invention provides a kind of face identification method and watch-dog, for improving precision and the efficiency of recognition of face.
First aspect present invention provides a kind of face identification method, comprising:
Watch-dog obtains face image data;
Described watch-dog carries out local linear discriminatory analysis LLDA to described face image data, extracts face characteristic data;
Described watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to described face characteristic data.
In conjunction with a first aspect of the present invention, in the first implementation of a first aspect of the present invention, described local linear discriminatory analysis LLDA comprises the local linear discriminatory analysis VLLDA based on vector or the local linear discriminatory analysis MLLDA based on matrix.
In conjunction with the first implementation of a first aspect of the present invention, in the second implementation of a first aspect of the present invention, described face image data is expressed as vector by the described local linear discriminatory analysis VLLDA based on vector, and described face image data is expressed as matrix by the described local linear discriminatory analysis MLLDA based on matrix.
In conjunction with a first aspect of the present invention or the first implementation of first aspect or the second implementation of first aspect, in the third implementation of a first aspect of the present invention, described watch-dog carries out local linear discriminatory analysis LLDA to described face image data, extracts face characteristic data and specifically comprises:
Described watch-dog calculates scatter matrix S in the class of described face image data respectively according to described default k nearest neighbor sample, default first formula and default second formula
wand scatter matrix S between class
b, described k nearest neighbor sample packages is containing the set of the training sample of multiple class;
Described first formula of presetting is:
Described second formula of presetting is:
Wherein, the classification number that c ' is k nearest neighbor sample, m ' is the average of k nearest neighbor sample, l '
ifor the number of the i-th class k nearest neighbor sample in classification c ', namely
m '
ifor the average of the k nearest neighbor sample of the i-th class in classification c ', x '
ijfor a jth k nearest neighbor sample of the i-th class in classification c ';
Described watch-dog is according to scatter matrix S in described class
w, scatter matrix S between described class
band Fei Sheer criterion calculates the proper vector of face image data;
Described watch-dog carries out feature extraction to the proper vector of described face image data, obtains described face characteristic data.
In conjunction with the third implementation of a first aspect of the present invention, in the 4th kind of implementation of a first aspect of the present invention, described watch-dog calculates scatter matrix S in the class of described face image data respectively according to described default k nearest neighbor sample, default first formula and default second formula
wand scatter matrix S between class
balso comprise before:
Described watch-dog carries out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample;
Described watch-dog determines described default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment.
In conjunction with a first aspect of the present invention or the first implementation of first aspect or the second implementation of first aspect, in the 5th kind of implementation of a first aspect of the present invention, described watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to described face characteristic data and specifically comprises:
Described face characteristic data are mated with described default k nearest neighbor sample by described watch-dog;
Described watch-dog utilizes the training sample matched to obtain the test sample book corresponding with described face characteristic data by k nearest neighbor algorithm;
Described watch-dog calculates the Euclidean distance between described test sample book and described default k nearest neighbor sample;
When described Euclidean distance is less than preset threshold value, determine in facial feature database, to comprise described face characteristic data; When described Euclidean distance is greater than preset threshold value, determine in facial feature database, not comprise described face characteristic data.
In conjunction with the 5th kind of implementation of a first aspect of the present invention, in the 6th kind of implementation of a first aspect of the present invention, described determine in facial feature database, not comprise described face characteristic data after comprise:
Described watch-dog display warning picture, and the prompt tone that gives a warning.
Second aspect present invention provides a kind of watch-dog, comprising:
Acquiring unit, for obtaining face image data;
Analytic unit, for carrying out local linear discriminatory analysis LLDA to described face image data, extracts face characteristic data;
Recognition unit, for carrying out Classification and Identification according to the k nearest neighbor sample preset to described face characteristic data.
In conjunction with a second aspect of the present invention, in the first implementation of a second aspect of the present invention, described analytic unit specifically comprises:
First computing module, for according to described default k nearest neighbor sample, preset the first formula and preset scatter matrix S in class that the second formula calculates described face image data respectively
wand scatter matrix S between class
b, described k nearest neighbor sample packages is containing the set of the training sample of multiple class;
Described first formula of presetting is:
Described second formula of presetting is:
Wherein, the classification number that c ' is k nearest neighbor sample, m ' is the average of k nearest neighbor sample, l '
ifor the number of the i-th class k nearest neighbor sample in classification c ', namely
m '
ifor the average of the k nearest neighbor sample of the i-th class in classification c ', x '
ijfor a jth k nearest neighbor sample of the i-th class in classification c ';
Second computing module, for according to scatter matrix S in described class
w, scatter matrix S between described class
band Fei Sheer criterion calculates the proper vector of face image data;
Extraction module, for carrying out feature extraction to the proper vector of described face image data, obtains described face characteristic data.
In conjunction with the first implementation of a second aspect of the present invention, in the second implementation of a second aspect of the present invention, described watch-dog also comprises:
Processing unit, for carrying out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample;
Determining unit, for determining described default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment.
In conjunction with a second aspect of the present invention or the first implementation of second aspect or the second implementation of second aspect, in the third implementation of a second aspect of the present invention, described recognition unit specifically comprises:
Matching module, for mating described face characteristic data with described default k nearest neighbor sample;
3rd computing module, obtains the test sample book corresponding with described face characteristic data for utilizing the training sample matched by k nearest neighbor algorithm;
4th computing module, for calculating the Euclidean distance between described test sample book and described default k nearest neighbor sample;
First determination module, for after described Euclidean distance is less than preset threshold value, determines to comprise described face characteristic data in facial feature database;
Second determination module, for after described Euclidean distance is greater than preset threshold value, determines not comprise described face characteristic data in facial feature database.
In conjunction with the third implementation of a second aspect of the present invention, in the 4th kind of implementation of a second aspect of the present invention, described recognition unit also comprises:
Output module, for after determining not comprise described face characteristic data in described facial feature database, display warning picture, and the prompt tone that gives a warning.
As can be seen from the above technical solutions, the embodiment of the present invention has the following advantages: watch-dog obtains face image data; Described watch-dog carries out local linear discriminatory analysis LLDA to described face image data, extracts face characteristic data; Described watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to described face characteristic data.The present invention is based on the process to large data, employing be distributed structure/architecture, rely on that the distributed treatment of cloud computing, distributed data base and cloud store, Intel Virtualization Technology.Therefore, when data category distribution is more complicated, by carrying out local linear discriminatory analysis LLDA to described face image data, thus only need train the sub-fraction of whole training set before testing, and according to the k nearest neighbor sample preset, Classification and Identification is carried out to described face characteristic data, improve precision and the efficiency of recognition of face.By said method, watch-dog carries out man face image acquiring to the personnel of region, preserves in a database as training sample.After collection completes, just can carry out man face image acquiring to dealing personnel and as test sample book.Described training sample is used to Modling model, utilizes their feature can structural classification device, and some parameters of sorter are determined by the feature of training sample.Described test sample book can think new unknown sample, is classified to test sample book by the sorter established.Then carry out recognition of face, not personnel are in a database irised out with rectangle frame in display frame, and send caution sound and remind security personnel to can personnel check, to take precautions against the personal safety as well as the property safety of specifying place.Because the method does not need to train all samples, but wherein a part of sample, be more suitable for the process to large data in this way, popular saying is exactly the process to great amount of samples.And traditional LDA be not suitable for the process of large sample.
Embodiment
For making goal of the invention of the present invention, feature, advantage can be more obvious and understandable, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, the embodiments described below are only the present invention's part embodiments, and the embodiment of not all.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Be specifically described face identification method a kind of in the embodiment of the present invention below, refer to Fig. 1, in the embodiment of the present invention, an a kind of embodiment of face identification method comprises:
101, watch-dog obtains face image data;
Watch-dog obtains face image data; It should be noted that, watch-dog is by USB (Universal Serial Bus is leading to and getting lines crossed) interface or network node, any one obtains existing face image data; Or obtain face image data by the photographing module connected, concrete obtain manner is not construed as limiting herein.
102, above-mentioned watch-dog carries out local linear discriminatory analysis LLDA to above-mentioned face image data, extracts face characteristic data;
Above-mentioned watch-dog carries out local linear discriminatory analysis LLDA (Local Linear Discriminant Analysis, local linear discriminatory analysis) to above-mentioned face image data and extracts face characteristic data; It should be noted that, above-mentioned local linear discriminatory analysis LLDA comprises local linear discriminatory analysis VLLDA (the Vector Local Linear Discriminant Analysis based on vector, local linear discriminatory analysis based on vector) or based on the local linear discriminatory analysis MLLDA (Matrix Local Linear Discriminant Analysis, the local linear discriminatory analysis based on matrix) of matrix.Wherein, above-mentioned face image data is expressed as vector by the above-mentioned local linear discriminatory analysis VLLDA based on vector, and above-mentioned face image data is expressed as matrix by the above-mentioned local linear discriminatory analysis MLLDA based on matrix.
103, above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data.
Above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data; It should be noted that, above-mentioned default k nearest neighbor sample is K arest neighbors of the test sample book determined in training sample, and the number of K is not construed as limiting; Compare with the facial feature database preserved after classification is carried out to above-mentioned face characteristic data, thus complete face recognition process.
In the embodiment of the present invention, watch-dog obtains face image data; Above-mentioned watch-dog carries out local linear discriminatory analysis LLDA to above-mentioned face image data, extracts face characteristic data; Above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data.The present invention is based on the process to large data, employing be distributed structure/architecture, rely on that the distributed treatment of cloud computing, distributed data base and cloud store, Intel Virtualization Technology.Therefore, when data category distribution is more complicated, by carrying out local linear discriminatory analysis LLDA to above-mentioned face image data, thus only need train the sub-fraction of whole training set before testing, and according to the k nearest neighbor sample preset, Classification and Identification is carried out to above-mentioned face characteristic data, improve precision and the efficiency of recognition of face.
By said method, watch-dog carries out man face image acquiring to the personnel of region, preserves in a database as training sample.After collection completes, just can carry out man face image acquiring to dealing personnel and as test sample book.Described training sample is used to Modling model, utilizes their feature can structural classification device, and some parameters of sorter are determined by the feature of training sample.Described test sample book can think new unknown sample, is classified to test sample book by the sorter established.Then carry out recognition of face, not personnel are in a database irised out with rectangle frame in display frame, and send caution sound and remind security personnel to can personnel check, to take precautions against the personal safety as well as the property safety of specifying place.Because the method does not need to train all samples, but wherein a part of sample, be more suitable for the process to large data in this way, popular saying is exactly the process to great amount of samples.And traditional LDA be not suitable for the process of large sample.
Based on the face identification method in above-described embodiment, the detailed process below for above-mentioned local linear discriminatory analysis LLDA is illustrated, and refers to Fig. 2, and in the embodiment of the present invention, another embodiment of a kind of face identification method comprises:
201, watch-dog obtains face image data;
Watch-dog obtains face image data; It should be noted that, watch-dog is by USB (Universal Serial Bus is leading to and getting lines crossed) interface or network node, any one obtains existing face image data; Or obtain face image data by the photographing module connected, concrete obtain manner is not construed as limiting herein.
202, above-mentioned watch-dog according to the k nearest neighbor sample preset, preset the first formula and preset scatter matrix S in class that the second formula calculates above-mentioned face image data respectively
wand scatter matrix S between class
b;
It should be noted that, above-mentioned k nearest neighbor sample packages is containing the set of the training sample of multiple class; Above-mentioned first formula of presetting is:
Above-mentioned second formula of presetting is:
Wherein, the classification number that c ' is k nearest neighbor sample, m ' is the average of k nearest neighbor sample, l '
ifor the number of the i-th class k nearest neighbor sample in classification c ', namely
m '
ifor the average of the k nearest neighbor sample of the i-th class in classification c ', x '
ijfor a jth k nearest neighbor sample of the i-th class in classification c '.
203, above-mentioned watch-dog is according to scatter matrix S in above-mentioned class
w, scatter matrix S between above-mentioned class
band Fei Sheer criterion calculates the proper vector of face image data;
It should be noted that, above-mentioned specific algorithm can with reference to as follows: such as, in VLLDA algorithm, the vector representation of input face image data.For a given sample, from whole training sample x
i∈ R
n(i=1,2 ..., L) in determine K arest neighbors of this sample.This K arest neighbors is expressed as x '
i∈ R
n(i=1,2 ..., K).They, from the individual classification of c ', are expressed as c '
i(i=1,2 ..., c '), these classifications are parts of whole classification.If classification c '
ithere is l '
iindividual fixed neighbour, namely
m '
irepresent at classification c '
iin the average of fixed neighbour, x '
ijfor this sample is at classification c '
iin jth fixed neighbour.In definition class, between scatter matrix and class, scatter matrix is as follows:
Wherein, m ' is the average of whole fixed neighbour.Then, local can be expressed as based on the Fei Sheer criterion of vector:
Be understandable that, if each classification in the individual classification of c ' only comprises an arest neighbors of given sample, in the class of so these arest neighbors, scatter matrix is exactly a null matrix.So, in above-mentioned VLLDA algorithm, only need to utilize scatter matrix between class
, and criterion just becomes:
On the other hand, if whole K arest neighbors of given sample are all from same classification, so between their class, scatter matrix is exactly a null matrix.So, only need to utilize scatter matrix in class
and criterion becomes:
So, for a given sample, make J
vLF(W
v) maximize, and obtaining a projection matrix, this matrix column is proper vector, correspond to secular equation
top eigenwert, or matrix
or
top eigenwert.
Different from VLLDA, the input data in MLLDA are represented as matrix.Suppose the training sample having L from c classification
in order to extract the feature of sample, first we determine its K arest neighbors from training set.These neighbours are expressed as A '
i(i=1,2 ..., K), and from the individual classification C ' of C '
i(i=1,2 ..., C '), the individual classification of this c ' is a part for whole classification.Then, we define K the fixed neighbour of a sample class between scatter matrix and class scatter matrix as follows:
Wherein, L '
iat classification C '
ithe number of the fixed neighbour in classification, namely
m '
irepresent at classification C '
iin the average of fixed neighbour, A '
ijat classification C '
iin jth fixed neighbour, M ' represents the average of K fixed neighbour of given sample.So local can be expressed as based on the Fei Sheer criterion of matrix:
Similarly, if each classification in the individual classification of C ' only has a fixed neighbour, in the class of so this K fixed neighbour, scatter matrix is a null matrix.So MLLDA only needs to utilize scatter matrix between class
, and criterion is:
On the other hand, if whole K arest neighbors of given sample are all from same classification, so between their class, scatter matrix is exactly a null matrix.So we only need to utilize scatter matrix in class
, and criterion becomes:
Be understandable that, for a given sample, make J
mLF(W
m) maximize, and obtaining a projection matrix, this matrix column is proper vector, correspond to secular equation
top eigenwert, or matrix
or
top eigenwert.
204, above-mentioned watch-dog carries out feature extraction to the proper vector of above-mentioned face image data, obtains above-mentioned face characteristic data;
Above-mentioned watch-dog carries out feature extraction to the proper vector of above-mentioned face image data, obtains above-mentioned face characteristic data.
205, above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data.
Above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data; Above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data; It should be noted that, above-mentioned default k nearest neighbor sample is K arest neighbors of the test sample book determined in training sample, and the number of K is not construed as limiting; Compare with the facial feature database preserved after classification is carried out to above-mentioned face characteristic data, thus complete face recognition process; Above-mentioned sorting technique can select nearest neighbor classifier or other sorters to classify to above-mentioned face characteristic data, is not specifically restricted.
In the embodiment of the present invention, above-mentioned watch-dog according to the k nearest neighbor sample preset, preset the first formula and to preset in class that the second formula calculates above-mentioned face image data respectively scatter matrix between scatter matrix and class, and utilize Fei Sheer criterion to calculate the proper vector of face image data, thus extract face characteristic data by Partial data structure, improve precision and the efficiency of recognition of face.
Based on the face identification method in above-described embodiment, in the embodiment of the present invention, for the recognition of face of large database concept, first can carry out Data Dimensionality Reduction to it, to carry out characteristic extraction, refer to Fig. 3, in the embodiment of the present invention, another embodiment of a kind of face identification method comprises:
301, watch-dog obtains face image data;
Watch-dog obtains face image data; It should be noted that, watch-dog is by USB interface or network node, any one obtains existing face image data; Or obtain face image data by the photographing module connected, concrete obtain manner is not construed as limiting herein.
302, above-mentioned watch-dog carries out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample;
Above-mentioned watch-dog carries out dimension-reduction treatment according to principal component analysis (PCA) PCA (Principal Component Analysis, principal component analysis (PCA)) to training sample; Namely first PCA conversion is carried out to training sample, obtain the projection matrix after PCA projection.
303, above-mentioned watch-dog determines above-mentioned default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment;
Above-mentioned watch-dog determines above-mentioned default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment; K nearest neighbor algorithm with reference to prior art, wherein, can determine that namely above-mentioned default k nearest neighbor sample determines K nearest samples of test sample book from above-mentioned training sample.
304, above-mentioned watch-dog according to the k nearest neighbor sample preset, preset the first formula and preset scatter matrix S in class that the second formula calculates above-mentioned face image data respectively
wand scatter matrix S between class
b;
It should be noted that, above-mentioned k nearest neighbor sample packages is containing the set of the training sample of multiple class; Above-mentioned first formula of presetting is:
Above-mentioned second formula of presetting is:
Wherein, the classification number that c ' is k nearest neighbor sample, m ' is the average of k nearest neighbor sample, l '
ifor the number of the i-th class k nearest neighbor sample in classification c ', namely
m '
ifor the average of the k nearest neighbor sample of the i-th class in classification c ', x '
ijfor a jth k nearest neighbor sample of the i-th class in classification c '.
305, above-mentioned watch-dog is according to scatter matrix S in above-mentioned class
w, scatter matrix S between above-mentioned class
band Fei Sheer criterion calculates the proper vector of face image data;
Specific algorithm can refer step 203, repeats no more herein.
306, above-mentioned watch-dog carries out feature extraction to the proper vector of above-mentioned face image data, obtains above-mentioned face characteristic data;
Above-mentioned watch-dog carries out feature extraction to the proper vector of above-mentioned face image data, obtains above-mentioned face characteristic data.
307, above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data.
Above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data; Above-mentioned watch-dog carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data; It should be noted that, above-mentioned default k nearest neighbor sample is K arest neighbors of the test sample book determined in training sample, and the number of K is not construed as limiting; Compare with the facial feature database preserved after classification is carried out to above-mentioned face characteristic data, thus complete face recognition process; Above-mentioned sorting technique can select nearest neighbor classifier or other sorters to classify to above-mentioned face characteristic data, is not specifically restricted.
In the embodiment of the present invention, above-mentioned watch-dog carries out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample, and from the training sample after dimension-reduction treatment, determines above-mentioned default k nearest neighbor sample by k nearest neighbor algorithm; Thus from huge database, face to be identified more accurately.
Based on the face identification method in above-described embodiment, in the embodiment of the present invention, will carry out Classification and Identification to above-mentioned face characteristic data and be described specifically, and refer to Fig. 4, in the embodiment of the present invention, another embodiment of a kind of face identification method comprises:
401, watch-dog obtains face image data;
Watch-dog obtains face image data; It should be noted that, watch-dog is by USB interface or network node, any one obtains existing face image data; Or obtain face image data by the photographing module connected, concrete obtain manner is not construed as limiting herein.
402, above-mentioned watch-dog carries out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample;
Above-mentioned watch-dog carries out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample; Namely first PCA conversion is carried out to training sample, obtain the projection matrix after PCA projection.
403, above-mentioned watch-dog determines above-mentioned default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment;
Above-mentioned watch-dog determines above-mentioned default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment; K nearest neighbor algorithm with reference to prior art, wherein, can determine that namely above-mentioned default k nearest neighbor sample determines K nearest samples of test sample book from above-mentioned training sample.
404, above-mentioned watch-dog according to the k nearest neighbor sample preset, preset the first formula and preset scatter matrix S in class that the second formula calculates above-mentioned face image data respectively
wand scatter matrix S between class
b;
It should be noted that, above-mentioned k nearest neighbor sample packages is containing the set of the training sample of multiple class; Above-mentioned first formula of presetting is:
Above-mentioned second formula of presetting is:
Wherein, the classification number that c ' is k nearest neighbor sample, m ' is the average of k nearest neighbor sample, l '
ifor the number of the i-th class k nearest neighbor sample in classification c ', namely
m '
ifor the average of the k nearest neighbor sample of the i-th class in classification c ', x '
ijfor a jth k nearest neighbor sample of the i-th class in classification c '.
405, above-mentioned watch-dog is according to scatter matrix S in above-mentioned class
w, scatter matrix S between above-mentioned class
band Fei Sheer criterion calculates the proper vector of face image data;
Specific algorithm can refer step 203, repeats no more herein.
406, above-mentioned watch-dog carries out feature extraction to the proper vector of above-mentioned face image data, obtains above-mentioned face characteristic data;
Above-mentioned watch-dog carries out feature extraction to the proper vector of above-mentioned face image data, obtains above-mentioned face characteristic data.
407, above-mentioned face characteristic data are mated with above-mentioned default k nearest neighbor sample by above-mentioned watch-dog;
Above-mentioned face characteristic data are mated with above-mentioned default k nearest neighbor sample by above-mentioned watch-dog.
408, above-mentioned watch-dog utilizes the training sample matched to obtain the test sample book corresponding with above-mentioned face characteristic data by k nearest neighbor algorithm;
Above-mentioned watch-dog utilizes the training sample matched to obtain the test sample book corresponding with above-mentioned face characteristic data by k nearest neighbor algorithm.
409, above-mentioned watch-dog calculates the Euclidean distance between above-mentioned test sample book and above-mentioned default k nearest neighbor sample;
Above-mentioned watch-dog calculates the Euclidean distance between above-mentioned test sample book and above-mentioned default k nearest neighbor sample.
410, when above-mentioned Euclidean distance is less than preset threshold value, determine in facial feature database, to comprise above-mentioned face characteristic data; When above-mentioned Euclidean distance is greater than preset threshold value, determine in facial feature database, not comprise above-mentioned face characteristic data.
When above-mentioned Euclidean distance is less than preset threshold value, determine in facial feature database, to comprise above-mentioned face characteristic data; When above-mentioned Euclidean distance is greater than preset threshold value, determine in facial feature database, not comprise above-mentioned face characteristic data.It should be noted that, when determining not comprise above-mentioned face characteristic data in above-mentioned facial feature database, this watch-dog display warning picture, and the prompt tone that gives a warning; Specifically with rectangle frame, the facial image got can be irised out in display frame, and send caution sound and remind security personnel to check a suspect, specify the personal safety as well as the property safety in place to ensure.
In the embodiment of the present invention, above-mentioned watch-dog calculates the Euclidean distance between above-mentioned test sample book and above-mentioned default k nearest neighbor sample, when above-mentioned Euclidean distance is less than preset threshold value, determines to comprise above-mentioned face characteristic data in facial feature database; When above-mentioned Euclidean distance is greater than preset threshold value, determine in facial feature database, not comprise above-mentioned face characteristic data, and display warning picture, give a warning prompt tone, thus complete face recognition process.
Above face identification method a kind of in the embodiment of the present invention is described, from the angle of device, a kind of watch-dog the embodiment of the present invention is described in detail below, refer to Fig. 5, in the embodiment of the present invention, an a kind of embodiment of watch-dog comprises:
Acquiring unit 501, for obtaining face image data;
Analytic unit 502, for carrying out local linear discriminatory analysis LLDA to above-mentioned face image data, extracts face characteristic data;
Recognition unit 503, for carrying out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data.
It should be noted that, the mode of above-mentioned acquisition face image data is by USB interface or network node, any one obtains existing face image data; Or obtain face image data by the photographing module connected, concrete obtain manner is not construed as limiting herein.
Above-mentioned local linear discriminatory analysis LLDA comprises the local linear discriminatory analysis VLLDA based on vector or the local linear discriminatory analysis MLLDA based on matrix.Wherein, above-mentioned face image data is expressed as vector by the above-mentioned local linear discriminatory analysis VLLDA based on vector, and above-mentioned face image data is expressed as matrix by the above-mentioned local linear discriminatory analysis MLLDA based on matrix.
Above-mentioned default k nearest neighbor sample is K arest neighbors of the test sample book determined in training sample, and the number of K is not construed as limiting; Compare with the facial feature database preserved after carrying out classification to above-mentioned face characteristic data, thus complete face recognition process, the processing mode of above-mentioned face image data is by extra large dupp Hadoop process.
In the embodiment of the present invention, above-mentioned acquiring unit 501 obtains face image data; Above-mentioned analytic unit 502 carries out local linear discriminatory analysis LLDA to above-mentioned face image data, extracts face characteristic data; Above-mentioned recognition unit 503 carries out Classification and Identification according to the k nearest neighbor sample preset to above-mentioned face characteristic data.Therefore, when data category distribution is more complicated, by carrying out local linear discriminatory analysis LLDA to above-mentioned face image data, thus only need train the sub-fraction of whole training set before testing, and according to the k nearest neighbor sample preset, Classification and Identification is carried out to above-mentioned face characteristic data, improve precision and the efficiency of recognition of face.
Based on the watch-dog in above-described embodiment, optionally, as shown in Figure 6, in the embodiment of the present invention, above-mentioned analytic unit 502 specifically comprises:
First computing module 601, for according to above-mentioned default k nearest neighbor sample, preset the first formula and to preset in class that the second formula calculates above-mentioned face image data respectively scatter matrix Sb between scatter matrix Sw and class;
Second computing module 602, for according in above-mentioned class between scatter matrix Sw, above-mentioned class scatter matrix Sb and Fei Sheer criterion calculate the proper vector of face image data;
Extraction module 603, for carrying out feature extraction to the proper vector of above-mentioned face image data, obtains above-mentioned face characteristic data.
Detailed process can with reference to as follows: such as, in VLLDA algorithm, the vector representation of input face image data.For a given sample, from whole training sample x
i∈ R
n(i=1,2 ..., L) in determine K arest neighbors of this sample.This K arest neighbors is expressed as x '
i∈ R
n(i=1,2 ..., K).They, from the individual classification of c ', are expressed as c '
i(i=1,2 ..., c '), these classifications are parts of whole classification.If classification c '
ithere is l '
iindividual fixed neighbour, namely
m '
irepresent at classification c '
iin the average of fixed neighbour, x '
ijfor this sample is at classification c '
iin jth fixed neighbour.In definition class, between scatter matrix and class, scatter matrix is as follows:
Wherein, m ' is the average of whole fixed neighbour.Then, local can be expressed as based on the Fei Sheer criterion of vector:
Be understandable that, if each classification in the individual classification of c ' only comprises an arest neighbors of given sample, in the class of so these arest neighbors, scatter matrix is exactly a null matrix.So, in above-mentioned VLLDA algorithm, only need to utilize scatter matrix between class
and criterion just becomes:
On the other hand, if whole K arest neighbors of given sample are all from same classification, so between their class, scatter matrix is exactly a null matrix.So, only need to utilize scatter matrix in class
and criterion becomes:
So, for a given sample, make J
vLF(W
v) maximize, and obtaining a projection matrix, this matrix column is proper vector, correspond to secular equation
top eigenwert, or matrix
or
top eigenwert.
Different from VLLDA, the input data in MLLDA are represented as matrix.Suppose the training sample having L from c classification
.In order to extract the feature of sample, first we determine its K arest neighbors from training set.These neighbours are expressed as A '
i(i=1,2 ..., K), and from the individual classification C ' of C '
i(i=1,2 ..., C '), the individual classification of this c ' is a part for whole classification.Then, we define K the fixed neighbour of a sample class between scatter matrix and class scatter matrix as follows:
Wherein, L '
iat classification C '
ithe number of the fixed neighbour in classification, namely
m '
irepresent at classification C '
iin the average of fixed neighbour, A '
ijat classification C '
iin jth fixed neighbour, M ' represents the average of K fixed neighbour of given sample.So local can be expressed as based on the Fei Sheer criterion of matrix:
Similarly, if each classification in the individual classification of C ' only has a fixed neighbour, in the class of so this K fixed neighbour, scatter matrix is a null matrix.So MLLDA only needs to utilize scatter matrix between class
and criterion is:
On the other hand, if whole K arest neighbors of given sample are all from same classification, so between their class, scatter matrix is exactly a null matrix.So we only need to utilize scatter matrix in class
and criterion becomes:
Be understandable that, for a given sample, make J
mLF(W
m) maximize, and obtaining a projection matrix, this matrix column is proper vector, correspond to secular equation
top eigenwert, or matrix
or
top eigenwert; Carry out feature extraction after obtaining above-mentioned proper vector, thus obtain above-mentioned face characteristic data.
In the embodiment of the present invention, first computing module 601 according to the k nearest neighbor sample preset, preset the first formula and to preset in class that the second formula calculates above-mentioned face image data respectively scatter matrix between scatter matrix and class, and utilize Fei Sheer criterion to calculate the proper vector of face image data by above-mentioned second computing module 602, thus extract face characteristic data by Partial data structure, improve precision and the efficiency of recognition of face.
Based on the watch-dog in above-described embodiment, optionally, as shown in Figure 7, in the embodiment of the present invention, above-mentioned watch-dog also comprises:
Processing unit 701, for carrying out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample;
Determining unit 702, for determining above-mentioned default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment.
It should be noted that, above-mentionedly according to principal component analysis (PCA) PCA, dimension-reduction treatment is carried out to training sample and namely PCA conversion is carried out to training sample, obtain the projection matrix after PCA projection; Above-mentioned k nearest neighbor algorithm with reference to prior art, wherein, can determine that namely above-mentioned default k nearest neighbor sample determines K nearest samples of test sample book from above-mentioned training sample.
In the embodiment of the present invention, above-mentioned processing unit 701 carries out dimension-reduction treatment according to principal component analysis (PCA) PCA to training sample, and above-mentioned determining unit 702 determines above-mentioned default k nearest neighbor sample by k nearest neighbor algorithm from the training sample after dimension-reduction treatment; Thus from huge database, face to be identified more accurately.
Based on the watch-dog in above-described embodiment, optionally, as shown in Figure 8, in the embodiment of the present invention, above-mentioned recognition unit 503 specifically comprises:
Matching module 801, for mating above-mentioned face characteristic data with above-mentioned default k nearest neighbor sample;
3rd computing module 802, obtains the test sample book corresponding with above-mentioned face characteristic data for utilizing the training sample matched by k nearest neighbor algorithm;
4th computing module 803, for calculating the Euclidean distance between above-mentioned test sample book and above-mentioned default k nearest neighbor sample;
First determination module 804, for after above-mentioned Euclidean distance is less than preset threshold value, determines to comprise above-mentioned face characteristic data in facial feature database;
Second determination module 805, for after above-mentioned Euclidean distance is greater than preset threshold value, determines not comprise above-mentioned face characteristic data in facial feature database.
In the embodiment of the present invention, above-mentioned 4th computing module 803 calculates the Euclidean distance between above-mentioned test sample book and above-mentioned default k nearest neighbor sample, when above-mentioned Euclidean distance is less than preset threshold value, above-mentioned first determination module 804 is determined to comprise above-mentioned face characteristic data in facial feature database; When above-mentioned Euclidean distance is greater than preset threshold value, above-mentioned second determination module 805 is determined not comprise above-mentioned face characteristic data in facial feature database, thus completes face recognition process.
Based on the watch-dog in above-described embodiment, optionally, as shown in Figure 9, in the embodiment of the present invention, above-mentioned recognition unit 503 also comprises:
Output module 901, for after determining not comprise above-mentioned face characteristic data in above-mentioned facial feature database, display warning picture, and the prompt tone that gives a warning.
It should be noted that, the specific implementation that above-mentioned output module 901 shows warning picture can be irised out by the facial image got with rectangle frame in display frame, and send caution sound and remind security personnel to check a suspect, specify the personal safety as well as the property safety in place to ensure.
In the embodiment of the present invention, after determining not comprise above-mentioned face characteristic data in above-mentioned facial feature database, show warning picture by above-mentioned output module 901, and the prompt tone that gives a warning, to make the precautionary measures in time, ensure the personal safety as well as the property safety of specifying place.
Above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.