A method and system for hand detection and three-dimensional posture estimation based on diffusion model
The hand detection and three-dimensional pose estimation method based on the diffusion model solves the problem of insufficient performance of traditional methods in complex scenes, achieves more robust and accurate hand detection and pose estimation, adapts to complex environments, and reduces computational overhead.
Patent Information
- Application Number
- CN202410070427.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-17
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-01-17
AI Technical Summary
Traditional hand detection and three-dimensional pose estimation methods have unsatisfactory performance in complex scenes. It is especially difficult to accurately identify hand features under severe occlusion and different lighting conditions, and cannot meet the real-time requirements of applications such as virtual reality.
Using a diffusion model-based hand detection and three-dimensional pose estimation method, the pre-trained diffusion model adds bounding boxes, crops images, marks joint points, normalizes bone lengths and rotation angles, calculates rotation matrices and constructs hand images, using inverse motion Learning and forward kinematics constrain bone angles, and iteratively denoises stepwise to improve robustness.
It significantly improves the robustness and accuracy of hand detection and posture estimation, adapts to complex environments, generates hand postures that are more in line with human anatomy, can achieve better results under different occlusion situations, and reduces computational overhead.
Smart Images

Figure CN117894072B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a method and system for hand detection and three-dimensional posture estimation based on a diffusion model. Background Art
[0002] In recent years, with the rapid development of computer vision and deep learning technology, users' application demand for human hand detection, tracking, posture estimation and 3D reconstruction has gradually increased. Hand detection refers to accurately locating the position of the hand from an image or video. The 3D modeling of the hand is mainly based on 3D skeleton posture estimation (HandPoseEstimation), which involves determining the posture or motion state of the hand in 3D space, including rotation, bending and extension of the hand. Accurate detection and posture estimation of human hands are of great significance to many fields, such as virtual reality, augmented reality, gesture recognition and human-computer interaction.
[0003] However, due to factors such as the high degree of hand variability, severe occlusion, irregular posture, and changes in different lighting conditions in images or videos, traditional hand analysis methods often perform less than ideal in complex scenes, and a more robust and accurate solution is needed. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a hand detection and three-dimensional posture estimation method based on a diffusion model to eliminate or improve one or more defects existing in the prior art.
[0005] One aspect of the present invention provides a method for hand detection and three-dimensional posture estimation based on a diffusion model, the method comprising the steps of:
[0006] Acquire an image to be detected, and input the image to be detected into a pre-trained first diffusion model, where the first diffusion model is used to add a bounding box to each hand region in the image to be detected;
[0007] Cropping the image to be detected based on the bounding box to obtain a cropped image, and inputting the cropped image into a pre-trained second diffusion model, where the second diffusion model is used to mark a first joint point of the hand in the cropped image;
[0008] Determine the length of each bone of the hand and the bone rotation angle of each bone based on the position of each of the first joint points, and perform standardization processing on the bone length and the bone rotation angle;
[0009] Determine the axis angle corresponding to each first joint point based on the standardized bone length and the bone rotation angle of the bone, and calculate the rotation matrix corresponding to each first joint point based on the axis angle corresponding to the first joint point;
[0010] Based on the joint route to which each first joint point belongs, calculating the rotation matrix corresponding to the first joint point on the joint route, and converting the first joint point into a second joint point;
[0011] A hand image is constructed based on the coordinate data of the second joint point.
[0012] The above scheme is adopted. This scheme first marks the hand area in the image to be detected by adding a bounding box, detects the hand area, and then identifies the joint points of the hand in the cropped image through the cropped image based on the bounding box cropping. Since the joint points identified by the model often have great unreasonableness, this scheme further standardizes the bone length and bone rotation angle through the position of the first joint point, and then determines the rotation matrix corresponding to each first joint point. Finally, the first joint point is converted into the second joint point through the rotation matrix of the first joint point on the joint route to which each first joint point belongs. It can better adapt to more complex environments, and can obtain more reasonable second joint points, which is more robust and accurate, and completes three-dimensional posture estimation by constructing a hand image.
[0013] In some embodiments of the present invention, in the step of cropping the image to be detected based on the bounding box to obtain a cropped image, the image to be detected is cropped based on edge lines of the bounding box to obtain a cropped image corresponding to each bounding box.
[0014] In some embodiments of the present invention, in the step of calculating the rotation matrix corresponding to each first joint point based on the axis angle corresponding to the first joint point, the axis angle represented by the axis angle representation is converted into a rotation matrix by using the Rodriguez formula.
[0015] In some embodiments of the present invention, the following formula is used to perform the normalization process on the bone length and the bone rotation angle:
[0016]
[0017] Among them, a′ represents the bone length or bone rotation angle after standardization, a represents the bone length or bone rotation angle before standardization, and a max Indicates the maximum value of the bone length or bone rotation angle before normalization. min Indicates the minimum value of the bone length or bone rotation angle before normalization.
[0018] In some embodiments of the present invention, based on the joint route to which each first joint point belongs, the rotation matrix corresponding to the first joint point on the joint route is calculated, and in the step of converting the first joint point into the second joint point, the joint route to which the joint point belongs is determined based on the position of the first joint point, the rotation matrix corresponding to each first joint point in the joint route is obtained, and the second joint point corresponding to the first joint point is calculated based on the rotation matrix corresponding to each first joint point in the joint route.
[0019] In some embodiments of the present invention, in the step of calculating the second joint point corresponding to the first joint point based on the rotation matrix corresponding to each first joint point in the joint route, the second joint point corresponding to the first joint point is calculated based on the following formula:
[0020] j=R CMC ·R MCP ·R PIP ·R DIP ·j0
[0021] Where j represents the coordinate of the second joint point corresponding to the first joint point, j0 represents the initial coordinate of the second joint point in the resting posture of the hand, R CMC Represents the rotation matrix corresponding to the first joint point in the carpometacarpal joint in the joint path, R MCP Represents the rotation matrix corresponding to the first joint point in the metacarpophalangeal joint in the joint route, R PIP Represents the rotation matrix corresponding to the first joint point in the interphalangeal joint in the joint route, R DIP Represents the rotation matrix corresponding to the first joint point in the joint path at the finger joint.
[0022] In some embodiments of the present invention, both the first diffusion model and the second diffusion model are diffusion models including multiple time steps, and the first diffusion model and the second diffusion model gradually recover data from Gaussian noise through multiple time steps.
[0023] In some embodiments of the present invention, in the step of determining the lengths of each bone of the hand and the bone rotation angles of each bone based on the positions of each of the first joint points, the lengths of each bone of the hand and the bone rotation angles of each bone are determined by inverse kinematics calculation.
[0024] In some embodiments of the present invention, in the step of constructing a hand image based on the coordinate data of the second joint point, a preset three-dimensional modeling module is used to construct a hand model based on the coordinate data of the second joint point.
[0025] The second aspect of the present invention also provides a hand detection and three-dimensional posture estimation system based on a diffusion model, the system includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, the processor is used to execute the computer instructions stored in the memory, when the computer instructions are executed by the processor, the system implements the steps implemented by the method described above.
[0026] The third aspect of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps implemented by the aforementioned diffusion model-based hand detection and three-dimensional posture estimation method.
[0027] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention can be specifically pointed out and obtained in the specification and the accompanying drawings.
[0028] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.
[0030] Figure 1 A schematic diagram of an implementation of a method for hand detection and three-dimensional posture estimation based on a diffusion model of the present invention;
[0031] Figure 2 Schematic diagram of the architecture of the hand detection and three-dimensional posture estimation method based on the diffusion model of the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0033] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.
[0034] Introduction to existing technology:
[0035] The current mainstream solution is to use convolutional neural networks (CNNs) for end-to-end hand detection and posture estimation. These networks learn features directly from images and generate corresponding posture estimates. When processing video sequence data, recurrent neural networks (RNNs) and long short-term memory networks (LSTMs) introduce a loop structure to estimate the hand posture of the current frame by combining the feature information of the current frame with the historical information of the previous frames, which helps to smooth the changes in hand posture and reduce the jitter problem.
[0036] Currently, the task of hand pose estimation faces some challenges and shortcomings. For example, the hand is easily occluded by other objects or the hand itself, different lighting conditions will also cause the image appearance to change, and application products such as virtual reality (VR) have put forward higher requirements for real-time performance. Among these problems, the occlusion problem is particularly prominent, which directly affects the final effect of hand pose estimation.
[0037] In the field of pose estimation, there are three main methods for solving the occlusion problem. (1) Using occlusion-aware data augmentation (DA). This scheme simulates occlusion by covering part of the image with black solid shapes, object fragments, or background blocks. Such synthetic occlusion may not fully simulate the occlusion in real scenes, thus affecting the robustness of the model in practical applications. (2) Using temporal information (TI) to compensate for the information lost due to occlusion, which reduces the pose estimation performance for static images or instantaneous frames. In addition, this scheme assumes that the hand key points will not be occluded for a long time within a certain time range, otherwise the effect of the method will decrease. (3) Using the spatial attention mechanism. This scheme improves the pose estimation performance by weighting the feature map or filtering out the features of the occluded area. However, this method has poor estimation effect in the case of severe occlusion, because in this case, the hand features extracted from the image are sparse and incomplete, and the attention mechanism is difficult to correctly assign weights to the partially or completely occluded hand area.
[0038] Diffusion models have recently demonstrated strong performance in various generative tasks in computer vision. Diffusion models are a type of generative model that is often used in the field of image generation. Compared with other generative methods, such as GAN (Generative AdversarialNets), diffusion models have advantages in training stability. Diffusion models interpret image generation as the process of restoring the original image from Gaussian noise. It is mainly divided into forward diffusion process and reverse diffusion process. The forward process gradually adds noise to the image, and the reverse process learns to estimate noise through deep learning neural networks, and gradually removes noise from noisy images. In addition, the biggest advantage of diffusion models over convolution-based methods is that the output of convolution methods is determined once, while diffusion models are iterative step by step, and can continuously optimize the detection or estimation effect based on the output of the previous step.
[0039] The present invention aims to utilize the powerful iterative optimization capability of the diffusion model to better solve the occlusion problem. Compared with previous methods, this method has two advantages: (1) good compatibility. This method can directly use the existing convolution-based hand posture estimator as the feature extraction network, and use the extracted image features to guide the denoising direction of the inverse denoising module, so that the model can effectively convert the convolution-based deterministic method into a probabilistic calculation method based on the diffusion model; (2) strong efficiency. The diffusion model generates the final result through a step-by-step refinement iteration. In this process, the time step of the diffusion refinement is adjustable, which means that different time steps can be selected for different occlusion situations. For example, for severe occlusion, a larger time step can be selected to obtain better results. For slight occlusion or no occlusion, a smaller time step can be selected to reduce computational overhead.
[0040] The steps of the present invention specifically include:
[0041] like Figure 1 and 2 As shown, the present invention proposes a method for hand detection and three-dimensional posture estimation based on a diffusion model, the steps of the method comprising:
[0042] Step S100, obtaining an image to be detected, and inputting the image to be detected into a pre-trained first diffusion model, wherein the first diffusion model is used to add a bounding box to each hand region in the image to be detected;
[0043] In some embodiments of the present invention, the image to be detected may be a portrait image including hands.
[0044] In some embodiments of the present invention, during the training process of the first diffusion model, a set of true bounding box labels of training samples is given, and the filling scheme is to randomly sample the bounding box, that is, randomly generate values of the four elements of the bounding box, including the horizontal and vertical coordinates (x, y) of the upper left point of the bounding box and the height and width (h, w) of the bounding box, calculate the noise of the randomly sampled bounding box through the first diffusion model, and then calculate the real noise based on the true bounding box, calculate the loss function based on the real noise and the noise calculated by the first diffusion model, and train the first diffusion model.
[0045] Step S200, cropping the image to be detected based on the bounding box to obtain a cropped image, and inputting the cropped image into a pre-trained second diffusion model, wherein the second diffusion model is used to mark a first joint point of the hand in the cropped image;
[0046] In some embodiments of the present invention, the bounding box is a rectangular box, and the cropping is performed by the edges of the rectangle.
[0047] By adopting the above scheme, this scheme crops each hand area separately and then marks the joint points, which can better perform corresponding recognition for each hand image and improve the accuracy of joint point recognition.
[0048] In some embodiments of the present invention, each hand area includes 21 joint points, which are three-dimensional coordinate points. In the training step of the second diffusion model, the noisy joint point coordinates, time steps and image features are used as inputs of the second diffusion model. The estimator predicts the noise at the current time step, and the loss between the predicted noise and the actual noise is used as the training target. The time steps are randomly sampled, and the second diffusion model is continuously iterated to train so that the model accurately predicts based on the image features and time steps.
[0049] In the specific implementation process, the 21 joint points correspond to the 21 joints of the human hand, so there are 20 bones, and the adjacent parent-child bones form bone angles, so there are 16 angles.
[0050] In a specific implementation, the time step may be set to 50 to gradually recover data from Gaussian noise.
[0051] In the specific implementation process, a preset feature extraction network is used to extract the image features of the original image to be detected, and the feature extraction network can use ResNet50.
[0052] In the specific implementation process, after the second diffusion model is trained, the coordinates of the 3D joint points of the hand posture are predicted, starting from the 3D coordinates randomly sampled from the Gaussian distribution, and the model gradually iteratively improves the coordinates of the predicted 3D joint points.
[0053] In the specific implementation process, the following formula is used to calculate the loss function during the training of the first diffusion model and the second diffusion model:
[0054]
[0055] in, represents the loss function value, ε t represents the actual noise corresponding to time step t, ε′ t represents the prediction noise corresponding to time step t.
[0056] Step S300, determining the lengths of the bones of the hand and the rotation angles of the bones of the bones based on the positions of the first joints, and performing standardization on the bone lengths and the rotation angles of the bones;
[0057] In some embodiments of the present invention, in the step of determining the lengths of each bone of the hand and the bone rotation angles of each bone based on the positions of each of the first joint points, an inverse kinematics algorithm is used to determine the lengths of each bone of the hand and the bone rotation angles of each bone based on the positions of each of the first joint points.
[0058] In the specific implementation process, the inverse kinematics algorithm includes an iterative method and an optimization method. The iterative method is an inverse kinematics algorithm based on the iterative idea, and its basic idea is to approach the optimal solution through continuous iteration. The specific steps include: first, according to the position and posture of the robot end, the initial joint angle is calculated; then, iterative calculation is performed based on the initial joint angle, and each iteration updates the joint angle according to the position and posture of the robot end and the current joint angle; finally, iterate until the preset accuracy requirement is met. The optimization method is an inverse kinematics algorithm based on optimization theory, and its basic idea is to find the optimal solution through an optimization algorithm. The specific steps include: first, according to the position and posture of the robot end, the optimization objective function is defined; then, the optimization algorithm (such as gradient descent method and Newton method, etc.) is used to solve the optimal solution; finally, the joint angle is inversely solved through the optimal solution.
[0059] Step S400, determining the axis angle corresponding to each first joint point based on the standardized bone length and the bone rotation angle of the bone, and calculating the rotation matrix corresponding to each first joint point based on the axis angle corresponding to the first joint point;
[0060] In the specific implementation process, the rotation angle of the joint point is calculated through the coordinates of the first joint point. The rotating disk surface where each joint point is located can be determined according to the coordinates of each joint point in the resting posture and the current posture of the hand. The unit normal of the rotating disk surface is taken as the rotation axis, and multiplied by the rotation angle to get the axis angle.
[0061] Step S500, based on the joint route to which each first joint point belongs, calculating the rotation matrix corresponding to the first joint point on the joint route, and converting the first joint point into a second joint point;
[0062] In a specific implementation process, the joint route to which the first joint point belongs extends from the wrist-metacarpal joint to the fingertip joint.
[0063] Step S600: construct a hand image based on the coordinate data of the second joint point.
[0064] In a specific implementation process, in the step of constructing a hand image based on the coordinate data of the second joint point, MANO three-dimensional reconstruction of the hand mesh may be used.
[0065] The above scheme is adopted. This scheme first marks the hand area in the image to be detected by adding a bounding box, and then identifies the joint points of the hand in the cropped image through the cropped image based on the bounding box cropping. Since the joint points identified by the model often have great unreasonableness, this scheme further standardizes the bone length and bone rotation angle through the position of the first joint point, and then determines the rotation matrix corresponding to each first joint point. Finally, the first joint point is converted into the second joint point through the rotation matrix of the first joint point on the joint route to which each first joint point belongs. It can better adapt to more complex environments, and can obtain more reasonable second joint points, which are more robust and accurate.
[0066] In the specific implementation process, the robust detection of human hands and skeleton posture estimation of this scheme consists of two stages, namely hand detection and hand posture estimation. Hand detection is implemented based on the diffusion model, and the hand detection problem is understood as the process of gradually denoising and restoring the target bounding box from the hand bounding box randomly sampled from the normal distribution. Hand posture estimation is similar to it, and is also implemented based on the diffusion model. The difference is that the denoising target is the 3D coordinates of the hand posture. In addition, forward kinematics knowledge is introduced to constrain the range of skeleton rotation angles, making the estimated hand posture more reasonable. During the training process, the input of hand detection includes three parts, namely 1. the true bounding box after adding noise; 2. the time step corresponding to the current noise; 3. image features. The input of hand posture estimation replaces the "true bounding box after adding noise" in the hand detection input with "the true 3D coordinates of the hand posture after adding noise".
[0067] In some embodiments of the present invention, in the step of cropping the image to be detected based on the bounding box to obtain a cropped image, the image to be detected is cropped based on edge lines of the bounding box to obtain a cropped image corresponding to each bounding box.
[0068] In some embodiments of the present invention, in the step of calculating the rotation matrix corresponding to each first joint point based on the axis angle corresponding to the first joint point, the axis angle represented by the axis angle representation is converted into a rotation matrix by using the Rodriguez formula.
[0069] In some embodiments of the present invention, the following formula is used to perform the normalization process on the bone length and the bone rotation angle:
[0070]
[0071] Among them, a′ represents the bone length or bone rotation angle after standardization, a represents the bone length or bone rotation angle before standardization, and a max Indicates the maximum value of the bone length or bone rotation angle before normalization. min Indicates the minimum value of the bone length or bone rotation angle before normalization.
[0072] In the specific implementation process, when the bone length is standardized, the bone length value is brought into the calculation; when the bone rotation angle is standardized, the bone rotation angle value is brought into the calculation.
[0073] Using the above scheme, in order to enforce the angle and bone length constraints, the bone length and angle predictions are followed by a sinusoidal normalization function.
[0074] In some embodiments of the present invention, based on the joint route to which each first joint point belongs, the rotation matrix corresponding to the first joint point on the joint route is calculated, and in the step of converting the first joint point into the second joint point, the joint route to which the joint point belongs is determined based on the position of the first joint point, the rotation matrix corresponding to each first joint point in the joint route is obtained, and the second joint point corresponding to the first joint point is calculated based on the rotation matrix corresponding to each first joint point in the joint route.
[0075] In some embodiments of the present invention, if the position of the first joint point corresponds to the fingertip joint, the joint route corresponding to the first joint point includes the first joint points of the carpometacarpal joint, the metacarpophalangeal joint, the interphalangeal joint and the fingertip joint; if the position of the first joint point corresponds to the interphalangeal joint, the joint route corresponding to the first joint point includes the first joint points of the carpometacarpal joint, the metacarpophalangeal joint and the interphalangeal joint.
[0076] In the specific implementation process, in the field of hand skeleton posture estimation, the bones and joints of the human hand form a forward kinematics tree according to their positions and relationships, and the movement of low-level joints occurs on the basis of high-level joint movement. From the wrist to the fingertips, the hand joints can be divided into carpometacarpal joints (CMC), metacarpophalangeal joints (MCP), interphalangeal joints (PIP), distal interphalangeal joints (DIP) and tip joints (TIP).
[0077] The above scheme is adopted. In order to make the position of the joint points more reasonable, this scheme introduces the positions of other joint points in the corresponding joint route for each joint point, so that the position of the joint point can be compared with other joint points, making the position of the joint points in the hand more reasonable, and making the final arrangement of the hand joint points more reasonable.
[0078] In some embodiments of the present invention, in the step of calculating the second joint point corresponding to the first joint point based on the rotation matrix corresponding to each first joint point in the joint route, the second joint point corresponding to the first joint point is calculated based on the following formula:
[0079] j=R CMC ·R MCP ·R PIP ·R DIP ·j0
[0080] Where j represents the coordinate of the second joint point corresponding to the first joint point, j0 represents the initial coordinate of the second joint point in the resting posture of the hand, R CMC Represents the rotation matrix corresponding to the first joint point in the carpometacarpal joint in the joint path, R MCP Represents the rotation matrix corresponding to the first joint point in the metacarpophalangeal joint in the joint route, R PIP Represents the rotation matrix corresponding to the first joint point in the interphalangeal joint in the joint route, R DIP Represents the rotation matrix corresponding to the first joint point in the joint path at the finger joint.
[0081] In some embodiments of the present invention, both the first diffusion model and the second diffusion model are diffusion models including multiple time steps, and the first diffusion model and the second diffusion model gradually recover data from Gaussian noise through multiple time steps.
[0082] In some embodiments of the present invention, both the first diffusion model and the second diffusion model adopt the structure of the diffusion model. The diffusion model is a specific neural network structure in the field of deep learning, which uses a diffusion denoising process to perform tasks such as image generation. The diffusion model is a probability-based generative model that originates from non-equilibrium thermodynamics. The basic idea is to gradually generate data samples from random noise by learning the process from scratch. During the training process, the model gradually learns the process of adding noise until it can generate a distribution similar to the training data. When generating new samples, new samples can be generated from existing data distributions by gradually removing noise.
[0083] In some embodiments of the present invention, in the step of determining the lengths of each bone of the hand and the bone rotation angles of each bone based on the positions of each of the first joint points, the lengths of each bone of the hand and the bone rotation angles of each bone are determined by inverse kinematics calculation.
[0084] In some embodiments of the present invention, in the step of constructing a hand image based on the coordinate data of the second joint point, a preset three-dimensional modeling module is used to construct a hand model based on the coordinate data of the second joint point.
[0085] In some embodiments of the present invention, the 3D modeling module uses MANO to 3D reconstruct the hand mesh.
[0086] The beneficial effects of this program include:
[0087] 1. The present invention adopts a diffusion model to understand detection and estimation as an iterative denoising process. Different from the method of directly using a neural network to extract image features and regress the bounding box or the coordinates of the key points of the hand, the diffusion model uses the output of the previous step as the input of the current step, continuously iteratively refines the prediction results, and improves the robustness to occlusion.
[0088] 2. Compared with the current deterministic method based on convolution, the present invention is more flexible and can select the appropriate number of iterations according to the occlusion of the input image, thereby achieving a balance between prediction effect and computational overhead.
[0089] 3. Compared with the method of directly regressing the coordinates of the key points of the hand, the present invention introduces strong prior information on bone length and bone rotation angle through inverse kinematics and forward kinematics, limits unreasonable bone length and rotation angle, constrains them, and the generated hand posture is more in line with human hand anatomy.
[0090] 4. The process of hand detection and hand posture estimation is interpreted as a process of iterative denoising from random Gaussian noise, and the noise added to the bounding box or joint points in the forward process of the neural network learning diffusion model is used, so that the model can make predictions based on the current input noisy bounding box or joint point and remove the noise.
[0091] 5. A two-stage scheme of hand detection and hand pose estimation, where the output of hand detection is part of the input of hand pose estimation. Hand detection performs the diffusion denoising process of the bounding box in two dimensions, while the diffusion denoising process in hand pose estimation occurs in three dimensions.
[0092] 6. By using the principles of inverse kinematics and forward kinematics, the bone angles and lengths are normalized, and then the coordinates of the 3D key points are constrained, which to a certain extent solves the problem that the 3D hand posture estimation does not conform to the human body structure.
[0093] An embodiment of the present invention also provides a hand detection and three-dimensional posture estimation system based on a diffusion model, the system comprising a computer device, the computer device comprising a processor and a memory, the memory storing computer instructions, the processor being used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the system implements the steps implemented by the method described above.
[0094] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps implemented by the above-mentioned diffusion model-based hand detection and three-dimensional posture estimation method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0095] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0096] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0097] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.
[0098] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for hand detection and three-dimensional posture estimation based on a diffusion model, characterized in that: The steps of the method include: Acquire an image to be detected, and input the image to be detected into a pre-trained first diffusion model, where the first diffusion model is used to add a bounding box to each hand area in the image to be detected; in the process of training the first diffusion model, a set of true bounding box labels of training samples is given, and a filling scheme is to randomly sample the bounding box, that is, randomly generate values of four elements of the bounding box, including the horizontal and vertical coordinates (x, y) of the upper left point of the bounding box and the height and width (h, w) of the bounding box, calculate the noise of the randomly sampled bounding box through the first diffusion model, and then calculate the real noise based on the true bounding box, calculate the loss function based on the real noise and the noise calculated by the first diffusion model, and train the first diffusion model; The image to be detected is cropped based on the bounding box to obtain a cropped image, and the cropped image is input into a pre-trained second diffusion model, where the second diffusion model is used to mark the first joint point of the hand in the cropped image; the joint point is a three-dimensional coordinate point, and in the training step of the second diffusion model, the noisy joint point coordinates, time step and image features are used as inputs of the second diffusion model, the estimator predicts the noise at the current time step, and the loss between the predicted noise and the actual noise is used as the training target, the time step is randomly sampled, and the second diffusion model is continuously iterated to train, so that the model accurately predicts according to the image features and time step; after the second diffusion model is trained, the coordinates of the 3D joint points of the hand posture are predicted, starting from the 3D coordinates randomly sampled from the Gaussian distribution, and the model gradually iterates and improves the coordinates of the predicted 3D joint points; Determine the length of each bone of the hand and the bone rotation angle of each bone based on the position of each of the first joint points, and perform standardization processing on the bone length and the bone rotation angle; Determine the axis angle corresponding to each first joint point based on the standardized bone length and the bone rotation angle of the bone, and calculate the rotation matrix corresponding to each first joint point based on the axis angle corresponding to the first joint point; Based on the joint route to which each first joint point belongs, the rotation matrix corresponding to the first joint point on the joint route is calculated, the first joint point is converted into a second joint point, the joint route to which the joint point belongs is determined based on the position of the first joint point, the rotation matrix corresponding to each first joint point in the joint route is obtained, the second joint point corresponding to the first joint point is calculated based on the rotation matrix corresponding to each first joint point in the joint route, and the second joint point corresponding to the first joint point is calculated based on the following formula: j=R CMC ·R MCP ·R PIP ·R DIP ·j0 Where j represents the coordinate of the second joint point corresponding to the first joint point, j0 represents the initial coordinate of the second joint point in the resting posture of the hand, R CMC Represents the rotation matrix corresponding to the first joint point in the carpometacarpal joint in the joint path, R MCP Represents the rotation matrix corresponding to the first joint point in the metacarpophalangeal joint in the joint route, R PIP Represents the rotation matrix corresponding to the first joint point in the interphalangeal joint in the joint route, R DIP Represents the rotation matrix corresponding to the first joint point at the finger joint in the joint route; A hand image is constructed based on the coordinate data of the second joint point.
2. The method for hand detection and three-dimensional posture estimation based on a diffusion model according to claim 1, characterized in that: In the step of cropping the image to be detected based on the bounding box to obtain a cropped image, the image to be detected is cropped based on edge lines of the bounding box to obtain a cropped image corresponding to each bounding box.
3. The method for hand detection and three-dimensional posture estimation based on a diffusion model according to claim 1, characterized in that: In the step of calculating the rotation matrix corresponding to each first joint point based on the axis angle corresponding to the first joint point, the axis angle represented by the axis angle representation is converted into a rotation matrix by using the Rodriguez formula.
4. The method for hand detection and three-dimensional posture estimation based on a diffusion model according to claim 1, characterized in that: The following formula is used to standardize the bone length and bone rotation angle: Among them, a′ represents the bone length or bone rotation angle after standardization, a represents the bone length or bone rotation angle before standardization, and a max Indicates the maximum value of the bone length or bone rotation angle before normalization. min Indicates the minimum value of the bone length or bone rotation angle before normalization.
5. The method for hand detection and three-dimensional posture estimation based on diffusion model according to claim 1, characterized in that: The first diffusion model and the second diffusion model are both diffusion models including multiple time steps, and the first diffusion model and the second diffusion model gradually recover data from Gaussian noise through multiple time steps.
6. The method for hand detection and three-dimensional posture estimation based on diffusion model according to claim 1, characterized in that: In the step of determining the lengths of each bone of the hand and the bone rotation angles of each bone based on the positions of each of the first joint points, the lengths of each bone of the hand and the bone rotation angles of each bone are determined by inverse kinematics calculation.
7. The method for hand detection and three-dimensional posture estimation based on diffusion model according to claim 1, characterized in that: In the step of constructing a hand image based on the coordinate data of the second joint points, a preset three-dimensional modeling module is used to construct a hand model based on the coordinate data of the second joint points.
8. A hand detection and three-dimensional posture estimation system based on a diffusion model, characterized in that: The system includes a computer device, which includes a processor and a memory. The memory stores computer instructions. The processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the system implements the steps implemented by the method as described in any one of claims 1 to 7.
