Summary of the invention
In view of the above problems, proposing the present invention to provide a kind of overcomes the problems referred to above or solves the problem at least in part, and technical scheme of the present invention is achieved in that
On the one hand, the invention provides a kind of gender identification method based on image, comprising:
Obtain facial image to be detected and corresponding key point; Described key point is the corner location of main portions;
According to described facial image to be detected and corresponding key point, extract face primitive character to be detected;
Described face primitive character to be detected is carried out dimension-reduction treatment, obtains the low dimension proper vector of face to be detected;
By sex model of cognition, sex identification is carried out to the low dimension proper vector of described face to be detected.
Preferably, the method also comprises:
Described according to described facial image to be detected and corresponding key point, extract face primitive character step to be detected, specifically comprise:
According to described facial image to be detected and corresponding key point, obtain face local feature to be detected;
Described face local feature to be detected is connected in series, obtains face primitive character to be detected;
Described described face primitive character to be detected is carried out dimension-reduction treatment, obtains face to be detected low dimension proper vector step, specifically comprise:
Obtain Feature Dimension Reduction matrix and described face primitive character to be detected;
By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described face primitive character to be detected, obtain the low dimension proper vector of face to be detected.
Preferably, the method also comprises:
Obtain the sex of facial image sample information set and correspondence image sample;
Determine the key point of each sample in the set of described facial image sample information; Described key point is the corner location of main portions;
According to each sample and key point thereof in the set of described facial image sample information, obtain the primitive character of each sample in the set of described facial image sample information;
The primitive character of each sample in the set of described facial image sample information is carried out dimension-reduction treatment, obtains the low dimension proper vector of each sample;
By the sex value training sex model of cognition that the low dimension proper vector of described each sample is corresponding with it, obtain described sex model of cognition, used in order to follow-up sex identification; Wherein, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model.
Preferably, described according to each sample and key point thereof in the set of described facial image sample information, the primitive character step obtaining each sample in the set of described facial image sample information comprises:
According to the key point of each sample in the set of described facial image sample information, obtain the local feature of each sample;
Sample image local feature same in the set of described facial image sample information is connected in series, obtains each sample primitive character.
Preferably, described the primitive character of each sample in the set of described facial image sample information is carried out dimension-reduction treatment, obtains the low dimension proper vector step of each sample, comprising:
Feature Dimension Reduction matrix is obtained by dimension-reduction algorithm;
By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described each sample primitive character, obtain the low dimension proper vector of each sample.
Preferably, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model; Describedly by sex model of cognition, sex identification step is carried out to the low dimension proper vector of described face to be detected and comprises:
Adopt the sex identifying of two verification mode as follows:
Preset the similar threshold value one of described standard women face model and described standard male sex face model similar threshold value two;
By described measuring similarity model, obtain described face to be detected low dimension proper vector and described standard women face distortion one and described face to be detected low dimension proper vector and described standard male sex face distortion two;
Described in interpretation, whether similarity one exceedes described threshold value one; If described similarity one exceedes described threshold value one, be then tentatively judged as women; Otherwise, then tentatively the male sex is judged as;
Described in interpretation, whether similarity two exceedes described threshold value two; If described similarity two exceedes described threshold value two, be then tentatively judged as the male sex; Otherwise, then tentatively women is judged as;
If described judgement is consistent, then export judged result; If described judgement is inconsistent, then exporting can not recognition result;
Or, adopt the sex identifying of recognition method as follows:
Preset similarity otherness threshold value;
By described measuring similarity model, obtain described face to be detected low dimension proper vector and described standard women face distortion one and described face to be detected low dimension proper vector and described standard male sex face distortion two;
Judge whether described similarity one is less than described similarity otherness threshold value with the absolute value of the difference of described similarity two;
If described absolute value is less than described similarity otherness threshold value, then exporting can not recognition result;
If described absolute value is greater than described similarity otherness threshold value, then export sex types corresponding to similarity higher value.
On the other hand, the invention provides a kind of sex recognition device based on image, comprising:
Information acquisition unit, for obtaining facial image to be detected and corresponding key point; Described key point is the corner location of main portions;
Feature extraction unit, for according to described facial image to be detected and corresponding key point, extracts face primitive character to be detected;
Dimensionality reduction unit, for described face primitive character to be detected is carried out dimension-reduction treatment, obtains the low dimension proper vector of face to be detected;
Sex recognition unit, for carrying out sex identification by sex model of cognition to the low dimension proper vector of described face to be detected.
Preferably, described feature extraction unit specifically comprises:
Local feature obtains subelement, for according to described facial image to be detected and corresponding key point, obtains face local feature to be detected;
Primitive character obtains subelement, for being connected in series by described face local feature to be detected, obtains face primitive character to be detected;
Described dimensionality reduction unit, also for obtaining Feature Dimension Reduction matrix and described face primitive character to be detected; By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described face primitive character to be detected, obtain the low dimension proper vector of face to be detected.
Preferably, this device also comprises:
Sample information acquiring unit, for obtaining the sex of the set of facial image sample information and correspondence image sample;
Position determination unit, for determining the key point of each sample in the set of described facial image sample information; Described key point is the corner location of main portions;
Sample primitive character acquiring unit, for according to each sample and key point thereof in the set of described facial image sample information, obtains the primitive character of each sample in the set of described facial image sample information;
Sample dimensionality reduction unit, for the primitive character of each sample in the set of described facial image sample information is carried out dimension-reduction treatment, obtains the low dimension proper vector of each sample;
Model acquiring unit, trains sex model of cognition for the sex value corresponding with it by the low dimension proper vector of described each sample, obtains described sex model of cognition, used in order to follow-up sex identification; Wherein, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model.
Preferably, described sample primitive character acquiring unit is used for the key point according to each sample in the set of described facial image sample information, obtains the local feature of each sample; Sample image local feature same in the set of described facial image sample information is connected in series, obtains each sample primitive character.
Described sample dimensionality reduction unit, for obtaining Feature Dimension Reduction matrix by dimension-reduction algorithm; By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described each sample primitive character, obtain the low dimension proper vector of each sample.
Preferably, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model; Described sex recognition unit adopts two verification mode or recognition method to carry out sex identification.
Again on the one hand, the invention provides a kind of sex recognition system based on image, comprising: the sex recognition device based on image as above described in any one.
The present invention realizes sex identification by the local shape factor of key point, improves robustness and the accuracy of identification of system significantly, and in addition, the training of described sex model of cognition does not need the identity information knowing sample, greatly facilitates the acquisition of training sample.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
As a kind of gender identification method based on image that Fig. 1 provides for being depicted as the embodiment of the present invention; The method comprises:
101: obtain facial image to be detected and corresponding key point; Described key point is the corner location of main portions;
102: according to described facial image to be detected and corresponding key point, extract face primitive character to be detected;
103: described face primitive character to be detected is carried out dimension-reduction treatment, obtain the low dimension proper vector of face to be detected;
104: by sex model of cognition, sex identification is carried out to the low dimension proper vector of described face to be detected.
It should be noted that, described according to described facial image to be detected and corresponding key point, extract face primitive character step to be detected, specifically comprise:
According to described facial image to be detected and corresponding key point, obtain face local feature to be detected;
Described face local feature to be detected is connected in series, obtains face primitive character to be detected;
Described described face primitive character to be detected is carried out dimension-reduction treatment, obtains face to be detected low dimension proper vector step, specifically comprise:
Obtain Feature Dimension Reduction matrix and described face primitive character to be detected;
By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described face primitive character to be detected, obtain the low dimension proper vector of face to be detected.
Based on above embodiment, be illustrated in figure 3 a kind of training process flow diagram based on sex model of cognition in the gender identification method of image; This training flow process is as follows:
301: the sex obtaining facial image sample information set and correspondence image sample;
302: the key point determining each sample in the set of described facial image sample information; Described key point is the corner location of main portions; It should be noted that, described key point also can directly get;
303: according to each sample and key point thereof in the set of described facial image sample information, obtain the primitive character of each sample in the set of described facial image sample information;
304: the primitive character of each sample in the set of described facial image sample information is carried out dimension-reduction treatment, obtains the low dimension proper vector of each sample;
305: by the sex value training sex model of cognition that the low dimension proper vector of described each sample is corresponding with it, obtain described sex model of cognition, used in order to follow-up sex identification; Wherein, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model.
Preferably, described according to each sample and key point thereof in the set of described facial image sample information, the primitive character step obtaining each sample in the set of described facial image sample information comprises:
According to the key point of each sample in the set of described facial image sample information, obtain the local feature of each sample;
Sample image local feature same in the set of described facial image sample information is connected in series, obtains each sample primitive character.
Preferably, described the primitive character of each sample in the set of described facial image sample information is carried out dimension-reduction treatment, obtains the low dimension proper vector step of each sample, comprising:
Feature Dimension Reduction matrix is obtained by dimension-reduction algorithm;
By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described each sample primitive character, obtain the low dimension proper vector of each sample.
Based on a kind of gender identification method embodiment based on image that above Fig. 1 and Fig. 3 provides, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model; Describedly by sex model of cognition, sex identification step is carried out to the low dimension proper vector of described face to be detected and comprises:
Adopt the sex identifying of two verification mode as follows:
Preset the similar threshold value one of described standard women face model and described standard male sex face model similar threshold value two;
By described measuring similarity model, obtain described face to be detected low dimension proper vector and described standard women face distortion one and described face to be detected low dimension proper vector and described standard male sex face distortion two;
Described in interpretation, whether similarity one exceedes described threshold value one; If described similarity one exceedes described threshold value one, be then tentatively judged as women; Otherwise, then tentatively the male sex is judged as;
Described in interpretation, whether similarity two exceedes described threshold value two; If described similarity two exceedes described threshold value two, be then tentatively judged as the male sex; Otherwise, then tentatively women is judged as;
If described judgement is consistent, then export judged result; If described judgement is inconsistent, then exporting can not recognition result;
Or, adopt the sex identifying of recognition method as follows:
Preset similarity otherness threshold value;
By described measuring similarity model, obtain described face to be detected low dimension proper vector and described standard women face distortion one and described face to be detected low dimension proper vector and described standard male sex face distortion two;
Judge whether described similarity one is less than described similarity otherness threshold value with the absolute value of the difference of described similarity two;
If described absolute value is less than described similarity otherness threshold value, then exporting can not recognition result;
If described absolute value is greater than described similarity otherness threshold value, then export sex types corresponding to similarity higher value.
Based on above embodiment, as shown in Figure 2, be a kind of sex recognition device structural representation based on image that the embodiment of the present invention provides; This device comprises:
Information acquisition unit 201, for obtaining facial image to be detected and corresponding key point; Described key point is the corner location of main portions;
Feature extraction unit 202, for according to described facial image to be detected and corresponding key point, extracts face primitive character to be detected;
Dimension-reduction treatment unit 203, for described face primitive character to be detected is carried out dimension-reduction treatment, obtains the low dimension proper vector of face to be detected;
Sex recognition unit 204, for carrying out sex identification by sex model of cognition to the low dimension proper vector of described face to be detected.
Preferably, described feature extraction unit specifically comprises:
Local feature obtains subelement, for according to described facial image to be detected and corresponding key point, obtains face local feature to be detected;
Primitive character obtains subelement, for being connected in series by described face local feature to be detected, obtains face primitive character to be detected;
Described dimensionality reduction unit, also for obtaining Feature Dimension Reduction matrix and described face primitive character to be detected; By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described face primitive character to be detected, obtain the low dimension proper vector of face to be detected.
Preferably, this device also comprises:
Sample information acquiring unit, for obtaining the sex of the set of facial image sample information and correspondence image sample;
Position determination unit, for determining the key point of each sample in the set of described facial image sample information; Described key point is the corner location of main portions;
Sample primitive character acquiring unit, for according to each sample and key point thereof in the set of described facial image sample information, obtains the primitive character of each sample in the set of described facial image sample information;
Sample dimensionality reduction unit, for the primitive character of each sample in the set of described facial image sample information is carried out dimension-reduction treatment, obtains the low dimension proper vector of each sample;
Model acquiring unit, trains sex model of cognition for the sex value corresponding with it by the low dimension proper vector of described each sample, obtains described sex model of cognition, used in order to follow-up sex identification; Wherein, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model.
Preferably, described sample primitive character acquiring unit is used for the key point according to each sample in the set of described facial image sample information, obtains the local feature of each sample; Sample image local feature same in the set of described facial image sample information is connected in series, obtains each sample primitive character.
Described sample dimensionality reduction unit, for obtaining Feature Dimension Reduction matrix by dimension-reduction algorithm; By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described each sample primitive character, obtain the low dimension proper vector of each sample.
Preferably, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model; Described sex recognition unit adopts two verification mode or recognition method to carry out sex identification.
Based on above embodiment, below the training principle of sex model of cognition and sex recognition principle are described in detail.
The training principle specific implementation process of described sex model of cognition is as follows:
The first step obtains the sex of facial image sample information set and correspondence image sample;
Second step determines the key point of each sample in the set of described facial image sample information; Described key point also can directly be got by the first step simultaneously;
3rd step, according to each sample and key point thereof in the set of described facial image sample information, calculates local feature; Described same sample image local feature is connected in series, obtains primitive character.Described primitive character is complete face representation.
Because do normalization to face no longer on the whole, the problem that the factors such as attitude, expression and shape of face difference cause can effectively be avoided, meanwhile, the local field of key point is extracted local feature and also can obtain meticulousr and complete face representation, be of value to final sex identification.Described primitive character describes can adopt HOG, LBP, Gabor etc., and the size, gridding parameter etc. of each key point local field can according to actual conditions free settings.
Described primitive character is carried out dimension-reduction treatment by the 4th step; Described Feature Dimension Reduction process, the dimension reduction method of employing can use PCA, LDA etc.The usual dimension of face primitive character that described 3rd step obtains is very high, and dimension-reduction treatment can reduce characteristic dimension, and plays Noise Reduction, is beneficial to subsequent treatment.Be that example is described dimension-reduction treatment process below by way of PCA dimension reduction method: concrete point two steps: 1, Feature Dimension Reduction matrix is obtained by PCA algorithm, Feature Dimension Reduction matrix described herein is dimensionality reduction model, and this dimensionality reduction model only obtains in the training flow process of sex model of cognition; 2., by described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described primitive character, obtains low dimension proper vector.
5th step trains sex model of cognition by the sex value that the low dimension proper vector of described each sample is corresponding with it, obtains described sex model of cognition, used in order to follow-up sex identification; Wherein, described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model.
The sex identifying of the described gender identification method based on image is specific as follows:
The first step obtains facial image to be detected and corresponding key point; Described key point is the corner location of main portions; Such as: the corner location of the organs such as eye, nose, mouth.
Second step, according to described detection facial image and corresponding key point, extracts face primitive character to be detected; This step, specifically comprises:
According to described facial image to be detected and corresponding key point, obtain face local feature to be detected;
Described face local feature to be detected is connected in series, obtains face primitive character to be detected;
Described face primitive character to be detected is carried out dimension-reduction treatment by the 3rd step, obtains the low dimension proper vector of face to be detected; This step, specifically comprises:
Obtain Feature Dimension Reduction matrix and described face primitive character to be detected;
By described Feature Dimension Reduction matrix, dimension-reduction treatment is carried out to described face primitive character to be detected, obtain the low dimension proper vector of face to be detected.
4th step carries out sex identification by sex model of cognition to the low dimension proper vector of described face to be detected.When described sex model of cognition comprises: standard women face model, standard male sex face model and measuring similarity model; This step specific implementation comprises the following two kinds method:
Adopt the sex identifying of two verification mode as follows:
Preset the similar threshold value one of described standard women face model and described standard male sex face model similar threshold value two;
By described measuring similarity model, obtain described face to be detected low dimension proper vector and described standard women face distortion one and described face to be detected low dimension proper vector and described standard male sex face distortion two;
Described in interpretation, whether similarity one exceedes described threshold value one; If described similarity one exceedes described threshold value one, be then tentatively judged as women; Otherwise, then tentatively the male sex is judged as;
Described in interpretation, whether similarity two exceedes described threshold value two; If described similarity two exceedes described threshold value two, be then tentatively judged as the male sex; Otherwise, then tentatively women is judged as;
If described judgement is consistent, then export judged result; If described judgement is inconsistent, then exporting can not recognition result;
Or, adopt the sex identifying of recognition method as follows:
Preset similarity otherness threshold value;
By described measuring similarity model, obtain described face to be detected low dimension proper vector and described standard women face distortion one and described face to be detected low dimension proper vector and described standard male sex face distortion two;
Judge whether described similarity one is less than described similarity otherness threshold value with the absolute value of the difference of described similarity two;
If described absolute value is less than described similarity otherness threshold value, then exporting can not recognition result;
If described absolute value is greater than described similarity otherness threshold value, then export sex types corresponding to similarity higher value.
It should be noted that, described standard women face model, standard male sex face model and measuring similarity model;
Described standard women face model and described standard male sex face model are the face of abstract, the process that so-called standard women's face model and described standard male sex face model obtain most simple possible is: the key point being extracted each sample by women or male sex's sample training collection, calculates the local feature that this key point is corresponding; Described same sample image local feature is connected in series, obtains primitive character.Described primitive character is complete face representation; Described primitive character is carried out dimension-reduction treatment, and the low dimension set of eigenvectors obtaining each sample set is closed; Obtain the mid point vector that described low dimension set of eigenvectors is closed; The mid point vector that the described low dimension set of eigenvectors that women's sample is corresponding is closed is standard women face model; The mid point vector that the described low dimension set of eigenvectors that male sex's sample is corresponding is closed is described standard male sex face model.All standard faces constituent ratios are to collection.Each concrete sample can regard as the once observation to same class standard face, and like this, sex identification problem is converted into identification problem, and all personal identification methods can directly be used for doing sex identification.
Described measuring similarity model uses tolerance learning algorithm to obtain by similarity, also needs to learn metric parameter; Test phase needs the Similarity value calculating sample to be identified and standard male sex face and standard women face respectively.
In addition, the embodiment of the present invention also provides a kind of sex recognition system based on image; This system comprises: as above arbitrary described sex recognition device based on image.
The present invention is by the primitive character of dimension-reduction treatment, meticulous and complete face representation method, and for the custom-designed sorter of sex identification problem, establish an accurate sex recognition system, and the technical scheme of the described sex identification based on image is by setting up abstract sex face, sex identification problem is converted into authentication or identification problem, and the Local Feature Extraction of distinguished point based also improves robustness and the accuracy of identification of system significantly simultaneously.The sex discrimination of native system under security protection scene reaches 94%.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.All any amendments done within the spirit and principles in the present invention, equivalent replacement, improvement etc., be all included in protection scope of the present invention.