A method for detecting 3D key points of human face based on RGBD camera
By moving the RGBD camera around the face to obtain multi-view data, using the TSDF model and PFLD model, combined with the ICP and Marching Cubes algorithms, high-precision and complete 3D key point detection of the face is achieved, solving the detection accuracy and problem in the existing technology. Insufficient completeness problem.
Patent Information
- Application Number
- CN202211609939.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-12
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2042-12-12
AI Technical Summary
Existing 3D face key point detection algorithms have deficiencies in accuracy and completeness. Monocular cameras lack depth information, and binocular cameras cannot observe some key points at the same time, resulting in high but incomplete detection accuracy. RGBD cameras also have the same problem and cannot Meet high accuracy and integrity requirements.
By moving the RGBD camera around the face, RGB images and depth images from multiple perspectives are obtained, converted into point clouds and merged into the world coordinate system, the TSDF model and ICP algorithm are used to update the transformation matrix, and the key points of the face are extracted using the PFLD model. Marching Cubes algorithm and Poisson reconstruction obtain high-precision three-dimensional face key points.
It achieves high-precision and complete 3D key point detection on faces, covers the complete face through multi-view data, and solves the problem of incomplete reconstruction caused by the inability of RGB cameras and depth cameras to observe some key points at the same time.
Smart Images

Figure CN115984461B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional key point detection of human faces, and in particular to a three-dimensional key point detection method of human faces based on an RGBD camera. Background Art
[0002] In the prior art, the current facial 3D key point detection algorithms are mainly divided into three categories. The first category is to detect 3D key points directly from a single frame of RGB image, but the monocular camera has no depth information. The z coordinate accuracy of the 3D key points estimated by this method is poor and cannot meet the high precision requirements. The second category is to use a binocular camera to obtain a pair of images, detect 2D key points from the images of the left and right cameras respectively, and then use the triangulation principle to obtain accurate 3D key points. For some key points, the left and right cameras cannot observe at the same time, so this method detects 3D key points with high accuracy but is incomplete. The third category is to use an RGBD camera to obtain a pair of RGB images and depth images, detect 2D key points from the RGB images, and obtain 3D key points based on the correspondence between the RGB images and the depth images. The disadvantages of this method are the same as those of the binocular method. For some key points, the RGB camera and the depth camera cannot observe at the same time. In summary, to detect high-precision and complete 3D key points of the face, multiple frames of face images must be obtained from different perspectives.
[0003] In order to obtain high-precision and complete three-dimensional key points of the face. The present invention obtains RGB images and depth images of multiple perspectives by moving the RGBD camera around the face. According to the depth camera parameters, each frame of the depth image is converted into a point cloud and fused into the world coordinate system to obtain a high-precision dense point cloud, and then the dense point cloud is converted into a grid. The two-dimensional face key points of each frame of the RGB image are detected, and the three-dimensional face key points of the camera coordinate system are obtained according to the correspondence between the RGB image and the depth image. According to the transformation matrix of each frame of the camera coordinate system and the world coordinate system, the face key points in multiple frames of the world coordinate system are obtained, and the final three-dimensional face key points are obtained from the vertices of the grid based on these key points. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention discloses a method for detecting three-dimensional key points of a face based on an RGBD camera, the key point detection method comprising the following steps:
[0005] Step 1: acquiring an RGB image and a corresponding depth image based on the RGBD camera, performing face detection and two-dimensional face key point detection on the RGB image, and converting the depth image into point cloud data;
[0006] Step 2, detecting and judging the acquired image, determining the first frame in the RGB image and the corresponding depth image, and using the first frame depth camera coordinate system as the world coordinate system;
[0007] Step 3, starting from the second frame, use the ICP algorithm to calculate the transformation matrix of the camera coordinate system of the current frame and the camera coordinate system of the previous frame, and obtain the transformation matrix from the current camera coordinate system to the world coordinate system, and update the TSDF model according to the transformation matrix to determine whether a sufficient amount of data information is collected. If not, jump back to step 1 to reacquire the RGB image and the corresponding depth image. If so, obtain the face point cloud data from the TSDF model, and perform surface reconstruction on the face point cloud data to obtain the face mesh data;
[0008] Step 4: For each frame of RGB image, face detection is performed using a lightweight face recognition model, and facial key points are extracted using the PFLD model;
[0009] Step 5, calculate the centers of multiple groups of three-dimensional key points, and use the kd-tree algorithm to traverse all vertices to find the nearest point of each center point.
[0010] Furthermore, the TSDF model is a three-dimensional space representation method, wherein the TSDF model pre-sets a rectangular bounding box and divides each dimension of the rectangular parallelepiped into n equal parts, that is, the rectangular parallelepiped is divided into n 3 A small cube is defined as a voxel, and then the voxel is transformed from the world coordinate system to the camera coordinate system:
[0011]
[0012] In the formula, represents the coordinates of the j-th voxel in the i-th camera coordinate system, Represents the transformation matrix from the world coordinate system to the i-th camera coordinate system.
[0013] Furthermore, the calculation formula of the TSDF value in the TSDF model is as follows:
[0014] tsdf j ′=max(-1,min(sdf j / t,1))
[0015] In the formula, tsdf j ′ represents the TSDF value of the jth voxel before updating, the max function is used to obtain the maximum value of two values, the min function is used to obtain the minimum value of two values, and t represents the cutoff distance, where the higher the accuracy of the depth camera, the smaller the cutoff distance.
[0016] Furthermore, updating the TSDF model according to the transformation matrix further includes updating the TSDF value and its weight, and the updating formula is as follows:
[0017]
[0018] w j =w j ′+w j-1
[0019] In the formula, w j ′ represents the weight of the jth voxel before updating, which is 1 by default. j Represents the updated weight. When enough images are collected, the Marching Cubes algorithm is used to find the 0 isosurface in the TSDF model as the reconstructed point cloud, and the normal vector of each point in the point cloud is calculated. The Poisson reconstruction can be used to obtain the mesh from the point cloud and its normal vector.
[0020] Furthermore, the face detection by the lightweight face recognition model further includes: the lightweight face recognition model replaces the backbone of the Yolov5-s model with ShuffleNetv2, and sets the input resolution of the model to 320X320.
[0021] Furthermore, the extraction of facial key points by the PFLD model further includes: the PFLD model uses MobileNetv2 as the backbone of FPLD, and obtains the coordinates of the key points by a regression method, wherein the loss function used by the FPLD model is as follows:
[0022]
[0023] In the formula, M represents the number of samples, N represents the number of key points, and γ n Indicates different weights, Represents the distance between the regression value of the nth key point in the mth sample and the true value.
[0024] Furthermore, the weight γ n The calculation of is as follows:
[0025]
[0026] In the formula, C represents the number of different categories, are the weights corresponding to different categories of faces; K is equal to 3, They represent the yaw, pitch, and roll of the nth key point respectively.
[0027] Furthermore, reconstructing a face requires multiple frames of RGB images and depth images, so there are multiple sets of 3D key points. The center of multiple sets of 3D key points is calculated. The center calculation formula is as follows:
[0028]
[0029] In the formula, p i represents the center of the i-th key point, a represents the number of frames of the face, Represents the i-th key point in the j-th frame image.
[0030] Furthermore, the step 5 further includes: the reconstructed face mesh contains more vertices, and kd-tree is used to accelerate the time of traversing all vertices to find the nearest point of each center point.
[0031] Furthermore, Kd-tree is a binary tree that saves the face mesh vertices in a tree structure to reduce the number of searches. Assuming the number of face key points is N and the number of face mesh vertices is M, when the traversal search method is used, the number of searches is N·M, and when the kd-tree search method is used, the number of searches is N·logM.
[0032] Compared with the prior art, the present invention has the following beneficial effects: compared with the RGBD face three-dimensional key point detection scheme based on a single perspective, the present invention obtains RGBD images of different perspectives. The RGBD camera moves slowly around the face, obtains a large amount of data from different perspectives and fuses them into the TSDF model. The TSDF model can improve the accuracy of three-dimensional reconstruction of the face, thereby obtaining more accurate three-dimensional key points of the face. Because data from multiple perspectives are obtained, these data can cover the entire face, thus solving the problem of incomplete reconstruction caused by the inability of the RGB camera and the depth camera to observe some key points at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The present invention can be further understood from the following description in conjunction with the accompanying drawings. The components in the figures are not necessarily drawn to scale, but the emphasis is placed on illustrating the principles of the embodiments. In the figures, the same reference numerals designate corresponding parts in different views.
[0034] Figure 1 It is an overall flow chart of face surface reconstruction in the face three-dimensional key point detection method based on RGBD camera of the present invention.
[0035] Figure 2 This is a flow chart of selecting the point closest to the center from the face mesh as the final three-dimensional key point according to an embodiment of the present invention.
[0036] Figure 3 It is a schematic diagram of the face grid and some key points of the present invention. DETAILED DESCRIPTION
[0037] The technical solution of the present invention will be described in more detail below with reference to the accompanying drawings and embodiments.
[0038] A mobile terminal implementing various embodiments of the present invention will now be described with reference to the accompanying drawings. In the subsequent description, suffixes such as "module", "component" or "unit" used to represent elements are used only to facilitate the description of the present invention and have no specific meaning in themselves. Therefore, "module" and "component" can be used interchangeably.
[0039] The mobile terminal can be implemented in various forms. For example, the terminal described in the present invention may include a mobile terminal such as a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation device, etc., and a fixed terminal such as a digital TV, a desktop computer, etc. Below, it is assumed that the terminal is a mobile terminal. However, it will be appreciated by those skilled in the art that, in addition to the elements specifically used for mobile purposes, the construction according to the embodiments of the present invention can also be applied to fixed type terminals.
[0040] The present invention obtains multiple frames of continuous RGB and depth images, calculates the transformation matrix between the depth camera coordinate system and the world coordinate system of each frame, fuses the three-dimensional information of each frame, and obtains a complete, high-precision dense point cloud of the face. The surface is reconstructed using the Poisson reconstruction algorithm to obtain the face mesh. The overall flow chart of face surface reconstruction is as follows: Figure 1 Detect the 2D face key points of each frame of RGB image, obtain the 3D face key points in the multi-frame world coordinate system, remove the abnormal key points, calculate the center of each key point, and select the point closest to the center from the face grid as the final 3D key point. The flowchart for obtaining the final 3D key points is as follows: Figure 2 The face mesh and some key points are shown in Figure 3 shown.
[0041] 1. Point cloud fusion and TSDF model
[0042] In order to improve efficiency and accuracy, the present invention adopts the TSDF model to represent the three-dimensional space during the fusion process. The first frame depth camera coordinate system is used as the world coordinate system. The point cloud is obtained according to the depth camera parameters and the depth map. Starting from the second frame, the ICP algorithm is used to calculate the transformation matrix of the current frame camera coordinate system and the previous frame camera coordinate system, and the transformation matrix from the current camera coordinate system to the world coordinate system is obtained. According to the transformation matrix, the TSDF model is updated. The TSDF model is a three-dimensional space representation method. TSDF requires the pre-setting of the rectangular bounding box and the division of each dimension of the rectangular block into n equal parts, that is, the rectangular block is divided into n 3 Small cubes are called voxels. Transform voxels from the world coordinate system to the camera coordinate system:
[0043]
[0044] In the formula, Represents the coordinates of the j-th voxel in the i-th camera coordinate system. Represents the transformation matrix from the world coordinate system to the i-th camera coordinate system.
[0045] SDF value calculation:
[0046]
[0047] Where sdf j represents the SDF value of the j-th voxel, express The z coordinate of represents the projection of voxels into the image coordinate system, Indicates the depth in image coordinates.
[0048] TSDF value calculation:
[0049] tsdf j ′=max(-1,min(sdf j |t,1))
[0050] In the formula, tsdf j ′ represents the TSDF value of the jth voxel before the update, the max function is used to obtain the maximum value of two values, the min function is used to obtain the minimum value of two values, and t represents the cutoff distance. The higher the accuracy of the depth camera, the smaller the cutoff distance.
[0051] Update TSDF values and their weights:
[0052]
[0053] w j =w j ′+w j-1
[0054] In the formula, w j ′ represents the weight of the jth voxel before updating, which is 1 by default. j Represents the updated weight.
[0055] When enough images are collected, the Marching Cubes algorithm is used to find the 0 isosurface in the TSDF model as the reconstructed point cloud. The normal vector of each point in the point cloud is calculated, and the mesh can be obtained from the point cloud and its normal vector using Poisson reconstruction.
[0056] 2. Face Detection
[0057] Because the only target to be detected in the present invention is the face, a lightweight model can meet the requirements. The backbone of the Yolov5-s model is replaced with ShuffleNetv2, and the input resolution of the model is set to 320X320. The modified Yolov5-s can accurately detect the face area and consume very little time.
[0058] 3. Face key point detection
[0059] The PFLD model has a very good detection effect on faces of different angles and expressions. MobileNetv2 is used as the backbone of FPLD, and the coordinates of key points are obtained by regression. The loss function used by the FPLD model is as follows:
[0060]
[0061] In the formula, M represents the number of samples, N represents the number of key points, and γ n Indicates different weights, Represents the distance between the regression value of the nth key point in the mth sample and the true value. Weight γ n The calculation of is as follows:
[0062]
[0063] In the formula, C represents the number of different categories. Faces can be divided into multiple categories, such as front face, side face, head up, head down, etc. are the weights corresponding to different categories of faces. K is equal to 3, They represent the yaw, pitch, and roll of the nth key point respectively.
[0064] 4. Key point center and kd-tree
[0065] Reconstructing a face requires multiple frames of RGB images and depth images, so there are multiple sets of 3D key points, the center of which is calculated as follows:
[0066]
[0067] In the formula, p i represents the center of the i-th key point, a represents the number of frames of the face, Represents the i-th key point in the j-th frame image.
[0068] The reconstructed face mesh contains many vertices. It takes a lot of time to traverse all vertices to find the nearest point of each center point, so kd-tree is used for acceleration. Kd-tree is a binary tree that saves the face mesh vertices in a tree structure, which can effectively reduce the number of searches. Let the number of face key points be N and the number of face mesh vertices be M. When using the traversal search method, the number of searches is N·M. When using the kd-tree search method, the number of searches is N·logM.
[0069] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0070] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0071] Although the present invention has been described above with reference to various embodiments, it should be understood that many changes and modifications can be made without departing from the scope of the present invention. Therefore, it is intended that the above detailed description is considered to be illustrative rather than restrictive, and it should be understood that the following claims (including all equivalents) are intended to limit the spirit and scope of the present invention. The above embodiments should be understood to be only used to illustrate the present invention and not to limit the scope of protection of the present invention. After reading the content of the record of the present invention, the technician can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall into the scope defined by the claims of the present invention.
Claims
1. A method for detecting 3D key points of human face based on RGBD camera. It is characterized in that The key point detection method comprises the following steps: Step 1, acquiring an RGB image and a corresponding depth image based on the RGBD camera, performing face detection and two-dimensional face key point detection on the RGB image, and converting the depth image into point cloud data; Step 2, detecting and judging the acquired image, determining the first frame in the RGB image and the corresponding depth image, and using the first frame depth camera coordinate system as the world coordinate system; Step 3, starting from the second frame, use the ICP algorithm to calculate the transformation matrix of the camera coordinate system of the current frame and the camera coordinate system of the previous frame, and obtain the transformation matrix from the current camera coordinate system to the world coordinate system, and update the TSDF model according to the transformation matrix to determine whether a sufficient amount of data information has been collected. If not, jump back to step 1 to reacquire the RGB image and the corresponding depth image. If so, obtain the face point cloud data from the TSDF model, and perform surface reconstruction on the face point cloud data to obtain the face mesh data. The TSDF model is a three-dimensional space representation method, in which the TSDF model pre-sets a rectangular bounding box and divides each dimension of the rectangular block into n equal parts, that is, the rectangular block is divided into n 3 A small cube is defined as a voxel, and then the voxel is transformed from the world coordinate system to the camera coordinate system: In the formula, represents the coordinates of the j-th voxel in the i-th camera coordinate system, Represents the transformation matrix from the world coordinate system to the i-th camera coordinate system. The calculation formula of the TSDF value in the TSDF model is as follows: tsdf′ j =max(-1,min(sdf j / t,1)) In the formula, tsdf j ′ represents the TSDF value of the jth voxel before updating, the max function is used to obtain the maximum value of two values, the min function is used to obtain the minimum value of two values, and t represents the cutoff distance, where the higher the accuracy of the depth camera, the smaller the cutoff distance; The updating of the TSDF model according to the transformation matrix further includes updating the TSDF value and its weight, and the updating formula is as follows: In j =in′ j +in j-1 In the formula, w j ′ represents the weight of the jth voxel before updating, which is 1 by default. j Represents the updated weight. When enough images are collected, the Marching Cubes algorithm is used to find the 0 isosurface in the TSDF model as the reconstructed point cloud, and the normal vector of each point in the point cloud is calculated. The mesh can be obtained from the point cloud and its normal vector using Poisson reconstruction. Step 4: For each frame of RGB image, face detection is performed using a lightweight face recognition model, and facial key points are extracted using the PFLD model; Step 5: Reconstructing the face requires multiple frames of RGB images and depth images, so there are multiple sets of 3D key points. The center of multiple sets of 3D key points is calculated. The center calculation formula is as follows: In the formula, pi represents the center of the i-th key point, a represents the number of frames of the face, It represents the i-th key point in the j-th frame image, and uses the kd-tree algorithm to traverse all vertices to find the nearest point to each center point, and selects the point closest to the center from the face mesh as the final three-dimensional key point.
2. A method for detecting three-dimensional key points of a face based on an RGBD camera as claimed in claim 1, It is characterized in that Performing face detection through a lightweight face recognition model further includes: the lightweight face recognition model replaces the backbone of the Yolov5-s model with ShuffleNetv2, and setting the input resolution of the model to 320X320.
3. A method for detecting three-dimensional key points of a face based on an RGBD camera as claimed in claim 1, It is characterized in that The extracting of facial key points by the PFLD model further includes: the PFLD model uses MobileNetv2 as the backbone of PFLD, and obtains the coordinates of the key points by a regression method, wherein the loss function used by the PFLD model is as follows: In the formula, M represents the number of samples, N represents the number of key points, and γ n Indicates different weights, Represents the distance between the regression value of the nth key point in the mth sample and the true value.
4. A method for detecting three-dimensional key points of a face based on an RGBD camera as claimed in claim 3, It is characterized in that Weight γ n The calculation of is as follows: In the formula, C represents the number of different categories, are the weights corresponding to different categories of faces; K is equal to 3, They represent the yaw, pitch, and roll of the nth key point respectively.
Citation Information
Patent Citations
Face key point detection method, device and equipment and storage medium
CN110807451A
Three-dimensional face grid generation method and device, equipment and storage medium
CN111243093A
Method and device for detecting key points on three-dimensional face scanning
CN111753644A
Multi-task neural network face key point detection method for edge device
CN112836566A
Method and terminal for locating critical point of face
WO2016192477A1
