Driver's face posture prediction method and device
By identifying key points and alignment processing in the face image, the roll angle and pitch angle of the face are calculated, which solves the problems of high computational complexity and image quality impact in the existing technology, and achieves efficient and accurate face pose prediction.
Patent Information
- Application Number
- CN202410438255.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-12
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-04-12
AI Technical Summary
Existing face pose prediction methods have high computational complexity and are greatly affected by image quality and occlusion, making it difficult to achieve efficient and accurate prediction in practical applications.
By obtaining the face image to be measured, identifying key points, using a pre-configured set of reference key points for alignment processing, calculating the projection coefficients of the roll angle, yaw angle and pitch angle, and predicting the face posture based on these parameters, reducing calculation dimensions and improve accuracy.
It simplifies the calculation process, improves the accuracy and reliability of face pose prediction, reduces the impact of image blur and occlusion, and is suitable for a wide range of application scenarios.
Smart Images

Figure CN118038560B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of face posture estimation, and in particular to a method and device for predicting the face posture of a driver. Background Art
[0002] With the continuous development of artificial intelligence technology, face pose estimation has become one of the key technologies in the field of intelligent driving, aiming to monitor the driver's status to assist driving or monitor dangerous driving behaviors to ensure traffic safety.
[0003] The current face pose prediction methods are mainly based on regressing the input face image based on the trained neural network to estimate the face pose in the image, or projecting the face image into each principal component analysis pose space and selecting the face pose in the face image from the poses in each principal component analysis pose space. However, in the actual application process, both the feature extraction and matching of the neural network and the principal component analysis pose space require high-dimensional calculations, which have high computational complexity and affect the efficiency of face pose recognition. In addition, the quality of the face image itself, such as whether the face is blurred, whether the face is blocked, or the brightness of the face, will affect the final prediction of the face pose. Summary of the invention
[0004] In view of this, the present invention provides a method and device for predicting a driver's facial posture, so as to solve the problem of how to efficiently and accurately predict a driver's facial posture during driving.
[0005] In a first aspect, the present invention provides a method for predicting a driver's facial posture, comprising: obtaining a facial image to be tested; identifying multiple key points in the facial image to be tested to obtain a key point set; aligning the facial image to be tested using a pre-configured reference key point set and a key point set to obtain a processed standard key point set; determining a roll angle corresponding to the facial image to be tested based on the relationship between the reference key point set and the corresponding key points in the key point set; calculating a yaw angle projection coefficient and a pitch angle projection coefficient of the facial image to be tested using features of the key points in the standard key point set; calculating the yaw angle of the face in the facial image to be tested based on the yaw angle projection coefficient and a first mapping relationship between the yaw angle projection coefficient and the facial posture angle, and calculating the pitch angle of the face in the facial image to be tested based on the pitch angle projection coefficient and a second mapping relationship between the pitch angle projection coefficient and the facial posture angle; and determining the roll angle, yaw angle and pitch angle as a facial posture prediction result for the facial image to be tested.
[0006] The method for predicting the facial posture of a driver provided by an embodiment of the present invention analyzes the facial image to be tested and identifies multiple key points therein after obtaining the facial image to be tested, and these key points can reflect different features and positions of the face. A pre-configured reference key point set and a key point set of the face to be tested are used for alignment processing to obtain a standard key point set to eliminate the deviation caused by the facial posture, so that subsequent calculations are more accurate. By comparing the relationship between the reference key point set and the key point set of the face image to be tested, the roll angle of the face image to be tested, that is, the rotation angle of the face on the horizontal plane, is determined. The projection coefficients of the yaw angle and the pitch angle of the face image to be tested are calculated using the features of the key points in the standard key point set. According to the projection coefficients of the yaw angle and the pitch angle and the mapping relationship between the angles of the facial posture, the yaw angle and the pitch angle of the face in the face image to be tested are calculated. Finally, the calculated roll angle, yaw angle and pitch angle are used as the facial posture prediction results of the face image to be tested, which greatly reduces the calculation dimension and avoids the interference of image blur, lighting changes and partial occlusion on the image pixel information. Under the premise of accurate feature point detection, the accuracy and reliability of facial posture estimation are improved. It is simple, efficient and has a wider range of applications.
[0007] In an optional embodiment, before obtaining the face image to be tested, the method also includes: obtaining a face posture sample data set, wherein the face posture sample data set includes multiple face sample images annotated with face key points and face postures, the face key points correspond to different parts of the face, and the different parts are described by different numbers of face key points; extracting a sample key point annotation set and a sample posture angle annotation set of multiple face sample images from the face posture sample data set; the sample key point annotation set is used to characterize the coordinate set of multiple face key points of the multiple face sample images, and the sample posture angle annotation set is used to characterize the sample pitch angle and A sample yaw angle set; for a specific key point in the face key points, taking the first coordinate average of multiple sample coordinates corresponding to the specific key point included in the sample key point annotation set, and determining the first coordinate average as the reference key point coordinate of the specific key point; wherein the specific key point is any point in the face key points; taking the angle average of multiple face posture angles corresponding to multiple face sample images included in the sample posture angle annotation set, and determining the angle average as the reference posture angle of the face posture sample data set; wherein the reference posture angle includes a yaw angle reference posture angle and a pitch angle reference posture angle; determining multiple reference key point coordinates and reference posture angles as a reference key point set.
[0008] The method for predicting the facial posture of a driver provided by an embodiment of the present invention collects a plurality of facial sample images containing annotated facial key points and facial postures before obtaining a facial image to be tested. A sample key point annotation set and a sample posture angle annotation set of a plurality of facial sample images are extracted from a facial posture sample data set. For a specific key point in the facial key points, an average value of a plurality of sample coordinates corresponding to the specific key point is taken from the sample key point annotation set, and the average value is determined as the reference key point coordinate of the specific key point. An average value of the posture angles of a plurality of facial sample images is taken from the sample posture angle annotation set, and the average value is determined as the reference posture angle of the facial posture sample data set, including the yaw angle and the pitch angle. A plurality of reference key point coordinates and reference posture angles are determined as a reference key point set for subsequent facial posture prediction, so that by establishing a reference key point set and a reference posture angle, the accurate prediction of the posture of the facial image to be tested can be improved, and the error caused by sample differences can be reduced. By processing the sample data set and extracting key information, the influence of noise in the data on the prediction result can be effectively reduced, and the stability of the algorithm can be improved. After determining the reference key point set and posture angle, the complexity of subsequent calculations can be simplified and the efficiency and practicality of the algorithm can be improved.
[0009] In an optional embodiment, a preconfigured reference key point set and a key point set are used to align the face image to obtain a processed standard key point set, including: taking a second coordinate average value for multiple reference key point coordinates in the reference key point set, and determining the second coordinate average value as the reference center of mass of the reference face image corresponding to the reference key point set; identifying multiple actual coordinate positions corresponding to multiple key points in the key point set; taking a third coordinate average value for the multiple actual coordinate positions, and determining the third coordinate average value as the actual center of mass of the face image to be tested; and using the position information of the reference center of mass and the actual center of mass to align the face image to obtain a processed standard key point set.
[0010] The method for predicting the facial posture of a driver provided by the embodiment of the present invention averages the second coordinates of the coordinates of multiple reference key points in the reference key point set to obtain the reference centroid of the reference facial image corresponding to the reference key point set. Identify multiple key points in the key point set of the face image to be tested, determine their coordinate positions in the actual image, and average the third coordinates of the multiple actual coordinate positions to obtain the actual centroid of the face image to be tested. Align the face image to be tested using the position information of the reference centroid and the actual centroid. By adjusting the position of the face image to be tested to align it with the reference face image, a processed standard key point set is obtained. Therefore, by aligning the face image to be tested, it can be more consistent with the reference face image in position, thereby improving the accuracy and reliability of subsequent processing tasks. By calculating the reference centroid and the actual centroid, the spatial offset and rotation differences in the face image to be tested can be eliminated, making the subsequent operation more stable and reliable. Through the alignment process, the face image to be tested can be converted into a standard key point set, which simplifies the complexity of subsequent processing tasks and improves the efficiency and accuracy of the algorithm.
[0011] In an optional embodiment, the facial image to be tested is aligned using the relevant position information of the reference center of mass and the actual center of mass to obtain a processed standard key point set, including: subtracting the reference center of mass coordinates corresponding to the reference center of mass from the coordinates of each reference key point in the reference key point set to obtain the standardized reference key point coordinates of the reference facial image; subtracting the actual center of mass coordinates corresponding to the actual center of mass from any actual coordinate position in the key point set to obtain the standardized actual coordinate position of the facial image to be tested; calculating a rotation matrix based on the standardized reference key point coordinates and the standardized actual coordinate positions to rotate multiple actual coordinate positions to the positions of multiple reference key point coordinates; and obtaining a standard key point set based on the multiple actual coordinate positions after rotation by the rotation matrix.
[0012] The method for predicting the facial posture of a driver provided by an embodiment of the present invention subtracts the reference center of mass coordinates corresponding to the reference center of mass from the coordinates of each reference key point in the reference key point set to obtain the standardized reference key point coordinates of the reference face image. Subtracts the actual center of mass coordinates corresponding to the actual center of mass from any actual coordinate position in the key point set to obtain the standardized actual coordinate position of the face image to be tested. According to the standardized reference key point coordinates and the standardized actual coordinate positions, a rotation matrix capable of rotating multiple actual coordinate positions to multiple reference key point coordinate positions is calculated. The actual coordinate position is transformed according to the rotation matrix to obtain the rotated actual coordinate position. The processed standard key point set is obtained by the rotated actual coordinate position. Therefore, by calculating the position information of the reference center of mass and the actual center of mass, and transforming the rotation matrix, a more accurate alignment process can be achieved, so that the face image to be tested and the reference face image are more consistent in the key point position. By standardizing the reference key point coordinates and the actual coordinate positions, and transforming the rotation matrix, the spatial displacement and rotation differences in the face image to be tested can be eliminated, so that the subsequent processing is more accurate and reliable. By obtaining a set of standard key points, the complexity of subsequent processing tasks can be simplified and the stability and accuracy of the algorithm can be improved.
[0013] In an optional embodiment, based on the relationship between a reference key point set and corresponding key points in the key point set, a roll angle corresponding to the face image to be tested is determined, including: performing inverse trigonometric operations on the rotation matrix to obtain the rotation angle between the reference key point set and the key point set; and determining the rotation angle as the roll angle corresponding to the face image to be tested.
[0014] The method for predicting the facial posture of a driver provided by an embodiment of the present invention performs inverse trigonometric operations on a rotation matrix to calculate the rotation angle between a reference key point set and a key point set. The calculated rotation angle is determined as the roll angle corresponding to the face image to be tested, so that the roll angle is determined based on the relationship between the reference key point set and the key point set of the face image to be tested, and the rotation of the face image to be tested relative to the reference face image can be more accurately described, thereby improving the accuracy of subsequent processing. By determining the roll angle, the processing flow of the face image to be tested can be simplified, making adjustment and alignment more intuitive and convenient, and also facilitating subsequent tasks such as face recognition and feature extraction. Determining the roll angle can help stabilize rotational transformations that may exist during the processing, thereby improving the stability and robustness of the algorithm and ensuring that the processing results are more reliable and accurate.
[0015] In an optional embodiment, after determining multiple reference key point coordinates and reference posture angles as a reference key point set, it also includes: preprocessing multiple face sample images in a face posture sample data set according to the reference key point set to eliminate scale and position differences between the multiple face sample images to obtain a standardized set of face key points; performing principal component analysis on the standardized set of face key points to obtain the corresponding relationship between the change direction of the principal component space corresponding to each eigenvector and the change of face posture.
[0016] The driver's facial posture prediction method provided by the embodiment of the present invention determines multiple reference key point coordinates and reference posture angles as a reference key point set, which is used as a standard reference point for subsequent processing. According to the reference key point set, multiple face sample images in the face posture sample data set are preprocessed. Through the preprocessed face sample images, a standardized set of face key points is obtained. Principal component analysis is performed on the standardized set of face key points to explore the main change directions in the data set. Therefore, the preprocessing process can effectively eliminate the scale and position differences between different face samples, making the subsequent analysis more accurate and reliable. By obtaining a standardized set of face key points, the key point positions between different face samples can be made to be in a consistent scale and position, which is conducive to the comparison and analysis of subsequent data. Principal component analysis can help reveal the main change directions in the data set, so as to better understand the characteristics and correlation of face posture changes, and provide useful information for subsequent pattern recognition and classification tasks.
[0017] In an optional implementation, principal component analysis is performed on a standardized set of facial key points to obtain a corresponding relationship between a change direction of a principal component space corresponding to each eigenvector and a change in facial posture, including: constructing a two-dimensional key point matrix according to the standardized set of facial key points; calculating a mean vector of the two-dimensional key point matrix; subtracting the mean vector from the two-dimensional key point matrix to obtain a standardized key point matrix; transposing the standardized key point matrix to obtain a transposed matrix of the standardized key point matrix; calculating a covariance matrix corresponding to the two-dimensional key point matrix based on the transposed matrix, the standardized key point matrix, and the number of multiple facial sample images in a facial posture sample data set; performing eigenvalue decomposition on the covariance matrix to obtain eigenvectors and eigenvalues; The eigenvector is used to characterize the change direction of each sample key point in the standardized set of facial key points in each principal component space; the eigenvalue is used to characterize the weight coefficient of each eigenvector; the eigenvalues are sorted in descending order to obtain a sorting result; multiple target eigenvalues are extracted from the sorting result, and the target eigenvectors corresponding to the multiple target eigenvalues are confirmed; each target eigenvector is visualized and analyzed to obtain a visualization result; the visualization result is used to characterize the change direction of the principal component space corresponding to the target eigenvector; according to the visualization result, a yaw angle eigenvector used to characterize the change direction of the face yaw angle and a pitch angle eigenvector used to characterize the change direction of the face pitch angle are selected from the target eigenvector.
[0018] The method for predicting the facial posture of a driver provided by an embodiment of the present invention constructs the key point coordinates in the standardized set of facial key points into a two-dimensional key point matrix according to specific rules, calculates the mean vector of the two-dimensional key point matrix, and uses it for subsequent standardization processing. Subtracts the mean vector from the two-dimensional key point matrix to obtain a standardized key point matrix to eliminate the deviation in the data. Based on the standardized key point matrix, the covariance matrix corresponding to the two-dimensional key point matrix is calculated and used for subsequent eigenvalue decomposition. The covariance matrix is subjected to eigenvalue decomposition to obtain eigenvectors and eigenvalues, the eigenvalues are sorted by size, and the eigenvectors corresponding to the first few eigenvalues are selected as target eigenvectors. The target eigenvector is visualized and analyzed to display the direction of change in the principal component space, including the direction of change in the yaw angle and the pitch angle. Therefore, principal component analysis can help reduce the data dimension, extract the main features that best represent the data change, and help understand and analyze the change in facial posture. Through eigenvalue decomposition and eigenvector selection, redundant information in the data can be reduced, the most important information can be retained, and the validity and interpretability of the data can be improved. Through the visualization analysis results, the main direction of the change in facial posture can be intuitively displayed, which is convenient for further research and application.
[0019] In an optional embodiment, the yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested are calculated using the features of the key points in the standard key point set, including: calculating the difference between the standard key point set and the mean vector; multiplying the difference with the yaw angle feature vector to obtain the yaw angle projection coefficient of the face image to be tested; multiplying the difference with the pitch angle feature vector to obtain the pitch angle projection coefficient of the face image to be tested.
[0020] The method for predicting the facial posture of a driver provided by an embodiment of the present invention subtracts the key point data of the face image to be tested from the mean vector to obtain a difference, multiplies the difference with the yaw angle feature vector extracted in advance, and obtains the yaw angle projection coefficient of the face image to be tested, which reflects the degree of deviation of the face image to be tested in the yaw angle direction. The difference is multiplied with the pitch angle feature vector to obtain the pitch angle projection coefficient of the face image to be tested, which reflects the degree of deviation of the face image to be tested in the pitch angle direction. Therefore, by calculating the yaw angle and pitch angle projection coefficients of the face image to be tested, the face can be more accurately located and identified, and personalized facial feature extraction can be achieved. The calculation method of the feature vector and the projection coefficient can be used to describe and analyze the facial posture concisely and efficiently, thereby improving the calculation efficiency and accuracy. The feature vector obtained by principal component analysis can better capture the main change information in the face data, which helps to accurately and effectively characterize the yaw angle and pitch angle changes of the face.
[0021] In an optional embodiment, before calculating the yaw angle of the face in the face image to be tested, the method also includes: determining a first calculation result obtained by multiplying the standardized key point matrix and the yaw angle feature vector as a sample yaw angle projection coefficient; wherein the sample yaw angle projection coefficient includes multiple projection coefficients of multiple face sample images in the yaw angle feature space; according to a preset yaw angle polynomial model, a yaw angle reference posture angle and a sample yaw angle projection coefficient, calculating a yaw angle fitting parameter; according to the yaw angle fitting parameter and the yaw angle polynomial model, calculating a first mapping relationship.
[0022] The method for predicting the facial posture of a driver provided by an embodiment of the present invention multiplies the standardized key point matrix with the yaw angle feature vector to obtain a first calculation result, namely, a sample yaw angle projection coefficient. Based on the preset yaw angle polynomial model, the yaw angle reference attitude angle and the sample yaw angle projection coefficient, the fitting parameters of the yaw angle are calculated. These parameters can be used to fit the changes of the face image in the yaw angle direction. Using the yaw angle fitting parameters and the yaw angle polynomial model, a first mapping relationship is calculated to map the sample yaw angle projection coefficient to the actual yaw angle quantity. Therefore, by multiplying the standardized key point matrix with the yaw angle feature vector, the sample yaw angle projection coefficient is obtained, and the projection coefficient can effectively represent the changes of the face image in the yaw angle direction, providing a basis for the subsequent fitting parameter calculation. Through the preset yaw angle polynomial model and the yaw angle reference attitude angle, flexible parameter setting and adjustment can be performed according to actual needs to meet the accuracy requirements of the yaw angle in different scenarios. By calculating the yaw angle fitting parameter and the first mapping relationship, the sample yaw angle projection coefficient can be mapped to the actual yaw angle quantity, thereby improving the precision and accuracy of the yaw angle measurement.
[0023] In an optional embodiment, before calculating the pitch angle of the face in the face image to be tested, a second mapping relationship between the pitch angle projection coefficient and the face posture angle is determined, including: determining a second calculation result obtained by multiplying the standardized key point matrix and the pitch angle feature vector as a sample pitch angle projection coefficient; wherein the sample pitch angle projection coefficient includes multiple projection coefficients of multiple face sample images in the pitch angle feature space; according to a preset pitch angle polynomial model, a pitch angle reference posture angle and a sample pitch angle projection coefficient, calculating the pitch angle fitting parameters; according to the pitch angle fitting parameters and the pitch angle polynomial model, calculating the second mapping relationship.
[0024] The method for predicting the facial posture of a driver provided by an embodiment of the present invention multiplies the standardized key point matrix with the pitch angle feature vector to obtain a second calculation result, namely, a sample pitch angle projection coefficient. Based on a preset pitch angle polynomial model, a pitch angle reference posture angle and a sample pitch angle projection coefficient, a fitting parameter of the pitch angle is calculated. Using the pitch angle fitting parameter and the pitch angle polynomial model, a second mapping relationship is calculated to map the sample pitch angle projection coefficient to an actual pitch angle quantity. Therefore, by multiplying the standardized key point matrix with the pitch angle feature vector, a sample pitch angle projection coefficient is obtained, and the projection coefficient can effectively represent the change of the face image in the pitch angle direction, providing a basis for subsequent fitting parameter calculation. Through the preset pitch angle polynomial model and the pitch angle reference posture angle, flexible parameter setting and adjustment can be performed according to actual needs to meet the accuracy requirements of the pitch angle in different scenarios. By calculating the pitch angle fitting parameter and the second mapping relationship, the sample pitch angle projection coefficient can be mapped to the actual pitch angle quantity, thereby improving the precision and accuracy of the pitch angle measurement.
[0025] In an optional implementation, the yaw angle polynomial model and the pitch angle polynomial model are both cubic polynomial models.
[0026] The method for predicting the facial posture of a driver provided by an embodiment of the present invention adopts a cubic polynomial function to describe the posture changes of the face in these two directions when modeling the yaw angle and the pitch angle. Since the cubic polynomial model has high flexibility, it can better fit complex posture changes. For describing the changes of the face in the yaw angle and the pitch angle, the use of the cubic polynomial model can more accurately capture the subtle changes in the facial posture. At the same time, since the cubic polynomial model takes into account the curvature and inflection point of the curve, it can better describe the posture changes of the face at different angles, which makes the model more in line with the actual situation and improves the measurement accuracy of the posture angle.
[0027] In a second aspect, the present invention provides a driver's face posture prediction device, comprising: a first acquisition module, used to acquire a face image to be tested; a recognition module, used to identify multiple key points in the face image to be tested, and obtain a key point set; an alignment module, used to align the face image to be tested using a pre-configured reference key point set and a key point set, and obtain a processed standard key point set; a first determination module, used to determine the roll angle corresponding to the face image to be tested based on the relationship between the reference key point set and the corresponding key points in the key point set; a first calculation module, used to The yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested are calculated by utilizing the features of the key points in the standard key point set; the second calculation module is used to calculate the yaw angle of the face in the face image to be tested according to the yaw angle projection coefficient and the first mapping relationship between the yaw angle projection coefficient and the face posture angle, and to calculate the pitch angle of the face in the face image to be tested according to the pitch angle projection coefficient and the second mapping relationship between the pitch angle projection coefficient and the face posture angle; the second determination module is used to determine the roll angle, the yaw angle and the pitch angle as the face posture prediction result of the face image to be tested. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 is a schematic flow chart of a method for predicting a driver's face posture according to an embodiment of the present invention;
[0030] Figure 2 is a schematic flow chart of another method for predicting a driver's face posture according to an embodiment of the present invention;
[0031] Figure 3 is a schematic diagram of 68 facial key points according to an embodiment of the present invention;
[0032] Figure 4 is a schematic flow chart of another method for predicting a driver's face posture according to an embodiment of the present invention;
[0033] Figure 5 is a structural block diagram of a device for predicting a driver's face posture according to an embodiment of the present invention;
[0034] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0036] With the continuous development of artificial intelligence, related technologies such as autonomous driving and assisted driving are also making continuous progress. The driver status monitoring function has been applied to some models. When implementing the driver status monitoring function, it is often necessary to estimate the driver's facial posture to analyze the driver's current driving state.
[0037] At present, there are three main methods for estimating facial pose: the first is to calculate the facial pose by mapping the facial key points and the facial model from three-dimensional coordinates to two-dimensional coordinates. The second is to directly regress the facial pose angle based on the input face image based on a neural network. The third is to project the face image into each principal component analysis pose space and take the pose in the closest projection coefficient space as the face pose of the image. However, the above three methods have certain limitations. The first method relies on the standard face model and facial key points. If there is an error in positioning, it will cause a large error in the face pose estimation; the second method is to restore this relationship and determine the face pose by building a neural network model to train a large number of face images with known poses, but in fact this correspondence requires a large number of training images and computing resources, and has high requirements for the deployment platform; the third method relies on the overall pixel information of the image, so the calculation dimension is high, and the pose space is discontinuous, requiring a large number of face image samples with different poses.
[0038] In view of this, the technical solution of the present invention performs principal component analysis on the key points of the face, such as eyes, nose, mouth, etc., accurately located in the face image or video, to obtain the projection coefficients of different principal component spaces, and then selects the projection coefficients of the associated space and the face posture angle for fitting to obtain the corresponding mapping relationship to estimate the face posture, so that the technical solution of the present invention can be directly combined with the most advanced open source face key point detection model, and directly estimate the face posture based on the face key points output by the model, eliminating the complex intermediate matching steps and post-processing process, and avoiding the cost of additional data collection, annotation and model training. By using face key points instead of image pixels in traditional methods, the calculation dimension is greatly reduced, and it is simple, efficient, easy to deploy, and has a wider range of applications. While reducing the amount of calculation, it avoids the interference of the image due to the use of image pixel information, image blur, illumination changes and partial occlusion, and improves the accuracy and reliability of face posture estimation under the premise of accurate feature point detection.
[0039] According to an embodiment of the present invention, an embodiment of a method for predicting a driver's facial posture is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0040] In this embodiment, a method for predicting a driver's face posture is provided, which can be used in vehicles. Figure 1 is a flowchart of a method for predicting a driver's face posture according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0041] Step S101, obtaining a face image to be tested.
[0042] In a driver monitoring system or a vehicle safety system, a facial image for identifying, monitoring or evaluating the driver's status is obtained from a camera or other device. Specifically, the driver's facial image can be captured by a vehicle-mounted camera or a built-in camera.
[0043] Step S102, identifying multiple key points in the face image to be tested to obtain a key point set.
[0044] The key point set is to organize the coordinates of multiple key points into a key point set, which is used to represent the structural features and morphological information of the face. Specifically, the face detection algorithm is used to determine the position of the face in the image, and multiple key points are identified and located on the detected face, such as the position of the eyes, the position of the nose, the position of the mouth, etc. This usually requires the use of a face key point detection algorithm, such as a key point detection model based on a neural network, to achieve the positioning of the key points. The key point coordinates obtained are organized into a key point set.
[0045] Step S103, using the pre-configured reference key point set and the key point set, aligning the face image to be tested to obtain a processed standard key point set.
[0046] The reference key point set is usually a set of key point coordinates that are pre-defined or pre-annotated, and used as standard key point positions in tasks such as face recognition and face alignment. These reference key point sets can be pre-determined for specific tasks or specific data sets, and used as a benchmark for comparison or alignment.
[0047] The standard key point set is the set obtained after the face image to be tested is aligned. Specifically, based on the pre-configured reference key point set and the key point set in the face image to be tested, a transformation matrix can be calculated to describe how to transform the key points in the face image to be tested to align to the reference key point positions. The calculated transformation matrix is applied to the key point set on the face image to be tested, and the corresponding transformation operations are performed so that these key points are aligned to the specified standard positions. After the alignment process, the processed standard key point set can be obtained, which can be used for subsequent tasks such as face recognition and feature extraction.
[0048] Step S104: determining the roll angle corresponding to the face image to be tested based on the relationship between the reference key point set and the corresponding key points in the key point set.
[0049] The roll angle is the rotation angle of the face relative to the horizontal direction, that is, the angle at which the head tilts left and right. Specifically, the roll angle corresponding to the face image to be tested is calculated based on the relationship between the reference key point set and the corresponding key points in the key point set. For example, the transformation matrix calculated based on the pre-configured reference key point set and the key point set in the face image to be tested can be operated to obtain the rotation angle of the face relative to the horizontal line, that is, the roll angle. It can also be based on the position of key point A in the reference key point set and the key point set in the face image to be tested. The corresponding position of key point A can be found by comparing the position of key point A in the reference key point set with the position of key point A in the face image to be tested. The horizontal offset between them can be calculated, and the roll angle can be inferred based on the horizontal offset of the eyes.
[0050] Step S105, using the features of the key points in the standard key point set, calculate the yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested.
[0051] The yaw angle projection coefficient is used to calculate the yaw angle of the face, and the pitch angle projection coefficient is used to calculate the pitch angle of the face. Specifically, the yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested can be calculated by combining the key point related features in the standard key point set with the key point related features in the reference key point set.
[0052] Step S106, calculate the yaw angle of the face in the face image to be tested according to the yaw angle projection coefficient and the first mapping relationship between the yaw angle projection coefficient and the face posture angle, and calculate the pitch angle of the face in the face image to be tested according to the pitch angle projection coefficient and the second mapping relationship between the pitch angle projection coefficient and the face posture angle.
[0053] Among them, the yaw angle (Yaw Angle) and the pitch angle (Pitch Angle) are the angles that describe the left-right rotation of the face on the horizontal plane and the up-and-down rotation on the vertical plane.
[0054] The first mapping relationship is the corresponding relationship between the yaw angle projection coefficient obtained through the training data and the face posture angle. The second mapping relationship is the corresponding relationship between the pitch angle projection coefficient obtained through the training data and the face posture angle. Specifically, after the yaw angle projection coefficient is obtained, the yaw angle of the face in the face image to be tested can be calculated in combination with the first mapping relationship. After the pitch angle projection coefficient is obtained, the pitch angle of the face in the face image to be tested can be calculated in combination with the second mapping relationship.
[0055] Step S107: determining the roll angle, yaw angle and pitch angle as the face posture prediction result of the face image to be tested.
[0056] The roll angle, yaw angle and pitch angle are used to describe the rotation of the face in the three-dimensional space. Specifically, after the roll angle, yaw angle and pitch angle are determined, they are determined as the face posture prediction result of the face image to be tested.
[0057] The method for predicting the facial posture of a driver provided by an embodiment of the present invention analyzes the facial image to be tested and identifies multiple key points therein after obtaining the facial image to be tested, and these key points can reflect different features and positions of the face. A pre-configured reference key point set and a key point set of the face to be tested are used for alignment processing to obtain a standard key point set to eliminate the deviation caused by the facial posture, so that subsequent calculations are more accurate. By comparing the relationship between the reference key point set and the key point set of the face image to be tested, the roll angle of the face image to be tested, that is, the rotation angle of the face on the horizontal plane, is determined. The projection coefficients of the yaw angle and the pitch angle of the face image to be tested are calculated using the features of the key points in the standard key point set. According to the projection coefficients of the yaw angle and the pitch angle and the mapping relationship between the angles of the facial posture, the yaw angle and the pitch angle of the face in the face image to be tested are calculated. Finally, the calculated roll angle, yaw angle and pitch angle are used as the facial posture prediction results of the face image to be tested, which greatly reduces the calculation dimension and avoids the interference of image blur, lighting changes and partial occlusion on the image pixel information. Under the premise of accurate feature point detection, the accuracy and reliability of facial posture estimation are improved. It is simple, efficient and has a wider range of applications.
[0058] In this embodiment, a method for predicting a driver's face posture is provided, which can be used in vehicles. Figure 2 is a flowchart of a method for predicting a driver's face posture according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0059] Step S201, obtaining a face posture sample data set, wherein the face posture sample data set includes a plurality of face sample images annotated with face key points and face postures, the face key points correspond to different parts of the face, and different parts are described by different numbers of face key points.
[0060] The face pose sample data set is a data set containing annotated face pose information, including a large number of face sample images, each of which is annotated with the key point positions of the face and the corresponding face pose information. Specifically, the face pose sample data set can be obtained through academic research institutions or data sharing platforms.
[0061] For example, the face pose sample data set downloaded from the data sharing platform contains more than 600 face images of multiple people with diverse poses and expressions collected from different angles under various lighting conditions, and annotated 68 facial key points and corresponding poses, such as Figure 3 shown.
[0062] Step S202, extracting a sample key point annotation set and a sample posture angle annotation set of multiple face sample images from the face posture sample data set; the sample key point annotation set is used to characterize the coordinate set of multiple face key points of the multiple face sample images, and the sample posture angle annotation set is used to characterize the sample pitch angle and sample yaw angle set corresponding to multiple face postures of the multiple face sample images.
[0063] The sample key point annotation set represents the key point positions in the face image, such as the coordinate positions of the eyes, nose, mouth and other parts. The sample posture angle annotation set represents the pitch angle and yaw angle of the face, that is, the orientation angle of the face in three-dimensional space. Specifically, the image files and corresponding annotation files in the face posture sample data set are read, the key point annotations and posture angle annotations of each image are parsed, and the key point annotations and posture angle annotations are organized into a set form so that they correspond to each face image.
[0064] For example, multiple facial landmarks are often used Figure 3 The facial key points are defined by the 68 key points shown in the figure. These key points can be used to describe the various parts and postures of the face. For each face image in the dataset, there is a corresponding set of facial key point annotations. Used to represent 68 facial key points, among which represents the horizontal and vertical coordinates of the i-th key point on the 2D face image. Assume that the dataset contains For a face image, we can get the key point annotations of the dataset: in is a set of key points corresponding to the i-th face image.
[0065] For example, the facial posture is mainly expressed through three posture angles: pitch angle (pitch), yaw angle (yaw) and roll angle (roll) is used to represent the angle of the face in the three-dimensional coordinate system. For each face image in the dataset, there is a corresponding set of posture angle annotations. ,in represents the pitch angle of the face image, represents the yaw angle. Assume that the data set contains face images, we can get the face pose angle annotations for the training set:
[0066]
[0067]
[0068] in is the annotation set of the pitch angle of each face image in the dataset, It is the annotation set of the yaw angle of each face image in the dataset.
[0069] Step S203, for a specific key point among the facial key points, take the first coordinate average of multiple sample coordinates corresponding to the specific key point included in the sample key point annotation set, and determine the first coordinate average as the reference key point coordinate of the specific key point; wherein the specific key point is any point among the facial key points.
[0070] Select any one of the facial key points as a specific key point, for example, it can be the B key point among the 68 key points, and find all sample coordinates containing the selected B key point from the sample key point annotation set, and these coordinates correspond to the positions of the B key points in different face images. For multiple coordinates of the B key point in each sample, calculate the average of the first coordinates, and determine the coordinates corresponding to the average of the first coordinates as the reference key point coordinates of the B key point.
[0071] Step S204, taking the angle average of multiple face posture angles corresponding to multiple face sample images included in the sample posture angle annotation set, and determining the angle average as the reference posture angle of the face posture sample data set; wherein the reference posture angle includes a yaw angle reference posture angle and a pitch angle reference posture angle.
[0072] The yaw and pitch angle data corresponding to multiple face sample images are obtained from the sample pose angle annotation set. These angles represent the orientation angles of different face samples. For each face sample image, the corresponding yaw and pitch angles are calculated respectively, and the yaw and pitch angles of all samples are averaged to obtain the average yaw angle and the average pitch angle. The average yaw angle and the average pitch angle are determined as the reference pose angle of the face pose sample data set.
[0073] Step S205: determining a plurality of reference key point coordinates and reference posture angles as a reference key point set.
[0074] The reference key point set is a set of multiple reference key point coordinates and reference posture angles. Specifically, the multiple reference key point coordinates and reference posture angles that have been calculated are sorted into a set to ensure that each key point corresponds to its specific coordinate value, and each angle corresponds to its related posture angle. The sorted reference key point coordinates and reference posture angles are used as part of the data set to form a set containing all reference key points and posture angles.
[0075] The face image corresponding to the reference key point set is determined as the reference face image. For example, the reference face image may include 68 key points with first coordinate average values and a reference posture angle.
[0076] The method for predicting the facial posture of a driver provided by an embodiment of the present invention collects a plurality of facial sample images containing annotated facial key points and facial postures before obtaining a facial image to be tested. A sample key point annotation set and a sample posture angle annotation set of a plurality of facial sample images are extracted from a facial posture sample data set. For a specific key point in the facial key points, an average value of a plurality of sample coordinates corresponding to the specific key point is taken from the sample key point annotation set, and the average value is determined as the reference key point coordinate of the specific key point. An average value of the posture angles of a plurality of facial sample images is taken from the sample posture angle annotation set, and the average value is determined as the reference posture angle of the facial posture sample data set, including the yaw angle and the pitch angle. A plurality of reference key point coordinates and reference posture angles are determined as a reference key point set for subsequent facial posture prediction, so that by establishing a reference key point set and a reference posture angle, the accurate prediction of the posture of the facial image to be tested can be improved, and the error caused by sample differences can be reduced. By processing the sample data set and extracting key information, the influence of noise in the data on the prediction result can be effectively reduced, and the stability of the algorithm can be improved. After determining the reference key point set and posture angle, the complexity of subsequent calculations can be simplified and the efficiency and practicality of the algorithm can be improved.
[0077] Step S206, preprocessing the multiple face sample images in the face posture sample data set according to the reference key point set to eliminate the scale and position differences between the multiple face sample images to obtain a standardized set of face key points.
[0078] The standardized set of facial key points is a set of key point coordinates processed for each face sample image after adjusting the scale and position. Specifically, since the face pose sample data set contains face images of various scales and positions, the face sample images need to be preprocessed to eliminate the scale and position differences between the face sample images, so that the model can focus on learning the characteristics of the face pose itself.
[0079] For example, Procrustes Analysis can be used to standardize the pose variations between different faces into a unified reference pose, including the following steps:
[0080] Step a1, normalizing the key point coordinates of all face sample images in the sample key point annotation set, that is, subtracting the corresponding average of each first coordinate from each key point coordinate of each face sample image.
[0081] Step a2: For each sample face image, calculate the average value of all key points in its key point coordinate set, that is, calculate the centroid coordinates. Compare the centroid of each face key point set with the centroid of the reference face image, and calculate the offset, that is, the difference between the centroid of the reference face and the centroid of the current face. Use the calculated offset to align the coordinates of each key point of the current face to the centroid of the reference face so that their centroids coincide.
[0082] Step a3, calculate the rotation angle between each facial key point set and the reference facial image, and rotate all key points accordingly to make them consistent with the direction of the reference face. The least squares method is used to calculate the rotation angle from the facial key point set in each image to the reference facial key point set.
[0083] (1)
[0084] Where a and b represent the parameters of the rotation change:
[0085]
[0086] and It represents the mean x-coordinate and y-coordinate of key point i in the data set, and k is the scale factor that does not affect the rotation angle.
[0087] Taking partial derivatives of (1) can obtain the target rotation change parameters,
[0088]
[0089] right Perform inverse trigonometric operations to obtain the rotation angle ,
[0090]
[0091] Step a4, calculate the scale difference between each set of facial key points and the reference face image, and scale all key points accordingly to match their scale with the reference face.
[0092] Step a5: Use an iterative approach to optimize the alignment process. Common optimization methods include the least squares method or the iterative closest point algorithm.
[0093] Step S207, performing principal component analysis on the standardized set of facial key points to obtain the corresponding relationship between the change direction of the principal component space corresponding to each eigenvector and the change of the facial posture.
[0094] Principal Components Analysis (PCA) is performed on the standardized set of facial key points. PCA can extract the main change directions of key points, thereby reducing the dimensions of key points and retaining key information.
[0095] The purpose of principal component analysis of facial key point information is to find the corresponding relationship between the change direction of the principal component space corresponding to each eigenvector and the change of facial posture.
[0096] The driver's facial posture prediction method provided by the embodiment of the present invention determines multiple reference key point coordinates and reference posture angles as a reference key point set, which is used as a standard reference point for subsequent processing. According to the reference key point set, multiple face sample images in the face posture sample data set are preprocessed. Through the preprocessed face sample images, a standardized set of face key points is obtained. Principal component analysis is performed on the standardized set of face key points to explore the main change directions in the data set. Therefore, the preprocessing process can effectively eliminate the scale and position differences between different face samples, making the subsequent analysis more accurate and reliable. By obtaining a standardized set of face key points, the key point positions between different face samples can be made to be in a consistent scale and position, which is conducive to the comparison and analysis of subsequent data. Principal component analysis can help reveal the main change directions in the data set, so as to better understand the characteristics and correlation of face posture changes, and provide useful information for subsequent pattern recognition and classification tasks.
[0097] Specifically, the above step S207 includes:
[0098] Step S2071, constructing a two-dimensional key point matrix according to the standardized set of facial key points.
[0099] A two-dimensional key point matrix is constructed based on the standardized set of facial key points, and the coordinates of all facial key points are arranged into a two-dimensional matrix according to certain rules.
[0100] Specifically, the facial key points analyzed by Prof. middle, ,in is the number of face sample images in the face pose sample data set, It is the number of facial key points multiplied by the coordinate dimension of the key points, for example .matrix Each row vector represents a face sample, and each column vector represents the horizontal or vertical coordinate of a key point.
[0101] Step S2072, calculate the mean vector of the two-dimensional key point matrix; subtract the mean vector from the two-dimensional key point matrix to obtain a standardized key point matrix.
[0102] The mean vector of the two-dimensional key point matrix is calculated, and the mean vector is subtracted from the two-dimensional key point matrix to obtain a standardized key point matrix to eliminate the offset of the data.
[0103] Specifically, the key point coordinates are normalized so that all key points are in the same scale range. Calculate the matrix The mean vector of , represents the average value of key points in each dimension,
[0104]
[0105] matrix Subtract the mean vector Get the standardized key point matrix ,
[0106]
[0107] Step S2073, transpose the standardized key point matrix to obtain a transposed matrix of the standardized key point matrix.
[0108] Transpose the standardized key point matrix to obtain the transposed matrix of the standardized key point matrix for subsequent calculations. Specifically, transpose the standardized key point matrix to obtain .
[0109] Step S2074, based on the transposed matrix, the standardized key point matrix and the number of multiple face sample images in the face posture sample data set, calculate the covariance matrix corresponding to the two-dimensional key point matrix.
[0110] Based on the transposed matrix, the standardized key point matrix and the number of multiple face sample images in the face posture sample data set, the covariance matrix corresponding to the two-dimensional key point matrix is calculated to analyze the correlation between the data.
[0111] Specifically, the data matrix is calculated The covariance matrix of , represents the covariance relationship between each key point,
[0112]
[0113] Step S2075, perform eigenvalue decomposition on the covariance matrix to obtain eigenvectors and eigenvalues; the eigenvectors are used to characterize the change direction of each sample key point in the standardized set of face key points in each principal component space; the eigenvalues are used to characterize the weight coefficient of each eigenvector.
[0114] Perform eigenvalue decomposition on the covariance matrix to obtain eigenvectors and eigenvalues, which are used to characterize the main change direction and weight of the data.
[0115] Specifically, the covariance matrix Perform eigenvalue decomposition to obtain the eigenvector ,
[0116]
[0117] and the corresponding eigenvalues ,
[0118]
[0119] The eigenvector Indicates the direction of change of key point data in each principal component space, is the direction of change of the i-th feature space, and the eigenvalue Indicates the importance of each principal component (eigenvector), Represents the feature vector The weight coefficient of .
[0120] Step S2076, sort the eigenvalues in descending order to obtain a sorting result.
[0121] Sort the eigenvalues by size to facilitate subsequent selection of the main eigenvectors. Sort from largest to smallest, select the first The eigenvalues make The eigenvalues account for more than 99% of the total eigenvalues.
[0122]
[0123] Step S2077, extracting multiple target feature values from the sorting result, and confirming the target feature vectors corresponding to the multiple target feature values.
[0124] Extract multiple target eigenvalues from the sorting results, and confirm the target eigenvectors corresponding to these eigenvalues, usually selecting the eigenvector corresponding to the largest eigenvalue. The eigenvalues corresponding to the eigenvectors .
[0125] Step S2078, performing visual analysis on each target feature vector to obtain a visual analysis result; wherein the visual analysis result is used to characterize the change direction of the principal component space corresponding to the target feature vector.
[0126] Visual analysis is performed on the target feature vector to obtain a visual result, which helps us understand the direction of data change corresponding to the feature vector. The eigenvalues corresponding to the eigenvectors Perform visual inspections one by one to observe the direction of change in the feature space corresponding to the eigenvector.
[0127] Step S2079, selecting a yaw angle feature vector for characterizing the direction of change of the yaw angle of the face and a pitch angle feature vector for characterizing the direction of change of the pitch angle of the face from the target feature vector according to the visualization analysis result.
[0128] According to the visual analysis results, feature vectors used to characterize the direction of facial posture change, such as yaw angle feature vectors and pitch angle feature vectors, are selected for subsequent posture analysis and recognition. Specifically, select and , which represents the direction of the face yaw angle change Recorded as , indicating the direction of change of the face pitch angle Recorded as .
[0129] The method for predicting the facial posture of a driver provided by an embodiment of the present invention constructs the key point coordinates in the standardized set of facial key points into a two-dimensional key point matrix according to specific rules, calculates the mean vector of the two-dimensional key point matrix, and uses it for subsequent standardization processing. Subtracts the mean vector from the two-dimensional key point matrix to obtain a standardized key point matrix to eliminate the deviation in the data. Based on the standardized key point matrix, the covariance matrix corresponding to the two-dimensional key point matrix is calculated and used for subsequent eigenvalue decomposition. The covariance matrix is subjected to eigenvalue decomposition to obtain eigenvectors and eigenvalues, the eigenvalues are sorted by size, and the eigenvectors corresponding to the first few eigenvalues are selected as target eigenvectors. The target eigenvector is visualized and analyzed to display the direction of change in the principal component space, including the direction of change in the yaw angle and the pitch angle. Therefore, principal component analysis can help reduce the data dimension, extract the main features that best represent the data change, and help understand and analyze the change in facial posture. Through eigenvalue decomposition and eigenvector selection, redundant information in the data can be reduced, the most important information can be retained, and the validity and interpretability of the data can be improved. Through the visualization analysis results, the main direction of the change in facial posture can be intuitively displayed, which is convenient for further research and application.
[0130] In this embodiment, a method for predicting a driver's face posture is provided, which can be used in vehicles. Figure 4 is a flowchart of a method for predicting a driver's face posture according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0131] Step S301, obtain the face image to be tested. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0132] Step S302, identify multiple key points in the face image to be tested and obtain a key point set. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0133] Step S303: aligning the face image to be tested using the pre-configured reference key point set and the key point set to obtain a processed standard key point set.
[0134] Specifically, the above step S303 includes:
[0135] Step S3031, taking an average value of second coordinates of the coordinates of multiple reference key points in the reference key point set, and determining the second coordinate average value as the reference centroid of the reference face image corresponding to the reference key point set.
[0136] The coordinates of multiple key points are extracted from the reference key point set, the coordinates of the multiple reference key points are averaged to obtain a second coordinate average value, and the calculated average value is determined as the reference centroid of the reference face image corresponding to the reference key point set.
[0137] Step S3032, identifying multiple actual coordinate positions corresponding to multiple key points in the key point set.
[0138] Parse the key point set to obtain the actual coordinates of multiple key points in the key point set. Specifically, this can be achieved through image processing algorithms or computer vision technology to extract the specific coordinates of each key point in the image, thereby providing an accurate data basis for subsequent tasks such as face alignment.
[0139] Step S3033, taking the third coordinate average value of the multiple actual coordinate positions, and determining the third coordinate average value as the actual centroid of the face image to be tested.
[0140] An average calculation is performed on multiple actual coordinate positions to obtain a third coordinate average value, and the calculated third coordinate average value is determined as the actual centroid coordinate of the face image to be tested.
[0141] Step S3034, using the position information of the reference centroid and the actual centroid, align the face image to be tested to obtain a processed standard key point set.
[0142] By calculating the position information of the reference center of mass and the actual center of mass, the offset and rotation angle of the face image to be tested are determined. According to the offset and rotation angle, the face image to be tested is translated and rotated to align it with the reference face image. After alignment, a processed set of standard key points is obtained, and the positions of these key points in space are consistent with the reference key point set.
[0143] The method for predicting the facial posture of a driver provided by the embodiment of the present invention averages the second coordinates of the coordinates of multiple reference key points in the reference key point set to obtain the reference centroid of the reference facial image corresponding to the reference key point set. Identify multiple key points in the key point set of the face image to be tested, determine their coordinate positions in the actual image, and average the third coordinates of the multiple actual coordinate positions to obtain the actual centroid of the face image to be tested. Align the face image to be tested using the position information of the reference centroid and the actual centroid. By adjusting the position of the face image to be tested to align it with the reference face image, a processed standard key point set is obtained. Therefore, by aligning the face image to be tested, it can be more consistent with the reference face image in position, thereby improving the accuracy and reliability of subsequent processing tasks. By calculating the reference centroid and the actual centroid, the spatial offset and rotation differences in the face image to be tested can be eliminated, making the subsequent operation more stable and reliable. Through the alignment process, the face image to be tested can be converted into a standard key point set, which simplifies the complexity of subsequent processing tasks and improves the efficiency and accuracy of the algorithm.
[0144] In some optional implementations, the above step S3034 includes:
[0145] Step b1, subtract the reference center of mass coordinates corresponding to the reference center of mass from the coordinates of each reference key point in the reference key point set to obtain the standardized reference key point coordinates of the reference face image.
[0146] Calculate the average coordinates of all key points in the reference key point set, that is, the reference center of mass coordinates corresponding to the reference center of mass. For each key point in the reference key point set, subtract the coordinates of the reference center of mass from its coordinates to obtain the standardized reference key point coordinates of the reference face image. Their coordinate values are adjusted relative to the position of the reference center of mass, so that the reference center of mass becomes the new origin.
[0147] Step b2: subtract the actual center of mass coordinate corresponding to the actual center of mass from any actual coordinate position in the key point set to obtain the standardized actual coordinate position of the face image to be tested.
[0148] Calculate the average coordinates of all key points in the key point set to be tested, that is, the actual center of mass coordinates corresponding to the actual center of mass. For any actual coordinate position in the key point set to be tested, subtract the coordinates of the actual center of mass from its coordinates to obtain the standardized actual coordinate position of the face image to be tested. These coordinates are adjusted relative to the actual center of mass so that the actual center of mass becomes the new origin.
[0149] Step b3, calculating a rotation matrix based on the standardized reference key point coordinates and the standardized actual coordinate positions to rotate the multiple actual coordinate positions to the positions of the multiple reference key point coordinates.
[0150] According to the standardized reference key point coordinates and the standardized actual coordinate positions, the rotation matrix is calculated by the least square method and other methods. Among them, the rotation matrix is usually a 2x2 matrix, which is used to describe how to rotate the coordinate system to align the two sets of key point positions. Multiplying all the actual key point positions (after standardization) in the face image to be tested with the calculated rotation matrix can obtain the new positions of these actual key point positions after rotation. Therefore, the multiple actual key point positions in the face image to be tested are rotated to positions aligned with the reference key point positions, achieving the effect of face alignment.
[0151] Specifically, the key point set corresponding to the face image to be tested is analyzed using Protoss Preprocessing to obtain a standard key point set and the rotation matrix
[0152]
[0153] in Represents the rotation matrix, which is used to rotate all key points in the test face image accordingly so that their directions are consistent with those of the reference face image.
[0154] Step b4, obtaining a set of standard key points according to a plurality of actual coordinate positions after rotation by the rotation matrix.
[0155] For each actual coordinate position in the face image to be tested, the rotation matrix calculated above is applied to perform coordinate transformation, and the actual coordinate position is rotated to the reference key point position corresponding to the reference face image to obtain a standard key point set.
[0156] In the above implementation, the reference center of mass coordinates corresponding to the reference center of mass are respectively subtracted from the reference key point coordinates in the reference key point set to obtain the standardized reference key point coordinates of the reference face image. The actual center of mass coordinates corresponding to the actual center of mass are subtracted from any actual coordinate position in the key point set to obtain the standardized actual coordinate position of the face image to be tested. According to the standardized reference key point coordinates and the standardized actual coordinate positions, a rotation matrix capable of rotating multiple actual coordinate positions to multiple reference key point coordinate positions is calculated. The actual coordinate position is transformed according to the rotation matrix to obtain the rotated actual coordinate position. The processed standard key point set is obtained by the rotated actual coordinate position. Therefore, by calculating the position information of the reference center of mass and the actual center of mass, and the transformation of the rotation matrix, a more accurate alignment process can be achieved, so that the face image to be tested and the reference face image are more consistent in the key point position. By standardizing the reference key point coordinates and the actual coordinate position, and the transformation of the rotation matrix, the spatial displacement and rotation difference in the face image to be tested can be eliminated, so that the subsequent processing is more accurate and reliable. By obtaining a set of standard key points, the complexity of subsequent processing tasks can be simplified and the stability and accuracy of the algorithm can be improved.
[0157] Step S304: determining the roll angle corresponding to the face image to be tested based on the relationship between the reference key point set and the corresponding key points in the key point set.
[0158] Specifically, the above step S304 includes:
[0159] Step S3041, performing inverse trigonometric operation on the rotation matrix to obtain the rotation angle between the reference key point set and the key point set.
[0160] The rotation matrix is used to perform inverse trigonometric operations to calculate the rotation angle between the reference keypoint set and the keypoint set. This angle can help determine how many degrees the actual keypoint position needs to be rotated to align with the reference keypoint position.
[0161] Specifically, the rotation matrix Performing inverse trigonometric operations yields
[0162]
[0163] in Represents the rotation angle between the key point set and the reference face image.
[0164] Step S3042: determine the rotation angle as the roll angle corresponding to the face image to be tested.
[0165] The rotation angle is determined as the roll angle corresponding to the face image to be tested. Specifically, by setting the rotation angle as the roll angle corresponding to the face image to be tested, the rotation posture of the face in the image can be more intuitively understood and described.
[0166] In the above implementation, the rotation matrix is subjected to inverse trigonometric function operations to calculate the rotation angle between the reference key point set and the key point set. The calculated rotation angle is determined as the roll angle corresponding to the face image to be tested, so that the roll angle is determined based on the relationship between the reference key point set and the key point set of the face image to be tested, which can more accurately describe the rotation of the face image to be tested relative to the reference face image, thereby improving the accuracy of subsequent processing. By determining the roll angle, the processing flow of the face image to be tested can be simplified, making adjustment and alignment more intuitive and convenient, and also facilitating subsequent face recognition, feature extraction and other tasks. Determining the roll angle can help stabilize the rotation transformation that may exist during the processing, thereby improving the stability and robustness of the algorithm and ensuring that the processing results are more reliable and accurate.
[0167] Step S305, using the features of the key points in the standard key point set, calculate the yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested.
[0168] Specifically, the above step S305 includes:
[0169] Step S3051, calculate the difference between the standard key point set and the mean vector.
[0170] The purpose of calculating the difference between the standard key point set and the mean vector is to measure the offset between the key point positions in the test face image and the key point positions in the reference face image.
[0171] Step S3052: multiply the difference value and the yaw angle feature vector to obtain the yaw angle projection coefficient of the face image to be tested.
[0172] The difference calculated above is multiplied by the yaw angle feature vector to obtain the yaw angle projection coefficient of the face image to be tested. The yaw angle projection coefficient reflects the degree of rotation of the face on the horizontal plane and helps to describe the left and right deflection of the face.
[0173] Step S3053, multiplying the difference value and the pitch angle feature vector to obtain the pitch angle projection coefficient of the face image to be tested.
[0174] The same difference is multiplied by the pitch angle feature vector to obtain the pitch angle projection coefficient of the face image to be tested. The pitch angle projection coefficient is used to describe the degree of rotation of the face on the vertical plane, helping to understand the up and down angles of the face.
[0175] Specifically, we get the standard key point set After that, the projection coefficient in the face posture feature space can be calculated.
[0176]
[0177]
[0178] in is the projection coefficient of the face image to be tested in the yaw angle feature space, is the projection coefficient of the pitch angle feature space.
[0179] In the above implementation, the key point data of the face image to be tested is subtracted from the mean vector to obtain a difference, and the difference is multiplied by the yaw angle feature vector extracted in advance to obtain the yaw angle projection coefficient of the face image to be tested, which reflects the degree of deviation of the face image to be tested in the yaw angle direction. The difference is multiplied by the pitch angle feature vector to obtain the pitch angle projection coefficient of the face image to be tested, which reflects the degree of deviation of the face image to be tested in the pitch angle direction. Therefore, by calculating the yaw angle and pitch angle projection coefficient of the face image to be tested, the face can be more accurately located and identified, and personalized face feature extraction can be achieved. The calculation method of the feature vector and the projection coefficient can be used to describe and analyze the face posture concisely and efficiently, thereby improving the calculation efficiency and accuracy. The feature vector obtained by principal component analysis can better capture the main change information in the face data, which helps to accurately and effectively characterize the yaw angle and pitch angle changes of the face.
[0180] In some optional implementations, between step S305 and step S306, the following steps are included:
[0181] Step b1, determining the first calculation result obtained by multiplying the standardized key point matrix and the yaw angle feature vector as the sample yaw angle projection coefficient; wherein the sample yaw angle projection coefficient includes multiple projection coefficients of multiple face sample images in the yaw angle feature space.
[0182] Specifically, through the matrix and the eigenvector Doing matrix dot multiplication can obtain the projection coefficients of multiple face sample images in the yaw angle feature space. ,
[0183]
[0184] in Each element in corresponds to the projection coefficient of each face sample image in the yaw angle feature space.
[0185] Step b2, calculating the yaw angle fitting parameters according to the preset yaw angle polynomial model, the yaw angle reference attitude angle and the sample yaw angle projection coefficient.
[0186] Specifically, a cubic polynomial model of the yaw angle is established , the projection coefficient matrix of the face pose sample data set in the yaw angle feature space and the label matrix of the yaw angle Substitute the yaw angle polynomial model and convert it into matrix form
[0187]
[0188] in
[0189]
[0190]
[0191]
[0192] Use linear algebra to solve the above linear equations and get the parameter vector .
[0193] Step b3: Calculate and obtain a first mapping relationship according to the yaw angle fitting parameter and the yaw angle polynomial model.
[0194] Specifically, Substituting into the yaw angle polynomial model, we can get:
[0195]
[0196] Equation (2) is the first mapping relationship between the yaw angle projection coefficient and the face posture angle.
[0197] In the above implementation, the standardized key point matrix is multiplied with the yaw angle feature vector to obtain a first calculation result, namely, the sample yaw angle projection coefficient. Based on the preset yaw angle polynomial model, the yaw angle reference attitude angle and the sample yaw angle projection coefficient, the fitting parameters of the yaw angle are calculated. These parameters can be used to fit the changes of the face image in the yaw angle direction. Using the yaw angle fitting parameters and the yaw angle polynomial model, the first mapping relationship is calculated to map the sample yaw angle projection coefficient to the actual yaw angle quantity. Therefore, by multiplying the standardized key point matrix with the yaw angle feature vector, the sample yaw angle projection coefficient is obtained, and the projection coefficient can effectively represent the changes of the face image in the yaw angle direction, providing a basis for the subsequent fitting parameter calculation. Through the preset yaw angle polynomial model and the yaw angle reference attitude angle, flexible parameter setting and adjustment can be performed according to actual needs to meet the accuracy requirements of the yaw angle in different scenarios. By calculating the yaw angle fitting parameter and the first mapping relationship, the sample yaw angle projection coefficient can be mapped to the actual yaw angle quantity, thereby improving the precision and accuracy of the yaw angle measurement.
[0198] In some optional implementations, before the above step S306, the following steps are further included:
[0199] Step c1, determining the second calculation result obtained by multiplying the standardized key point matrix and the pitch angle feature vector as the sample pitch angle projection coefficient; wherein the sample pitch angle projection coefficient includes multiple projection coefficients of multiple face sample images in the pitch angle feature space.
[0200] Specifically, through the matrix and the eigenvector Doing matrix dot multiplication can obtain the projection coefficients of multiple face sample images in the pitch angle feature space. ,
[0201]
[0202] in Each element in corresponds to the projection coefficient of each face sample image in the pitch angle feature space.
[0203] Step c2, calculating the pitch angle fitting parameters according to the preset pitch angle polynomial model, the pitch angle reference attitude angle and the sample pitch angle projection coefficient.
[0204] Specifically, a cubic polynomial model of the pitch angle is established , the projection coefficient matrix of the face pose sample data set in the pitch angle feature space and the pitch angle matrix Substitute the pitch angle polynomial model and convert it into matrix form
[0205]
[0206] in
[0207]
[0208]
[0209]
[0210] Use linear algebra to solve the above linear equations and get the parameter vector .
[0211] Step c3, calculating and obtaining a second mapping relationship according to the pitch angle fitting parameters and the pitch angle polynomial model.
[0212] Specifically, Substituting into the pitch angle polynomial model, we can get:
[0213]
[0214] Equation (3) is the second mapping relationship between the pitch angle projection coefficient and the face posture angle.
[0215] In the above implementation, the standardized key point matrix is multiplied with the pitch angle feature vector to obtain a second calculation result, i.e., the sample pitch angle projection coefficient. Based on the preset pitch angle polynomial model, the pitch angle reference posture angle and the sample pitch angle projection coefficient, the pitch angle fitting parameters are calculated. The pitch angle fitting parameters and the pitch angle polynomial model are used to calculate the second mapping relationship, which is used to map the sample pitch angle projection coefficient to the actual pitch angle amount. Therefore, by multiplying the standardized key point matrix with the pitch angle feature vector, the sample pitch angle projection coefficient is obtained, and the projection coefficient can effectively represent the change of the face image in the pitch angle direction, providing a basis for the subsequent fitting parameter calculation. Through the preset pitch angle polynomial model and the pitch angle reference posture angle, flexible parameter setting and adjustment can be performed according to actual needs to meet the accuracy requirements of the pitch angle in different scenarios. By calculating the pitch angle fitting parameters and the second mapping relationship, the sample pitch angle projection coefficient can be mapped to the actual pitch angle amount, thereby improving the precision and accuracy of the pitch angle measurement.
[0216] Step S306, calculate the yaw angle of the face in the face image to be tested according to the yaw angle projection coefficient and the first mapping relationship between the yaw angle projection coefficient and the face posture angle, and calculate the pitch angle of the face in the face image to be tested according to the pitch angle projection coefficient and the second mapping relationship between the pitch angle projection coefficient and the face posture angle.
[0217] Specifically, the projection coefficient in step S3053 is obtained and After that, the posture angle of the face image to be tested can be predicted by combining the first mapping relationship and the second mapping relationship obtained through the training data.
[0218]
[0219]
[0220] in is the estimated face yaw angle, is the estimated face pitch angle.
[0221] Step S307: determining the roll angle, yaw angle and pitch angle as the face posture prediction result of the face image to be tested.
[0222] Specifically, in combination with step S3041 , It can be used to represent the face pose of the face image to be tested, that is, the face pose prediction result.
[0223] The method for predicting the facial posture of a driver provided by an embodiment of the present invention adopts a cubic polynomial function to describe the posture changes of the face in these two directions when modeling the yaw angle and the pitch angle. Since the cubic polynomial model has high flexibility, it can better fit complex posture changes. For describing the changes of the face in the yaw angle and the pitch angle, the use of the cubic polynomial model can more accurately capture the subtle changes in the facial posture. At the same time, since the cubic polynomial model takes into account the curvature and inflection point of the curve, it can better describe the posture changes of the face at different angles, which makes the model more in line with the actual situation and improves the measurement accuracy of the posture angle.
[0224] In the present embodiment, a device for predicting a driver's face posture is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0225] This embodiment provides a driver's face posture prediction device, such as Figure 5 As shown, including:
[0226] The first acquisition module 401 is used to acquire a face image to be tested.
[0227] The recognition module 402 is used to recognize multiple key points in the face image to be tested and obtain a key point set.
[0228] The alignment module 403 is used to perform alignment processing on the face image to be tested using the pre-configured reference key point set and the key point set to obtain a processed standard key point set.
[0229] The first determination module 404 is used to determine the roll angle corresponding to the face image to be tested based on the relationship between the reference key point set and the corresponding key points in the key point set.
[0230] The first calculation module 405 is used to calculate the yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested by using the features of the key points in the standard key point set.
[0231] The second calculation module 406 is used to calculate the yaw angle of the face in the face image to be tested according to the yaw angle projection coefficient and the first mapping relationship between the yaw angle projection coefficient and the face posture angle, and to calculate the pitch angle of the face in the face image to be tested according to the pitch angle projection coefficient and the second mapping relationship between the pitch angle projection coefficient and the face posture angle.
[0232] The second determination module 407 is used to determine the roll angle, the yaw angle and the pitch angle as the face posture prediction result of the face image to be measured.
[0233] In some optional embodiments, the above device further includes:
[0234] The second acquisition module is used to obtain a face posture sample data set, wherein the face posture sample data set includes multiple face sample images marked with face key points and face postures, the face key points correspond to different parts of the face, and different parts are described by different numbers of face key points.
[0235] The extraction module is used to extract a sample key point annotation set and a sample posture angle annotation set of multiple face sample images from the face posture sample data set. The sample key point annotation set is used to characterize the coordinate set of multiple face key points of the multiple face sample images, and the sample posture angle annotation set is used to characterize the sample pitch angle and sample yaw angle set corresponding to multiple face postures of the multiple face sample images.
[0236] The third determination module is used to take the first coordinate average of multiple sample coordinates corresponding to the specific key point included in the sample key point annotation set for a specific key point in the face key point, and determine the first coordinate average as the reference key point coordinate of the specific key point. The specific key point is any point in the face key point.
[0237] The fourth determination module is used to take the average angle of multiple face posture angles corresponding to multiple face sample images included in the sample posture angle annotation set, and determine the average angle as the reference posture angle of the face posture sample data set. The reference posture angle includes a yaw angle reference posture angle and a pitch angle reference posture angle.
[0238] The fifth determination module is used to determine multiple reference key point coordinates and reference posture angles as a reference key point set.
[0239] In some optional implementations, the alignment module 403 includes:
[0240] The first determination submodule is used to obtain a second coordinate average value of the coordinates of multiple reference key points in the reference key point set, and determine the second coordinate average value as the reference centroid of the reference face image corresponding to the reference key point set.
[0241] The identification submodule is used to identify multiple actual coordinate positions corresponding to multiple key points in the key point set.
[0242] The second determination submodule is used to obtain a third coordinate average value for multiple actual coordinate positions, and determine the third coordinate average value as the actual centroid of the face image to be tested.
[0243] The alignment submodule is used to align the face image to be tested using the position information of the reference center of mass and the actual center of mass to obtain a processed set of standard key points.
[0244] In some optional implementations, the alignment submodule includes:
[0245] The first calculation unit is used to subtract the reference center of mass coordinates corresponding to the reference center of mass from the coordinates of each reference key point in the reference key point set to obtain the coordinates of each standardized reference key point of the reference face image.
[0246] The second calculation unit is used to subtract the actual center of mass coordinate corresponding to the actual center of mass from any actual coordinate position in the key point set to obtain the standardized actual coordinate position of the face image to be tested.
[0247] The third calculation unit is used to calculate a rotation matrix according to the standardized reference key point coordinates and the standardized actual coordinate positions, so as to rotate the multiple actual coordinate positions to the positions of the multiple reference key point coordinates.
[0248] The rotation unit is used to obtain a set of standard key points according to a plurality of actual coordinate positions after rotation by a rotation matrix.
[0249] In some optional implementations, the first determining module 404 includes:
[0250] The operator module is used to perform inverse trigonometric function operations on the rotation matrix to obtain the rotation angle between the reference key point set and the key point set.
[0251] The third determination submodule is used to determine the rotation angle as the roll angle corresponding to the face image to be tested.
[0252] In some optional embodiments, the above device further includes:
[0253] The preprocessing module is used to preprocess multiple face sample images in the face posture sample data set according to the reference key point set to eliminate the scale and position differences between the multiple face sample images and obtain a standardized set of face key points.
[0254] The principal component analysis module is used to perform principal component analysis on the standardized set of facial key points to obtain the corresponding relationship between the change direction of the principal component space corresponding to each eigenvector and the change of facial posture.
[0255] In some optional embodiments, the principal component analysis module includes:
[0256] The construction submodule is used to construct a two-dimensional key point matrix based on the standardized set of facial key points.
[0257] The first calculation submodule is used to calculate the mean vector of the two-dimensional key point matrix.
[0258] The second calculation submodule is used to subtract the mean vector from the two-dimensional key point matrix to obtain a standardized key point matrix.
[0259] The transposition submodule is used to transpose the standardized key point matrix to obtain a transposed matrix of the standardized key point matrix.
[0260] The third calculation submodule is used to calculate the covariance matrix corresponding to the two-dimensional key point matrix based on the transposed matrix, the standardized key point matrix and the number of multiple face sample images in the face posture sample data set.
[0261] The eigenvalue decomposition submodule is used to perform eigenvalue decomposition on the covariance matrix to obtain eigenvectors and eigenvalues. The eigenvectors are used to characterize the change direction of each sample key point in the standardized set of facial key points in each principal component space. The eigenvalues are used to characterize the weight coefficients of each eigenvector.
[0262] The sorting submodule is used to sort the eigenvalues in descending order to obtain the sorting result.
[0263] The extraction submodule is used to extract multiple target feature values from the sorting results and confirm the target feature vectors corresponding to the multiple target feature values.
[0264] The visualization analysis submodule is used to perform visualization analysis on each target feature vector to obtain visualization analysis results, wherein the visualization analysis results are used to characterize the change direction of the principal component space corresponding to the target feature vector.
[0265] The selection submodule is used to select a yaw angle feature vector for characterizing the direction of change of the yaw angle of the face and a pitch angle feature vector for characterizing the direction of change of the pitch angle of the face from the target feature vector according to the visualization analysis result.
[0266] In some optional implementations, the first calculation module 405 includes:
[0267] The fourth calculation submodule is used to calculate the difference between the standard key point set and the mean vector.
[0268] The fifth calculation submodule is used to multiply the difference value and the yaw angle feature vector to obtain the yaw angle projection coefficient of the face image to be tested.
[0269] The sixth calculation submodule is used to multiply the difference value and the pitch angle feature vector to obtain the pitch angle projection coefficient of the face image to be tested.
[0270] In some optional embodiments, the above device further includes:
[0271] The third calculation module is used to determine the first calculation result obtained by multiplying the standardized key point matrix and the yaw angle feature vector as the sample yaw angle projection coefficient, wherein the sample yaw angle projection coefficient includes multiple projection coefficients of multiple face sample images in the yaw angle feature space.
[0272] The fourth calculation module is used to calculate the yaw angle fitting parameters according to the preset yaw angle polynomial model, the yaw angle reference attitude angle and the sample yaw angle projection coefficient.
[0273] The fifth calculation module is used to calculate and obtain the first mapping relationship according to the yaw angle fitting parameter and the yaw angle polynomial model.
[0274] In some optional embodiments, the above device further includes:
[0275] The sixth calculation module is used to determine the second calculation result obtained by multiplying the standardized key point matrix and the pitch angle feature vector as the sample pitch angle projection coefficient, wherein the sample pitch angle projection coefficient includes multiple projection coefficients of multiple face sample images in the pitch angle feature space.
[0276] The seventh calculation module is used to calculate the pitch angle fitting parameters according to the preset pitch angle polynomial model, the pitch angle reference attitude angle and the sample pitch angle projection coefficient.
[0277] An eighth calculation module is used to calculate a second mapping relationship according to the pitch angle fitting parameters and the pitch angle polynomial model.
[0278] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0279] The driver's facial posture prediction device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0280] The driver's face posture prediction device provided by the embodiment of the present invention analyzes the face image to be tested and identifies multiple key points therein after obtaining the face image to be tested, and these key points can reflect different features and positions of the face. A pre-configured reference key point set and a key point set of the face to be tested are used for alignment processing to obtain a standard key point set to eliminate the deviation caused by the face posture, so that subsequent calculations are more accurate. By comparing the relationship between the reference key point set and the key point set of the face image to be tested, the roll angle of the face image to be tested, that is, the rotation angle of the face on the horizontal plane, is determined. The projection coefficients of the yaw angle and the pitch angle of the face image to be tested are calculated using the features of the key points in the standard key point set. According to the projection coefficients of the yaw angle and the pitch angle and the mapping relationship between the face posture angle, the yaw angle and the pitch angle of the face in the face image to be tested are calculated. Finally, the calculated roll angle, yaw angle and pitch angle are used as the facial posture prediction results of the face image to be tested, which greatly reduces the calculation dimension and avoids the interference of image blur, lighting changes and partial occlusion on the image pixel information. Under the premise of accurate feature point detection, the accuracy and reliability of facial posture estimation are improved. It is simple, efficient and has a wider range of applications.
[0281] The embodiment of the present invention also provides a computer device having the above Figure 5 The driver's facial posture prediction device is shown.
[0282] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0283] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0284] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0285] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0286] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0287] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0288] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device may be a touch screen.
[0289] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0290] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0291] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for predicting a driver's facial posture, characterized in that: The method comprises: Obtain the face image to be tested; Identify multiple key points in the face image to be tested to obtain a key point set; Using a pre-configured reference key point set and the key point set, the face image to be tested is aligned to obtain a processed standard key point set; Determining a roll angle corresponding to the face image to be tested based on a relationship between the reference key point set and corresponding key points in the key point set; Utilizing the features of the key points in the standard key point set, a yaw angle projection coefficient and a pitch angle projection coefficient of the face image to be tested are calculated; Calculate the yaw angle of the face in the face image to be measured according to the yaw angle projection coefficient and the first mapping relationship between the yaw angle projection coefficient and the face posture angle, and calculate the pitch angle of the face in the face image to be measured according to the pitch angle projection coefficient and the second mapping relationship between the pitch angle projection coefficient and the face posture angle; Determine the roll angle, the yaw angle, and the pitch angle as a face posture prediction result of the face image to be tested; Before obtaining the face image to be tested, the method further includes: Acquire a face pose sample data set, wherein the face pose sample data set includes a plurality of face sample images annotated with face key points and face poses, and different parts are described by different numbers of face key points; Extracting a sample key point annotation set and a sample posture angle annotation set of the plurality of face sample images from the face posture sample data set; the sample key point annotation set is used to characterize a coordinate set of the plurality of face key points of the plurality of face sample images, and the sample posture angle annotation set is used to characterize a set of sample pitch angles and sample yaw angles corresponding to the plurality of face postures of the plurality of face sample images; For a specific key point among the key points of the human face, taking a first coordinate average value of a plurality of sample coordinates corresponding to the specific key point included in the sample key point annotation set, and determining the first coordinate average value as a reference key point coordinate of the specific key point; wherein the specific key point is any point among the key points of the human face; Taking an angle average of a plurality of face posture angles corresponding to the plurality of face sample images included in the sample posture angle annotation set, and determining the angle average as a reference posture angle of the face posture sample data set; wherein the reference posture angle includes a yaw angle reference posture angle and a pitch angle reference posture angle; Determine the reference key point set by using a plurality of the reference key point coordinates and the reference posture angles; Preprocessing the plurality of face sample images in the face pose sample data set according to the reference key point set to eliminate scale and position differences between the plurality of face sample images to obtain a standardized set of face key points; The method comprises the steps of: performing principal component analysis on the standardized set of facial key points to obtain the corresponding relationship between the change direction of the principal component space corresponding to each eigenvector and the change of facial posture, comprising: constructing a two-dimensional key point matrix according to the standardized set of facial key points; calculating the mean vector of the two-dimensional key point matrix; subtracting the mean vector from the two-dimensional key point matrix to obtain a standardized key point matrix; transposing the standardized key point matrix to obtain a transposed matrix of the standardized key point matrix; calculating the covariance matrix corresponding to the two-dimensional key point matrix based on the transposed matrix, the standardized key point matrix and the number of multiple facial sample images in the facial posture sample data set; performing eigenvalue decomposition on the covariance matrix to obtain eigenvectors and eigenvalues; the eigenvectors are used to characterize the change direction of each sample key point in the standardized set of facial key points in each principal component space; the eigenvalues are used to characterize the change direction of each sample key point in the standardized set of facial key points in each principal component space; and the eigenvalues are used to characterize the change direction of each sample key point in the standardized set of facial key points in each principal component space. A weight coefficient for characterizing each of the feature vectors; sorting the feature values in descending order to obtain a sorting result; extracting multiple target feature values from the sorting result, and confirming the target feature vectors corresponding to the multiple target feature values; performing a visual analysis on each of the target feature vectors to obtain a visual analysis result; wherein the visual analysis result is used to characterize the direction of change of the principal component space corresponding to the target feature vector; selecting a yaw angle feature vector for characterizing the direction of change of the yaw angle of the face and a pitch angle feature vector for characterizing the direction of change of the pitch angle of the face from the target feature vectors according to the visual analysis result; wherein the yaw angle feature vector is the target feature vector corresponding to the target feature value with the largest value among the multiple target feature values; and the pitch angle feature vector is the target feature vector corresponding to the target feature value with the second largest value among the multiple target feature values; The method of calculating the yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested by utilizing the features of the key points in the standard key point set includes: Calculating the difference between the standard key point set and the mean vector; Multiplying the difference value and the yaw angle feature vector to obtain a yaw angle projection coefficient of the face image to be tested; The difference is multiplied by the pitch angle feature vector to obtain a pitch angle projection coefficient of the face image to be tested.
2. The method according to claim 1, characterized in that Using the pre-configured reference key point set and the key point set, the face image to be tested is aligned to obtain a processed standard key point set, including: Taking a second coordinate average value of coordinates of a plurality of the reference key points in the reference key point set, and determining the second coordinate average value as a reference centroid of the reference face image corresponding to the reference key point set; Identify a plurality of actual coordinate positions corresponding to a plurality of key points in the key point set; Taking a third coordinate average value for the multiple actual coordinate positions, and determining the third coordinate average value as the actual centroid of the face image to be tested; The position information of the reference centroid and the actual centroid is used to align the face image to be tested, so as to obtain a processed standard key point set.
3. The method according to claim 2, characterized in that The method of using the relevant position information of the reference centroid and the actual centroid to align the face image to be tested to obtain a processed standard key point set includes: Subtract the reference centroid coordinates corresponding to the reference centroid from the reference key point coordinates in the reference key point set to obtain the standardized reference key point coordinates of the reference face image; Subtract the actual center of mass coordinates corresponding to the actual center of mass from any one of the actual coordinate positions in the key point set to obtain a standardized actual coordinate position of the face image to be tested; A rotation matrix is calculated according to the standardized reference key point coordinates and the standardized actual coordinate positions to rotate the multiple actual coordinate positions to the positions of the multiple reference key point coordinates; The standard key point set is obtained according to the multiple actual coordinate positions after rotation by the rotation matrix.
4. The method according to claim 3, characterized in that Determining the roll angle corresponding to the face image to be tested based on the relationship between the reference key point set and the corresponding key points in the key point set includes: Performing inverse trigonometric operations on the rotation matrix to obtain a rotation angle between the reference key point set and the key point set; The rotation angle is determined as the roll angle corresponding to the face image to be tested.
5. The method according to claim 1, characterized in that Before calculating the yaw angle of the face in the face image to be tested, the method further includes: Determine a first calculation result obtained by multiplying the standardized key point matrix and the yaw angle feature vector as a sample yaw angle projection coefficient; wherein the sample yaw angle projection coefficient includes a plurality of projection coefficients of the plurality of face sample images in the yaw angle feature space; Calculate the yaw angle fitting parameters according to the preset yaw angle polynomial model, the yaw angle reference attitude angle and the sample yaw angle projection coefficient; The first mapping relationship is obtained by calculation according to the yaw angle fitting parameter and the yaw angle polynomial model.
6. The method according to claim 1, characterized in that Before calculating the pitch angle of the face in the face image to be tested, the method further includes: Determine a second calculation result obtained by multiplying the standardized key point matrix and the pitch angle feature vector as a sample pitch angle projection coefficient; wherein the sample pitch angle projection coefficient includes a plurality of projection coefficients of the plurality of face sample images in the pitch angle feature space; Calculate the pitch angle fitting parameters according to the preset pitch angle polynomial model, the pitch angle reference attitude angle and the sample pitch angle projection coefficient; The second mapping relationship is obtained by calculation according to the pitch angle fitting parameters and the pitch angle polynomial model.
7. The method according to claim 5 or 6, characterized in that: The yaw angle polynomial model and the pitch angle polynomial model are both cubic polynomial models.
8. A driver's face posture prediction device, characterized in that: The device comprises: The first acquisition module is used to acquire the face image to be tested; A recognition module, used to recognize multiple key points in the face image to be tested and obtain a key point set; An alignment module, used to align the face image to be tested using a pre-configured reference key point set and the key point set to obtain a processed standard key point set; A first determination module, configured to determine a roll angle corresponding to the face image to be tested based on a relationship between the reference key point set and corresponding key points in the key point set; A first calculation module is used to calculate the yaw angle projection coefficient and the pitch angle projection coefficient of the face image to be tested by using the features of the key points in the standard key point set; a second calculation module, configured to calculate the yaw angle of the face in the face image to be measured according to the yaw angle projection coefficient and the first mapping relationship between the yaw angle projection coefficient and the face posture angle, and to calculate the pitch angle of the face in the face image to be measured according to the pitch angle projection coefficient and the second mapping relationship between the pitch angle projection coefficient and the face posture angle; A second determination module is used to determine the roll angle, the yaw angle and the pitch angle as the face posture prediction result of the face image to be tested; The above device also includes: A second acquisition module is used to acquire a face posture sample data set, wherein the face posture sample data set includes a plurality of face sample images annotated with face key points and face postures, and different parts are described by different numbers of face key points; An extraction module is used to extract a sample key point annotation set and a sample posture angle annotation set of multiple face sample images from a face posture sample data set; the sample key point annotation set is used to characterize a coordinate set of multiple face key points of the multiple face sample images, and the sample posture angle annotation set is used to characterize a set of sample pitch angles and sample yaw angles corresponding to multiple face postures of the multiple face sample images; A third determination module is used to take a first coordinate average value of a plurality of sample coordinates corresponding to the specific key point included in the sample key point annotation set for a specific key point among the key points of the human face, and determine the first coordinate average value as a reference key point coordinate of the specific key point; wherein the specific key point is any point among the key points of the human face; A fourth determination module is used to take an angle average of multiple face posture angles corresponding to multiple face sample images included in the sample posture angle annotation set, and determine the angle average as a reference posture angle of the face posture sample data set; wherein the reference posture angle includes a yaw angle reference posture angle and a pitch angle reference posture angle; A fifth determination module, configured to determine a plurality of reference key point coordinates and reference posture angles as a reference key point set; A preprocessing module is used to preprocess multiple face sample images in the face posture sample data set according to the reference key point set, so as to eliminate the scale and position differences between the multiple face sample images and obtain a standardized set of face key points; The principal component analysis module is used to perform principal component analysis on the standardized set of facial key points to obtain the corresponding relationship between the change direction of the principal component space corresponding to each feature vector and the change of facial posture; Wherein, the principal component analysis module includes: A construction submodule is used to construct a two-dimensional key point matrix based on a standardized set of facial key points; A first calculation submodule is used to calculate the mean vector of the two-dimensional key point matrix; The second calculation submodule is used to subtract the mean vector from the two-dimensional key point matrix to obtain a standardized key point matrix; A transposition submodule, used for transposing the standardized key point matrix to obtain a transposed matrix of the standardized key point matrix; A third calculation submodule is used to calculate a covariance matrix corresponding to the two-dimensional key point matrix based on the transposed matrix, the standardized key point matrix and the number of multiple face sample images in the face posture sample data set; The eigenvalue decomposition submodule is used to perform eigenvalue decomposition on the covariance matrix to obtain eigenvectors and eigenvalues; the eigenvectors are used to characterize the change direction of each sample key point in the standardized set of face key points in each principal component space; the eigenvalues are used to characterize the weight coefficients of each eigenvector; The sorting submodule is used to sort the eigenvalues in descending order to obtain the sorting result; An extraction submodule, used to extract multiple target feature values from the sorting results, and confirm target feature vectors corresponding to the multiple target feature values; The visualization analysis submodule is used to perform visualization analysis on each target feature vector to obtain visualization analysis results; wherein the visualization analysis results are used to characterize the change direction of the principal component space corresponding to the target feature vector; A selection submodule is used to select a yaw angle feature vector for characterizing the direction of change of the yaw angle of the face and a pitch angle feature vector for characterizing the direction of change of the pitch angle of the face from the target feature vector according to the visualization analysis result; wherein the yaw angle feature vector is a target feature vector corresponding to the target feature value with the largest value among the multiple target feature values; and the pitch angle feature vector is a target feature vector corresponding to the target feature value with the second largest value among the multiple target feature values; Wherein, the first calculation module includes: The fourth calculation submodule is used to calculate the difference between the standard key point set and the mean vector; A fifth calculation submodule, used for multiplying the difference value and the yaw angle feature vector to obtain a yaw angle projection coefficient of the face image to be tested; The sixth calculation submodule is used to multiply the difference value and the pitch angle feature vector to obtain the pitch angle projection coefficient of the face image to be tested.
Citation Information
Patent Citations
Method and device for obtaining human face pose parameter
CN102043943A
Head posture estimation equipment and head posture estimation method
CN102456127A
Three-dimensional data visualization method based on PCA-Radviz
CN110162568A
Face pose estimation method based on key point constraint
CN110705355A
Human head posture estimation algorithm and operator working state recognition system
CN112347974A
