WO2019232866A1 - Human eye model training method, human eye recognition method, apparatus, device and medium - Google Patents

Human eye model training method, human eye recognition method, apparatus, device and medium Download PDF

Info

Publication number
WO2019232866A1
WO2019232866A1 PCT/CN2018/094341 CN2018094341W WO2019232866A1 WO 2019232866 A1 WO2019232866 A1 WO 2019232866A1 CN 2018094341 W CN2018094341 W CN 2018094341W WO 2019232866 A1 WO2019232866 A1 WO 2019232866A1
Authority
WO
WIPO (PCT)
Prior art keywords
sample data
face image
eye
training
image sample
Prior art date
Application number
PCT/CN2018/094341
Other languages
French (fr)
Chinese (zh)
Inventor
戴磊
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019232866A1 publication Critical patent/WO2019232866A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • G06V40/165Detection; Localisation; Normalisation using facial parts and geometric relationships
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/18Eye characteristics, e.g. of the iris

Definitions

  • the present application relates to the field of computer technology, and in particular, to a human eye model training method, a human eye recognition method, a device, a device, and a medium.
  • the trained human eye pictures are used for recognition to improve the accuracy of human eye recognition.
  • a human eye model training method includes:
  • a human eye judgment model is obtained according to the classification threshold.
  • a human eye model training device includes:
  • a facial image sample data acquisition module is configured to acquire a facial image sample, and mark the facial image sample to obtain facial image sample data, and extract a facial image sample from the facial image sample data.
  • a face image sample data division module configured to divide the face image sample data into training sample data and verification sample data
  • a critical surface acquisition module configured to train a support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier
  • a vector distance calculation module configured to calculate a vector distance between a feature vector of a verification sample and the critical surface in the verification sample data
  • a classification threshold obtaining module configured to obtain a preset true classification rate or a preset false positive classification rate, and obtain a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
  • the human eye judgment model acquisition module is configured to acquire a human eye judgment model according to the classification threshold.
  • a human eye recognition method includes:
  • a human eye recognition device includes:
  • a face picture acquisition module to be recognized is used to obtain a face picture to be identified, and a facial feature point detection algorithm is used to obtain a positive eye area image;
  • a to-be-recognized eye image acquisition module configured to perform normalization processing on the forward eye area image to obtain the to-be-recognized eye image
  • a recognition result acquisition module is configured to input the eye image to be recognized into a human eye judgment model trained by the human eye model training method to recognize and obtain a recognition result.
  • a computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor.
  • the processor executes the computer-readable instructions, the following steps are implemented:
  • a human eye judgment model is obtained according to the classification threshold.
  • One or more non-volatile readable storage media storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the following steps:
  • a human eye judgment model is obtained according to the classification threshold.
  • FIG. 1 is a schematic diagram of an application environment of a human eye model training method and a human eye recognition method according to an embodiment of the present application;
  • FIG. 2 is an implementation flowchart of a human eye model training method provided by an embodiment of the present application
  • step S10 in a human eye model training method according to an embodiment of the present application
  • FIG. 4 is a flowchart of implementing step S30 in a human eye model training method according to an embodiment of the present application.
  • step S15 is a flowchart of implementing step S15 in a human eye model training method according to an embodiment of the present application
  • FIG. 6 is an implementation flowchart of step S50 in a human eye model training method according to an embodiment of the present application
  • FIG. 7 is a schematic diagram of a human eye model training device provided by an embodiment of the present application.
  • FIG. 8 is a flowchart of implementing a human eye recognition method according to an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a human eye recognition device provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a computer device according to an embodiment of the present application.
  • the human eye model training method provided in this application can be applied in the application environment shown in FIG. 1, in which a client communicates with a server through a network, the server receives training sample data sent by the client, and establishes a human eye judgment model. Furthermore, it receives the verification samples sent by the client, and performs human eye judgment model training.
  • the client can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
  • the server can be implemented by an independent server or a server cluster composed of multiple servers.
  • the method is applied to the server in FIG. 1 as an example for description, and includes the following steps:
  • S10 Obtain a facial image sample, and mark the facial image sample to obtain facial image sample data, and extract a feature vector of the facial image sample from the facial image sample data, where the facial image sample data includes a person Face image samples and annotation data.
  • the face image sample data is human eye image data used for model training.
  • the feature vector of a face image sample refers to a vector used to characterize the image information characteristics of each face image sample in the face image sample data, for example: a HOG (Histogram of Oriented Gradient) feature vector, LBP (Local Binary Patterns (Local Binary Patterns) feature vector or PCA (Principal Component Analysis) feature vector.
  • Feature vectors can represent image information with simple data and avoid repeated extraction operations in subsequent training processes.
  • a HOG feature vector of a face image sample can be extracted. Since the HOG feature vector of the face image sample is described by the gradient of the local information of the face image sample, extracting the HOG feature vector of the face image sample can avoid the influence of factors such as geometric deformation and light changes on the training of the human eye model. .
  • Marking a face image sample refers to dividing the face image sample into a positive sample (unblocked eye image) and a negative sample (blocked eye image) according to the content of the sample, and labeling these two sample data respectively Then, the face image sample data was obtained.
  • the face image samples include positive samples and negative samples. Understandably, the face image sample data includes face image samples and annotation data.
  • the number of negative samples is 2-3 times the number of positive samples, which can make the sample information more comprehensive and improve the accuracy of model training.
  • the face detection sample data is acquired for subsequent model training, and the occluded eye image is used as the face image sample for training, thereby reducing the false detection rate.
  • the face image sample data includes, but is not limited to, a face image sample collected in advance and a face image sample stored in a commonly used face database in a memory in advance.
  • S20 Divide the face image sample data into training sample data and verification sample data.
  • the training sample data is sample data for learning, and a classifier is established by matching some parameters, that is, using the face image samples in the training sample data to train a machine learning model to determine the parameters of the machine learning model.
  • Validation sample data is sample data used to verify the resolving power (such as recognition rate) of a trained machine learning model.
  • the number of 70% -75% of the face image sample data is used as training sample data, and the rest is used as verification sample data.
  • a total of 1000 positive face samples and 700 negative samples are selected to combine 1000 face image samples with adult face image sample data, of which 260 samples are used as verification sample data and 740 samples are used as training sample data.
  • S30 Use the training sample data to train the support vector machine classifier to obtain the critical surface of the support vector machine classifier.
  • Support Vector Machine (SVM) classifier is a discriminative classifier defined by the classification critical surface, which is used to classify or regression analysis the data.
  • the critical surface is a classification surface that can correctly separate the two types of samples from the positive sample and the negative sample and maximize the distance between the two types of samples.
  • a suitable kernel function is selected, and then the feature vector of the training sample data and the kernel function are used to perform a kernel function operation, so that the feature vector of the training sample data is mapped to a high-dimensional feature space to achieve the
  • the feature vectors are linearly separable in this high-dimensional feature space to obtain a critical surface, and the critical surface is used as a classification surface for classifying training sample data, separating positive samples from negative samples.
  • the support vector machine classifier will output a critical face training data to classify.
  • the classification process of the support vector machine classifier is simplified by obtaining the critical surface.
  • a support vector machine classifier is trained by using feature vectors of a face image sample to obtain a critical surface, which has a good classification ability and improves the efficiency of human eye model training.
  • the verification sample data is pre-stored face image sample data for verification, which includes positive sample data (unblocked eye images) and negative sample data (blocked eye images). For these two types of sample data, Verification samples were obtained after labeling separately.
  • the feature vector of the verification sample refers to a feature vector obtained by extracting a feature vector from the verification sample.
  • the feature vectors of the verification samples include, but are not limited to, HOG feature vectors, LBP feature vectors, and PCA feature vectors.
  • the distance between the feature vector of the verification sample and the vector of the critical plane in the verification sample data refers to the distance between the directed line segment corresponding to the feature vector of the verification sample in mathematical sense and a plane corresponding to the critical plane in mathematical sense. That is, the distance from a line to a surface in a mathematical sense.
  • the distance is a value, and the distance is a vector distance.
  • represents the norm of w, that is,
  • S50 Obtain a preset true class rate or a preset false positive class rate, and obtain a classification threshold based on the vector distance and the labeled data corresponding to the verification sample data.
  • the preset true class rate refers to the preset ratio of the number of positive samples determined to be positive and the result is the total number of positive samples.
  • the preset false positive class rate refers to the preset number of negative samples determined to be negative and the results are incorrect.
  • the true class rate refers to the ratio of the face image samples of the unblocked eye images to the total unblocked eye image face image samples
  • the false positive class rate refers to The ratio of the face image samples of the occluded eye image determined to be unoccluded eyes to the total face image samples of the unoccluded eye image.
  • the higher the true class rate or the lower the false positive class rate it means that the classification requirements of the target are more stringent and can be adapted to more applications.
  • the preset true class rate in this embodiment is 95%, or when the preset false positive rate is 5%, a good classification effect can be obtained, which can be adapted to a variety of different application scenarios, and by setting the real class reasonably Rate or false positive class rate, so that the adaptability of the support vector machine classifier is better extended.
  • the preset true class rate or the preset false positive class rate here is the preferred range of this application, but it can be set according to the needs of the actual application occasion, and there is no limitation here.
  • the classification threshold is a critical value used to classify samples. Specifically, when samples are classified, a judgment that is lower than the classification threshold is a positive sample, and a judgment that is higher than the classification threshold is a negative sample.
  • the annotation data corresponding to the verification sample data refers to the annotation of the verification sample, for example, a positive sample is marked as 1 and a negative sample is marked as -1.
  • the classification threshold is calculated according to a preset true class rate or a preset false positive class rate.
  • the preset false positive rate is 10%
  • there are 15 verification samples of S 1 , S 2 ... S 15 among which there are 5 positive samples, 10 negative samples, and the feature vectors and critical surfaces of 10 negative samples.
  • the vector distances of are respectively 1, 2, ... 10, so when the classification threshold is in the interval [1,2], if the classification threshold is 1.5, it can meet the preset false positive class rate of 10%.
  • S60 Obtain a human eye judgment model according to the classification threshold.
  • the human eye judgment model refers to a model for judging whether an eye position is occluded in a face image sample. After the classification threshold is determined, the feature vector of the face image sample data and the vector distance of the critical surface of the support vector machine classifier are compared with the classification threshold, and the face image sample data is classified according to the comparison result to determine the face The position of the eyes in the image sample is either occluded or unoccluded. Therefore, after the classification threshold is given, the human eye judgment model is established. After inputting the face image to be identified into the human eye judgment model, the classification result of yes or no will be directly given according to the classification threshold, thus avoiding repeated training. To improve the efficiency of human eye model training.
  • the data is divided into training sample data and verification sample data; the training sample data is used to train the support vector machine classifier to obtain the critical surface of the support vector machine classifier, thereby simplifying the classification process, and then calculating the characteristics of the verification samples in the verification sample data
  • the vector distance between the vector and the critical surface of the support vector machine classifier can intuitively compare the closeness of each verification sample to the category to which it belongs, and obtain the preset true class rate or the preset false positive class rate in order to extend the support vector machine classifier.
  • the classification threshold is obtained based on the vector distance and the labeled data corresponding to the verification sample data.
  • the human eye judgment model is obtained to avoid repeated training and improve the efficiency of human eye model training.
  • step S10 the feature vector of the facial image sample in the facial image sample data is extracted, and specifically includes the following steps:
  • the facial feature points include: left eye corner point, right eye corner point, and eyebrow center point; among which, the left eye corner point, right eye corner point, and eyebrow center point belong to the same eye area. Feature points.
  • the facial feature point detection algorithm refers to an algorithm for detecting facial features and marking position information.
  • Face feature points refer to points used to mark the contours of the eyes, nose, and mouth, such as corner points, nose points, and mouth corner points.
  • the face feature point detection algorithm includes, but is not limited to, a face feature point detection algorithm based on deep learning, a face feature point detection algorithm based on a model, or a face feature point detection algorithm based on cascade shape regression.
  • the facial feature points can be obtained by using the Viola-Jones algorithm based on Harr features that comes with OpenCV.
  • OpenCV is a cross-platform computer vision library that can run on Linux, Windows, Android, and Mac OS operating systems. It consists of a series of C functions and a small number of C ++ classes. It also provides interfaces for languages such as Python, Ruby, and MATLAB.
  • Many general algorithms in image processing and computer vision have been implemented, and the Viola-Jones algorithm based on Harr features is one of facial feature point detection algorithms.
  • Haar feature is a feature that reflects the gray change of an image, and is a feature that reflects the difference between pixel sub-modules. Haar features are divided into three categories: edge features, linear features, and center-diagonal features.
  • the Viola-Jones algorithm is a method for face detection based on haar feature values of a face.
  • the input facial image sample data is obtained, the facial image sample data is preprocessed, and then the skin color region segmentation, face feature region segmentation, and face feature region classification steps are sequentially performed, and finally according to the Harr feature Viola- The Jones algorithm performs matching calculations on the classification of facial feature regions to obtain the facial feature point information of the facial image.
  • the left eye corner point, the right eye corner point, and the eyebrow point of the face image sample are obtained by using a face feature point detection algorithm, so as to determine the area where the eyes of the face image sample are located according to the position information of these feature points.
  • the left eye corner point, right eye corner point, and eyebrow center point mentioned in this step are three feature points belonging to the same eye area, for example, three feature points corresponding to the left eye or three feature points corresponding to the right eye.
  • a face image sample only an image of one of the eyes (left eye or right eye) can be collected. If there is a need to process two eyes, after collecting the image of one eye, mirroring it can be used as the image of the other eye in a face image sample to save acquisition time and improve data processing efficiency.
  • S12 Perform forward adjustment on the face image sample according to the left eye corner point and the right eye corner point.
  • the forward adjustment is a normalization of the orientation of the feature points of the face and is set to a forward adjustment.
  • forward adjustment refers to adjusting the left eye corner point and the right eye corner point on the same horizontal line (that is, the vertical coordinates of the left eye corner point and the right eye corner point are equal), thereby normalizing the human eye feature points to the same orientation.
  • S13 Construct a rectangular area of the eye according to the left corner point, the right corner point, and the eyebrow center point.
  • the rectangular area of the eye refers to a rectangular area including an eye image.
  • the position coordinates of the left corner point, the right corner point, and the eyebrow center point are located using a facial feature point detection algorithm.
  • the abscissa of the corner of the eye is the left coordinate
  • the abscissa of the right corner of the eye is the right coordinate
  • the ordinate of the eyebrow point is the upper coordinate
  • the distance from the point to the left eye corner point in the vertical direction is the lower side coordinates.
  • the rectangular area formed by these four point coordinates (left side coordinates, right side coordinates, upper side coordinates, and lower side coordinates) is the eye rectangular area.
  • S14 Perform image normalization processing on the rectangular area of the eyes to obtain a normalized rectangular area of the eyes.
  • normalization processing refers to performing a series of transformations on an image to be processed to convert the image to be processed into a corresponding standard form.
  • image size normalization image grayscale normalization and so on.
  • the normalization process refers to size normalization of a rectangular area of the eye.
  • the eye rectangular area is set to a fixed size according to the resolution of the face image sample.
  • the eye rectangular area can be set to a Size (48,32) rectangle, that is, a rectangular area with a length of 48 pixels and a width of 32 pixels.
  • the image normalization processing on the rectangular area of the eye is conducive to the subsequent training of the support vector machine model. It can avoid the attribute of the large numerical interval to be over-branched and the attribute of the small numerical interval, and it can also avoid the complex value during the calculation degree.
  • the HOG (Histogram of Oriented Gradient, HOG) feature vector is a vector used to describe the gradient direction information of a local area of the image. This feature is greatly affected by changes in image size and position.
  • the fixed input image range makes the calculated HOG feature vector more accurate.
  • model training can pay more attention to the difference between unobstructed eye images and obstructed eye images without paying attention to changes in eye position, which is more convenient for training.
  • the HOG feature vector itself focuses on image gradient features rather than color features. It is not greatly affected by changes in illumination and changes in geometric shapes. Therefore, extracting HOG feature vectors can conveniently and efficiently extract feature vectors from face image samples.
  • feature extraction is also different. Generally, color, texture, and shape are used as target features. According to the requirements for detecting the accuracy of the human eye image, this embodiment chooses to use the shape feature and the HOG feature vector of the training sample.
  • a facial feature point detection algorithm is used to obtain the left eye corner point, the right eye corner point, and the eyebrow center point of the facial feature point; then, the image sample is adjusted forward to improve the robustness of the face image to the direction change. Then, the eye rectangular area is constructed and the eye rectangular area is subjected to image normalization processing to obtain the normalized eye rectangular area, which is conducive to subsequent training of the support vector machine model, and finally extracts the normalized eye rectangular area HOG feature vector, so that It is convenient and efficient to extract feature vectors from the face image samples in the face image sample data.
  • step S30 training sample data is used to train a support vector machine classifier to obtain a critical surface of the support vector machine classifier, which specifically includes the following steps:
  • st is the abbreviation of the constraint condition in the mathematical formula
  • min means to replace the number formula under the constraint condition.
  • K (x i , x j ) is the kernel function of the support vector machine classifier
  • C is the penalty parameter of the support vector machine classifier
  • C> 0, ⁇ i and Lagrange multiplier Is the conjugate relationship
  • x i is the feature vector of the training sample data
  • l is the number of feature vectors of the training sample data
  • y i is the label of the training sample data.
  • the kernel function is a kernel function in a support vector machine classifier, and is used to perform a kernel function operation on the feature vectors of training samples input during the training of the support vector machine classifier.
  • the linear kernel parameter has the characteristics of few parameters and fast operation speed, which is suitable for linearly separable cases.
  • the penalty parameter C is a parameter used to optimize the support vector machine classifier, and it is a certain value. It can solve the problem of classification of sample skew. Specifically, the number of samples in the two categories (also referred to as multiple categories) that participate in the classification is very different. For example, there are 10,000 positive samples and 100 negative samples. This will cause sample bias. The skew problem. At this time, the distribution of positive samples is wide. To solve the problem of sample skew, specifically, the value of C can be reasonably increased according to the ratio of the number of positive samples to the number of negative samples. The larger C is, the smaller the fault tolerance of the classifier is.
  • the decision threshold b is a real number used to determine the threshold for decision classification in the process of a support vector machine classifier.
  • the optimal problem is solved, that is, the Lagrange multiplier Value of the kernel function Reached the minimum and got Then, determine the range in the open interval (0, C) Weight And according to Calculate the b value.
  • the training program first extracts and saves the feature vectors of the samples, so that the extracted features can be saved during the continuous adjustment of the training parameters for multiple training processes. Time to get the training parameters that meet the requirements as soon as possible. In this way, the false positive rate and accuracy rate of a certain category can be adjusted without needing to repeatedly train the model, which improves the model training efficiency.
  • a critical surface g (x) is obtained, so that subsequent face image samples are classified according to the training data of the critical face, without the need to repeatedly train the model, which improves the efficiency of model training.
  • step S15 the HOG feature vector is extracted according to the normalized rectangular area of the eyes, and specifically includes the following steps:
  • S151 Divide the normalized eye rectangular area into cell units, and calculate the size and direction of each pixel gradient of the cell unit.
  • the manner of dividing the normalized eye rectangular region is also different.
  • the sub-region and the sub-region may or may not overlap.
  • Cell units are connected subregions of the image, that is, each subregion is composed of multiple cell units. For example, a 48 * 32 normalized rectangular area of the eye. Assuming a cell unit is 4 * 4 pixels, 2 * 2 cells make up a sub-region, then this normalized eye rectangular region has 6 * 4 sub-regions.
  • the gradient direction interval of each cell unit from 0 ° to 180 ° is divided into 9 intervals, so a 9-dimensional vector can be used to describe a cell unit.
  • G x (x, y) is the horizontal gradient of the pixel (x, y)
  • G y (x, y) is the vertical gradient of the pixel (x, y)
  • H (x, y) is the pixel ( x, y).
  • G (x, y) is the size of the pixel gradient.
  • ⁇ (x, y) is the directional angle of the direction of the pixel gradient.
  • S152 Count the gradient histogram of the magnitude and direction of each pixel gradient of the cell unit.
  • the gradient histogram refers to a histogram obtained by statistically calculating the magnitude and direction of the pixel gradient, and is used to characterize the gradient information of each cell unit. Specifically, first divide the gradient direction of each cell unit from 0 ° to 180 ° into 9 direction blocks, that is, 0 ° -20 ° is the first direction block, and 20 ° -40 ° is the second direction block. By analogy, 160 ° -180 ° is the ninth direction block. Then determine the direction block where the direction of the pixel gradient of the cell unit is located, and add the size of the pixel gradient of the direction block.
  • the pixel value in the third direction of the gradient histogram is added to the magnitude of the pixel gradient in that direction to obtain the gradient histogram of the cell unit.
  • tandem refers to merging all gradient histograms of gradient histograms of each cell unit from left to right and top to bottom to obtain a normalized eye rectangular region HOG feature vector.
  • the normalized eye rectangle area is divided into several small areas, and then the gradient histograms of the small areas are calculated. Finally, the gradient histograms corresponding to the small areas are connected in series to obtain the entire normalized eye rectangle.
  • the gradient histogram of the region is used to describe the feature vector of the face image sample.
  • the HOG feature vector itself focuses on the image gradient feature rather than the color feature, and is not affected by the change of illumination. Extracting HOG feature vectors can easily and efficiently recognize human eye images.
  • step S50 a preset true class rate or false positive class rate is obtained, and a classification threshold is obtained according to the vector distance and the labeled data corresponding to the verification sample data, which specifically includes the following steps:
  • ROC curve refers to the receiver's operating characteristic curve / receiver operating characteristic curve (receiver operating characteristic curve). It is a comprehensive index reflecting continuous variables of sensitivity and specificity. It is a composition method to reveal the relationship between sensitivity and specificity. .
  • the ROC curve shows the relationship between the true class rate and the false positive class rate of the support vector machine classifier. The closer the curve is to the upper left corner of the classifier, the higher the accuracy.
  • the samples are classified into positive and negative samples: positive samples (negative) or negative samples (negative).
  • positive samples negative
  • negative samples negative
  • four situations will occur: if the face image data is a positive sample and is also predicted as a positive sample, it is a true class (TP).
  • Face image data is a negative sample that is predicted to be a positive sample, which is called a false positive (FP).
  • FP false positive
  • the face image data is a negative sample, it is predicted as a negative sample, which is called a true negative (TN)
  • a positive sample is predicted as a negative sample, which is a false negative (FN).
  • the true class rate characterizes the ratio of positive instances identified by the classifier to all positive instances.
  • the false positive rate (FPR) characterizes the proportion of negative instances that the classifier mistakes for positive samples to all negative instances.
  • the process of drawing the ROC curve is: according to the feature vector of the verification sample data and the vector distance of the critical surface feature vector and the corresponding verification sample data annotation, the true class rate and false positive class rate of many verification samples are obtained.
  • the ROC curve is false positive class
  • the rate is the horizontal axis
  • the true class rate is the vertical axis.
  • Connect the points, that is, the true class rate and false positive class rate of many verification samples draw a curve, and then calculate the area under the curve. The larger the area, the higher the judgment value.
  • the ROC curve drawing tool can be used for drawing.
  • the ROC curve is drawn using the plotSVMroc (true_labels, predict_labels, classnumber) function in matlab.
  • true_labels are correct labels
  • predict_labels are labels for classification judgment
  • the vector distance distribution that is, the distribution range of the closeness of each verification sample data to the critical surface
  • Annotate the true and false positive rates of the verification sample data and then draw the ROC curve based on the true and false positive rates of the verification sample data.
  • S52 Obtain a classification threshold on the horizontal axis of the ROC curve according to a preset true class rate or a preset false positive class rate.
  • the preset true class rate or preset false positive class rate is set according to actual use needs.
  • the server After the server obtains the preset true class rate or preset false positive class rate, it passes the horizontal axis in the ROC curve.
  • the false positive class rate and the true class rate represented by the vertical axis are compared with the preset true class rate or the preset false positive class rate, that is, the preset true class rate or the preset false positive class rate is used to classify the test sample data.
  • the classification threshold is determined from the horizontal axis of the ROC curve according to the classification criteria, so that in the subsequent model training, different classification thresholds can be selected according to different scenarios through the ROC curve, which avoids the need for repeated training and improves the efficiency of model training.
  • the true class rate and false positive class rate of the verification sample data can be obtained after calculating the vector distance between the feature vector of the verification sample data and the critical surface feature vector, and according to the corresponding verification sample data label.
  • the classification threshold is obtained from the horizontal axis of the ROC curve by presetting the real class rate or the preset false positive class rate, so that in the subsequent model training, different classification thresholds can be selected according to different scenarios through the ROC curve to avoid the need for repeated training. Improve the efficiency of model training.
  • FIG. 7 shows a principle block diagram of a human eye model training device corresponding to the human eye model training method in the embodiment.
  • the human eye model training device includes a face image sample data acquisition module 10, a face image sample data division module 20, a critical surface acquisition module 30, a vector distance calculation module 40, a classification threshold acquisition module 50, and a person. Eye judgment model acquisition module 60.
  • the realization function and implementation of the face image sample data acquisition module 10, the face image sample data division module 20, the critical surface acquisition module 30, the vector distance calculation module 40, the classification threshold acquisition module 50, and the human eye judgment model acquisition module 60 are one-to-one.
  • the detailed description of each functional module is as follows:
  • a face image sample data obtaining module 10 configured to obtain a face image sample, and mark the face image sample to obtain the face image sample data; and extract a feature vector of the face image sample from the face image sample data.
  • the facial image sample data includes facial image samples and annotation data;
  • a face image sample data dividing module configured to divide the face image sample data into training sample data and verification sample data
  • a critical surface acquisition module 30 is configured to train a support vector machine classifier using training sample data to obtain a critical surface of the support vector machine classifier;
  • the vector distance calculation module 40 is configured to calculate a vector distance between a feature vector of a verification sample and a critical surface in the verification sample data;
  • a classification threshold obtaining module 50 configured to obtain a preset true class rate or a preset false positive class rate, and obtain a classification threshold according to a vector distance and labeled data corresponding to the verification sample data;
  • the human eye judgment model acquisition module 60 is configured to acquire a human eye judgment model according to a classification threshold.
  • the facial image sample data acquisition module 10 includes a facial feature point acquisition unit 11, a forward adjustment unit 12, an eye rectangular region construction unit 13, an eye rectangular region acquisition unit 14, and a feature vector extraction unit 15.
  • a facial feature point acquisition unit 11 is configured to obtain a facial feature point by using a facial feature point detection algorithm.
  • the facial feature point includes: a left eye corner point, a right eye corner point, and a brow center point; among which, the left eye corner point and the right eye corner point And the eyebrow center point are characteristic points belonging to the same eye area;
  • a forward adjustment unit 12 configured to perform forward adjustment on a face image sample according to a left eye corner point and a right eye corner point;
  • the eye rectangular region constructing unit 13 is configured to construct an eye rectangular region according to the left eye corner point, the right eye corner point, and the eyebrow center point;
  • the eye rectangular area obtaining unit 14 is configured to perform image normalization processing on the eye rectangular area to obtain a normalized eye rectangular area;
  • a feature vector extraction unit 15 is configured to extract a HOG feature vector according to a normalized rectangular area of the eye.
  • the feature vector extraction unit 15 includes a pixel gradient acquisition subunit 151, a gradient histogram acquisition subunit 152, and a HOG feature vector acquisition subunit 153.
  • a pixel gradient acquisition subunit 151 configured to divide a normalized eye rectangular area into cell units, and calculate the size and direction of each pixel gradient of the cell unit;
  • the gradient histogram acquisition subunit 152 is used to count the gradient histogram of the magnitude and direction of each pixel gradient of the cell unit;
  • the HOG feature vector acquisition subunit 153 is used to concatenate gradient histograms to obtain a HOG feature vector.
  • the critical surface acquisition module 30 includes a parameter acquisition unit 31 and a critical surface acquisition unit 32.
  • a parameter obtaining unit 31 is used for obtaining a kernel function of the support vector machine classifier and a penalty parameter of the support vector machine classifier, and solving the Lagrange multiplier by using the following formula And decision threshold b:
  • st is the abbreviation of the constraint condition in the mathematical formula
  • min means to replace the number formula under the constraint condition.
  • K (x i , x j ) is the kernel function of the support vector machine classifier
  • C is the penalty parameter of the support vector machine classifier
  • C> 0, ⁇ i and Lagrange multiplier Is the conjugate relationship
  • x i is the feature vector of the training sample data
  • l is the number of feature vectors of the training sample data
  • y i is the label of the training sample data
  • Critical plane acquisition unit 32 used to obtain a Lagrangian multiplier And decision threshold b, the critical surface g (x) of the support vector machine classifier is obtained using the following formula:
  • the classification threshold acquisition module 50 includes a ROC curve drawing unit 51 and a classification threshold acquisition unit 52.
  • the ROC curve drawing unit 51 is configured to draw an ROC curve according to the vector distance and the labeled data corresponding to the verification sample data;
  • the classification threshold acquiring unit 52 is configured to acquire a classification threshold on a horizontal axis of the ROC curve according to a preset true class rate or a preset false positive class rate.
  • Each module in the above-mentioned human eye model training device may be implemented in whole or in part by software, hardware, and a combination thereof.
  • the above-mentioned modules may be embedded in the hardware in or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a human eye recognition method is provided.
  • the human eye recognition method can also be applied in the application environment as shown in FIG. 1, where a computer device communicates with a server through a network.
  • the client communicates with the server through the network, and the server receives the face picture to be identified sent by the client for human eye recognition.
  • the client can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
  • the server can be implemented by an independent server or a server cluster composed of multiple servers.
  • the method is applied to the server in FIG. 1 as an example for description, and includes the following steps:
  • S70 Obtain a face picture to be identified, and use a facial feature point detection algorithm to obtain a positive eye area image.
  • the face picture to be identified refers to a face picture that needs to be recognized by human eyes.
  • the face image can be obtained by collecting a face picture in advance, or directly obtaining a face picture from a face database, such as an AR face database.
  • the face pictures to be identified include unoccluded eye pictures and occluded eye pictures, and a facial feature point detection algorithm is used to obtain a positive eye area image.
  • the implementation process of using the facial feature point detection algorithm to obtain a positive eye area image is the same as the method in steps S11 to S13, and details are not described herein again.
  • S80 Perform normalization processing on the forward eye area image to obtain an eye image to be identified.
  • the to-be-recognized eye image refers to a forward-looking eye area image after the normalization process is performed.
  • the recognition efficiency can be improved.
  • the normalized to-be-recognized eye image is transformed to a unified standard form, thereby avoiding the attribute of the large-value interval in the support vector machine classifier from being over-branched with the attribute of the small-value interval, and also avoiding calculation Numerical complexity in the process.
  • the implementation process of normalizing the forward eye area image is the same as step S14, and details are not described herein again.
  • the recognition result refers to a result obtained by using a human eye judgment model for recognition of an eye image to be identified, including two cases: the eye image to be identified is an unobstructed eye image and the eye image to be identified is an obstructed eye image.
  • an eye image to be recognized is input to a human eye judgment model for recognition, so as to obtain a recognition result.
  • Perform recognition obtain recognition results, quickly recognize whether the eyes of the face picture are occluded, and improve the recognition efficiency, thereby avoiding affecting the subsequent image processing process.
  • FIG. 9 shows a principle block diagram of a human eye recognition device that corresponds to the human eye recognition method in a one-to-one manner in the embodiment.
  • the human eye recognition device includes a to-be-recognized eye image acquisition module 70, an to-be-recognized eye image acquisition module 80, and a recognition result acquisition module 90.
  • the functions of the eye image acquisition module 70, the eye image acquisition module 80, and the recognition result acquisition module 90 to be identified correspond to the steps corresponding to the human eye recognition method in the embodiment, and each functional module is described in detail as follows:
  • a face picture to be identified module 70 is configured to obtain a face picture to be identified, and a facial feature point detection algorithm is used to obtain a positive eye area image;
  • the eye image to be identified module 80 is configured to perform normalization processing on the forward eye area image to obtain the eye image to be identified;
  • the recognition result acquisition module 90 is configured to input an eye image to be recognized into a human eye judgment model trained by a human eye model training method to recognize and obtain a recognition result.
  • Each module in the above-mentioned human eye recognition device may be implemented in whole or in part by software, hardware, and a combination thereof.
  • the above-mentioned modules may be embedded in the hardware in or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 10.
  • the computer device includes a processor, a memory, a network interface, and a database connected through a system bus.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer-readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer-readable instructions in a non-volatile storage medium.
  • the database of the computer equipment is used to store the feature vector of the human face image sample data and the human eye model training data in the human eye model training method.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer-readable instructions are executed by a processor to implement a human eye model training method.
  • the functions of each module / unit in the human eye recognition device in the embodiment are realized.
  • a computer device including a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor.
  • the processor executes the computer-readable instructions
  • the steps of the model training method are, for example, steps S10 to S60 shown in FIG. 2.
  • the steps of the human eye recognition method of the foregoing embodiment are implemented, for example, steps S70 to S90 shown in FIG. 7.
  • the processor executes the computer-readable instructions
  • the functions of the modules / units of the human eye model training device of the foregoing embodiment are implemented, for example, modules 10 to 60 shown in FIG. 7.
  • the functions of the modules / units of the human eye recognition device in the foregoing embodiment are implemented, for example, modules 70 to 90 shown in FIG. 9. To avoid repetition, we will not repeat them here.
  • One or more non-volatile readable storage media storing computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors cause the human eye model training of the foregoing embodiment to be performed
  • the steps of the method, or the steps of the human eye recognition method of the foregoing embodiment are implemented when the computer readable instructions are executed by one or more processors, or the human eyes of the above embodiments are implemented when the computer readable instructions are executed by one or more processors.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Multimedia (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Geometry (AREA)
  • Ophthalmology & Optometry (AREA)
  • Image Analysis (AREA)

Abstract

A human eye model training method, a human eye recognition method, an apparatus, a device and a medium. The human eye model training method comprises: acquiring a face image sample and marking the face image sample so as to obtain face image sample data, and extracting a feature vector of the face image sample, wherein the face image sample data comprises the face image sample and marking data (S10); dividing the face image sample data into training sample data and verification sample data (S20); using the training sample data to train a support vector machine classifier so as to obtain a critical plane of the support vector machine classifier (S30); calculating a vector distance of a feature vector of a verification sample in the verification sample data and the critical plane (S40); acquiring a preset true positive rate or a preset false positive rate, and acquiring a classification threshold according to the vector distance and the marking data corresponding to the verification sample (S50); acquiring a human eye determination model according to the classification threshold (S60). The described method may obtain a human eye determination model that is highly accurate in determining whether a human eye is occluded.

Description

人眼模型训练方法、人眼识别方法、装置、设备及介质Human eye model training method, human eye recognition method, device, equipment and medium
本申请以2018年6月8日提交的申请号为201810585092.2,名称为“人眼模型训练方法、人眼识别方法、装置、设备及介质”的中国发明专利申请为基础,并要求其优先权。This application is based on a Chinese invention patent application filed on June 8, 2018 with application number 201810585092.2, entitled "Human Eye Model Training Method, Human Eye Recognition Method, Device, Equipment, and Medium" and claims priority.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种人眼模型训练方法、人眼识别方法、装置、设备及介质。The present application relates to the field of computer technology, and in particular, to a human eye model training method, a human eye recognition method, a device, a device, and a medium.
背景技术Background technique
随着人工智能的快速发展,人眼定位识别得到了广泛的关注成为了人工智能领域的热门话题。传统地,在现有的人脸特征点识别算法中,可以从人脸图片中标注出不同器官的位置,例如眼睛、耳朵、嘴巴或者鼻子等,即使对应部位有所遮挡(眼镜、头发、捂嘴等动作),该算法还是可以识别不同部件的相对位置,并提供对应的图片。然而,在一些图片处理过程中,需要的是无遮挡的眼睛图像,而常规采用人脸特征点识别算法识别出来的眼睛图片却无法对有遮挡的图片进行筛选,容易引入误差,不利于后续进一步地处理需要。With the rapid development of artificial intelligence, human eye location recognition has received extensive attention and has become a hot topic in the field of artificial intelligence. Traditionally, in existing facial feature point recognition algorithms, the positions of different organs, such as eyes, ears, mouth, or nose, can be marked from a face picture, even if the corresponding part is blocked (glasses, hair, cover Mouth and other actions), the algorithm can still identify the relative positions of different parts and provide corresponding pictures. However, in some image processing processes, an unobstructed eye image is required. However, the eye pictures identified by the conventional facial feature point recognition algorithm cannot filter the obstructed pictures, which is easy to introduce errors and is not conducive to further development. To deal with needs.
发明内容Summary of the Invention
基于此,有必要针对上述技术问题,提供一种可以提高模型训练效率的人眼模型训练方法、装置、计算机设备及存储介质。Based on this, it is necessary to provide a human eye model training method, device, computer equipment, and storage medium that can improve the efficiency of model training in response to the above technical problems.
此外,还有必要提出一种人眼识别方法,其根据人眼模型训练方法进行训练后,利用训练好的人眼图片进行识别,以提高人眼识别的准确率。In addition, it is necessary to propose a human eye recognition method. After training according to the human eye model training method, the trained human eye pictures are used for recognition to improve the accuracy of human eye recognition.
一种人眼模型训练方法,包括:A human eye model training method includes:
获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
一种人眼模型训练装置,包括:A human eye model training device includes:
人脸图像样本数据获取模块,用于获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;A facial image sample data acquisition module is configured to acquire a facial image sample, and mark the facial image sample to obtain facial image sample data, and extract a facial image sample from the facial image sample data. Feature vectors, where the face image sample data includes face image samples and annotation data;
人脸图像样本数据划分模块,用于将所述人脸图像样本数据划分为训练样本数据和验证样本数据;A face image sample data division module, configured to divide the face image sample data into training sample data and verification sample data;
临界面获取模块,用于采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;A critical surface acquisition module, configured to train a support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
向量距离计算模块,用于计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;A vector distance calculation module, configured to calculate a vector distance between a feature vector of a verification sample and the critical surface in the verification sample data;
分类阈值获取模块,用于获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;A classification threshold obtaining module, configured to obtain a preset true classification rate or a preset false positive classification rate, and obtain a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
人眼判断模型获取模块,用于根据所述分类阈值,获取人眼判断模型。The human eye judgment model acquisition module is configured to acquire a human eye judgment model according to the classification threshold.
一种人眼识别方法,包括:A human eye recognition method includes:
获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像;Obtain a face picture to be identified, and use a facial feature point detection algorithm to obtain a positive eye area image;
对所述正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像;Performing normalization processing on the forward eye area image to obtain an eye image to be identified;
将所述待识别眼睛图像输入到所述人眼模型训练方法训练得到的人眼判断模型进行识别,获取识别结果。And inputting the eye image to be identified into a human eye judgment model trained by the human eye model training method to identify and obtain a recognition result.
一种人眼识别装置,包括:A human eye recognition device includes:
待识别人脸图片获取模块,用于获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像;A face picture acquisition module to be recognized is used to obtain a face picture to be identified, and a facial feature point detection algorithm is used to obtain a positive eye area image;
待识别眼睛图像获取模块,用于对所述正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像;A to-be-recognized eye image acquisition module, configured to perform normalization processing on the forward eye area image to obtain the to-be-recognized eye image;
识别结果获取模块,用于将所述待识别眼睛图像输入到所述的人眼模型训练方法训练得到的人眼判断模型进行识别,获取识别结果。A recognition result acquisition module is configured to input the eye image to be recognized into a human eye judgment model trained by the human eye model training method to recognize and obtain a recognition result.
一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the computer-readable instructions, the following steps are implemented:
获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:One or more non-volatile readable storage media storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the following steps:
获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得更加明显。Details of one or more embodiments of the present application are set forth in the accompanying drawings and description below. Other features and advantages of the application will become apparent from the description, the drawings, and the claims.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the drawings used in the description of the embodiments of the application will be briefly introduced below. Obviously, the drawings in the following description are just some embodiments of the application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without paying creative labor.
图1是本申请实施例提供的人眼模型训练方法、人眼识别方法的应用环境示意图;1 is a schematic diagram of an application environment of a human eye model training method and a human eye recognition method according to an embodiment of the present application;
图2是本申请实施例提供的人眼模型训练方法的实现流程图;FIG. 2 is an implementation flowchart of a human eye model training method provided by an embodiment of the present application; FIG.
图3是本申请实施例提供的人眼模型训练方法中步骤S10的实现流程图;3 is a flowchart of implementing step S10 in a human eye model training method according to an embodiment of the present application;
图4是本申请实施例提供的人眼模型训练方法中步骤S30的实现流程图;FIG. 4 is a flowchart of implementing step S30 in a human eye model training method according to an embodiment of the present application; FIG.
图5是本申请实施例提供的人眼模型训练方法中步骤S15的实现流程图;5 is a flowchart of implementing step S15 in a human eye model training method according to an embodiment of the present application;
图6是本申请实施例提供的人眼模型训练方法中步骤S50的实现流程图;FIG. 6 is an implementation flowchart of step S50 in a human eye model training method according to an embodiment of the present application;
图7是本申请实施例提供的人眼模型训练装置的示意图;7 is a schematic diagram of a human eye model training device provided by an embodiment of the present application;
图8是本申请实施例提供的人眼识别方法的实现流程图;FIG. 8 is a flowchart of implementing a human eye recognition method according to an embodiment of the present application; FIG.
图9是本申请实施例提供的人眼识别装置的示意图;9 is a schematic diagram of a human eye recognition device provided by an embodiment of the present application;
图10是本申请实施例提供的计算机设备的示意图。FIG. 10 is a schematic diagram of a computer device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然, 所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In the following, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.
本申请提供的人眼模型训练方法,可应用在如图1的应用环境中,其中,客户端通过网络与服务端进行通信,服务端接收客户端发送的训练样本数据并建立人眼判断模型,进而接收客户端发送的验证样本,进行人眼判断模型训练。其中,客户端可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。服务端可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The human eye model training method provided in this application can be applied in the application environment shown in FIG. 1, in which a client communicates with a server through a network, the server receives training sample data sent by the client, and establishes a human eye judgment model. Furthermore, it receives the verification samples sent by the client, and performs human eye judgment model training. Among them, the client can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers.
在一个实施例中,如图2所示,以该方法应用于图1中的服务端为例进行说明,包括如下步骤:In one embodiment, as shown in FIG. 2, the method is applied to the server in FIG. 1 as an example for description, and includes the following steps:
S10:获取人脸图像样本,并对人脸图像样本进行标记以得到人脸图像样本数据,及提取人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据。S10: Obtain a facial image sample, and mark the facial image sample to obtain facial image sample data, and extract a feature vector of the facial image sample from the facial image sample data, where the facial image sample data includes a person Face image samples and annotation data.
其中,人脸图像样本数据是用于进行模型训练的人眼图像数据。人脸图像样本的特征向量是指人脸图像样本数据中用于表征每一人脸图像样本的图像信息特征的向量,例如:HOG(Histogram of Oriented Gradient,梯度方向直方图)特征向量、LBP(Local Binary Patterns,局部二值模式)特征向量或PCA(Principal Component Analysis,主成分分析)特征向量等。特征向量能够以简单的数据表征图像信息,避免后续训练过程重复的提取操作。The face image sample data is human eye image data used for model training. The feature vector of a face image sample refers to a vector used to characterize the image information characteristics of each face image sample in the face image sample data, for example: a HOG (Histogram of Oriented Gradient) feature vector, LBP (Local Binary Patterns (Local Binary Patterns) feature vector or PCA (Principal Component Analysis) feature vector. Feature vectors can represent image information with simple data and avoid repeated extraction operations in subsequent training processes.
优选地,本实施例中可以提取人脸图像样本的HOG特征向量。由于人脸图像样本的HOG特征向量是通过人脸图像样本的局部信息的梯度来描述,因此,提取人脸图像样本的HOG特征向量能够避免几何形变和光线变化等因素对人眼模型训练的影响。对人脸图像样本进行标记,是指将人脸图像样本依据样本的内容分为正样本(无遮挡的眼睛图像)和负样本(有遮挡的眼睛图像),对这两种样本数据分别进行标注后,得到了人脸图像样本数据。人脸图像样本中包括正样本和负样本,可以理解地,人脸图像样本数据包括人脸图像样本和标注数据。优选地,负样本数量是正样本数量的2-3倍,可以使得样本信息更加全面,提高模型训练的准确度。Preferably, in this embodiment, a HOG feature vector of a face image sample can be extracted. Since the HOG feature vector of the face image sample is described by the gradient of the local information of the face image sample, extracting the HOG feature vector of the face image sample can avoid the influence of factors such as geometric deformation and light changes on the training of the human eye model. . Marking a face image sample refers to dividing the face image sample into a positive sample (unblocked eye image) and a negative sample (blocked eye image) according to the content of the sample, and labeling these two sample data respectively Then, the face image sample data was obtained. The face image samples include positive samples and negative samples. Understandably, the face image sample data includes face image samples and annotation data. Preferably, the number of negative samples is 2-3 times the number of positive samples, which can make the sample information more comprehensive and improve the accuracy of model training.
在这个实施方式中,通过获取人脸图像样本数据,以便后续进行模型训练,并且通过把有遮挡的眼睛图像作为人脸图像样本进行训练,从而能够降低误检率。In this embodiment, the face detection sample data is acquired for subsequent model training, and the occluded eye image is used as the face image sample for training, thereby reducing the false detection rate.
可选地,该人脸图像样本数据包括但不限于预先采集的人脸图像样本和预先存储在存储器中常用人脸库中的人脸图像样本。Optionally, the face image sample data includes, but is not limited to, a face image sample collected in advance and a face image sample stored in a commonly used face database in a memory in advance.
S20:将人脸图像样本数据划分为训练样本数据和验证样本数据。S20: Divide the face image sample data into training sample data and verification sample data.
其中,训练样本数据是用于学习的样本数据,通过匹配一些参数来建立分类器,即采用训练样本数据中的人脸图像样本训练机器学习模型,以确定机器学习模型的参数。验证样本数据是用于验证训练好的机器学习模型的分辨能力(如识别率)的样本数据。可选地,将人脸图像样本数据的70%-75%的数目作为训练样本数据,其余的作为验证样本数据。在一具体实施方式中,选取300个正样本和700个负样本一共1000个人脸图像样本组合成人脸图像样本数据,其中的260个样本作为验证样本数据,740个样本作为训练样本数据。Among them, the training sample data is sample data for learning, and a classifier is established by matching some parameters, that is, using the face image samples in the training sample data to train a machine learning model to determine the parameters of the machine learning model. Validation sample data is sample data used to verify the resolving power (such as recognition rate) of a trained machine learning model. Optionally, the number of 70% -75% of the face image sample data is used as training sample data, and the rest is used as verification sample data. In a specific embodiment, a total of 1000 positive face samples and 700 negative samples are selected to combine 1000 face image samples with adult face image sample data, of which 260 samples are used as verification sample data and 740 samples are used as training sample data.
S30:采用训练样本数据训练支持向量机分类器,得到支持向量机分类器的临界面。S30: Use the training sample data to train the support vector machine classifier to obtain the critical surface of the support vector machine classifier.
支持向量机(Support Vector Machine,SVM)分类器是一个由分类临界面定义的判别分类器,用于对数据进行分类或者回归分析。临界面为能够将正样本和负样本这两类样本正确分开,并且使两类样本距离最大的分类面。具体地,根据人脸图像样本数据的特点,选取合适核函数,然后将训练样本数据的特征向量与核函数进行核函数运算,使得训练样本数据的特征向量映射到一个高维度特征空间,实现该特征向量在这个高维度特征空间的线性可分,得到临界面,并将临界面作为对训练样本数据进行分类的分类面,将正样本和负样本分开。具体地,输入训练样本数据,支持向量机分类器将会输出一个临界面对训练样本数据进行分类。通过获取临界面简化了支持向量机分类器的分类过程。Support Vector Machine (SVM) classifier is a discriminative classifier defined by the classification critical surface, which is used to classify or regression analysis the data. The critical surface is a classification surface that can correctly separate the two types of samples from the positive sample and the negative sample and maximize the distance between the two types of samples. Specifically, according to the characteristics of the face image sample data, a suitable kernel function is selected, and then the feature vector of the training sample data and the kernel function are used to perform a kernel function operation, so that the feature vector of the training sample data is mapped to a high-dimensional feature space to achieve the The feature vectors are linearly separable in this high-dimensional feature space to obtain a critical surface, and the critical surface is used as a classification surface for classifying training sample data, separating positive samples from negative samples. Specifically, by inputting training sample data, the support vector machine classifier will output a critical face training data to classify. The classification process of the support vector machine classifier is simplified by obtaining the critical surface.
本实施例中,通过将人脸图像样本的特征向量训练支持向量机分类器,得到临界面,具有良好的分类能力,提高了人眼模型训练的效率。In this embodiment, a support vector machine classifier is trained by using feature vectors of a face image sample to obtain a critical surface, which has a good classification ability and improves the efficiency of human eye model training.
S40:计算验证样本数据中的验证样本的特征向量与临界面的向量距离。S40: Calculate the distance between the feature vector of the verification sample and the vector of the critical surface in the verification sample data.
其中,验证样本数据是预先存储的用于验证的人脸图像样本数据,其中包括了正样本数据(无遮挡 的眼睛图像)和负样本数据(有遮挡的眼睛图像),对这两种样本数据分别进行标注后得到验证样本。其中,验证样本的特征向量是指对验证样本进行特征向量提取后获得的特征向量。The verification sample data is pre-stored face image sample data for verification, which includes positive sample data (unblocked eye images) and negative sample data (blocked eye images). For these two types of sample data, Verification samples were obtained after labeling separately. The feature vector of the verification sample refers to a feature vector obtained by extracting a feature vector from the verification sample.
验证样本的特征向量包括但不限于:HOG特征向量、LBP特征向量和PCA特征向量等。The feature vectors of the verification samples include, but are not limited to, HOG feature vectors, LBP feature vectors, and PCA feature vectors.
其中,验证样本数据中的验证样本的特征向量与临界面的向量距离是指验证样本的特征向量在数学意义上对应的有向线段与临界面在数学意义上对应的一个平面二者的距离,即数学意义上线到面的距离,其距离为一数值,该距离即为向量距离。假设临界面的表达式为g(x)=wx+b,式中w为多维向量,可表示为w=[w 1,w 2,w 3...w n],那么特征向量x到临界面的向量距离的表达式为
Figure PCTCN2018094341-appb-000001
式中||w||表示w的范数,即
Figure PCTCN2018094341-appb-000002
The distance between the feature vector of the verification sample and the vector of the critical plane in the verification sample data refers to the distance between the directed line segment corresponding to the feature vector of the verification sample in mathematical sense and a plane corresponding to the critical plane in mathematical sense. That is, the distance from a line to a surface in a mathematical sense. The distance is a value, and the distance is a vector distance. Suppose the expression of the critical surface is g (x) = wx + b, where w is a multi-dimensional vector, which can be expressed as w = [w 1 , w 2 , w 3 ... w n ], then the feature vector x arrives at The expression of the vector distance of the interface is
Figure PCTCN2018094341-appb-000001
Where || w || represents the norm of w, that is,
Figure PCTCN2018094341-appb-000002
通过计算验证样本数据中的验证样本的特征向量与临界面的向量距离,能够直观地比较各个验证样本与其所属类别的接近程度。By calculating the distance between the feature vector of the verification sample and the vector of the critical surface in the verification sample data, the closeness of each verification sample to the category to which it belongs can be intuitively compared.
S50:获取预设真正类率或预设假正类率,根据向量距离和与验证样本数据对应的标注数据获取分类阈值。S50: Obtain a preset true class rate or a preset false positive class rate, and obtain a classification threshold based on the vector distance and the labeled data corresponding to the verification sample data.
预设真正类率是指预先设定的判断为正样本且结果正确的数量占总的正样本数量的比值,预设假正类率是指预先设定的判断为负样本且结果错误的数量占总的正样本数量的比值。在本实施例中,真正类率是指将无遮挡的眼睛图像判断为无遮挡的眼睛的人脸图像样本占总的无遮挡的眼睛图像的人脸图像样本的比值,假正类率是指有遮挡的眼睛图像判断为无遮挡的眼睛的人脸图像样本占总的无遮挡的眼睛图像的人脸图像样本的比值。容易理解地,真正类率越高或者假正类率越低,说明目标的分类要求越严格,能适应更多的应用场合。优选地,本实施例中的预设真正类率为95%时,或者预设假正类率5%时,能够取得很好的分类效果,能够适应多种不同应用场合,通过合理设置真正类率或假正类率,从而较好地扩展支持向量机分类器的适应性。The preset true class rate refers to the preset ratio of the number of positive samples determined to be positive and the result is the total number of positive samples. The preset false positive class rate refers to the preset number of negative samples determined to be negative and the results are incorrect. The ratio of the total number of positive samples. In this embodiment, the true class rate refers to the ratio of the face image samples of the unblocked eye images to the total unblocked eye image face image samples, and the false positive class rate refers to The ratio of the face image samples of the occluded eye image determined to be unoccluded eyes to the total face image samples of the unoccluded eye image. It is easy to understand that the higher the true class rate or the lower the false positive class rate, it means that the classification requirements of the target are more stringent and can be adapted to more applications. Preferably, when the preset true class rate in this embodiment is 95%, or when the preset false positive rate is 5%, a good classification effect can be obtained, which can be adapted to a variety of different application scenarios, and by setting the real class reasonably Rate or false positive class rate, so that the adaptability of the support vector machine classifier is better extended.
应理解,此处预设真正类率或预设假正类率,为本申请优选范围,但可以根据实际应用场合的需要进行设置,此处不做限制。It should be understood that the preset true class rate or the preset false positive class rate here is the preferred range of this application, but it can be set according to the needs of the actual application occasion, and there is no limitation here.
分类阈值是用于对样本进行分类的临界值,具体地,对样本进行分类时,低于分类阈值的判断为正样本,高于分类阈值的判断为负样本。The classification threshold is a critical value used to classify samples. Specifically, when samples are classified, a judgment that is lower than the classification threshold is a positive sample, and a judgment that is higher than the classification threshold is a negative sample.
具体地,与验证样本数据对应的标注数据是指验证样本的标注,例如:将正样本标记为1,将负样本标记为-1。在获得了验证样本的特征向量与临界面的向量距离和验证样本的标注数据后,根据预设真正类率或预设假正类率计算得到分类阈值。Specifically, the annotation data corresponding to the verification sample data refers to the annotation of the verification sample, for example, a positive sample is marked as 1 and a negative sample is marked as -1. After obtaining the distance between the feature vector of the verification sample and the critical surface and the label data of the verification sample, the classification threshold is calculated according to a preset true class rate or a preset false positive class rate.
例如预设假正类率为10%,有S 1,S 2...S 15共15个验证样本,其中有5个正样本,10个负样本,10个负样本的特征向量与临界面的向量距离分别为1,2…10,那么此时分类阈值在区间[1,2]时,如分类阈值取1.5,能够满足10%的预设假正类率。 For example, the preset false positive rate is 10%, and there are 15 verification samples of S 1 , S 2 ... S 15 , among which there are 5 positive samples, 10 negative samples, and the feature vectors and critical surfaces of 10 negative samples. The vector distances of are respectively 1, 2, ... 10, so when the classification threshold is in the interval [1,2], if the classification threshold is 1.5, it can meet the preset false positive class rate of 10%.
S60:根据分类阈值,获取人眼判断模型。S60: Obtain a human eye judgment model according to the classification threshold.
具体地,人眼判断模型是指用于判断人脸图像样本中的眼睛位置是否有遮挡的模型。确定分类阈值之后,通过将人脸图像样本数据的特征向量与支持向量机分类器的临界面的向量距离,并与分类阈值比较,根据比较结果对人脸图像样本数据进行分类,进而确定人脸图像样本中的眼睛位置为有遮挡或者为无遮挡的两种情形。因此,给定分类阈值后,人眼判断模型就建立完成,将待识别人脸图像输入到该人眼判断模型后,会直接根据分类阈值给出是或者否的分类结果,因而能够避免重复训练,提高人眼模型训练的效率。Specifically, the human eye judgment model refers to a model for judging whether an eye position is occluded in a face image sample. After the classification threshold is determined, the feature vector of the face image sample data and the vector distance of the critical surface of the support vector machine classifier are compared with the classification threshold, and the face image sample data is classified according to the comparison result to determine the face The position of the eyes in the image sample is either occluded or unoccluded. Therefore, after the classification threshold is given, the human eye judgment model is established. After inputting the face image to be identified into the human eye judgment model, the classification result of yes or no will be directly given according to the classification threshold, thus avoiding repeated training. To improve the efficiency of human eye model training.
在本实施例中,首先获取人脸图像样本并对人脸图像样本进行标记以得到人脸图像样本数据,提取人脸图像样本数据中的人脸图像样本的特征向量,然后将人脸图像样本数据划分为训练样本数据和验证样本数据;采用训练样本数据训练支持向量机分类器,得到支持向量机分类器的临界面,从而简化了分 类的过程,接着计算验证样本数据中的验证样本的特征向量与支持向量机分类器的临界面的向量距离,能够直观地比较各个验证样本与其所属类别的接近程度,获取预设真正类率或预设假正类率,以便扩展支持向量机分类器的适应性,根据向量距离和与验证样本数据对应的标注数据获取分类阈值,最后获取人眼判断模型,避免重复训练,提高人眼模型训练的效率。In this embodiment, first obtain a face image sample and mark the face image sample to obtain the face image sample data, extract the feature vector of the face image sample in the face image sample data, and then convert the face image sample The data is divided into training sample data and verification sample data; the training sample data is used to train the support vector machine classifier to obtain the critical surface of the support vector machine classifier, thereby simplifying the classification process, and then calculating the characteristics of the verification samples in the verification sample data The vector distance between the vector and the critical surface of the support vector machine classifier can intuitively compare the closeness of each verification sample to the category to which it belongs, and obtain the preset true class rate or the preset false positive class rate in order to extend the support vector machine classifier. Adaptability. The classification threshold is obtained based on the vector distance and the labeled data corresponding to the verification sample data. Finally, the human eye judgment model is obtained to avoid repeated training and improve the efficiency of human eye model training.
在一实施例中,如图3所示,步骤S10中,即提取人脸图像样本数据中的人脸图像样本的特征向量,具体包括如下步骤:In an embodiment, as shown in FIG. 3, in step S10, the feature vector of the facial image sample in the facial image sample data is extracted, and specifically includes the following steps:
S11:采用人脸特征点检测算法获取人脸特征点,人脸特征点包括:左眼角点、右眼角点和眉心点;其中,左眼角点、右眼角点和眉心点是属于同一眼睛区域的特征点。S11: Use facial feature point detection algorithm to obtain facial feature points. The facial feature points include: left eye corner point, right eye corner point, and eyebrow center point; among which, the left eye corner point, right eye corner point, and eyebrow center point belong to the same eye area. Feature points.
其中,人脸特征点检测算法是指用于检测人脸五官特征并标记出位置信息的算法。人脸特征点是指眼角点、鼻翼点和嘴角点等用于标志眼、鼻和嘴等脸部轮廓的点。具体地,人脸特征点检测算法包括但不限于根据深度学习的人脸特征点检测算法、根据模型的人脸特征点检测算法或者根据级联形状回归的人脸特征点检测算法等。Among them, the facial feature point detection algorithm refers to an algorithm for detecting facial features and marking position information. Face feature points refer to points used to mark the contours of the eyes, nose, and mouth, such as corner points, nose points, and mouth corner points. Specifically, the face feature point detection algorithm includes, but is not limited to, a face feature point detection algorithm based on deep learning, a face feature point detection algorithm based on a model, or a face feature point detection algorithm based on cascade shape regression.
可选地,可以采用OpenCV自带的根据Harr特征的Viola-Jones算法获取人脸特征点。其中,OpenCV是一个跨平台计算机视觉库,可以运行在Linux、Windows、Android和Mac OS操作系统上,由一系列C函数和少量C++类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法,而根据Harr特征的Viola-Jones算法是其中一种人脸特征点检测算法。Haar特征是一种反映图像的灰度变化的特征,是反映像素分模块差值的一种特征。Haar特征分为三类:边缘特征、线性特征和中心-对角线特征。Viola-Jones算法是根据人脸的haar特征值进行人脸检测的方法。Optionally, the facial feature points can be obtained by using the Viola-Jones algorithm based on Harr features that comes with OpenCV. Among them, OpenCV is a cross-platform computer vision library that can run on Linux, Windows, Android, and Mac OS operating systems. It consists of a series of C functions and a small number of C ++ classes. It also provides interfaces for languages such as Python, Ruby, and MATLAB. Many general algorithms in image processing and computer vision have been implemented, and the Viola-Jones algorithm based on Harr features is one of facial feature point detection algorithms. Haar feature is a feature that reflects the gray change of an image, and is a feature that reflects the difference between pixel sub-modules. Haar features are divided into three categories: edge features, linear features, and center-diagonal features. The Viola-Jones algorithm is a method for face detection based on haar feature values of a face.
具体地,获取输入的人脸图像样本数据,对人脸图像样本数据进行预处理,接着依次进行肤色区域分割、人脸特征区域分割和人脸特征区域分类的步骤,最后根据Harr特征的Viola-Jones算法与人脸特征区域分类进行匹配计算,得到人脸图像的人脸特征点信息。Specifically, the input facial image sample data is obtained, the facial image sample data is preprocessed, and then the skin color region segmentation, face feature region segmentation, and face feature region classification steps are sequentially performed, and finally according to the Harr feature Viola- The Jones algorithm performs matching calculations on the classification of facial feature regions to obtain the facial feature point information of the facial image.
本实施例中,通过采用人脸特征点检测算法获取到人脸图像样本的左眼角点、右眼角点和眉心点,以便根据这几个特征点的位置信息确定人脸图像样本的眼睛所在区域。可以理解地,本步骤中提及的左眼角点、右眼角点和眉心点是属于同一个眼睛区域的三个特征点,例如左眼对应的三个特征点或者右眼对应的三个特征点。在一个实施方式中,对一个人脸图像样本,只采集其中一只眼睛(左眼或者右眼)的图像即可。若有需要处理两只眼睛时,在采集一只眼睛的图像之后,对其做镜像处理即可作为一个人脸图像样本中另一个眼睛的图像,以节省采集时间,提高数据处理效率。In this embodiment, the left eye corner point, the right eye corner point, and the eyebrow point of the face image sample are obtained by using a face feature point detection algorithm, so as to determine the area where the eyes of the face image sample are located according to the position information of these feature points. . Understandably, the left eye corner point, right eye corner point, and eyebrow center point mentioned in this step are three feature points belonging to the same eye area, for example, three feature points corresponding to the left eye or three feature points corresponding to the right eye. . In one embodiment, for a face image sample, only an image of one of the eyes (left eye or right eye) can be collected. If there is a need to process two eyes, after collecting the image of one eye, mirroring it can be used as the image of the other eye in a face image sample to save acquisition time and improve data processing efficiency.
S12:根据左眼角点和右眼角点对人脸图像样本进行正向调整。S12: Perform forward adjustment on the face image sample according to the left eye corner point and the right eye corner point.
其中,正向调整是对人脸特征点的方位进行规范化并设置为正向的调整。本实施例中,正向调整是指是指将左眼角点和右眼角点调整在同一水平线上(即左眼角点和右眼角点的纵坐标相等),从而将人眼特征点规范化到同一方位,以避免训练样本方位变化对模型训练的影响。提高人脸图像样本对方位变化的鲁棒性。Among them, the forward adjustment is a normalization of the orientation of the feature points of the face and is set to a forward adjustment. In this embodiment, forward adjustment refers to adjusting the left eye corner point and the right eye corner point on the same horizontal line (that is, the vertical coordinates of the left eye corner point and the right eye corner point are equal), thereby normalizing the human eye feature points to the same orientation. In order to avoid the impact of training sample orientation changes on model training. Improve the robustness of face image samples to changes in orientation.
S13:根据左眼角点、右眼角点和眉心点构建眼睛矩形区域。S13: Construct a rectangular area of the eye according to the left corner point, the right corner point, and the eyebrow center point.
其中,眼睛矩形区域是指包括眼睛图像的一个矩形区域,在一具体实施方式中,采用人脸特征点检测算法定位出左眼角点、右眼角点和眉心点的位置坐标,眼睛矩形区域以左眼角点的横坐标为左侧坐标,以右眼角点的横坐标为右侧坐标,以眉心点的纵坐标为上侧坐标,以左眼角点纵坐标(或者右眼角点纵坐标)加上眉心点到左眼角点垂直方向的距离为下侧坐标,以这四个点坐标(左侧坐标、右侧坐标、上侧坐标和下侧坐标)构成的矩形区域即为眼睛矩形区域。The rectangular area of the eye refers to a rectangular area including an eye image. In a specific embodiment, the position coordinates of the left corner point, the right corner point, and the eyebrow center point are located using a facial feature point detection algorithm. The abscissa of the corner of the eye is the left coordinate, the abscissa of the right corner of the eye is the right coordinate, the ordinate of the eyebrow point is the upper coordinate, and the ordinate of the left eye corner point (or the ordinate of the right eye corner point) plus the eyebrow center The distance from the point to the left eye corner point in the vertical direction is the lower side coordinates. The rectangular area formed by these four point coordinates (left side coordinates, right side coordinates, upper side coordinates, and lower side coordinates) is the eye rectangular area.
S14:对眼睛矩形区域进行图像归一化处理,得到归一化眼睛矩形区域。S14: Perform image normalization processing on the rectangular area of the eyes to obtain a normalized rectangular area of the eyes.
其中,归一化处理是指对待处理的图像进行一系列变换以使待处理的图像转换成相应的标准形式。如图像的尺寸归一化、图像的灰度归一化等。优选地,归一化处理是指对眼睛矩形区域进行尺寸归一化。具体地,将眼睛矩形区域依据人脸图像样本的分辨率设置为固定尺寸,例如:眼睛矩形区域可以设置为Size(48,32)矩形,即长为48像素,宽为32像素的矩形区域,通过将眼睛矩形区域设置为固定尺寸,以便后续减少特征向量提取的复杂度。Among them, normalization processing refers to performing a series of transformations on an image to be processed to convert the image to be processed into a corresponding standard form. Such as image size normalization, image grayscale normalization and so on. Preferably, the normalization process refers to size normalization of a rectangular area of the eye. Specifically, the eye rectangular area is set to a fixed size according to the resolution of the face image sample. For example, the eye rectangular area can be set to a Size (48,32) rectangle, that is, a rectangular area with a length of 48 pixels and a width of 32 pixels. By setting the rectangular area of the eyes to a fixed size, the complexity of feature vector extraction is subsequently reduced.
容易理解地,对眼睛矩形区域进行图像归一化处理,有利于后续支持向量机模型的训练,能够避免大数值区间的属性过分支配了小数值区间的属性,而且还能避免计算过程中数值复杂度。It is easy to understand that the image normalization processing on the rectangular area of the eye is conducive to the subsequent training of the support vector machine model. It can avoid the attribute of the large numerical interval to be over-branched and the attribute of the small numerical interval, and it can also avoid the complex value during the calculation degree.
S15:根据归一化眼睛矩形区域提取HOG特征向量。S15: Extract the HOG feature vector according to the normalized rectangular area of the eyes.
HOG(Histogram of Oriented Gradient,HOG)特征向量,是用于描述图像局部区域的梯度方向信息的向量,该特征受图像尺寸位置等变化影响较大,输入图像范围固定使计算得到的HOG特征向量更统一,模型训练时可以更多关注无遮挡眼睛图像与有遮挡眼睛图像的区别而不需要注意眼睛位置的变化,训练更方便,同时HOG特征向量本身关注的即是图像梯度特征而不是颜色特征,受光照变化以及几何形状变化的影响不大,因此,提取HOG特征向量能够方便高效地对人脸图像样本进行特征向量的提取。其中,根据分类检测目标的不同,对于特征提取也不同的,一般是将颜色、纹理以及形状作为目标特征。根据对检测人眼图像准确度的要求,本实施例选择采用形状特征,采用训练样本的HOG特征向量。The HOG (Histogram of Oriented Gradient, HOG) feature vector is a vector used to describe the gradient direction information of a local area of the image. This feature is greatly affected by changes in image size and position. The fixed input image range makes the calculated HOG feature vector more accurate. Unified, model training can pay more attention to the difference between unobstructed eye images and obstructed eye images without paying attention to changes in eye position, which is more convenient for training. At the same time, the HOG feature vector itself focuses on image gradient features rather than color features. It is not greatly affected by changes in illumination and changes in geometric shapes. Therefore, extracting HOG feature vectors can conveniently and efficiently extract feature vectors from face image samples. Among them, according to different detection targets, feature extraction is also different. Generally, color, texture, and shape are used as target features. According to the requirements for detecting the accuracy of the human eye image, this embodiment chooses to use the shape feature and the HOG feature vector of the training sample.
在本实施例中,采用人脸特征点检测算法获取人脸特征点的左眼角点、右眼角点和眉心点;然后对图像样本进行正向调整,以提高人脸图片对方向变化的鲁棒性,接着构建眼睛矩形区域并对眼睛矩形区域进行图像归一化处理,得到归一化眼睛矩形区域,有利于后续支持向量机模型的训练,最后提取归一化眼睛矩形区域HOG特征向量,从而方便高效地对人脸图像样本数据中的人脸图像样本进行特征向量的提取。In this embodiment, a facial feature point detection algorithm is used to obtain the left eye corner point, the right eye corner point, and the eyebrow center point of the facial feature point; then, the image sample is adjusted forward to improve the robustness of the face image to the direction change. Then, the eye rectangular area is constructed and the eye rectangular area is subjected to image normalization processing to obtain the normalized eye rectangular area, which is conducive to subsequent training of the support vector machine model, and finally extracts the normalized eye rectangular area HOG feature vector, so that It is convenient and efficient to extract feature vectors from the face image samples in the face image sample data.
在一实施例中,如图4所示,步骤S30中,即采用训练样本数据训练支持向量机分类器,得到支持向量机分类器的临界面,具体包括如下步骤:In an embodiment, as shown in FIG. 4, in step S30, training sample data is used to train a support vector machine classifier to obtain a critical surface of the support vector machine classifier, which specifically includes the following steps:
S31:获取支持向量机分类器的核函数和支持向量机分类器的惩罚参数,采用以下公式求解拉格朗日乘子
Figure PCTCN2018094341-appb-000003
和决策阈值b:
S31: Obtain the kernel function of the support vector machine classifier and the penalty parameters of the support vector machine classifier, and use the following formula to solve the Lagrangian multiplier
Figure PCTCN2018094341-appb-000003
And decision threshold b:
Figure PCTCN2018094341-appb-000004
Figure PCTCN2018094341-appb-000004
Figure PCTCN2018094341-appb-000005
Figure PCTCN2018094341-appb-000005
0≤α i≤C,i=1,...l 0≤α i ≤C, i = 1, ... l
Figure PCTCN2018094341-appb-000006
Figure PCTCN2018094341-appb-000006
式中,s.t.是数学公式中约束条件的缩写,min是指在约束条件下取代数式
Figure PCTCN2018094341-appb-000007
的最小值,K(x i,x j)为支持向量机分类器的核函数,C为支持向量机分类器的惩罚参数,C>0,α i与拉格朗日乘子
Figure PCTCN2018094341-appb-000008
是共轭关系,x i为训练样本数据的特征向量,l为训练样本数据的特征向量的个数,y i为训练样本数据的标注。
In the formula, st is the abbreviation of the constraint condition in the mathematical formula, and min means to replace the number formula under the constraint condition.
Figure PCTCN2018094341-appb-000007
K (x i , x j ) is the kernel function of the support vector machine classifier, C is the penalty parameter of the support vector machine classifier, C> 0, α i and Lagrange multiplier
Figure PCTCN2018094341-appb-000008
Is the conjugate relationship, x i is the feature vector of the training sample data, l is the number of feature vectors of the training sample data, and y i is the label of the training sample data.
其中,核函数是支持向量机分类器中的核函数,用于对训练支持向量机分类器过程中输入的训练样本的特征向量进行核函数运算,支持向量机分类器的核函数包括但不限于线性核函数、多项式核函数、高斯核函数、高斯核函数和基于径向基核函数,因为本实施例中的支持向量机分类器是线性可分的,优选地,本实施例中采用线性核函数作为支持向量机分类器中的核函数,因此K(x i,x j)=(x i,x j),线性核参数具有参数少、运算速度快的特点,适用于线性可分的情况。y i为训练样本数据的标注,因为是支持向量机分类器的二分类问题,因此y i可以为1或者-1两类,若人脸图像样本为正样本则y i=1,若 人脸图像样本为负样本则y i=-1。 The kernel function is a kernel function in a support vector machine classifier, and is used to perform a kernel function operation on the feature vectors of training samples input during the training of the support vector machine classifier. Linear kernel function, polynomial kernel function, Gaussian kernel function, Gaussian kernel function, and radial basis kernel function. Because the support vector machine classifier in this embodiment is linearly separable, it is preferred that a linear kernel The function is a kernel function in the support vector machine classifier, so K (x i , x j ) = (x i , x j ). The linear kernel parameter has the characteristics of few parameters and fast operation speed, which is suitable for linearly separable cases. . y i is the labeling of training sample data. Because it is a two-class classification problem of support vector machine classifiers, y i can be 1 or -1. If the face image sample is a positive sample, y i = 1. If the image samples are negative samples, y i = -1.
惩罚参数C是用于对支持向量机分类器进行优化的参数,是一个确定数值。可以解决样本偏斜的分类问题,具体地,参与分类的两个类别(也可以指多个类别)样本数量差异很大,例如正样本有10000个而负样本有100个,如此会产生样本偏斜问题,此时正样本分布范围广,为解决样本偏斜问题,具体地,可依据正样本数量与负样本数量的比例合理增大C的取值。C越大,表示分类器的容错性小。决策阈值b用于确定支持向量机分类器过程中的决策分类的临界值,是一个实数。The penalty parameter C is a parameter used to optimize the support vector machine classifier, and it is a certain value. It can solve the problem of classification of sample skew. Specifically, the number of samples in the two categories (also referred to as multiple categories) that participate in the classification is very different. For example, there are 10,000 positive samples and 100 negative samples. This will cause sample bias. The skew problem. At this time, the distribution of positive samples is wide. To solve the problem of sample skew, specifically, the value of C can be reasonably increased according to the ratio of the number of positive samples to the number of negative samples. The larger C is, the smaller the fault tolerance of the classifier is. The decision threshold b is a real number used to determine the threshold for decision classification in the process of a support vector machine classifier.
具体地,通过获取合适的核函数K(x i,x j),并设定合适的惩罚参数C,采用公式 Specifically, by obtaining an appropriate kernel function K (x i , x j ) and setting an appropriate penalty parameter C, the formula is adopted
Figure PCTCN2018094341-appb-000009
对训练样本数据的特征向量与核函数进行核函数运算后,求解最优问题,即求取拉格朗日乘子
Figure PCTCN2018094341-appb-000010
的值,使得核函数运算后的结果
Figure PCTCN2018094341-appb-000011
达到最小,得到了
Figure PCTCN2018094341-appb-000012
然后,确定开区间(0,C)范围中的
Figure PCTCN2018094341-appb-000013
的分量
Figure PCTCN2018094341-appb-000014
并根据
Figure PCTCN2018094341-appb-000015
计算b值。
Figure PCTCN2018094341-appb-000009
After performing the kernel function operation on the feature vectors and kernel functions of the training sample data, the optimal problem is solved, that is, the Lagrange multiplier
Figure PCTCN2018094341-appb-000010
Value of the kernel function
Figure PCTCN2018094341-appb-000011
Reached the minimum and got
Figure PCTCN2018094341-appb-000012
Then, determine the range in the open interval (0, C)
Figure PCTCN2018094341-appb-000013
Weight
Figure PCTCN2018094341-appb-000014
And according to
Figure PCTCN2018094341-appb-000015
Calculate the b value.
求解了支持向量机分类器的中的拉格朗日乘子
Figure PCTCN2018094341-appb-000016
和决策阈值b,从而获取较好的参数,以便构建高效的支持向量机分类器。
Solve the Lagrangian multiplier in the support vector machine classifier
Figure PCTCN2018094341-appb-000016
And decision threshold b to obtain better parameters in order to build an efficient support vector machine classifier.
S32:根据拉格朗日乘子
Figure PCTCN2018094341-appb-000017
和决策阈值b,采用如下公式,得到支持向量机分类器的临界面g(x):
S32: According to the Lagrangian multiplier
Figure PCTCN2018094341-appb-000017
And decision threshold b, the critical surface g (x) of the support vector machine classifier is obtained using the following formula:
Figure PCTCN2018094341-appb-000018
Figure PCTCN2018094341-appb-000018
通过训练支持向量机分类器得到拉格朗日乘子
Figure PCTCN2018094341-appb-000019
和决策阈值b后,即调整训练样本的拉格朗日乘子
Figure PCTCN2018094341-appb-000020
和决策阈值b这两个参数后,并代入到公式
Figure PCTCN2018094341-appb-000021
中,即得到支持向量机分类器的临界面。
Lagrangian multiplier obtained by training support vector machine classifier
Figure PCTCN2018094341-appb-000019
And the decision threshold b, the Lagrangian multiplier of the training sample is adjusted
Figure PCTCN2018094341-appb-000020
And the decision threshold b, and put them into the formula
Figure PCTCN2018094341-appb-000021
The critical surface of the support vector machine classifier is obtained.
容易理解地,通过计算得到临界面,以便后续人脸图像样本根据临界面对训练样本分类,训练程序先提取并保存样本的特征向量,从而可以在不断调整训练参数多次训练过程中节省提取特征的时间,尽快得到符合要求的训练参数。这样可以调整临界面对某一分类的误报率和准确率,而不需要经常重复训练模型,提高了模型训练效率。It is easy to understand that the critical surface is obtained through calculation, so that subsequent face image samples are classified according to the critical face training samples. The training program first extracts and saves the feature vectors of the samples, so that the extracted features can be saved during the continuous adjustment of the training parameters for multiple training processes. Time to get the training parameters that meet the requirements as soon as possible. In this way, the false positive rate and accuracy rate of a certain category can be adjusted without needing to repeatedly train the model, which improves the model training efficiency.
本实施例中,首先获取合适的核函数K(x i,x j),并设定合适的惩罚参数C,将训练样本数据的特 征向量与核函数进行核函数运算,求解支持向量机分类器中的决策阈值b,从而获取较好的参数,构建支持向量机分类器,然后将拉格朗日乘子
Figure PCTCN2018094341-appb-000022
和决策阈值b这两个参数代入到公式
Figure PCTCN2018094341-appb-000023
中,得到临界面g(x),以便后续人脸图像样本根据临界面对训练样本数据分类,而不需要经常重复训练模型,提高了模型训练的效率。
In this embodiment, first obtain an appropriate kernel function K (x i , x j ), set an appropriate penalty parameter C, perform a kernel function operation on the feature vector of the training sample data and the kernel function, and solve the support vector machine classifier. Decision threshold b in the algorithm to obtain better parameters, build a support vector machine classifier, and then divide the Lagrangian multiplier
Figure PCTCN2018094341-appb-000022
And the decision threshold b are substituted into the formula
Figure PCTCN2018094341-appb-000023
In the method, a critical surface g (x) is obtained, so that subsequent face image samples are classified according to the training data of the critical face, without the need to repeatedly train the model, which improves the efficiency of model training.
在一实施例中,如图5所示,步骤S15中,即根据归一化眼睛矩形区域提取HOG特征向量,具体包括如下步骤:In an embodiment, as shown in FIG. 5, in step S15, the HOG feature vector is extracted according to the normalized rectangular area of the eyes, and specifically includes the following steps:
S151:将归一化眼睛矩形区域划分成细胞单元,并计算细胞单元的每个像素梯度的大小和方向。S151: Divide the normalized eye rectangular area into cell units, and calculate the size and direction of each pixel gradient of the cell unit.
具体地,根据实际需要及对支持向量机分类器的要求不同,对归一化眼睛矩形区域划分的方式也不同。子区域与子区域可重叠也可以不重叠。细胞单元是指图像的连通子区域,即每个子区域是由多个细胞单元组成,例如,一幅48*32的归一化眼睛矩形区域,假设一个细胞单元为4*4像素,将2*2个细胞组成一个子区域,那么这个归一化眼睛矩形区域有6*4个子区域。每个细胞单元的梯度方向区间0°到180°分成了9个区间,因此可以用一个9维向量描述一个细胞单元。Specifically, according to the actual needs and requirements of the support vector machine classifier, the manner of dividing the normalized eye rectangular region is also different. The sub-region and the sub-region may or may not overlap. Cell units are connected subregions of the image, that is, each subregion is composed of multiple cell units. For example, a 48 * 32 normalized rectangular area of the eye. Assuming a cell unit is 4 * 4 pixels, 2 * 2 cells make up a sub-region, then this normalized eye rectangular region has 6 * 4 sub-regions. The gradient direction interval of each cell unit from 0 ° to 180 ° is divided into 9 intervals, so a 9-dimensional vector can be used to describe a cell unit.
获取归一化眼睛矩形区域每个像素梯度的大小和方向具体过程为:首先获取每个像素的梯度,假如像素为(x,y),其梯度计算公式如下:The specific process of obtaining the magnitude and direction of each pixel gradient of the normalized rectangular area of the eye is: first obtain the gradient of each pixel, if the pixel is (x, y), the gradient calculation formula is as follows:
Figure PCTCN2018094341-appb-000024
Figure PCTCN2018094341-appb-000024
其中,G x(x,y)为像素(x,y)的水平方向梯度,其中G y(x,y)为像素(x,y)的垂直方向梯度,H(x,y)为像素(x,y)的灰度值。然后采用以下公式计算该像素的梯度大小: Where G x (x, y) is the horizontal gradient of the pixel (x, y), where G y (x, y) is the vertical gradient of the pixel (x, y), and H (x, y) is the pixel ( x, y). Then use the following formula to calculate the gradient of the pixel:
Figure PCTCN2018094341-appb-000025
Figure PCTCN2018094341-appb-000025
其中,G(x,y)为像素梯度的大小。Among them, G (x, y) is the size of the pixel gradient.
最后,采用以下公式计算像素梯度的方向:Finally, the direction of the pixel gradient is calculated using the following formula:
Figure PCTCN2018094341-appb-000026
Figure PCTCN2018094341-appb-000026
其中,α(x,y)为像素梯度的方向的方向角。Where α (x, y) is the directional angle of the direction of the pixel gradient.
S152:统计细胞单元的每个像素梯度的大小和方向的梯度直方图。S152: Count the gradient histogram of the magnitude and direction of each pixel gradient of the cell unit.
其中,梯度直方图是指对像素梯度的大小和方向进行统计得到的直方图,用于表征每个细胞单元的梯度信息。具体地,首先将每个细胞单元的梯度方向从0°到180°均匀地分成9个方向块,即0°-20°是第一个方向块,20°-40°第二个方向块,依此类推,160°-180°为第九个方向块。然后判断细胞单元的像素梯度的方向所在的方向块,并加上该方向块的像素梯度的大小。例如,一个细胞单元的某一像素的方向落在40°-60°,就将梯度直方图第三个方向上的像素值加上该方向的像素梯度的大小,从而得到该细胞单元的梯度直方图。Among them, the gradient histogram refers to a histogram obtained by statistically calculating the magnitude and direction of the pixel gradient, and is used to characterize the gradient information of each cell unit. Specifically, first divide the gradient direction of each cell unit from 0 ° to 180 ° into 9 direction blocks, that is, 0 ° -20 ° is the first direction block, and 20 ° -40 ° is the second direction block. By analogy, 160 ° -180 ° is the ninth direction block. Then determine the direction block where the direction of the pixel gradient of the cell unit is located, and add the size of the pixel gradient of the direction block. For example, if the direction of a certain pixel of a cell unit falls between 40 ° and 60 °, the pixel value in the third direction of the gradient histogram is added to the magnitude of the pixel gradient in that direction to obtain the gradient histogram of the cell unit. Illustration.
S153:串联梯度直方图,得到HOG特征向量。S153: A histogram of gradients in series is obtained to obtain a HOG feature vector.
其中,串联是指对各个细胞单元的梯度直方图按照自左向右、自上向下的顺序将所有梯度直方图合并,从而得到归一化眼睛矩形区域的HOG特征向量。Among them, tandem refers to merging all gradient histograms of gradient histograms of each cell unit from left to right and top to bottom to obtain a normalized eye rectangular region HOG feature vector.
本实施例中,通过将归一化眼睛矩形区域分成若干个小区域,然后计算各个小区域的梯度直方图,最后将各个小区域对应的梯度直方图串联一起,得到整幅归一化眼睛矩形区域的梯度直方图,用于描述人脸图像样本的特征向量,同时HOG特征向量本身关注的即是图像梯度特征而不是颜色特征,受光照变化影响不大。提取HOG特征向量能够方便高效地对人眼图像进行识别。In this embodiment, the normalized eye rectangle area is divided into several small areas, and then the gradient histograms of the small areas are calculated. Finally, the gradient histograms corresponding to the small areas are connected in series to obtain the entire normalized eye rectangle. The gradient histogram of the region is used to describe the feature vector of the face image sample. At the same time, the HOG feature vector itself focuses on the image gradient feature rather than the color feature, and is not affected by the change of illumination. Extracting HOG feature vectors can easily and efficiently recognize human eye images.
在一实施例中,如图6所示,步骤S50中,即获取预设真正类率或假正类率,根据向量距离和与验证样本数据对应的标注数据获取分类阈值,具体包括如下步骤:In an embodiment, as shown in FIG. 6, in step S50, a preset true class rate or false positive class rate is obtained, and a classification threshold is obtained according to the vector distance and the labeled data corresponding to the verification sample data, which specifically includes the following steps:
S51:根据向量距离和与验证样本数据对应的标注数据绘制ROC曲线。S51: Draw a ROC curve according to the vector distance and the label data corresponding to the verification sample data.
其中,ROC曲线指受试者工作特征曲线/接收器操作特性曲线(receiver operating characteristic curve),是反映敏感性和特异性连续变量的综合指标,是用构图法揭示敏感性和特异性的相互关系。本实施例中,ROC曲线显示的是支持向量机分类器真正类率和假正类率之间的关系,该曲线越靠近左上角分类器的准确性越高。Among them, ROC curve refers to the receiver's operating characteristic curve / receiver operating characteristic curve (receiver operating characteristic curve). It is a comprehensive index reflecting continuous variables of sensitivity and specificity. It is a composition method to reveal the relationship between sensitivity and specificity. . In this embodiment, the ROC curve shows the relationship between the true class rate and the false positive class rate of the support vector machine classifier. The closer the curve is to the upper left corner of the classifier, the higher the accuracy.
在验证训练样本中将样本进行了正负样本的分类:正样本(positive)或负样本(negative)。在对验证训练样本中的人脸图像数据进行分类的过程中,会出现四种情况:如果人脸图像数据是正样本并且也被预测成正样本,即为真正类(True positive,TP),如果人脸图像数据是负样本被预测成正样本,称之为假正类(False positive,FP)。相应地,如果人脸图像数据是负样本被预测成负样本,称之为真负类(True negative,TN),正样本被预测成负样本则为假负样本(false negative,FN)。In the validation training sample, the samples are classified into positive and negative samples: positive samples (negative) or negative samples (negative). In the process of classifying the face image data in the verification training sample, four situations will occur: if the face image data is a positive sample and is also predicted as a positive sample, it is a true class (TP). Face image data is a negative sample that is predicted to be a positive sample, which is called a false positive (FP). Correspondingly, if the face image data is a negative sample, it is predicted as a negative sample, which is called a true negative (TN), and a positive sample is predicted as a negative sample, which is a false negative (FN).
真正类率(true positive rate,TPR)刻画的是分类器所识别出的正实例占所有正实例的比例,计算公式为TPR=TP/(TP+FN)。假正类率(false positive rate,FPR)刻画的是分类器错认为正样本的负实例占所有负实例的比例,计算公式为FPR=FP/(FP+TN)。The true class rate (TPR) characterizes the ratio of positive instances identified by the classifier to all positive instances. The calculation formula is TPR = TP / (TP + FN). The false positive rate (FPR) characterizes the proportion of negative instances that the classifier mistakes for positive samples to all negative instances. The calculation formula is FPR = FP / (FP + TN).
ROC曲线的绘制过程为:根据验证样本数据的特征向量和临界面特征向量的向量距离和对应的验证样本数据标注,获得众多验证样本的真正类率和假正类率,ROC曲线以假正类率为横轴,以真正类率为纵轴,连接各点即众多验证样本的真正类率和假正类率,绘制曲线,然后计算曲线下的面积,面积越大,判断价值越高。The process of drawing the ROC curve is: according to the feature vector of the verification sample data and the vector distance of the critical surface feature vector and the corresponding verification sample data annotation, the true class rate and false positive class rate of many verification samples are obtained. The ROC curve is false positive class The rate is the horizontal axis, and the true class rate is the vertical axis. Connect the points, that is, the true class rate and false positive class rate of many verification samples, draw a curve, and then calculate the area under the curve. The larger the area, the higher the judgment value.
在一具体实施方式中,可通过ROC曲线绘制工具进行绘制,具体地,通过matlab中的plotSVMroc(true_labels,predict_labels,classnumber)函数绘制ROC曲线。其中,true_labels为正确的标记,predict_labels为分类判断的标记,classnumber为分类类别的数量,本实施例因为是正负样本的二分类问题,因此classnumber=2。具体地,通过计算验证样本数据的特征向量和临界面特征向量的向量距离后,根据向量距离分布情况,即各个验证样本数据与临界面的接近程度的分布范围,并根据对应的验证样本数据的标注能够获取到验证样本数据的真正类率和假正类率,然后依据验证样本数据的真正类率和假正类率绘制ROC曲线。In a specific implementation manner, the ROC curve drawing tool can be used for drawing. Specifically, the ROC curve is drawn using the plotSVMroc (true_labels, predict_labels, classnumber) function in matlab. Among them, true_labels are correct labels, predict_labels are labels for classification judgment, and classnumber is the number of classification classes. In this embodiment, because it is a binary classification problem of positive and negative samples, classnumber = 2. Specifically, after calculating the vector distance between the feature vector of the verification sample data and the critical surface feature vector, according to the vector distance distribution, that is, the distribution range of the closeness of each verification sample data to the critical surface, and according to the corresponding verification sample data, Annotate the true and false positive rates of the verification sample data, and then draw the ROC curve based on the true and false positive rates of the verification sample data.
S52:根据预设真正类率或预设假正类率在ROC曲线的横轴上获取分类阈值。S52: Obtain a classification threshold on the horizontal axis of the ROC curve according to a preset true class rate or a preset false positive class rate.
具体地,预设真正类率或预设假正类率通过实际的使用需要而进行设置,服务端在获取到预设真正类率或预设假正类率后,通过ROC曲线中的横轴表示的假正类率和纵轴表示的真正类率与预设真正类率或预设假正类率比较大小,即预设真正类率或预设假正类率作为对测试样本数据进行分类的标准,从ROC曲线的横轴上依据分类标准确定分类阈值,从而使得后续模型训练中通过ROC曲线可以根据不同的场景选取不同的分类阈值,避免重复训练的需要,提高模型训练的效率。Specifically, the preset true class rate or preset false positive class rate is set according to actual use needs. After the server obtains the preset true class rate or preset false positive class rate, it passes the horizontal axis in the ROC curve. The false positive class rate and the true class rate represented by the vertical axis are compared with the preset true class rate or the preset false positive class rate, that is, the preset true class rate or the preset false positive class rate is used to classify the test sample data. The classification threshold is determined from the horizontal axis of the ROC curve according to the classification criteria, so that in the subsequent model training, different classification thresholds can be selected according to different scenarios through the ROC curve, which avoids the need for repeated training and improves the efficiency of model training.
本实施例中,首先通过计算验证样本数据的特征向量和临界面特征向量的向量距离后,并根据对应的验证样本数据的标注能够获取到验证样本数据的真正类率和假正类率,然后依据验证样本数据的真正类率和假正类率绘制ROC曲线。通过预设真正类率或预设假正类率从ROC曲线的横轴上获取分类阈值,从而使得后续模型训练中通过ROC曲线可以根据不同的场景选取不同的分类阈值,避免重复训练的需要,提高模型训练的效率。In this embodiment, the true class rate and false positive class rate of the verification sample data can be obtained after calculating the vector distance between the feature vector of the verification sample data and the critical surface feature vector, and according to the corresponding verification sample data label. Draw ROC curves based on the true and false positive rates of the validation sample data. The classification threshold is obtained from the horizontal axis of the ROC curve by presetting the real class rate or the preset false positive class rate, so that in the subsequent model training, different classification thresholds can be selected according to different scenarios through the ROC curve to avoid the need for repeated training. Improve the efficiency of model training.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
图7示出与实施例中人眼模型训练方法一一对应的人眼模型训练装置的原理框图。如图7所示,该人眼模型训练装置包括人脸图像样本数据获取模块10、人脸图像样本数据划分模块20、临界面获取模 块30、向量距离计算模块40、分类阈值获取模块50和人眼判断模型获取模块60。其中,人脸图像样本数据获取模块10、人脸图像样本数据划分模块20、临界面获取模块30、向量距离计算模块40、分类阈值获取模块50和人眼判断模型获取模块60的实现功能与实施例中人眼模型训练方法对应的步骤一一对应,各功能模块详细说明如下:FIG. 7 shows a principle block diagram of a human eye model training device corresponding to the human eye model training method in the embodiment. As shown in FIG. 7, the human eye model training device includes a face image sample data acquisition module 10, a face image sample data division module 20, a critical surface acquisition module 30, a vector distance calculation module 40, a classification threshold acquisition module 50, and a person. Eye judgment model acquisition module 60. Among them, the realization function and implementation of the face image sample data acquisition module 10, the face image sample data division module 20, the critical surface acquisition module 30, the vector distance calculation module 40, the classification threshold acquisition module 50, and the human eye judgment model acquisition module 60 In the example, the corresponding steps of the human eye model training method are one-to-one. The detailed description of each functional module is as follows:
人脸图像样本数据获取模块10,用于获取人脸图像样本,并对人脸图像样本进行标记以得到人脸图像样本数据,及提取人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;A face image sample data obtaining module 10, configured to obtain a face image sample, and mark the face image sample to obtain the face image sample data; and extract a feature vector of the face image sample from the face image sample data. The facial image sample data includes facial image samples and annotation data;
人脸图像样本数据划分模块20,用于将人脸图像样本数据划分为训练样本数据和验证样本数据;A face image sample data dividing module 20, configured to divide the face image sample data into training sample data and verification sample data;
临界面获取模块30,用于采用训练样本数据训练支持向量机分类器,得到支持向量机分类器的临界面;A critical surface acquisition module 30 is configured to train a support vector machine classifier using training sample data to obtain a critical surface of the support vector machine classifier;
向量距离计算模块40,用于计算验证样本数据中的验证样本的特征向量与临界面的向量距离;The vector distance calculation module 40 is configured to calculate a vector distance between a feature vector of a verification sample and a critical surface in the verification sample data;
分类阈值获取模块50,用于获取预设真正类率或预设假正类率,根据向量距离和与验证样本数据对应的标注数据获取分类阈值;A classification threshold obtaining module 50, configured to obtain a preset true class rate or a preset false positive class rate, and obtain a classification threshold according to a vector distance and labeled data corresponding to the verification sample data;
人眼判断模型获取模块60,用于根据分类阈值,获取人眼判断模型。The human eye judgment model acquisition module 60 is configured to acquire a human eye judgment model according to a classification threshold.
具体地,人脸图像样本数据获取模块10包括人脸特征点获取单元11、正向调整单元12、眼睛矩形区域构建单元13、眼睛矩形区域获取单元14和特征向量提取单元15。Specifically, the facial image sample data acquisition module 10 includes a facial feature point acquisition unit 11, a forward adjustment unit 12, an eye rectangular region construction unit 13, an eye rectangular region acquisition unit 14, and a feature vector extraction unit 15.
人脸特征点获取单元11,用于采用人脸特征点检测算法获取人脸特征点,该人脸特征点包括:左眼角点、右眼角点和眉心点;其中,左眼角点、右眼角点和眉心点是属于同一眼睛区域的特征点;A facial feature point acquisition unit 11 is configured to obtain a facial feature point by using a facial feature point detection algorithm. The facial feature point includes: a left eye corner point, a right eye corner point, and a brow center point; among which, the left eye corner point and the right eye corner point And the eyebrow center point are characteristic points belonging to the same eye area;
正向调整单元12,用于根据左眼角点和右眼角点对人脸图像样本进行正向调整;A forward adjustment unit 12 configured to perform forward adjustment on a face image sample according to a left eye corner point and a right eye corner point;
眼睛矩形区域构建单元13,用于根据左眼角点、右眼角点和眉心点构建眼睛矩形区域;The eye rectangular region constructing unit 13 is configured to construct an eye rectangular region according to the left eye corner point, the right eye corner point, and the eyebrow center point;
眼睛矩形区域获取单元14,用于对眼睛矩形区域进行图像归一化处理,得到归一化眼睛矩形区域;The eye rectangular area obtaining unit 14 is configured to perform image normalization processing on the eye rectangular area to obtain a normalized eye rectangular area;
特征向量提取单元15,用于根据归一化眼睛矩形区域提取HOG特征向量。A feature vector extraction unit 15 is configured to extract a HOG feature vector according to a normalized rectangular area of the eye.
具体地,特征向量提取单元15包括像素梯度获取子单元151、梯度直方图获取子单元152和HOG特征向量获取子单元153。Specifically, the feature vector extraction unit 15 includes a pixel gradient acquisition subunit 151, a gradient histogram acquisition subunit 152, and a HOG feature vector acquisition subunit 153.
像素梯度获取子单元151,用于将归一化眼睛矩形区域划分成细胞单元,并计算细胞单元的每个像素梯度的大小和方向;A pixel gradient acquisition subunit 151, configured to divide a normalized eye rectangular area into cell units, and calculate the size and direction of each pixel gradient of the cell unit;
梯度直方图获取子单元152,用于统计细胞单元的每个像素梯度的大小和方向的梯度直方图;The gradient histogram acquisition subunit 152 is used to count the gradient histogram of the magnitude and direction of each pixel gradient of the cell unit;
HOG特征向量获取子单元153,用于串联梯度直方图,得到HOG特征向量。The HOG feature vector acquisition subunit 153 is used to concatenate gradient histograms to obtain a HOG feature vector.
具体地,临界面获取模块30包括参数获取单元31和临界面获取单元32。Specifically, the critical surface acquisition module 30 includes a parameter acquisition unit 31 and a critical surface acquisition unit 32.
参数获取单元31,用于获取支持向量机分类器的核函数和支持向量机分类器的惩罚参数,采用以下公式求解拉格朗日乘子
Figure PCTCN2018094341-appb-000027
和决策阈值b:
A parameter obtaining unit 31 is used for obtaining a kernel function of the support vector machine classifier and a penalty parameter of the support vector machine classifier, and solving the Lagrange multiplier by using the following formula
Figure PCTCN2018094341-appb-000027
And decision threshold b:
Figure PCTCN2018094341-appb-000028
Figure PCTCN2018094341-appb-000028
Figure PCTCN2018094341-appb-000029
Figure PCTCN2018094341-appb-000029
0≤α i≤C,i=1,...l 0≤α i ≤C, i = 1, ... l
Figure PCTCN2018094341-appb-000030
Figure PCTCN2018094341-appb-000030
式中,s.t.是数学公式中约束条件的缩写,min是指在约束条件下取代数式
Figure PCTCN2018094341-appb-000031
的最小值,K(x i,x j)为支持向量机分类器的核函数,C为支持 向量机分类器的惩罚参数,C>0,α i与拉格朗日乘子
Figure PCTCN2018094341-appb-000032
是共轭关系,x i为训练样本数据的特征向量,l为训练样本数据的特征向量的个数,y i为训练样本数据的标注;
In the formula, st is the abbreviation of the constraint condition in the mathematical formula, and min means to replace the number formula under the constraint condition.
Figure PCTCN2018094341-appb-000031
K (x i , x j ) is the kernel function of the support vector machine classifier, C is the penalty parameter of the support vector machine classifier, C> 0, α i and Lagrange multiplier
Figure PCTCN2018094341-appb-000032
Is the conjugate relationship, x i is the feature vector of the training sample data, l is the number of feature vectors of the training sample data, and y i is the label of the training sample data;
临界面获取单元32:用于根据拉格朗日乘子
Figure PCTCN2018094341-appb-000033
和决策阈值b,采用如下公式,得到支持向量机分类器的临界面g(x):
Critical plane acquisition unit 32: used to obtain a Lagrangian multiplier
Figure PCTCN2018094341-appb-000033
And decision threshold b, the critical surface g (x) of the support vector machine classifier is obtained using the following formula:
Figure PCTCN2018094341-appb-000034
Figure PCTCN2018094341-appb-000034
具体地,分类阈值获取模块50包括ROC曲线绘制单元51和分类阈值获取单元52。Specifically, the classification threshold acquisition module 50 includes a ROC curve drawing unit 51 and a classification threshold acquisition unit 52.
ROC曲线绘制单元51,用于根据向量距离和与验证样本数据对应的标注数据绘制ROC曲线;The ROC curve drawing unit 51 is configured to draw an ROC curve according to the vector distance and the labeled data corresponding to the verification sample data;
分类阈值获取单元52,用于根据预设真正类率或预设假正类率在ROC曲线的横轴上获取分类阈值。The classification threshold acquiring unit 52 is configured to acquire a classification threshold on a horizontal axis of the ROC curve according to a preset true class rate or a preset false positive class rate.
关于人眼模型训练装置的具体限定可以参见上文中对于人眼模型训练方法的限定,在此不再赘述。上述人眼模型训练装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For specific limitations on the human eye model training device, reference may be made to the foregoing limitation on the human eye model training method, and details are not described herein again. Each module in the above-mentioned human eye model training device may be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules may be embedded in the hardware in or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
在一实施例中,提供一人眼识别方法,该人眼识别方法也可以应用在如图1的应用环境中,其中,计算机设备通过网络与服务端进行通信。客户端通过网络与服务端进行通信,服务端接收客户端发送待识别人脸图片,进行人眼识别。其中,客户端可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。服务端可以用独立的服务器或者是多个服务器组成的服务器集群来实现。In one embodiment, a human eye recognition method is provided. The human eye recognition method can also be applied in the application environment as shown in FIG. 1, where a computer device communicates with a server through a network. The client communicates with the server through the network, and the server receives the face picture to be identified sent by the client for human eye recognition. Among them, the client can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers.
在一个实施例中,如图8所示,以该方法应用于图1中的服务端为例进行说明,包括如下步骤:In one embodiment, as shown in FIG. 8, the method is applied to the server in FIG. 1 as an example for description, and includes the following steps:
S70:获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像。S70: Obtain a face picture to be identified, and use a facial feature point detection algorithm to obtain a positive eye area image.
其中,待识别人脸图片是指需要进行人眼识别的人脸图片。具体地,获取人脸图像可通过预先采集人脸图片,或者直接从人脸库中获取人脸图片,例如AR人脸库。The face picture to be identified refers to a face picture that needs to be recognized by human eyes. Specifically, the face image can be obtained by collecting a face picture in advance, or directly obtaining a face picture from a face database, such as an AR face database.
本实施例中,待识别人脸图片包括无遮挡眼睛图片和有遮挡眼睛图片,并采用人脸特征点检测算法获取正向的眼睛区域图像。该采用人脸特征点检测算法获取正向的眼睛区域图像的实现过程和步骤S11至步骤S13的方法相同,在此不再赘述。In this embodiment, the face pictures to be identified include unoccluded eye pictures and occluded eye pictures, and a facial feature point detection algorithm is used to obtain a positive eye area image. The implementation process of using the facial feature point detection algorithm to obtain a positive eye area image is the same as the method in steps S11 to S13, and details are not described herein again.
S80:对正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像。S80: Perform normalization processing on the forward eye area image to obtain an eye image to be identified.
其中,待识别眼睛图像是指实现了归一化处理后的正向的眼睛区域图像,通过对正向的眼睛区域图像进行归一化处理,可以提高识别效率。具体地,归一化处理得到的待识别眼睛图像因为变换到统一的标准形式,从而避免了支持向量机分类器中的大数值区间的属性过分支配了小数值区间的属性,而且还能避免计算过程中数值复杂度。可选地,对正向的眼睛区域图像进行归一化处理的实现过程和步骤S14相同,在此不再赘述。The to-be-recognized eye image refers to a forward-looking eye area image after the normalization process is performed. By normalizing the forward-looking eye area image, the recognition efficiency can be improved. Specifically, the normalized to-be-recognized eye image is transformed to a unified standard form, thereby avoiding the attribute of the large-value interval in the support vector machine classifier from being over-branched with the attribute of the small-value interval, and also avoiding calculation Numerical complexity in the process. Optionally, the implementation process of normalizing the forward eye area image is the same as step S14, and details are not described herein again.
S90:将待识别眼睛图像输入到如步骤S10至步骤S60中的人眼模型训练方法训练得到的人眼判断模型进行识别,获取识别结果。S90: Input the eye image to be identified into a human eye judgment model trained by the human eye model training method in steps S10 to S60 to perform recognition, and obtain a recognition result.
其中,识别结果是指对待识别眼睛图像采用人眼判断模型进行识别所得到的结果,包括两种情形:待识别眼睛图像是无遮挡的眼睛图像和待识别眼睛图像是有遮挡的眼睛图像。具体地,将待识别眼睛图像输入到人眼判断模型进行识别,以获取识别结果。The recognition result refers to a result obtained by using a human eye judgment model for recognition of an eye image to be identified, including two cases: the eye image to be identified is an unobstructed eye image and the eye image to be identified is an obstructed eye image. Specifically, an eye image to be recognized is input to a human eye judgment model for recognition, so as to obtain a recognition result.
本实施例中,先获取待识别人脸图片,对正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像,以便对归一化处理的待识别人脸图片输入到人眼判断模型进行识别,获取识别结果,快速识别出该人脸图片眼睛有无遮挡,提高识别效率,从而避免影响后续的图像处理过程。In this embodiment, first obtain a face picture to be identified, and perform normalization processing on the forward eye area image to obtain the to-be-recognized eye image, so as to input the normalized face image to be identified into the human eye judgment model. Perform recognition, obtain recognition results, quickly recognize whether the eyes of the face picture are occluded, and improve the recognition efficiency, thereby avoiding affecting the subsequent image processing process.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其 功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
图9示出与实施例中人眼识别方法一一对应的人眼识别装置的原理框图。如图9所示,该人眼识别装置包括待识别眼睛图像获取模块70、待识别眼睛图像获取模块80和识别结果获取模块90。其中,待识别眼睛图像获取模块70、待识别眼睛图像获取模块80和识别结果获取模块90的实现功能与实施例中人眼识别方法对应的步骤一一对应,各功能模块详细说明如下:FIG. 9 shows a principle block diagram of a human eye recognition device that corresponds to the human eye recognition method in a one-to-one manner in the embodiment. As shown in FIG. 9, the human eye recognition device includes a to-be-recognized eye image acquisition module 70, an to-be-recognized eye image acquisition module 80, and a recognition result acquisition module 90. The functions of the eye image acquisition module 70, the eye image acquisition module 80, and the recognition result acquisition module 90 to be identified correspond to the steps corresponding to the human eye recognition method in the embodiment, and each functional module is described in detail as follows:
待识别人脸图片获取模块70,用于获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像;A face picture to be identified module 70 is configured to obtain a face picture to be identified, and a facial feature point detection algorithm is used to obtain a positive eye area image;
待识别眼睛图像获取模块80,用于对正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像;The eye image to be identified module 80 is configured to perform normalization processing on the forward eye area image to obtain the eye image to be identified;
识别结果获取模块90,用于将待识别眼睛图像输入到人眼模型训练方法训练得到的人眼判断模型进行识别,获取识别结果。The recognition result acquisition module 90 is configured to input an eye image to be recognized into a human eye judgment model trained by a human eye model training method to recognize and obtain a recognition result.
关于人眼模型训练装置的具体限定可以参见上文中对于人眼识别方法的限定,在此不再赘述。上述人眼识别装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitation of the human eye model training device, refer to the limitation on the human eye recognition method described above, and details are not described herein again. Each module in the above-mentioned human eye recognition device may be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules may be embedded in the hardware in or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图10所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储人眼模型训练方法中的人脸图像样本数据的特征向量和人眼模型训练数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种人眼模型训练方法。或者,该计算机可读指令被处理器执行时实现实施例中人眼识别装置中各模块/单元的功能In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. 10. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer-readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in a non-volatile storage medium. The database of the computer equipment is used to store the feature vector of the human face image sample data and the human eye model training data in the human eye model training method. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer-readable instructions are executed by a processor to implement a human eye model training method. Alternatively, when the computer-readable instructions are executed by a processor, the functions of each module / unit in the human eye recognition device in the embodiment are realized.
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,处理器执行计算机可读指令时实现上述实施例人眼模型训练方法的步骤,例如图2所示的步骤S10至步骤S60。或者处理器执行计算机可读指令时实现上述实施例人眼识别方法的步骤,例如图7所示的步骤S70至步骤S90。或者,处理器执行计算机可读指令时实现上述实施例人眼模型训练装置的各模块/单元的功能,例如图7所示的模块10至模块60。或者,处理器执行计算机可读指令时实现上述实施例人眼识别装置的各模块/单元的功能,例如图9所示的模块70至模块90。为避免重复,这里不再赘述。In one embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor. When the processor executes the computer-readable instructions, the human eyes of the foregoing embodiments are implemented. The steps of the model training method are, for example, steps S10 to S60 shown in FIG. 2. Alternatively, when the processor executes the computer-readable instructions, the steps of the human eye recognition method of the foregoing embodiment are implemented, for example, steps S70 to S90 shown in FIG. 7. Alternatively, when the processor executes the computer-readable instructions, the functions of the modules / units of the human eye model training device of the foregoing embodiment are implemented, for example, modules 10 to 60 shown in FIG. 7. Alternatively, when the processor executes the computer-readable instructions, the functions of the modules / units of the human eye recognition device in the foregoing embodiment are implemented, for example, modules 70 to 90 shown in FIG. 9. To avoid repetition, we will not repeat them here.
一个或多个存储有计算机可读指令的非易失性可读存储介质,该计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述实施例人眼模型训练方法的步骤,或者计算机可读指令被一个或多个处理器执行时实现上述实施例人眼识别方法的步骤,或者,计算机可读指令被一个或多个处理器执行时实现上述实施例人眼模型训练装置的各模块/单元的功能,或者,计算机可读指令被一个或多个处理器执行时实现上述实施例人眼识别装置的各模块/单元的功能,为避免重复,这里不再赘述。One or more non-volatile readable storage media storing computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors cause the human eye model training of the foregoing embodiment to be performed The steps of the method, or the steps of the human eye recognition method of the foregoing embodiment are implemented when the computer readable instructions are executed by one or more processors, or the human eyes of the above embodiments are implemented when the computer readable instructions are executed by one or more processors. The functions of the modules / units of the model training device, or the functions of the modules / units of the human eye recognition device of the above embodiment when computer-readable instructions are executed by one or more processors, to avoid repetition, details are not repeated here. .
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。A person of ordinary skill in the art can understand that all or part of the processes in the methods of the foregoing embodiments can be implemented by using computer-readable instructions to instruct related hardware. The computer-readable instructions can be stored in a non-volatile computer. In the readable storage medium, the computer-readable instructions, when executed, may include the processes of the embodiments of the methods described above.
上述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above embodiments are only used to illustrate the technical solutions of the present application, and are not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still apply the foregoing embodiments. The recorded technical solutions are modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of this application, and shall be included in this application. Within the scope of protection.

Claims (20)

  1. 一种人眼模型训练方法,其特征在于,包括:A human eye model training method, comprising:
    获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
    将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
    采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
    计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
    获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
    根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
  2. 如权利要求1所述的人眼模型训练方法,其特征在于,所述提取所述人脸图像样本数据中的人脸图像样本的特征向量,具体包括:The human eye model training method according to claim 1, wherein the extracting a feature vector of a face image sample in the face image sample data specifically comprises:
    采用人脸特征点检测算法获取人脸特征点,所述人脸特征点包括:左眼角点、右眼角点和眉心点;其中,所述左眼角点、所述右眼角点和所述眉心点是属于同一眼睛区域的特征点;A facial feature point detection algorithm is used to obtain a facial feature point, the facial feature points include: a left eye corner point, a right eye corner point, and an eyebrow point; wherein the left eye corner point, the right eye corner point, and the eyebrow point Are characteristic points belonging to the same eye area;
    根据所述左眼角点和所述右眼角点对所述人脸图像样本进行正向调整;Perform forward adjustment on the face image sample according to the left eye corner point and the right eye corner point;
    根据所述左眼角点、所述右眼角点和所述眉心点构建眼睛矩形区域;Constructing a rectangular area of the eye according to the left eye corner point, the right eye corner point, and the eyebrow center point;
    对所述眼睛矩形区域进行图像归一化处理,得到归一化眼睛矩形区域;Performing image normalization processing on the eye rectangular area to obtain a normalized eye rectangular area;
    根据所述归一化眼睛矩形区域提取HOG特征向量。A HOG feature vector is extracted according to the normalized eye rectangular area.
  3. 如权利要求1所述的人眼模型训练方法,其特征在于,所述采用训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面,具体包括:The human eye model training method according to claim 1, wherein the training of a support vector machine classifier with training sample data to obtain a critical surface of the support vector machine classifier specifically includes:
    获取所述支持向量机分类器的核函数和所述支持向量机分类器的惩罚参数,采用以下公式求解拉格朗日乘子
    Figure PCTCN2018094341-appb-100001
    和决策阈值b:
    Obtain the kernel function of the support vector machine classifier and the penalty parameters of the support vector machine classifier, and use the following formula to solve the Lagrange multiplier
    Figure PCTCN2018094341-appb-100001
    And decision threshold b:
    Figure PCTCN2018094341-appb-100002
    Figure PCTCN2018094341-appb-100002
    式中,s.t.是数学公式中约束条件的缩写,min是指在约束条件下取代数式
    Figure PCTCN2018094341-appb-100003
    的最小值,K(x i,x j)为所述支持向量机分类器的核函数,C为所述支持向量机分类器的惩罚参数,C>0,α i与所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100004
    是共轭关系,x i为所述训练样本数据的特征向量,l为所述训练样本数据的特征向量的个数,y i为所述训练样本数据的标注;
    In the formula, st is the abbreviation of the constraint condition in the mathematical formula, and min means to replace the number formula under the constraint condition.
    Figure PCTCN2018094341-appb-100003
    K (x i , x j ) is a kernel function of the support vector machine classifier, C is a penalty parameter of the support vector machine classifier, C> 0, α i and the Lagrange Multiplier
    Figure PCTCN2018094341-appb-100004
    Is a conjugate relationship, x i is a feature vector of the training sample data, l is the number of feature vectors of the training sample data, and y i is a label of the training sample data;
    根据所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100005
    和所述决策阈值b,采用如下公式,得到所述支持向量机分类器的临界面g(x):
    According to the Lagrange multiplier
    Figure PCTCN2018094341-appb-100005
    And the decision threshold b, use the following formula to obtain the critical surface g (x) of the support vector machine classifier:
    Figure PCTCN2018094341-appb-100006
    Figure PCTCN2018094341-appb-100006
  4. 如权利要求2所述的人眼模型训练方法,其特征在于,所述根据所述归一化眼睛矩形区域提取HOG特征向量,具体包括:The human eye model training method according to claim 2, wherein the extracting a HOG feature vector based on the normalized rectangular area of the eye specifically comprises:
    将归一化眼睛矩形区域划分成细胞单元,并计算所述细胞单元的每个像素梯度的大小和方向;Divide the normalized eye rectangular area into cell units, and calculate the size and direction of each pixel gradient of the cell unit;
    统计所述细胞单元的每个像素梯度的大小和方向的梯度直方图;A gradient histogram of the magnitude and direction of each pixel gradient of the cell unit;
    串联所述梯度直方图,得到所述HOG特征向量。The gradient histograms are connected in series to obtain the HOG feature vector.
  5. 如权利要求1所述的人眼模型训练方法,其特征在于,所述获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值,具体包括:The human eye model training method according to claim 1, wherein the preset true class rate or the preset false positive class rate is obtained, and a classification threshold is obtained according to the vector distance and the label data corresponding to the verification sample data. , Including:
    根据所述向量距离和与验证样本数据对应的标注数据绘制ROC曲线;Draw a ROC curve according to the vector distance and labeled data corresponding to the verification sample data;
    根据所述预设真正类率或预设假正类率在所述ROC曲线的横轴上获取分类阈值。A classification threshold is obtained on the horizontal axis of the ROC curve according to the preset true class rate or the preset false positive class rate.
  6. 一种人眼识别方法,其特征在于,包括:A human eye recognition method, comprising:
    获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像;Obtain a face picture to be identified, and use a facial feature point detection algorithm to obtain a positive eye area image;
    对所述正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像;Performing normalization processing on the forward eye area image to obtain an eye image to be identified;
    将所述待识别眼睛图像输入到如权利要求1-5任一项所述人眼模型训练方法训练得到的人眼判断模型进行识别,获取识别结果。The eye image to be identified is input to a human eye judgment model trained by the human eye model training method according to any one of claims 1-5 to perform recognition, and obtain a recognition result.
  7. 一种人眼模型训练装置,其特征在于,包括:A human eye model training device, comprising:
    人脸图像样本数据获取模块,用于获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;A facial image sample data acquisition module is configured to acquire a facial image sample, and mark the facial image sample to obtain facial image sample data, and extract a facial image sample from the facial image sample data. Feature vectors, where the face image sample data includes face image samples and annotation data;
    人脸图像样本数据划分模块,用于将所述人脸图像样本数据划分为训练样本数据和验证样本数据;A face image sample data division module, configured to divide the face image sample data into training sample data and verification sample data;
    临界面获取模块,用于采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;A critical surface acquisition module, configured to train a support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
    向量距离计算模块,用于计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;A vector distance calculation module, configured to calculate a vector distance between a feature vector of a verification sample and the critical surface in the verification sample data;
    分类阈值获取模块,用于获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;A classification threshold obtaining module, configured to obtain a preset true classification rate or a preset false positive classification rate, and obtain a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
    人眼判断模型获取模块,用于根据所述分类阈值,获取人眼判断模型。The human eye judgment model acquisition module is configured to acquire a human eye judgment model according to the classification threshold.
  8. 如权利要求7所述的人眼模型训练装置,其特征在于,所述人脸图像样本数据获取模块,具体包括:The human eye model training device according to claim 7, wherein the face image sample data acquisition module specifically comprises:
    人脸特征点获取单元,用于采用人脸特征点检测算法获取人脸特征点,所述人脸特征点包括:左眼角点、右眼角点和眉心点;其中,所述左眼角点、所述右眼角点和所述眉心点是属于同一眼睛区域的特征点;A facial feature point acquisition unit is configured to obtain a facial feature point by using a facial feature point detection algorithm, and the facial feature point includes a left eye corner point, a right eye corner point, and an eyebrow center point, wherein the left eye corner point, the The right eye corner point and the eyebrow center point are characteristic points belonging to the same eye area;
    正向调整单元,用于根据所述左眼角点和所述右眼角点对所述人脸图像样本进行正向调整;A forward adjustment unit, configured to perform forward adjustment on the face image sample according to the left eye corner point and the right eye corner point;
    眼睛矩形区域构建单元,用于根据所述左眼角点、所述右眼角点和所述眉心点构建眼睛矩形区域;An eye rectangular region constructing unit, configured to construct an eye rectangular region according to the left eye corner point, the right eye corner point, and the eyebrow center point;
    特征向量提取单元,用于眼睛矩形区域获取单元,同于对所述眼睛矩形区域进行图像归一化处理,得到归一化眼睛矩形区域;A feature vector extraction unit for obtaining a rectangular area of eyes, which is the same as performing image normalization processing on the rectangular area of eyes to obtain a normalized rectangular area of eyes;
    根据所述归一化眼睛矩形区域提取HOG特征向量。A HOG feature vector is extracted according to the normalized eye rectangular area.
  9. 如权利要求7所述的人眼模型训练装置,其特征在于,所述临界面获取模块,具体包括:The human eye model training device according to claim 7, wherein the critical surface acquisition module specifically comprises:
    参数获取单元,用于获取所述支持向量机分类器的核函数和所述支持向量机分类器的惩罚参数,采用以下公式求解拉格朗日乘子
    Figure PCTCN2018094341-appb-100007
    和决策阈值b:
    A parameter obtaining unit, configured to obtain a kernel function of the support vector machine classifier and a penalty parameter of the support vector machine classifier, and solve the Lagrange multiplier by using the following formula
    Figure PCTCN2018094341-appb-100007
    And decision threshold b:
    Figure PCTCN2018094341-appb-100008
    Figure PCTCN2018094341-appb-100008
    式中,s.t.是数学公式中约束条件的缩写,min是指在约束条件下取代数式
    Figure PCTCN2018094341-appb-100009
    的最小值,K(x i,x j)为所述支持向量机分类器的核函数,C为所述支持向量机分类器的惩罚参数,C>0,α i与所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100010
    是共轭关系,x i为所述训练样本数据的特征向量,l为所述训练样本数据的特征向量的个数,y i为所述训练样本数据的标注;
    In the formula, st is the abbreviation of the constraint condition in the mathematical formula, and min means to replace the number formula under the constraint condition.
    Figure PCTCN2018094341-appb-100009
    K (x i , x j ) is a kernel function of the support vector machine classifier, C is a penalty parameter of the support vector machine classifier, C> 0, α i and the Lagrange Multiplier
    Figure PCTCN2018094341-appb-100010
    Is a conjugate relationship, x i is a feature vector of the training sample data, l is the number of feature vectors of the training sample data, and y i is a label of the training sample data;
    临界面获取单元,用于根据所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100011
    和所述决策阈值b,采用如下公式,得到所述支持向量机分类器的临界面g(x):
    A critical surface acquisition unit, according to the Lagrangian multiplier
    Figure PCTCN2018094341-appb-100011
    And the decision threshold b, use the following formula to obtain the critical surface g (x) of the support vector machine classifier:
    Figure PCTCN2018094341-appb-100012
    Figure PCTCN2018094341-appb-100012
  10. 一种人眼识别装置,其特征在于,包括:A human eye recognition device, comprising:
    待识别人脸图片获取模块,用于获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像;A face picture acquisition module to be recognized is used to obtain a face picture to be identified, and a facial feature point detection algorithm is used to obtain a positive eye area image;
    待识别眼睛图像获取模块,用于对所述正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像;A to-be-recognized eye image acquisition module, configured to perform normalization processing on the forward eye area image to obtain the to-be-recognized eye image;
    将所述待识别眼睛图像输入到人眼判断模型进行识别,获取识别结果,其中,所述人眼判断模型采用如下训练方法得到:The eye image to be identified is input to a human eye judgment model for recognition, and a recognition result is obtained, wherein the human eye judgment model is obtained by using the following training method:
    获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
    将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
    采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
    计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
    获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
    根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
  11. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and is characterized in that the processor implements the computer-readable instructions as follows step:
    获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
    将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
    采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
    计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
    获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
    根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
  12. 如权利要求11所述的计算机设备,其特征在于,所述提取所述人脸图像样本数据中的人脸图像样本的特征向量,具体包括:The computer device according to claim 11, wherein the extracting a feature vector of a face image sample in the face image sample data specifically comprises:
    采用人脸特征点检测算法获取人脸特征点,所述人脸特征点包括:左眼角点、右眼角点和眉心点;其中,所述左眼角点、所述右眼角点和所述眉心点是属于同一眼睛区域的特征点;A facial feature point detection algorithm is used to obtain a facial feature point, the facial feature points include: a left eye corner point, a right eye corner point, and an eyebrow point; wherein the left eye corner point, the right eye corner point, and the eyebrow point Are characteristic points belonging to the same eye area;
    根据所述左眼角点和所述右眼角点对所述人脸图像样本进行正向调整;Perform forward adjustment on the face image sample according to the left eye corner point and the right eye corner point;
    根据所述左眼角点、所述右眼角点和所述眉心点构建眼睛矩形区域;Constructing a rectangular area of the eye according to the left eye corner point, the right eye corner point, and the eyebrow center point;
    对所述眼睛矩形区域进行图像归一化处理,得到归一化眼睛矩形区域;Performing image normalization processing on the eye rectangular area to obtain a normalized eye rectangular area;
    根据所述归一化眼睛矩形区域提取HOG特征向量。A HOG feature vector is extracted according to the normalized eye rectangular area.
  13. 如权利要求11所述的计算机设备,其特征在于,所述采用训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面,具体包括:The computer device according to claim 11, wherein the training of a support vector machine classifier with training sample data to obtain a critical surface of the support vector machine classifier specifically comprises:
    获取所述支持向量机分类器的核函数和所述支持向量机分类器的惩罚参数,采用以下公式求解拉格朗日乘子
    Figure PCTCN2018094341-appb-100013
    和决策阈值b:
    Obtain the kernel function of the support vector machine classifier and the penalty parameters of the support vector machine classifier, and use the following formula to solve the Lagrange multiplier
    Figure PCTCN2018094341-appb-100013
    And decision threshold b:
    Figure PCTCN2018094341-appb-100014
    Figure PCTCN2018094341-appb-100014
    式中,s.t.是数学公式中约束条件的缩写,min是指在约束条件下取代数式
    Figure PCTCN2018094341-appb-100015
    的最小值,K(x i,x j)为所述支持向量机分类器的核函数,C为所述支持向量机分类器的惩罚参数,C>0,α i与所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100016
    是共轭关系,x i为所述训练样本数据的特征向量,l为所述训练样本数据的特征向量的个数,y i为所述训练样本数据的标注;
    In the formula, st is the abbreviation of the constraint condition in the mathematical formula, and min means to replace the number formula under the constraint condition.
    Figure PCTCN2018094341-appb-100015
    K (x i , x j ) is a kernel function of the support vector machine classifier, C is a penalty parameter of the support vector machine classifier, C> 0, α i and the Lagrange Multiplier
    Figure PCTCN2018094341-appb-100016
    Is a conjugate relationship, x i is a feature vector of the training sample data, l is the number of feature vectors of the training sample data, and y i is a label of the training sample data;
    根据所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100017
    和所述决策阈值b,采用如下公式,得到所述支持向量机分类器的临界面g(x):
    According to the Lagrange multiplier
    Figure PCTCN2018094341-appb-100017
    And the decision threshold b, use the following formula to obtain the critical surface g (x) of the support vector machine classifier:
    Figure PCTCN2018094341-appb-100018
    Figure PCTCN2018094341-appb-100018
  14. 如权利要求12述的计算机设备,其特征在于,所述根据所述归一化眼睛矩形区域提取HOG特征向量,具体包括:The computer device according to claim 12, wherein the extracting the HOG feature vector based on the normalized rectangular area of the eye specifically comprises:
    将归一化眼睛矩形区域划分成细胞单元,并计算所述细胞单元的每个像素梯度的大小和方向;Divide the normalized eye rectangular area into cell units, and calculate the size and direction of each pixel gradient of the cell unit;
    统计所述细胞单元的每个像素梯度的大小和方向的梯度直方图;A gradient histogram of the magnitude and direction of each pixel gradient of the cell unit;
    串联所述梯度直方图,得到所述HOG特征向量。The gradient histograms are connected in series to obtain the HOG feature vector.
  15. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像;A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and is characterized in that the processor implements the computer-readable instructions as follows Step: Obtain a face picture to be identified, and use a facial feature point detection algorithm to obtain a positive eye area image;
    对所述正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像;Performing normalization processing on the forward eye area image to obtain an eye image to be identified;
    将所述待识别眼睛图像输入到人眼判断模型进行识别,获取识别结果,其中,所述人眼判断模型采用如下训练方法得到:The eye image to be identified is input to a human eye judgment model for recognition, and a recognition result is obtained, wherein the human eye judgment model is obtained by using the following training method:
    获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
    将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
    采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
    计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
    获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
    根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
  16. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:One or more non-volatile readable storage media storing computer readable instructions, characterized in that when the computer readable instructions are executed by one or more processors, the one or more processors are caused to execute The following steps:
    获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
    将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
    采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
    计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
    获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
    根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
  17. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述提取所述人脸图像样本数据中的人脸图像样本的特征向量,具体包括:The non-volatile readable storage medium according to claim 16, wherein the extracting a feature vector of a face image sample in the face image sample data specifically comprises:
    采用人脸特征点检测算法获取人脸特征点,所述人脸特征点包括:左眼角点、右眼角点和眉心点;其中,所述左眼角点、所述右眼角点和所述眉心点是属于同一眼睛区域的特征点;A facial feature point detection algorithm is used to obtain a facial feature point, the facial feature points include: a left eye corner point, a right eye corner point, and an eyebrow point; wherein the left eye corner point, the right eye corner point, and the eyebrow point Are characteristic points belonging to the same eye area;
    根据所述左眼角点和所述右眼角点对所述人脸图像样本进行正向调整;Perform forward adjustment on the face image sample according to the left eye corner point and the right eye corner point;
    根据所述左眼角点、所述右眼角点和所述眉心点构建眼睛矩形区域;Constructing a rectangular area of the eye according to the left eye corner point, the right eye corner point, and the eyebrow center point;
    对所述眼睛矩形区域进行图像归一化处理,得到归一化眼睛矩形区域;Performing image normalization processing on the eye rectangular area to obtain a normalized eye rectangular area;
    根据所述归一化眼睛矩形区域提取HOG特征向量。A HOG feature vector is extracted according to the normalized eye rectangular area.
  18. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述采用训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面,具体包括:The non-volatile readable storage medium according to claim 16, wherein the training a support vector machine classifier using training sample data to obtain a critical surface of the support vector machine classifier specifically comprises:
    获取所述支持向量机分类器的核函数和所述支持向量机分类器的惩罚参数,采用以下公式求解拉格朗日乘子
    Figure PCTCN2018094341-appb-100019
    和决策阈值b:
    Obtain the kernel function of the support vector machine classifier and the penalty parameters of the support vector machine classifier, and use the following formula to solve the Lagrangian multiplier
    Figure PCTCN2018094341-appb-100019
    And decision threshold b:
    Figure PCTCN2018094341-appb-100020
    Figure PCTCN2018094341-appb-100020
    式中,s.t.是数学公式中约束条件的缩写,min是指在约束条件下取代数式
    Figure PCTCN2018094341-appb-100021
    的最小值,K(x i,x j)为所述支持向量机分类器的核函数,C为所述支持向量机分类器的惩罚参数,C>0,α i与所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100022
    是共轭关系,x i为所述训练样本数据的特征向量,l为所述训练样本数据的特征向量的个数,y i为所述训练样本数据的标注;
    In the formula, st is the abbreviation of the constraint condition in the mathematical formula, and min means to replace the number formula under the constraint condition.
    Figure PCTCN2018094341-appb-100021
    K (x i , x j ) is a kernel function of the support vector machine classifier, C is a penalty parameter of the support vector machine classifier, C> 0, α i and the Lagrange Multiplier
    Figure PCTCN2018094341-appb-100022
    Is a conjugate relationship, x i is a feature vector of the training sample data, l is the number of feature vectors of the training sample data, and y i is a label of the training sample data;
    根据所述拉格朗日乘子
    Figure PCTCN2018094341-appb-100023
    和所述决策阈值b,采用如下公式,得到所述支持向量机分类器的临界面g(x):
    According to the Lagrange multiplier
    Figure PCTCN2018094341-appb-100023
    And the decision threshold b, use the following formula to obtain the critical surface g (x) of the support vector machine classifier:
    Figure PCTCN2018094341-appb-100024
    Figure PCTCN2018094341-appb-100024
  19. 如权利要求16所述的非易失性可读存储介质,其特征在于,,所述获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值,具体包括:The non-volatile readable storage medium according to claim 16, wherein the obtaining a preset true class rate or a preset false positive class rate is based on the vector distance and a label corresponding to the verification sample data Data acquisition classification threshold, including:
    根据所述向量距离和与验证样本数据对应的标注数据绘制ROC曲线;Draw a ROC curve according to the vector distance and labeled data corresponding to the verification sample data;
    根据所述预设真正类率或预设假正类率在所述ROC曲线的横轴上获取分类阈值。A classification threshold is obtained on the horizontal axis of the ROC curve according to the preset true class rate or the preset false positive class rate.
  20. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:One or more non-volatile readable storage media storing computer readable instructions, characterized in that when the computer readable instructions are executed by one or more processors, the one or more processors are caused to execute The following steps:
    获取待识别人脸图片,采用人脸特征点检测算法获取正向的眼睛区域图像;Obtain a face picture to be identified, and use a facial feature point detection algorithm to obtain a positive eye area image;
    对所述正向的眼睛区域图像进行归一化处理,得到待识别眼睛图像;Performing normalization processing on the forward eye area image to obtain an eye image to be identified;
    将所述待识别眼睛图像输入到人眼判断模型进行识别,获取识别结果,其中,所述人眼判断模型采用如下训练方法得到:The eye image to be identified is input to a human eye judgment model for recognition, and a recognition result is obtained, wherein the human eye judgment model is obtained by using the following training method:
    获取人脸图像样本,并对所述人脸图像样本进行标记以得到人脸图像样本数据,及提取所述人脸图像样本数据中的人脸图像样本的特征向量,其中,人脸图像样本数据包括人脸图像样本和标注数据;Obtaining a face image sample, and labeling the face image sample to obtain face image sample data, and extracting a feature vector of the face image sample from the face image sample data, wherein the face image sample data Including face image samples and annotation data;
    将所述人脸图像样本数据划分为训练样本数据和验证样本数据;Dividing the face image sample data into training sample data and verification sample data;
    采用所述训练样本数据训练支持向量机分类器,得到所述支持向量机分类器的临界面;Training the support vector machine classifier using the training sample data to obtain a critical surface of the support vector machine classifier;
    计算所述验证样本数据中的验证样本的特征向量与所述临界面的向量距离;Calculating a distance between a feature vector of a verification sample in the verification sample data and a vector of the critical surface;
    获取预设真正类率或预设假正类率,根据所述向量距离和与验证样本数据对应的标注数据获取分类阈值;Obtaining a preset true class rate or a preset false positive class rate, and obtaining a classification threshold according to the vector distance and the labeled data corresponding to the verification sample data;
    根据所述分类阈值,获取人眼判断模型。A human eye judgment model is obtained according to the classification threshold.
PCT/CN2018/094341 2018-06-08 2018-07-03 Human eye model training method, human eye recognition method, apparatus, device and medium WO2019232866A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810585092.2A CN108985159A (en) 2018-06-08 2018-06-08 Human-eye model training method, eye recognition method, apparatus, equipment and medium
CN201810585092.2 2018-06-08

Publications (1)

Publication Number Publication Date
WO2019232866A1 true WO2019232866A1 (en) 2019-12-12

Family

ID=64541049

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/094341 WO2019232866A1 (en) 2018-06-08 2018-07-03 Human eye model training method, human eye recognition method, apparatus, device and medium

Country Status (2)

Country Link
CN (1) CN108985159A (en)
WO (1) WO2019232866A1 (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110991641A (en) * 2019-12-17 2020-04-10 合肥鼎盛锦业科技有限公司 Oil reservoir type analysis method and device and electronic equipment
CN111126347A (en) * 2020-01-06 2020-05-08 腾讯科技(深圳)有限公司 Human eye state recognition method and device, terminal and readable storage medium
CN111259743A (en) * 2020-01-09 2020-06-09 中山大学中山眼科中心 Training method and system for myopia image deep learning recognition model
CN111444860A (en) * 2020-03-30 2020-07-24 东华大学 Expression recognition method and system
CN111583093A (en) * 2020-04-27 2020-08-25 西安交通大学 Hardware implementation method for ORB feature point extraction with good real-time performance
CN111582068A (en) * 2020-04-22 2020-08-25 北京交通大学 Method for detecting wearing state of personal mask
CN111611910A (en) * 2020-05-19 2020-09-01 黄河水利委员会黄河水利科学研究院 Image feature identification method for ice dam of yellow river
CN111783598A (en) * 2020-06-24 2020-10-16 北京百度网讯科技有限公司 Face recognition model training method, device, equipment and medium
CN111967436A (en) * 2020-09-02 2020-11-20 北京猿力未来科技有限公司 Image processing method and device
CN112052723A (en) * 2020-07-23 2020-12-08 深圳市玩瞳科技有限公司 Literacy card, and desktop scene STR method and device based on image recognition
CN112116525A (en) * 2020-09-24 2020-12-22 百度在线网络技术(北京)有限公司 Face-changing identification method, device, equipment and computer-readable storage medium
CN112733795A (en) * 2021-01-22 2021-04-30 腾讯科技(深圳)有限公司 Method, device and equipment for correcting sight of face image and storage medium
CN114005151A (en) * 2020-07-28 2022-02-01 北京君正集成电路股份有限公司 Method for collecting and labeling face angle samples
CN114609602A (en) * 2022-03-09 2022-06-10 电子科技大学 Feature extraction-based target detection method under sea clutter background
CN116311553A (en) * 2023-05-17 2023-06-23 武汉利楚商务服务有限公司 Human face living body detection method and device applied to semi-occlusion image
CN117275080A (en) * 2023-11-22 2023-12-22 深圳市美爱堂科技有限公司 Eye state identification method and system based on computer vision

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109858024B (en) * 2019-01-04 2023-04-11 中山大学 Word2 vec-based room source word vector training method and device
CN109919029A (en) * 2019-01-31 2019-06-21 深圳和而泰数据资源与云技术有限公司 Black eye kind identification method, device, computer equipment and storage medium
CN110222571B (en) * 2019-05-06 2023-04-07 平安科技(深圳)有限公司 Intelligent judgment method and device for black eye and computer readable storage medium
CN110211094B (en) * 2019-05-06 2023-05-26 平安科技(深圳)有限公司 Intelligent judging method and device for black eye and computer readable storage medium
CN110222724B (en) * 2019-05-15 2023-12-19 平安科技(深圳)有限公司 Picture instance detection method and device, computer equipment and storage medium
CN110276333B (en) * 2019-06-28 2021-10-15 上海鹰瞳医疗科技有限公司 Eye ground identity recognition model training method, eye ground identity recognition method and equipment
CN110414588A (en) * 2019-07-23 2019-11-05 广东小天才科技有限公司 Picture labeling method and device, computer equipment and storage medium
CN110569826B (en) * 2019-09-18 2022-05-24 深圳市捷顺科技实业股份有限公司 Face recognition method, device, equipment and medium
CN111401440B (en) * 2020-03-13 2023-03-31 重庆第二师范学院 Target classification recognition method and device, computer equipment and storage medium
CN111429409A (en) * 2020-03-13 2020-07-17 深圳市雄帝科技股份有限公司 Method and system for identifying glasses worn by person in image and storage medium thereof
CN111626371B (en) * 2020-05-29 2023-10-31 歌尔科技有限公司 Image classification method, device, equipment and readable storage medium
CN111881770B (en) * 2020-07-06 2024-05-31 上海序言泽网络科技有限公司 Face recognition method and system
CN111931617B (en) * 2020-07-29 2023-11-21 中国工商银行股份有限公司 Human eye image recognition method and device based on image processing and self-service terminal
CN112883774A (en) * 2020-12-31 2021-06-01 厦门易仕特仪器有限公司 Pedestrian re-identification data enhancement method, device and equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107292225A (en) * 2016-08-18 2017-10-24 北京师范大学珠海分校 A kind of face identification method
CN107590506A (en) * 2017-08-17 2018-01-16 北京航空航天大学 A kind of complex device method for diagnosing faults of feature based processing
CN107633204A (en) * 2017-08-17 2018-01-26 平安科技(深圳)有限公司 Face occlusion detection method, apparatus and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107292225A (en) * 2016-08-18 2017-10-24 北京师范大学珠海分校 A kind of face identification method
CN107590506A (en) * 2017-08-17 2018-01-16 北京航空航天大学 A kind of complex device method for diagnosing faults of feature based processing
CN107633204A (en) * 2017-08-17 2018-01-26 平安科技(深圳)有限公司 Face occlusion detection method, apparatus and storage medium

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110991641A (en) * 2019-12-17 2020-04-10 合肥鼎盛锦业科技有限公司 Oil reservoir type analysis method and device and electronic equipment
CN110991641B (en) * 2019-12-17 2024-03-05 合肥鼎盛锦业科技有限公司 Oil reservoir type analysis method and device and electronic equipment
CN111126347B (en) * 2020-01-06 2024-02-20 腾讯科技(深圳)有限公司 Human eye state identification method, device, terminal and readable storage medium
CN111126347A (en) * 2020-01-06 2020-05-08 腾讯科技(深圳)有限公司 Human eye state recognition method and device, terminal and readable storage medium
CN111259743A (en) * 2020-01-09 2020-06-09 中山大学中山眼科中心 Training method and system for myopia image deep learning recognition model
CN111259743B (en) * 2020-01-09 2023-11-24 中山大学中山眼科中心 Training method and system for myopia image deep learning recognition model
CN111444860A (en) * 2020-03-30 2020-07-24 东华大学 Expression recognition method and system
CN111582068A (en) * 2020-04-22 2020-08-25 北京交通大学 Method for detecting wearing state of personal mask
CN111582068B (en) * 2020-04-22 2023-07-07 北京交通大学 Method for detecting wearing state of mask for personnel
CN111583093A (en) * 2020-04-27 2020-08-25 西安交通大学 Hardware implementation method for ORB feature point extraction with good real-time performance
CN111611910A (en) * 2020-05-19 2020-09-01 黄河水利委员会黄河水利科学研究院 Image feature identification method for ice dam of yellow river
CN111611910B (en) * 2020-05-19 2023-04-28 黄河水利委员会黄河水利科学研究院 Yellow river ice dam image feature recognition method
CN111783598A (en) * 2020-06-24 2020-10-16 北京百度网讯科技有限公司 Face recognition model training method, device, equipment and medium
CN111783598B (en) * 2020-06-24 2023-08-08 北京百度网讯科技有限公司 Face recognition model training method, device, equipment and medium
CN112052723A (en) * 2020-07-23 2020-12-08 深圳市玩瞳科技有限公司 Literacy card, and desktop scene STR method and device based on image recognition
CN114005151A (en) * 2020-07-28 2022-02-01 北京君正集成电路股份有限公司 Method for collecting and labeling face angle samples
CN114005151B (en) * 2020-07-28 2024-05-03 北京君正集成电路股份有限公司 Face angle sample collection and labeling method
CN111967436A (en) * 2020-09-02 2020-11-20 北京猿力未来科技有限公司 Image processing method and device
CN111967436B (en) * 2020-09-02 2024-03-19 北京猿力未来科技有限公司 Image processing method and device
CN112116525B (en) * 2020-09-24 2023-08-04 百度在线网络技术(北京)有限公司 Face recognition method, device, equipment and computer readable storage medium
CN112116525A (en) * 2020-09-24 2020-12-22 百度在线网络技术(北京)有限公司 Face-changing identification method, device, equipment and computer-readable storage medium
CN112733795B (en) * 2021-01-22 2022-10-11 腾讯科技(深圳)有限公司 Method, device and equipment for correcting sight of face image and storage medium
CN112733795A (en) * 2021-01-22 2021-04-30 腾讯科技(深圳)有限公司 Method, device and equipment for correcting sight of face image and storage medium
CN114609602A (en) * 2022-03-09 2022-06-10 电子科技大学 Feature extraction-based target detection method under sea clutter background
CN116311553A (en) * 2023-05-17 2023-06-23 武汉利楚商务服务有限公司 Human face living body detection method and device applied to semi-occlusion image
CN116311553B (en) * 2023-05-17 2023-08-15 武汉利楚商务服务有限公司 Human face living body detection method and device applied to semi-occlusion image
CN117275080A (en) * 2023-11-22 2023-12-22 深圳市美爱堂科技有限公司 Eye state identification method and system based on computer vision

Also Published As

Publication number Publication date
CN108985159A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
WO2019232866A1 (en) Human eye model training method, human eye recognition method, apparatus, device and medium
WO2019232862A1 (en) Mouth model training method and apparatus, mouth recognition method and apparatus, device, and medium
US11256905B2 (en) Face detection method and apparatus, service processing method, terminal device, and storage medium
US10956719B2 (en) Depth image based face anti-spoofing
US11182592B2 (en) Target object recognition method and apparatus, storage medium, and electronic device
WO2020024400A1 (en) Class monitoring method and apparatus, computer device, and storage medium
WO2020119450A1 (en) Risk identification method employing facial image, device, computer apparatus, and storage medium
US8818034B2 (en) Face recognition apparatus and methods
US7912253B2 (en) Object recognition method and apparatus therefor
WO2022027912A1 (en) Face pose recognition method and apparatus, terminal device, and storage medium.
Sun et al. Face detection based on color and local symmetry information
CN106778450B (en) Face recognition method and device
WO2015149534A1 (en) Gabor binary pattern-based face recognition method and device
CN108629336B (en) Face characteristic point identification-based color value calculation method
US11361587B2 (en) Age recognition method, storage medium and electronic device
WO2020187160A1 (en) Cascaded deep convolutional neural network-based face recognition method and system
KR102530516B1 (en) Automatic Sign Language Recognition Method and System
CN112784712B (en) Missing child early warning implementation method and device based on real-time monitoring
Kawulok Energy-based blob analysis for improving precision of skin segmentation
Lahiani et al. Hand pose estimation system based on Viola-Jones algorithm for android devices
Mayer et al. Adjusted pixel features for robust facial component classification
CN110175500B (en) Finger vein comparison method, device, computer equipment and storage medium
Sithara et al. A survey on face recognition technique
Nguyen et al. Reliable detection of eye features and eyes in color facial images using ternary eye-verifier
US11074676B2 (en) Correction of misaligned eyes in images

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18921647

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 11/03/2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18921647

Country of ref document: EP

Kind code of ref document: A1