Head posture estimation method and apparatus, and device and storage medium
By using the network model to identify two-dimensional and three-dimensional key point coordinates and updating the 3D head model in real time, the problem of unstable head posture estimation in the existing technology is solved, and the stability of posture calculation in large-scale expressions is achieved.
Patent Information
- Application Number
- PCT/CN2023/108312
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-09-15
- Filing Date
- 2023-07-20
- Publication Date
- 2024-09-12
AI Technical Summary
The existing head pose estimation method is based on the PnP algorithm, which results in the head pose being unstable and unreliable when people make large expressions.
A network model composed of the first branch network and the second branch network is used to identify the two-dimensional key point coordinates and the three-dimensional key point coordinates respectively, and the 3D head model is updated in real time through the correspondence between the two-dimensional and three-dimensional key points to ensure that the expression changes stability of attitude estimation.
The stability and reliability of head posture estimation are improved, especially in the case of large expressions, which can maintain the accuracy of posture calculation.
Smart Images

Figure CN2023108312_12092024_PF_FP_ABST
Abstract
Description
Head posture estimation method, device, equipment and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 15, 2022, with application number 2022111304414 and application name “A head posture estimation method, device, equipment and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of image processing, and in particular to head posture estimation technology. Background Art
[0003] In the context of computer vision, head pose estimation refers to the ability to infer the orientation of a person's head relative to the camera view. Head pose estimation is a crucial component in visual motion capture. Accurate head pose allows virtual avatars to perfectly replicate human head movements, making virtual human animations more vivid, flexible, and realistic.
[0004] Currently, mainstream head pose estimation methods generally require the use of traditional motion sensors or three-dimensional (3D) image acquisition devices to obtain the three-dimensional coordinate information of the head. However, since mainstream image acquisition devices currently capture two-dimensional (2D) image information, it is necessary to convert the 2D coordinate information into a 3D world coordinate system based on the coordinate information of facial key points to obtain the 3D coordinate information of the human head pose. Then, based on the changes in this coordinate information, the head pose can be estimated and the head movement can be determined.
[0005] This method is based on solving the motion problem of 3D to 2D point pairs (also known as Perspective-n-Point (PnP)). This method first estimates the 2D key points of the face; then, based on these 2D key points, the corresponding 3D points are calibrated within a fixed 3D head model. Through the PnP solution, the transformed pose of the 3D points corresponding to the 2D key points is obtained. While this method is generally accurate and highly interpretable, when a person makes large facial expressions, jitter becomes noticeable, making the estimated head pose less stable and reliable.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide a head posture estimation method, apparatus, device, and storage medium, which can ensure stable and reliable head posture estimation.
[0008] In view of this, on the one hand, the present application provides a head posture estimation method, which is executed by a computer device, including: obtaining an image to be identified, which includes a target face image; performing key point recognition processing based on the image to be identified through a first network model to obtain a two-dimensional key point coordinate set of the target face image in the image to be identified, and a three-dimensional key point coordinate set of the target face image, wherein the first network model includes a first branch network and a second branch network, wherein the first branch network is used to identify the two-dimensional key point coordinate set, and the second branch network is used to identify the three-dimensional key point coordinate set; according to the two-dimensional key point coordinate set and the three-dimensional key point coordinate set, determine the head posture corresponding to the target face image in the image to be identified.
[0009] Another aspect of the present application provides a head posture estimation device, comprising:
[0010] An acquisition module is used to acquire an image to be identified, wherein the image to be identified includes a target face image;
[0011] a processing module, configured to perform key point recognition processing based on the image to be recognized through a first network model to obtain a two-dimensional key point coordinate set of a target facial image in the image to be recognized and a three-dimensional key point coordinate set of the target facial image, wherein the first network model includes a first branch network and a second branch network, wherein the first branch network is used to identify the two-dimensional key point coordinate set, and the second branch network is used to identify the three-dimensional key point coordinate set;
[0012] The output module is used to determine the head posture corresponding to the target face image in the image to be identified based on the two-dimensional key point coordinate set and the three-dimensional key point coordinate set.
[0013] Another aspect of the present application provides a computer device, comprising: a memory, a processor, and a bus system;
[0014] Wherein, the memory is used to store programs;
[0015] The processor is used to execute the program in the memory, and the processor is used to perform the above-mentioned methods according to the instructions in the program code;
[0016] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0017] Another aspect of the present application provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.
[0018] Another aspect of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the above aspects.
[0019] As can be seen from the above technical solution, the embodiment of the present application has the following advantages: through two branch networks, the 2D key point coordinates and 3D key point coordinates of the target facial image in the image to be recognized are output respectively, and then the head posture of the target facial image is calculated based on the 2D key point coordinates and the 3D key point coordinates. In particular, because the 3D key point coordinates can be obtained in real time, the 3D head model can change with the change of expression. Accordingly, the coordinate correspondence between the 2D key points and the 3D key points is made more accurate, thereby ensuring stable and reliable head posture calculation when making large expressions. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] FIG1 is a schematic diagram of an architecture of an application system according to an embodiment of the present application;
[0021] FIG2 is a schematic diagram of an architecture of a first network model according to an embodiment of the present application;
[0022] FIG3 is another schematic diagram of the architecture of the first network model according to an embodiment of the present application;
[0023] FIG4 is a flow chart of a head posture estimation method according to an embodiment of the present application;
[0024] FIG5 is a schematic diagram of a target face image in an image to be recognized in an embodiment of the present application;
[0025] FIG6 is a flow chart showing a process of obtaining an image to be recognized by processing an image to be processed by an image processing model in an embodiment of the present application;
[0026] FIG7 a is a schematic diagram of an embodiment of head posture estimation in an embodiment of the present application;
[0027] FIG7 b is a schematic diagram of a virtual image generated after the image to be processed is estimated through head posture according to an embodiment of the present application;
[0028] FIG8 is a schematic diagram of an embodiment of a head posture estimation device according to an embodiment of the present application;
[0029] FIG9 is a schematic diagram of another embodiment of a head posture estimation device according to an embodiment of the present application;
[0030] FIG10 is a schematic diagram of another embodiment of a head posture estimation device according to an embodiment of the present application;
[0031] FIG11 is a schematic diagram of another embodiment of the head posture estimation device in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The embodiments of the present application provide a head posture estimation method, apparatus, device, and storage medium for ensuring stable and reliable head posture estimation.
[0033] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the numbers used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "corresponding to" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] In order to solve the problem that head posture estimation based on the PnP algorithm in the related art is not stable and reliable, this application provides the following technical solutions:
[0035] An image to be identified is obtained, wherein the image to be identified includes a target facial image; the image to be identified is input into a first network model to obtain a two-dimensional key point coordinate set of the target facial image in the image to be identified, and a three-dimensional key point coordinate set of the target facial image, wherein the first network model includes a first branch network and a second branch network, wherein the first branch network is used to identify and obtain the two-dimensional key point coordinate set, and the second branch network is used to identify and obtain the three-dimensional key point coordinate set; based on the two-dimensional key point coordinate set and the three-dimensional key point coordinate set, the head posture corresponding to the target facial image in the image to be identified is determined. In an embodiment of the present application, the 3D key point coordinates of the facial image in the image to be identified can be obtained in real time, thereby ensuring that the 3D head model can change with changes in the facial expression of the person, and accordingly, the coordinate correspondence between the 2D key points and the 3D key points can be made more accurate, and when the person in the image to be identified makes a large expression, the head posture solution can also be guaranteed to be stable and reliable.
[0036] For ease of understanding, some professional terms in this application are explained below:
[0037] Key points of facial features: used to indicate the location of facial features on a person's face. The locations of facial features can be represented by key points. The key points of facial features involved in the embodiments of this application include points corresponding to the left pupil, right pupil, nose tip, left corner of the mouth, and right corner of the mouth.
[0038] Euler angles: refers to a set of three independent angular parameters proposed by Euler to determine the position of a fixed-point rotating rigid body. The embodiment of the present application establishes a rectangular coordinate system based on the human face. The embodiment of the present application uses the facial posture angle as an example to illustrate. In the three-dimensional rectangular coordinate system, the Euler angle is based on the center or center of gravity of the human head as the origin, the direction from one ear to the other ear of the face is the X-axis direction, the direction from the top of the head to the neck is the Y-axis, and the direction from the face to the back of the head is the Z-axis. The Euler angles include the following three angles:
[0039] Pitch angle: the angle of rotation around the X axis;
[0040] Yaw angle (yaw): the angle of rotation around the Y axis;
[0041] Roll angle: The angle of rotation around the Z axis.
[0042] Visual Motion Capture: Traditional motion capture uses inertial sensors or markers attached to the person. Visual motion capture doesn't require the person to wear any equipment. Instead, it uses a single or multiple cameras to capture facial and body movements.
[0043] 6DoF (6 degrees of freedom): DoF is the number of directions an object can move in 3D space, for a total of 6 degrees of freedom. The head pose includes rotation and translation, where rotation is represented by three Euler angles and translation is represented by displacement in three directions, which together give the 6DoF pose parameters.
[0044] PnP (Perspective-n-Point): PnP is a method for solving 3D-to-2D point pair motions. Its goal is to solve the pose of the camera coordinate system relative to the world coordinate system. It describes how to estimate the camera pose (i.e., solve the rotation matrix and translation vector from the world coordinate system to the camera coordinate system) when the coordinates of several 3D points (relative to the world coordinate system) and the 2D coordinates of these points are known.
[0045] A convolutional layer (Conv) refers to a layered structure composed of several convolutional units in a convolutional neural network layer. A convolutional neural network (CNN) is a feedforward neural network that includes at least two neural network layers. Each neural network layer contains several neurons, and each neuron is arranged in layers. Neurons in the same layer are not connected to each other, and information between layers is transmitted only in one direction.
[0046] The pooling layer, also known as the sampling layer, is a layered structure that extracts features from the input values. It maintains the key features of the previous layer's values while reducing the parameters and computational complexity of the next layer. The pooling layer is composed of multiple feature planes. Each feature plane in the convolutional layer corresponds to a feature plane in the pooling layer, without changing the number of feature planes. By reducing the resolution of the feature planes, spatially invariant features are obtained.
[0047] A fully connected layer (FC) means that each node in the layered structure is connected to all nodes in the previous layer. It can be used to comprehensively process the features extracted by the neural network layer in the previous layer and plays the role of a "classifier" in the neural network model.
[0048] Backpropagation: Forward propagation refers to the feedforward processing of the model. Backpropagation is the opposite of forward propagation, updating the weight parameters of each layer of the model based on the model output. For example, if the model consists of an input layer, a hidden layer, and an output layer, forward propagation refers to processing in the order of input layer, hidden layer, and output layer. Backpropagation refers to updating the weight parameters of each layer in the order of output layer, hidden layer, and input layer.
[0049] The embodiments of the present application provide a head posture estimation method, apparatus, device, and storage medium that can ensure stable and reliable head posture estimation. The following describes exemplary applications of the electronic device provided by the embodiments of the present application. The electronic device provided by the embodiments of the present application can be implemented as various types of user terminals or as a server.
[0050] By running the head pose estimation solution provided in the embodiments of the present application, electronic devices can ensure the stability and reliability of head pose estimation, that is, improve the stability and reliability of head pose estimation by the electronic device itself, and are suitable for multiple application scenarios of head pose estimation. For example, augmented reality (AR) games, virtual reality (VR) games, helping gaze estimation, modeling attention, fitting 3D models to videos, and performing facial alignment.
[0051] Refer to Figure 1, which is an optional architectural diagram of an application scenario of the head posture estimation solution provided in an embodiment of the present application. In order to support a head posture estimation application, the terminal device 100 (terminal device 1001 and terminal device 1002 are shown as examples) is connected to the server 300 through the network 200, and the server 300 is connected to the database 400. The network 200 can be a wide area network or a local area network, or a combination of the two.
[0052] Among them, the client for implementing the head posture estimation solution is deployed on the terminal device 100, wherein the client can run on the terminal device 100 in the form of a browser, or can run on the terminal device 100 in the form of an independent application (APP). The specific display form of the client is not limited here.
[0053] The server 300 involved in this application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal device 100 can be a smart phone, tablet computer, laptop computer, PDA, personal computer, smart TV, smart watch, car device, wearable device, etc., but is not limited to this. The terminal device 100 and the server 300 can be directly or indirectly connected through the network 200 via wired or wireless communication, and this application does not limit this. The number of servers 300 and terminal devices 100 is also not limited. The solution provided in this application can be completed independently by the terminal device 100, or by the server 300, or by the terminal device 100 and the server 300 in cooperation, and this application does not make specific limitations on this.
[0054] Database 400 can be simply thought of as an electronic filing cabinet—a place where electronic files are stored, where users can perform operations such as adding, querying, updating, and deleting data within the files. A database is a collection of data that is stored in a specific manner, can be shared with multiple users, has minimal redundancy, and is independent of applications. A database management system (DBMS) is a computer software system designed to manage databases, generally providing basic functions such as storage, access, security, and backup. Database management systems can be categorized based on the database model they support, such as relational or Extensible Markup Language (XML); the type of computers they support, such as server clusters and mobile phones; the query language used, such as Structured Query Language (SQL) or XQuery; performance priorities, such as maximum scale or maximum speed; or other classification methods. Regardless of the classification method used, some DBMSs are cross-category, for example, supporting multiple query languages simultaneously. In the present application, the database 400 can be used to store training sample sets and images to be identified. Of course, the storage location of the training sample sets is not limited to the database. For example, it can also be stored in the terminal device 100, blockchain or distributed file system of the server 300.
[0055] In some embodiments, the server 300 can execute the head posture estimation method provided in the embodiments of the present application, and the training method of the first network model in head posture estimation. In this embodiment, the first network model includes a first branch network and a second branch network, wherein the first branch network is used to identify and obtain the two-dimensional key point coordinates and the uncertainty, and the second branch network is used to identify and obtain the three-dimensional key point coordinates. When executing the training method of the first network model, the specific process can be as follows: obtain a first training sample set corresponding to the real 2D key point coordinates and the real 3D key point coordinates from the terminal device 100 and / or the database 400, detect and process the first training sample set through the first initial network model to be trained, and obtain the predicted 2D key point coordinates and predicted 3D key point coordinates of each face in the first training sample set. Optionally, the uncertainty corresponding to the predicted 2D key point coordinates can also be obtained. According to a loss function including pre-designed loss factors (such as interval value and distance factors), determine the first loss value corresponding to the uncertainty corresponding to the predicted 2D key point coordinates and the predicted 2D key point coordinates, and determine the second loss value corresponding to the predicted 3D key point coordinates, and then adjust the parameters of the first branch network according to the first loss value by backpropagation; at the same time, adjust the parameters of the second branch network according to the second loss value by backpropagation, thereby realizing the training of the first initial network model and obtaining the first network model. In this embodiment, the first branch network and the second branch network are trained independently and do not affect the adjustment of parameters of each other. This can improve the generalization ability of the first branch network and the second branch network. In this embodiment, when training the first network model, the server can use Gaussian negative log-likelihood loss (GaussianNLLLoss, GNLL) to calculate the first loss value. In an exemplary solution, the specific calculation process can use Formula 1:
[0056] Among them, N is used to indicate the number of the 2D key points, y is used to indicate the real 2D key point coordinates, f(x) is used to represent the predicted 2D key point coordinates output by the first branch network, and δ is used to represent the uncertainty of the predicted 2D key point coordinates.
[0057] The server may use a regression loss function to calculate the second loss value. In an exemplary solution, the server uses L2LOSS, and its specific calculation process may use Formula 2:
[0058] Among them, N is used to indicate the number of the 3D key points, y is used to indicate the real 3D key point coordinates, and f(x) is used to represent the predicted 3D key point coordinates output by the second branch network.
[0059] When the server 300 trains the first network model, the initial model architecture of the first network model may include a feature extraction network, a fully connected layer, a pooling layer, and the first branch network and the second branch network. The feature extraction network may be a CNN network such as a Residual Neural Network (ResNet), Le Net or AlexNet, or a high-resolution network with a feature pyramid (High-Resolution netV2P, HRNetV2P), or a hierarchical visual self-attention model based on a moving window (Swin Transformer), and the first branch network and the second branch network may be fully connected layers. In an exemplary embodiment, the first network model is described below using the feature extraction network ResNet50 as an example. As shown in Figure 2, the first network model includes the ResNet50, wherein the ResNet50 includes 49 convolutional layers and a fully connected layer, and the fully connected layer is then connected to the pooling layer; the output of the pooling layer is connected to two fully connected layers, one of which is the first branch network and the other is the second branch network. The network input is 224×224×3. After the convolution calculation of the above structure, the output is 7×7×2048. The pooling layer will convert it into a feature vector. Finally, the classifier will calculate this feature vector and output the category probability. The ResNet50 network structure can be divided into seven parts. The first part does not contain residual blocks and mainly performs convolution, regularization, activation function, and maximum pooling on the input. The second, third, fourth, and fifth parts of the structure all contain residual blocks. Their existence does not change the size of the residual blocks, but is only used to change the dimensional structure of the residual blocks. In the Resnet50 network structure, the residual blocks have three layers of convolution, so the network has a total of 1+3×(3+4+6+3)=49 convolution layers, plus the final fully connected layer, a total of 50 layers, which is also the origin of the name Resnet50. The input of the Resnet50 network is 256×256×3. After the convolution calculations in the first five parts, the output is an N×2048×8×8 feature map, where N is the number of samples selected for training (also known as the batch size). The N×2048×8×8 feature map is then passed through the pooling layer to obtain N×2048 features. These N×2048 features are then passed through two FC layers, which output the 2D keypoint coordinates and uncertainty and 3D keypoint coordinates respectively. The weight dimension of each FC layer is 2048×3660 (1220 points), where 3660 is regarded as 1220×3. For the 2D branch, 3 represents the x and y coordinates and the uncertainty δ. For the 3D branch, 3 represents the x, y, and z coordinate values.
[0060] In other embodiments, the server 300 can execute the head posture estimation method provided in the embodiment of the present application, and the training method of the first network model in the head posture estimation. In this embodiment, the first network model includes a first branch network, a second branch network and a computing network, wherein the first branch network is used to identify and obtain the two-dimensional key point coordinates, the second branch network is used to identify and obtain the three-dimensional key point coordinates, and the computing network is used to estimate the head posture based on the 2D key point coordinates and the 3D key point coordinates. When executing the training method of the first network model, the specific process can be as follows: obtain a second training sample set corresponding to the real 2D key point coordinates, the real 3D key point coordinates and the real head posture from the terminal device 100 and / or the database 400, detect and process the second training sample set through the second initial network model to be trained, and obtain the predicted 2D key point coordinates and predicted 3D key point coordinates of each face in the second training sample set. Optionally, the uncertainty corresponding to the predicted 2D key point coordinates can also be obtained, and the uncertainty is calculated based on the two factors including pre-designed loss factors (such as interval value and distance). ) loss function, determine the first loss value corresponding to the predicted 2D key point coordinates and the uncertainty corresponding to the predicted 2D key point coordinates, and determine the second loss value corresponding to the predicted 3D key point coordinates; then calculate the predicted head posture based on the predicted 2D key point coordinates and the predicted 3D key point coordinates, and calculate the third loss value based on the predicted head posture and the actual head posture; and then adjust the parameters of the first branch network and the second branch network based on the first loss value, the second loss value and the third loss value, so as to train the second initial network model to obtain the first network model. In this embodiment, the first branch network and the second branch network can be jointly trained so that the two branches can influence each other and enhance the network learning ability. In this embodiment, when training the first network model, the server can use Gaussian negative log-likelihood loss (GaussianNLLLoss, GNLL) to calculate the first loss value. In an exemplary scheme, the specific calculation process can use Formula 1:
[0061] Among them, N is used to indicate the number of the 2D key points, y is used to indicate the real 2D key point coordinates, f(x) is used to represent the predicted 2D key point coordinates output by the first branch network, and δ is used to represent the uncertainty of the predicted 2D key point coordinates.
[0062] The server may use a regression loss function to calculate the second loss value. In an exemplary solution, the server uses L2LOSS, and its specific calculation process may use Formula 2:
[0063] Among them, N is used to indicate the number of the 3D key points, y is used to indicate the real 3D key point coordinates, and f(x) is used to represent the predicted 3D key point coordinates output by the second branch network.
[0064] When the server 300 trains the first network model, the initial model architecture of the first network model may include a feature extraction network, a fully connected layer, a pooling layer, the first branch network, the second branch network and the computing network. The feature extraction network may be a CNN network such as a Residual Neural Network (ResNet), Le Net or AlexNet, or a high-resolution network with a feature pyramid (High-Resolution netV2P, HRNetV2P), or a hierarchical visual self-attention model based on a moving window (Swin Transformer), and the first branch network and the second branch network may be fully connected layers. In an exemplary embodiment, the first network model is described below using ResNet50 as an example in which the feature extraction network is an example. As shown in Figure 3, the first network model includes ResNet50, wherein the ResNet50 includes 49 convolutional layers and a fully connected layer, and the fully connected layer is then connected to the pooling layer; the output of the pooling layer is connected to two fully connected layers, one of which is the first branch network and the other is the second branch network. The network input is 224×224×3. After the convolution calculation of the above structure, the output is 7×7×2048. The pooling layer will convert it into a feature vector. Finally, the classifier will calculate this feature vector and output the category probability. The ResNet50 network structure can be divided into five parts. The first part does not contain residual blocks and mainly performs convolution, regularization, activation function, and maximum pooling on the input. The second, third, fourth, and fifth parts of the structure all contain residual blocks. Their existence does not change the size of the residual blocks, but is only used to change the dimensional structure of the residual blocks. In the Resnet50 network structure, the residual blocks have three layers of convolution, so the network has a total of 1+3×(3+4+6+3)=49 convolution layers, plus the final fully connected layer, a total of 50 layers, which is also the origin of the name Resnet50. The input of the Resnet50 network is 256×256×3. After the convolution calculations in the first five parts, the output is an N×2048×8×8 feature map, where N is the number of samples selected for training (also known as the batch size). The N×2048×8×8 feature map is then passed through the pooling layer to obtain N×2048 features. These N×2048 features are then passed through two FC layers, which output the 2D keypoint coordinates and uncertainty and 3D keypoint coordinates respectively. The weight dimension of each FC layer is 2048×3660 (1220 points), where 3660 is regarded as 1220×3. For the 2D branch, 3 represents the x and y coordinates and the uncertainty δ. For the 3D branch, 3 represents the x, y, and z coordinate values.The predicted head posture is then calculated based on the predicted 2D key point coordinates and uncertainty output by the first branch network and the predicted 3D key point coordinates output by the second branch network.
[0065] In this embodiment, the data for the first and second training sample sets can be generated using the following technical solution: facial images are captured using the terminal device's built-in depth camera, and then augmented reality technology (ARKit) based on the device system is used to capture 3D facial point cloud data and corresponding head poses in real time. Data acquisition software is developed based on ARKit, and facial data is then acquired at a rate of 60 frames per second. This facial data acquisition based on existing technology can reduce the difficulty of acquiring the training sample sets.
[0066] It is understood that other external cameras can also be used to obtain the first and second training sample sets. The external camera can be a depth camera or other cameras, that is, as long as it can achieve facial data collection, the specific method is not limited here. Using external devices to collect facial data can reduce hardware requirements and thus reduce costs.
[0067] After training the first network model, the server 300 can save the first network model locally, thereby providing a remote head pose estimation function for the terminal device 100. For example, the server 300 can receive an image to be recognized sent by the terminal device 100, and detect and process the image to be recognized using the first network model to obtain the head pose and confidence probability corresponding to the target face image in the image to be recognized; finally, the head pose is sent to the terminal device 100 so that the terminal device 100 displays the head pose in the graphical interface 110 (graphical interface 1101 and graphical interface 1102 are shown as examples).
[0068] The server 300 may also send (deploy) the trained first network model to the terminal device 100, thereby locally implementing head pose estimation on the terminal device 100. For example, the terminal device 100 may obtain an image to be recognized in real time or obtain an image to be recognized from another device, and perform detection and processing on the image to be recognized using the first network model to obtain the head pose and confidence probability corresponding to the target face image in the image to be recognized; finally, the terminal device 100 displays the head pose in the graphical interface 110 (graphical interface 1101 and graphical interface 1102 are shown as examples).
[0069] Based on the above system, as shown in FIG4 , an execution flow of the head posture estimation method in this application can be as follows:
[0070] Step 1: Generate an image to be recognized for the target face. In this embodiment, the image to be recognized includes a target face image, wherein the target face image refers to the area of the image to be recognized that only includes the face image, and does not include other background images. As shown in Figure 5, Figure 5 (a) is an image including a background image, and Figure 5 (b) is an image to be recognized that includes the target face image. In this embodiment, various cameras can first capture the image to be processed that includes other background images, and then pre-process the image to be processed to obtain the image to be recognized. The specific process can be shown in Figure 6: the image to be processed a is captured by the camera; then, sparse key points in the image to be processed a are obtained through face detection, wherein the sparse key points can be facial features and facial contour points; then, the target face image is extracted from the image to be processed based on the facial contour points; then, the target face image is horizontally aligned using the eye key points among the facial features, and the image is scaled to the target size, thereby obtaining the image to be recognized.
[0071] Step 2: The image to be identified is detected by the first network model to obtain 2D key point coordinates and the uncertainty of the 2D key point coordinates, as well as 3D key point coordinates.
[0072] Step 3: Screen the 2D key point coordinates and the 3D key point coordinates according to the uncertainty to obtain target 2D key point coordinates and target 3D key point coordinates whose uncertainty is less than a prediction threshold.
[0073] Step 4: Use the PnP algorithm to estimate the head posture corresponding to the target face image using the target 2D key point coordinates and the target 3D key point coordinates.
[0074] It is understandable that in the specific implementation of this application, related data such as images to be detected and training sample sets are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0075] In combination with the above introduction, the head posture estimation method in this application is introduced below, taking the terminal device as the execution subject as an example. Please refer to Figure 7a. An embodiment of the head posture estimation method in this application includes:
[0076] 701. Obtain an image to be recognized, where the image to be recognized includes a target face image.
[0077] The terminal device can capture the image to be processed through its own camera, and then input the image to be processed into the image processing model for processing to obtain the image to be identified. Alternatively, the terminal device can also obtain the image to be identified stored in the memory. Alternatively, the terminal device can also obtain the image to be identified through an instant messaging application, where an instant messaging application refers to software that uses instant messaging technology to enable online chatting and communication. Alternatively, the terminal device can also obtain the image to be identified from the Internet, for example, obtaining a video image from an Internet video network, extracting a facial image from the video image, or directly downloading a facial image from the Internet.
[0078] In an exemplary scheme, the specific process can be as follows: obtaining an image to be processed, which includes a target facial image captured by a camera, and then determining the sparse key points of the target facial image in the image to be processed through an image preprocessing network, wherein the sparse key points include the facial features and facial contour points of the target facial image; obtaining the target facial image from the image to be processed based on the facial contour points; horizontally aligning the target facial image based on the facial features and scaling it to the target size to obtain the image to be identified.
[0079] The target facial image refers to the image to be identified that only includes the facial image and no longer includes other background images. As shown in Figure 5, Figure 5 (a) shows an image that includes the background image, while Figure 5 (b) shows the image to be identified that includes the target facial image. In this embodiment, various cameras can first capture the image to be processed that includes the background image, and then preprocess the image to be processed to obtain the image to be identified.
[0080] The specific process can be shown in Figure 6: the image a to be processed is captured by the camera; then the image a to be processed is subjected to face detection through the image preprocessing network to obtain sparse key points in the image a to be processed, wherein the sparse key points can be facial features and facial contour points; then the target face image is extracted from the image a to be processed based on the facial contour points; then the target face image is horizontally aligned using the eye key points in the facial features, and the horizontally aligned target face image is scaled to a preset target size, thereby obtaining the image to be recognized.
[0081] 702. Perform key point recognition processing based on the image to be recognized through a first network model to obtain a two-dimensional key point coordinate set of the target facial image in the image to be recognized, and a three-dimensional key point coordinate set of the target facial image, wherein the first network model includes a first branch network and a second branch network, wherein the first branch network is used to identify the two-dimensional key point coordinate set, and the second branch network is used to identify the three-dimensional key point coordinate set.
[0082] In addition, through the first network model, key point processing is performed based on the image to be identified, and the uncertainty corresponding to each two-dimensional key point in the above-mentioned two-dimensional key point coordinate set can also be obtained. The uncertainty is obtained by the first branch network identification in the above-mentioned first network model.
[0083] The terminal device inputs the image to be identified into the first network model, and then the feature extraction network of the first network model performs corresponding feature extraction on the image to be identified to obtain the final feature representation of the image to be identified; then the final feature representation is input into the first branch network and the second branch network of the first network model respectively; wherein, the first branch network will output the two-dimensional key point coordinates (i.e., 2D key point coordinates) set and uncertainty of the target face image in the image to be identified; the second branch network will output the three-dimensional key point coordinates (i.e., 3D key point coordinates) set of the target face image in the image to be identified.
[0084] It can be understood that the training process of the first network model in this application can refer to Figures 2 to 3, and the details will not be repeated here.
[0085] 703. Determine the head posture corresponding to the target face image in the image to be recognized based on the two-dimensional key point coordinate set and the three-dimensional key point coordinate set.
[0086] It should be understood that when the first network model also outputs the uncertainty corresponding to each two-dimensional key point coordinate in the two-dimensional key point coordinate set, the terminal device can determine the head posture corresponding to the target face image in the image to be identified based on the two-dimensional key point coordinate set, the uncertainty corresponding to each two-dimensional key point coordinate in the two-dimensional key point coordinate set and the three-dimensional key point coordinate set.
[0087] In this embodiment, the terminal device can filter the 2D keypoint coordinates in the 2D keypoint coordinate set and the 3D keypoint coordinates in the 3D keypoint coordinate set based on the uncertainty to obtain intermediate 3D keypoint coordinates and intermediate 2D keypoint coordinates. The terminal device then uses a PnP algorithm to solve the head pose corresponding to the target facial image based on the intermediate 3D keypoint coordinates and intermediate 2D keypoint coordinates. In one exemplary embodiment, the terminal device sorts the uncertainties corresponding to the 2D keypoint coordinates, removes the 20% of 2D keypoint coordinates with the largest uncertainties, and uses the retained intermediate 2D keypoint coordinates to determine the corresponding intermediate 3D keypoint coordinates. The terminal device then uses a PnP algorithm to solve the head pose based on the retained intermediate 2D keypoint coordinates and intermediate 3D keypoint coordinates. In one exemplary embodiment, the terminal device can use the solvePnP algorithm built into OpenCV. This algorithm iteratively solves the pose so that the intermediate 3D keypoint coordinates, after projection through the pose, are as close as possible to the intermediate 2D keypoint coordinates.
[0088] In this way, the two-dimensional key point coordinates with higher uncertainty are eliminated, and head posture estimation is performed only based on the two-dimensional key point coordinates with lower uncertainty and their corresponding three-dimensional key point coordinates. This can effectively avoid the key points with higher uncertainty from affecting the final posture estimation results, that is, avoid the negative effects caused by key points with higher uncertainty, thereby making the head posture solution more reliable and robust.
[0089] It is understood that the technical solutions provided in the embodiments of this application can be applied to virtual image construction, assisting gaze estimation, modeling attention, fitting 3D models to videos, and performing facial alignment. In an exemplary application scenario, the construction of a game character is used as an example. The gaming device collects the user's facial data through a camera and estimates the head posture, thereby generating an image of a virtual object corresponding to the user. This virtual object then interacts with other virtual objects in the game, thereby achieving game interaction.
[0090] Among them, the facial data collected by the gaming device through the camera and the process of generating a virtual object based on the facial data can be shown in Figure 7b. As shown in Figure 7b, the head movement of the game character is generated by collecting facial movements. Specifically, the collected image to be processed can be shown as (a) in Figure 7b, that is, the head movement displayed by the target face image is a tilted head; then the head posture estimation provided by the embodiment of the present application is obtained as shown in (b) in Figure 7b, that is, the head movement of the corresponding game character is synchronously displayed with a tilted head. In Figure 7b, the head movement of the corresponding virtual object is generated by collecting the user's facial movement, thereby improving the game interaction experience, and at the same time, the head movement of the virtual object is synchronized in real time, thereby improving the data processing efficiency.
[0091] In practical applications, this head pose estimation method can also be applied to live broadcasts or video recordings. Specifically, if a user doesn't want to appear in their real appearance during a live broadcast, a camera can be used to capture their facial data, generate a corresponding avatar based on that facial data, and then use that avatar for live broadcasts or video recordings. This allows the avatar's movements to be synchronized with the user's, effectively enabling interaction between the user and the viewer while protecting their privacy.
[0092] The beneficial effects of the technical solution provided by this application are described below with a specific example:
[0093] A dataset of approximately 500,000 images of 40 people was obtained to evaluate the technical performance of the methods provided in this application and other methods. Three methods were evaluated: 1. Directly estimating the 6DOF parameters; 2. Using the PnP approach without estimating uncertainty; and 3. Using the technical solution provided in this application. The results are shown in Table 1:
[0094] Table 1
[0095] As shown in Table 1, the six dimensions of 6DoF are compared: pitch, yaw, roll, tx, ty, and tz. The results show that the technical solution provided by this application significantly outperforms other methods in all dimensions.
[0096] The head posture estimation device in the present application is described in detail below. Please refer to FIG8 , which is a schematic diagram of an embodiment of the head posture estimation device in the present application. The head posture estimation device 20 includes:
[0097] An acquisition module 201 is configured to acquire an image to be recognized, wherein the image to be recognized includes a target face image;
[0098] A processing module 202 is configured to perform key point recognition processing based on the image to be recognized using a first network model to obtain a two-dimensional key point coordinate set of a target facial image in the image to be recognized and a three-dimensional key point coordinate set of the target facial image, wherein the first network model includes a first branch network and a second branch network, wherein the first branch network is configured to recognize the two-dimensional key point coordinate set, and the second branch network is configured to recognize the three-dimensional key point coordinate set;
[0099] The output module 203 is configured to determine the head posture corresponding to the target face image in the image to be recognized based on the two-dimensional key point coordinate set and the three-dimensional key point coordinate set.
[0100] An embodiment of the present application provides a head pose estimation device. Using the above device, two branch networks are used to output the 2D keypoint coordinates and 3D keypoint coordinates of the target facial image in the image to be identified. The head pose of the target facial image is then calculated based on the 2D keypoint coordinates and the 3D keypoint coordinates. Because the 3D keypoint coordinates can be acquired in real time, the 3D head model can change with changes in facial expression. Accordingly, the coordinate correspondence between the 2D keypoints and the 3D keypoints is more accurate, thereby ensuring stable and reliable head pose estimation when making large facial expressions.
[0101] Optionally, based on the embodiment corresponding to FIG8 , in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application,
[0102] The processing module 202 is specifically configured to perform key point recognition processing based on the image to be recognized using the first network model to obtain a two-dimensional key point coordinate set, an uncertainty corresponding to each two-dimensional key point coordinate in the two-dimensional key point coordinate set, and a three-dimensional key point coordinate set; wherein the first branch network in the first network model is further configured to identify the uncertainty corresponding to each two-dimensional key point coordinate in the two-dimensional key point coordinate set;
[0103] The output module 203 is specifically configured to determine the head posture corresponding to the target face image in the image to be recognized based on the two-dimensional key point coordinate set, the uncertainty, and the three-dimensional key point coordinate set.
[0104] Optionally, based on the embodiment corresponding to FIG8 , in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application,
[0105] The output module 203 is specifically configured to remove the two-dimensional key point coordinates whose corresponding uncertainty is greater than a preset threshold from the two-dimensional key point coordinate set to obtain an intermediate two-dimensional key point coordinate set;
[0106] Obtaining an intermediate three-dimensional key point coordinate set from the three-dimensional key point coordinate set according to the intermediate two-dimensional key point coordinate set;
[0107] The head posture corresponding to the target face image in the image to be recognized is determined according to the intermediate two-dimensional key point coordinate set and the intermediate three-dimensional key point coordinate set.
[0108] The present invention provides a head pose estimation device. Using the device, the 2D keypoint coordinates and the 3D keypoint coordinates are filtered based on the corresponding uncertainty of the 2D keypoint coordinates, thereby removing points with large uncertainty when performing head pose estimation, making the head pose estimation more robust.
[0109] Optionally, based on the embodiment corresponding to the above-mentioned Figure 8, in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the output module 203 is specifically used to use PnP solution to determine the head posture corresponding to the target face image in the image to be identified based on the intermediate two-dimensional key point coordinate set and the intermediate three-dimensional key point coordinate set.
[0110] The embodiment of the present application provides a head posture estimation device. Using the above device, posture estimation is performed using a PnP solution method, making the head posture estimation more feasible.
[0111] Optionally, based on the embodiment corresponding to FIG8 , another embodiment of the head posture estimation device 20 provided in the embodiment of the present application is shown in FIG9 :
[0112] The acquisition module 201 is further configured to acquire a first training sample set, wherein the first training sample set includes training samples of a real two-dimensional key point coordinate set and a real three-dimensional key point coordinate set annotated with a face image;
[0113] The head posture estimation apparatus further includes a training module 204 for performing feature extraction processing on the face images corresponding to the training samples in the first training sample set through a feature extraction network layer in the first initial network model to be trained, to obtain feature representations of the training samples;
[0114] Determining, by an initial first branch network in the first initial network model, a set of predicted two-dimensional key point coordinates corresponding to the training sample based on the feature representation of the training sample; and determining, by an initial second branch network in the first initial network model, a set of predicted three-dimensional key point coordinates corresponding to the training sample based on the feature representation of the training sample;
[0115] Calculate a first loss value based on the predicted two-dimensional key point coordinate set and the real two-dimensional key point coordinate set in the training sample, and calculate a second loss value based on the predicted three-dimensional key point coordinate set and the real three-dimensional key point coordinate set in the training sample;
[0116] Adjusting the initial first branch network according to the first loss value to obtain the first branch network, and adjusting the initial second branch network according to the second loss value to obtain the second branch network;
[0117] The first network model is obtained according to the first branch network and the second branch network.
[0118] An embodiment of the present application provides a head posture estimation device. Using the above-mentioned device, the first branch network and the second branch network are trained during the training process, and the 2D key point coordinates and 3D key point coordinates of the target face image in the image to be identified are respectively output through the two branch networks, and then the head posture of the target face image is calculated based on the 2D key point coordinates and the 3D key point coordinates. Among them, since the 3D key point coordinates can be obtained in real time, the 3D head model can change with the change of expression. Accordingly, the coordinate correspondence between the 2D key point and the 3D key point is more accurate, thereby ensuring the stability and reliability of the head posture estimation when making large expressions. At the same time, the first branch network and the second branch network are trained independently, which can increase the generalization of the model.
[0119] Optionally, based on the embodiment corresponding to FIG. 9 , in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the training module 204 is specifically configured to:
[0120] Determining, by the initial first branch network, a set of predicted two-dimensional key point coordinates corresponding to the training sample and a prediction uncertainty corresponding to each predicted key point coordinate in the set of predicted two-dimensional key point coordinates based on the feature representation of the training sample;
[0121] The first loss value is calculated according to the predicted two-dimensional key point coordinate set, the prediction uncertainty and the real two-dimensional key point coordinate set.
[0122] Optionally, based on the embodiment corresponding to FIG9 above, in another embodiment of the head posture estimation device 20 provided in an embodiment of the present application, the acquisition module 201 is specifically configured to acquire a training image set through a depth camera, wherein each training image in the training image set includes three-dimensional point cloud data of a face image and a real head posture;
[0123] Performing posture projection on the three-dimensional point cloud data to obtain two-dimensional key point data of the face image in the training image;
[0124] The first training sample set is determined based on the training image set through an image processing network.
[0125] The embodiment of the present application provides a head pose estimation device. By using the above device and capturing training images with a depth camera, the 3D point cloud data and the real head pose can be more conveniently obtained, thereby simplifying the process of obtaining a training sample set.
[0126] Optionally, based on the embodiment corresponding to FIG. 9 , in another embodiment of the head pose estimation device 20 provided in an embodiment of the present application, the acquisition module 201 is specifically configured to determine, through the image processing network, sparse key points of a facial image in the training image based on the training image in the training image set, the sparse key points including facial features and facial contour points of the facial image in the training image;
[0127] Acquire the face image from the training image according to the face contour points;
[0128] The facial image is horizontally aligned according to the facial features and scaled to a target size to obtain training samples in the first training sample set.
[0129] This embodiment of the present application provides a head pose estimation device. Using this device, facial images are cropped and aligned using sparse key points, reducing interference from background information in camera-generated images. Scaling the images to a uniform size facilitates feature extraction and reduces training difficulty.
[0130] Optionally, based on the embodiment corresponding to FIG. 9 above, in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the sparse key points include at least five facial feature points and four facial contour points.
[0131] The embodiment of the present application provides a head posture estimation device. Using the above device, the image pre-processing process can be reduced while ensuring accurate cutout and alignment.
[0132] Optionally, based on the embodiment corresponding to Figure 9 above, in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the feature extraction network includes a residual neural network ResNet and a pooling layer, the first branch network is a fully connected layer, and the second branch network is a fully connected layer.
[0133] The embodiment of the present application provides a head posture estimation device. Using the above device can increase the feasibility of the solution.
[0134] Optionally, based on the embodiment corresponding to the above-mentioned Figure 9, in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the training module 204 is specifically used to use Gaussian negative log-likelihood loss to calculate a first loss value based on the predicted two-dimensional key point coordinate set, the prediction uncertainty and the true two-dimensional key point coordinate set; and use the regression loss function to calculate a second loss value based on the predicted three-dimensional key point coordinate set and the true three-dimensional key point coordinate set.
[0135] The embodiment of the present application provides a head posture estimation device. Using the above device can increase the feasibility of the solution.
[0136] Optionally, based on the embodiment corresponding to FIG8 , in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, as shown in FIG9 ,
[0137] The acquisition module 201 is specifically configured to acquire a second training sample set, wherein the second training sample set includes a real two-dimensional key point coordinate set, a real three-dimensional key point coordinate set, and real head posture training samples annotated with a face image;
[0138] The head posture estimation apparatus further includes a training module 204 for performing feature extraction processing on the face image corresponding to the training sample in the second training sample set through a feature extraction network layer in the second initial network model to be trained, to obtain a feature representation of the training sample;
[0139] Determining, by the initial first branch network in the second initial network model, a set of predicted two-dimensional key point coordinates corresponding to the training sample based on the feature representation of the training sample; and determining, by the initial second branch network in the second initial network model, a set of predicted three-dimensional key point coordinates corresponding to the training sample based on the feature representation of the training sample;
[0140] Calculating a predicted head posture based on the predicted two-dimensional key point coordinate set and the predicted three-dimensional key point coordinate set by a computing network in the second initial network model;
[0141] Calculating a first loss value based on the predicted two-dimensional key point coordinate set and the true two-dimensional key point coordinate set in the training sample, calculating a second loss value based on the predicted three-dimensional key point coordinate set and the true three-dimensional key point coordinate set in the training sample, and calculating a third loss value based on the predicted head pose and the true head pose in the training sample;
[0142] The second initial network model is adjusted according to the first loss value, the second loss value, and the third loss value to obtain the first network model.
[0143] An embodiment of the present application provides a head posture estimation device. Using the above-mentioned device, the first branch network and the second branch network are trained during the training process, and the 2D key point coordinates and 3D key point coordinates of the target face image in the image to be identified are respectively output through the two branch networks, and then the head posture of the target face image is calculated based on the 2D key point coordinates and the 3D key point coordinates. Among them, since the 3D key point coordinates can be obtained in real time, the 3D head model can change with the change of expression. Accordingly, the coordinate correspondence between the 2D key point and the 3D key point is more accurate, so that when making large expressions, the solution of the head posture is stable and reliable. At the same time, the first branch network and the second branch network are jointly trained to increase the learnability of the model.
[0144] Optionally, based on the embodiment corresponding to FIG. 9 , in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the training module 204 is specifically configured to:
[0145] Determining, by the initial first branch network, a set of predicted two-dimensional key point coordinates corresponding to the training sample and a prediction uncertainty corresponding to each predicted key point coordinate in the set of predicted two-dimensional key point coordinates based on the feature representation of the training sample;
[0146] The first loss value is calculated according to the predicted two-dimensional key point coordinate set, the prediction uncertainty and the real two-dimensional key point coordinate set.
[0147] Optionally, based on the embodiment corresponding to Figure 9 above, in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the feature extraction network includes a residual neural network ResNet and a pooling layer, the first branch network is a fully connected layer, and the second branch network is a fully connected layer; the computing network is a differentiable PnP solution network.
[0148] The embodiment of the present application provides a head posture estimation device. Using the above device can increase the feasibility of the solution.
[0149] Optionally, based on the embodiment corresponding to FIG8 , in another embodiment of the head posture estimation device 20 provided in the embodiment of the present application, the acquisition module 201 is specifically configured to acquire an image to be processed, where the image to be processed includes a target face image captured by a camera;
[0150] Determine, through an image preprocessing network, sparse key points of a target face image in the image to be processed, wherein the sparse key points include facial features and facial contour points of the target face image;
[0151] Acquire the target face image from the image to be processed according to the face contour points;
[0152] The target face image is horizontally aligned according to the facial features and scaled to a target size to obtain the image to be recognized.
[0153] This embodiment of the present application provides a head pose estimation device. Using this device, a facial image is cropped and aligned using sparse key points, thereby reducing interference from background information in the image captured by the camera. Scaling the image to a uniform size facilitates feature extraction.
[0154] The head posture estimation device provided by the present application can be used in a server. Please refer to Figure 10. Figure 10 is a schematic diagram of a server structure provided by an embodiment of the present application. The server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) for storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be temporary storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 322 can be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.
[0155] The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows Server 2003 or Windows Server 2003R. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.
[0156] The steps executed by the server in the above embodiment may be based on the server structure shown in FIG10 .
[0157] The head posture estimation device provided by this application can be used in terminal devices. Please refer to Figure 11. For the sake of convenience, only the parts related to the embodiment of this application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of this application. In the embodiment of this application, the terminal device is a smartphone as an example for explanation:
[0158] FIG11 is a block diagram showing a partial structure of a smartphone related to a terminal device provided in an embodiment of the present application. Referring to FIG11 , the smartphone includes components such as a radio frequency (RF) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and a power supply 490. It will be understood by those skilled in the art that the smartphone structure shown in FIG11 does not constitute a limitation on the smartphone, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0159] The following is a detailed introduction to the various components of a smartphone with reference to FIG11:
[0160] The RF circuit 410 can be used to receive and send signals during information transmission or calls. In particular, after receiving the downlink information from the base station, it is sent to the processor 480 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 410 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 410 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the global system of mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short messaging service (SMS), etc.
[0161] The memory 420 can be used to store software programs and modules. The processor 480 executes the various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created based on the use of the smartphone (such as audio data, a phone book, etc.). In addition, the memory 420 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0162] The input unit 430 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the smartphone. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 431) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 431 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 480, and can receive commands sent by the processor 480 and execute them. In addition, the touch panel 431 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 431, the input unit 430 may further include other input devices 432. Specifically, the other input devices 432 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power keys, etc.), a trackball, a mouse, and a joystick.
[0163] The display unit 440 can be used to display information input by the user or information provided to the user and various menus of the smartphone. The display unit 440 may include a display panel 441. Optionally, the display panel 441 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 431 may cover the display panel 441. When the touch panel 431 detects a touch operation on or near it, it is transmitted to the processor 480 to determine the type of touch event. Subsequently, the processor 480 provides a corresponding visual output on the display panel 441 according to the type of touch event. Although in Figure 11, the touch panel 431 and the display panel 441 are used as two independent components to implement the input and output functions of the smartphone, in some embodiments, the touch panel 431 and the display panel 441 can be integrated to implement the input and output functions of the smartphone.
[0164] The smartphone may also include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 441 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 441 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the smartphone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the smartphone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.
[0165] Audio circuit 460, speaker 461, and microphone 462 provide an audio interface between the user and the smartphone. Audio circuit 460 converts received audio data into electrical signals and transmits them to speaker 461, where they are converted into sound signals for output. Microphone 462, on the other hand, converts collected sound signals into electrical signals, which are then received by audio circuit 460 and converted into audio data. The audio data is then output to processor 480 for processing, then sent to, for example, another smartphone via RF circuit 410, or stored in memory 420 for further processing.
[0166] WiFi is a short-range wireless transmission technology. Smartphones use WiFi module 470 to help users send and receive emails, browse the web, and access streaming media, providing users with wireless broadband internet access. Although FIG11 shows WiFi module 470, it is understood that it is not a required component of a smartphone and can be omitted as needed without changing the essence of the invention.
[0167] Processor 480 is the control center of the smartphone, connecting all components of the smartphone using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 420 and accessing data stored in memory 420, it executes various smartphone functions and processes data, thereby providing overall smartphone monitoring. Optionally, processor 480 may include one or more processing units; alternatively, processor 480 may integrate an application processor and a modem processor, with the application processor primarily handling the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 480.
[0168] The smartphone also includes a power supply 490 (such as a battery) for supplying power to various components. Optionally, the power supply can be logically connected to the processor 480 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0169] Although not shown, the smartphone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0170] The steps executed by the terminal device in the above embodiment may be based on the terminal device structure shown in FIG11 .
[0171] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0172] An embodiment of the present application also provides a computer program product including a program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0173] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0174] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0175] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0176] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0177] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0178] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A head posture estimation method, performed by a computer device, comprising: Acquire an image to be identified, wherein the image to be identified includes a target face image; By using a first network model, key point recognition processing is performed based on the image to be recognized, so as to obtain a two-dimensional key point coordinate set of the target face image in the image to be recognized, and a three-dimensional key point coordinate set of the target face image, wherein the first network model includes a first branch network and a second branch network, wherein the first branch network is used to recognize the two-dimensional key point coordinate set, and the second branch network is used to recognize the three-dimensional key point coordinate set; The head posture corresponding to the target face image in the image to be recognized is determined according to the two-dimensional key point coordinate set and the three-dimensional key point coordinate set.
2. According to the method of claim 1, the step of performing key point recognition processing based on the image to be recognized by the first network model to obtain a two-dimensional key point coordinate set of the target face image in the image to be recognized and a three-dimensional key point coordinate set of the target face image, comprising: By using the first network model, key point recognition processing is performed based on the image to be recognized, so as to obtain the two-dimensional key point coordinate set, the uncertainty corresponding to each two-dimensional key point coordinate in the two-dimensional key point coordinate set, and the three-dimensional key point coordinate set; wherein the first branch network in the first network model is also used to identify the uncertainty corresponding to each two-dimensional key point coordinate in the two-dimensional key point coordinate set; The step of determining the head posture corresponding to the target face image in the image to be recognized according to the two-dimensional key point coordinate set and the three-dimensional key point coordinate set includes: The head posture corresponding to the target face image in the image to be recognized is determined according to the two-dimensional key point coordinate set, the uncertainty and the three-dimensional key point coordinate set.
3. The method according to claim 2, wherein determining the head posture corresponding to the target face image in the image to be identified according to the two-dimensional key point coordinate set, the uncertainty and the three-dimensional key point coordinate set comprises: Eliminate the two-dimensional key point coordinates whose corresponding uncertainties are greater than a preset threshold from the two-dimensional key point coordinate set to obtain an intermediate two-dimensional key point coordinate set; According to the intermediate two-dimensional key point coordinate set, obtaining an intermediate three-dimensional key point coordinate set from the three-dimensional key point coordinate set; The head posture corresponding to the target face image in the image to be recognized is determined according to the intermediate two-dimensional key point coordinate set and the intermediate three-dimensional key point coordinate set.
4. The method according to claim 3, wherein determining the head posture corresponding to the target face image in the image to be identified according to the intermediate two-dimensional key point coordinate set and the intermediate three-dimensional key point coordinate set comprises: The head posture corresponding to the target face image in the image to be identified is determined by using the PnP solution according to the intermediate two-dimensional key point coordinate set and the intermediate three-dimensional key point coordinate set.
5. The method according to any one of claims 1 to 4, further comprising: Acquire a first training sample set, wherein the first training sample set includes training samples of a real two-dimensional key point coordinate set and a real three-dimensional key point coordinate set annotated with a face image; Performing feature extraction processing on the face images corresponding to the training samples in the first training sample set through the feature extraction network layer in the first initial network model to be trained, so as to obtain feature representations of the training samples; Determine, by means of an initial first branch network in the first initial network model, a set of predicted two-dimensional key point coordinates corresponding to the training sample according to the feature representation of the training sample; determine, by means of an initial second branch network in the first initial network model, a set of predicted three-dimensional key point coordinates corresponding to the training sample according to the feature representation of the training sample; Calculate a first loss value based on the predicted two-dimensional key point coordinate set and the real two-dimensional key point coordinate set in the training sample, and calculate a second loss value based on the predicted three-dimensional key point coordinate set and the real three-dimensional key point coordinate set in the training sample; Adjusting the initial first branch network according to the first loss value to obtain the first branch network, and adjusting the initial second branch network according to the second loss value to obtain the second branch network; The first network model is obtained according to the first branch network and the second branch network.
6. The method according to claim 5, wherein determining the predicted two-dimensional key point coordinate set corresponding to the training sample according to the feature representation of the training sample through the initial first branch network in the first initial network model comprises: Determining, by the initial first branch network, a set of predicted two-dimensional key point coordinates corresponding to the training sample and prediction uncertainties corresponding to respective predicted key point coordinates in the set of predicted two-dimensional key point coordinates according to the feature representation of the training sample; The calculating the first loss value according to the predicted two-dimensional key point coordinate set and the real two-dimensional key point coordinate set in the training sample comprises: The first loss value is calculated according to the predicted two-dimensional key point coordinate set, the prediction uncertainty and the real two-dimensional key point coordinate set.
7. The method according to claim 5 or 6, wherein obtaining the first training sample set comprises: Collecting a training image set by a depth camera, each training image in the training image set includes three-dimensional point cloud data of a face image and a real head posture; Performing posture projection on the three-dimensional point cloud data to obtain two-dimensional key point data of the face image in the training image; The first training sample set is determined according to the training image set through an image processing network.
8. The method according to claim 7, wherein determining the first training sample set according to the training image set through an image processing network comprises: Determining, by the image processing network, sparse key points of a face image in the training image according to the training image in the training image set, wherein the sparse key points include facial features and facial contour points of the face image; Acquire the face image from the training image according to the face contour points; The face images are horizontally aligned according to the facial features and scaled to a target size to obtain training samples in the first training sample set.
9. The method according to claim 8, wherein the sparse key points include at least five facial feature points and four facial contour points.
10. According to the method according to any one of claims 5 to 9, the feature extraction network includes a residual neural network ResNet and a pooling layer, the first branch network is a fully connected layer, and the second branch network is a fully connected layer.
11. The method according to any one of claims 6 to 9, wherein the calculating the first loss value according to the predicted two-dimensional key point coordinate set, the prediction uncertainty and the real two-dimensional key point coordinate set comprises: Calculating the first loss value according to the predicted two-dimensional key point coordinate set, the prediction uncertainty and the true two-dimensional key point coordinate set by using Gaussian negative log-likelihood loss; Calculating a second loss value according to the predicted three-dimensional key point coordinate set and the real three-dimensional key point coordinate set in the training sample includes: The second loss value is calculated according to the predicted three-dimensional key point coordinate set and the real three-dimensional key point coordinate set by using a regression loss function.
12. The method according to any one of claims 1 to 4, further comprising: Acquire a second training sample set, wherein the second training sample set includes a real two-dimensional key point coordinate set, a real three-dimensional key point coordinate set, and real head posture training samples annotated with a face image; Performing feature extraction processing on the face images corresponding to the training samples in the second training sample set through the feature extraction network layer in the second initial network model to be trained, so as to obtain feature representations of the training samples; Determine, by means of an initial first branch network in the second initial network model, a set of predicted two-dimensional key point coordinates corresponding to the training sample according to the feature representation of the training sample; determine, by means of an initial second branch network in the second initial network model, a set of predicted three-dimensional key point coordinates corresponding to the training sample according to the feature representation of the training sample; Calculating, by a computing network in the second initial network model, a predicted head posture according to the predicted two-dimensional key point coordinate set and the predicted three-dimensional key point coordinate set; Calculating a first loss value according to the predicted two-dimensional key point coordinate set and the real two-dimensional key point coordinate set in the training sample, calculating a second loss value according to the predicted three-dimensional key point coordinate set and the real three-dimensional key point coordinate set in the training sample, and calculating a third loss value according to the predicted head posture and the real head posture in the training sample; The second initial network model is adjusted according to the first loss value, the second loss value and the third loss value to obtain the first network model.
13. The method according to claim 12, wherein determining the predicted two-dimensional key point coordinate set corresponding to the training sample according to the feature representation of the training sample through the initial first branch network in the second initial network model comprises: Determining, by the initial first branch network, a set of predicted two-dimensional key point coordinates corresponding to the training sample and prediction uncertainties corresponding to respective predicted key point coordinates in the set of predicted two-dimensional key point coordinates according to the feature representation of the training sample; The calculating the first loss value according to the predicted two-dimensional key point coordinate set and the real two-dimensional key point coordinate set in the training sample comprises: The first loss value is calculated according to the predicted two-dimensional key point coordinate set, the prediction uncertainty and the real two-dimensional key point coordinate set.
14. According to the method of claim 12 or 13, the feature extraction network includes a residual neural network ResNet and a pooling layer, the first branch network is a fully connected layer, and the second branch network is a fully connected layer; the computing network is a differentiable PnP solution network.
15. The method according to any one of claims 1 to 14, wherein acquiring the image to be identified comprises: Acquire an image to be processed, wherein the image to be processed includes a target face image captured by a camera; Determine the sparse key points of the target face image in the image to be processed through an image preprocessing network, wherein the sparse key points include the facial features and facial contour points of the target face image; Acquire the target face image from the image to be processed according to the face contour points; The target face image is horizontally aligned according to the facial features and scaled to a target size to obtain the image to be recognized.
16. A head posture estimation device, comprising: An acquisition module, used for acquiring an image to be recognized, wherein the image to be recognized includes a target face image; A processing module, configured to perform key point recognition processing based on the image to be recognized through a first network model to obtain a two-dimensional key point coordinate set of the target face image in the image to be recognized and a three-dimensional key point coordinate set of the target face image, wherein the first network model includes a first branch network and a second branch network, wherein the first branch network is used to recognize the two-dimensional key point coordinate set, and the second branch network is used to recognize the three-dimensional key point coordinate set; The output module is used to determine the head posture corresponding to the target face image in the image to be recognized according to the two-dimensional key point coordinate set and the three-dimensional key point coordinate set.
17. A computer device comprising: Memory, processor, and bus system; Wherein, the memory is used to store programs; The processor is used to execute the program in the memory, and the processor is used to execute the method according to any one of claims 1 to 15 according to the instructions in the program code; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
18. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to perform the method according to any one of claims 1 to 15.
19. A computer program product, comprising a computer program or instructions, wherein when the computer program or the instructions are executed by a processor, the method according to any one of claims 1 to 15 is implemented.
