Real-time hand perception method based on adaptive positioning and Kalman filter tracking
Through adaptive hand area coarse positioning and Kalman filter tracking, combined with OpenPose and BlazePalm models, the problem of unstable detection of hand perception algorithms in complex scenes is solved, and more stable and accurate hand detection is achieved, which is suitable for many applications. application scenarios.
Patent Information
- Application Number
- CN202111574194.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-12-21
AI Technical Summary
Existing hand perception algorithms are unstable in detection when target distance, illumination, occlusion, and background contrast are low, resulting in frequent missed detections in real-time hand detection and inability to effectively complete hand-based applications.
Adopt adaptive hand area coarse positioning and improved Kalman filter real-time hand perception method, use OpenPose human posture estimation model and BlazePalm hand detection model, combined with Kalman filter tracker, adaptively generate local hand areas and optimize the forearm And the tracking of hand detection frame, the size and position of the hand area frame are determined by the length of the upper arm.
It improves the real-time and accuracy of hand detection, enhances the robustness to illumination changes, occlusions and backgrounds, making hand perception more stable and suitable for a variety of application scenarios.
Smart Images

Figure CN114494338B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and more specifically, to a real-time hand perception method based on adaptive positioning and Kalman filter tracking. Background Art
[0002] The ability to sense hand shape and hand movement can be applied to multiple scenarios to realize the intelligence of devices. For example, it can form the basis of sign language understanding and gesture control, and can realize the overlay of digital content and information of the physical world in augmented reality scenarios.
[0003] However, the actual application scenarios are relatively complex. The detection model in the hand perception algorithm is easily affected by the target distance, lighting, occlusion, and low background contrast, which leads to unstable real-time hand detection and problems in downstream applications. For example, at 720p resolution and using a lightweight hand detection model, the detection target is more than 2.5 meters away from the camera. At this time, the hand target is too small, and the lightweight hand detection model cannot stably perform the task of small target detection, resulting in a large number of missed detections in hand detection, and thus unable to complete related hand-based applications. Therefore, stable real-time hand detection is an extremely challenging computer vision task. Summary of the invention
[0004] Based on the above technical problems, the present invention aims to solve the unstable situation of hand perception and proposes a real-time hand perception method using adaptive hand area coarse positioning and improved Kalman filtering. The method uses a human posture estimation model, a hand detector and a Kalman filter tracker.
[0005] A first aspect of the present invention provides a real-time hand perception method based on adaptive positioning and Kalman filter tracking, the method comprising:
[0006] Acquire an RGB image and preprocess the RGB image;
[0007] Input the preprocessed RGB image into the trained OpenPose human pose estimation model to obtain a first preset number of human key points;
[0008] Extracting a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair;
[0009] If there is a point in a default state in the forearm key point pair, a first prediction result is obtained for the forearm key point pair based on an optimized Kalman filter forearm tracker, wherein the point in the default state represents a point where position value regression fails;
[0010] Adaptively generate a local hand region using the first prediction result, and input the RGB image corresponding to the local hand region into a trained BlazePalm hand detection model to obtain a hand detection frame;
[0011] If there are points in the hand detection frame in a default state, a second prediction result is obtained for the hand detection frame based on the optimized Kalman filter hand detection frame tracker as a real-time hand perception result.
[0012] Furthermore, the method also includes: if the forearm key point pair is in a complete state and is in the first frame image, setting a forearm key point tracker for the forearm key point pair, wherein the forearm key point tracker requires initialization parameters.
[0013] Specifically, the optimized Kalman filter forearm tracker obtains a first prediction result for the forearm key point pair, including:
[0014] The forearm tracker predicts the state of the forearm key point pair at time t-1 and the state at time t is recorded as the predicted value;
[0015] Obtain the observation state of the forearm key point pair at time t and record it as the observation value;
[0016] The best matching pair of forearm key points based on the predicted value and the observed value is obtained and recorded as the first prediction result.
[0017] Further preferably, before obtaining the best matching pair of forearm key point pairs based on the predicted value and the observed value and recording it as the first prediction result, the method further includes:
[0018] Calculate the Euclidean distances corresponding to the wrist point and elbow point respectively;
[0019] Calculate the average distance based on the Euclidean distances corresponding to the wrist point and the elbow point to obtain a loss matrix;
[0020] The minimum loss is obtained by using the Hungarian algorithm based on the loss matrix.
[0021] More specifically, the step of adaptively generating a local hand region using the first prediction result includes:
[0022] Obtaining the wrist point and the elbow point in the first prediction result;
[0023] Calculating a two-dimensional vector modulus of the forearm according to the wrist point and the elbow point;
[0024] Calculate the two-dimensional vector modulus of the upper arm based on the elbow point and the shoulder point;
[0025] Calculate the coordinates and length and width values of the local area of the hand based on the determination formula of the forearm two-dimensional vector modulus and the upper arm two-dimensional vector modulus;
[0026] Adaptively adjusting the coordinates and length and width values to obtain a local area of the hand;
[0027] Wherein, the determination formula of the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm is:
[0028] Dist af =||w i -e i ‖ 2
[0029] Dist au =||e i -s i ‖ 2
[0030] Among them, Dist af Represents the two-dimensional vector norm of the forearm, DisT au represents the two-dimensional vector norm of the upper arm, w i Indicates wrist point, e i Indicates the elbow point, s i Indicates the shoulder point.
[0031] Furthermore, the coordinates and length and width values of the local area of the hand are calculated based on the determination formula of the forearm two-dimensional vector modulus and the upper arm two-dimensional vector modulus, and the formula is:
[0032]
[0033]
[0034]
[0035] Among them, c x , c y Respectively represent the x-axis coordinate and y-axis coordinate of the local area of the hand, Dist af Represents the two-dimensional vector norm of the forearm, Dist au represents the two-dimensional vector norm of the upper arm, w i Indicates wrist point, e i Indicates the elbow point, s i represents the shoulder point, l represents the width of the local area of the hand, and x wi 、x ei 、x si The x-axis coordinates of the wrist point, elbow point, and shoulder point are respectively wi ,y ei ,y si These are the y-axis coordinates of the wrist point, elbow point, and shoulder point, respectively.
[0036] Further preferably, the optimized Kalman filter includes a prediction phase and an update phase and a correction to the update phase; the correction to the update phase is based on the Kalman gain, wherein the Kalman gain is multiplied by an enhancement factor or by an attenuation factor.
[0037] A second aspect of the present invention provides a real-time hand perception device based on adaptive positioning and Kalman filter tracking, the device comprising:
[0038] An acquisition module, used for acquiring an RGB image and preprocessing the RGB image;
[0039] A preprocessing module, used for inputting the preprocessed RGB image into a trained OpenPose human posture estimation model to obtain a first preset number of human key points;
[0040] An extraction module is used to extract a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair;
[0041] A first prediction module, if there is a point in a default state in the forearm key point pair, obtains a first prediction result for the forearm key point pair based on an optimized Kalman filter forearm tracker, wherein the point in the default state indicates a point where position value regression fails;
[0042] A hand detection module, used to adaptively generate a local hand area using the first prediction result, and input an RGB image corresponding to the local hand area into a trained BlazePalm hand detection model to obtain a hand detection frame;
[0043] The second prediction module obtains a second prediction result for the hand detection frame as a real-time hand perception result based on the optimized Kalman filter hand detection frame tracker if there is a point in the default state in the hand detection frame.
[0044] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0045] Acquire an RGB image and preprocess the RGB image;
[0046] Input the preprocessed RGB image into the trained OpenPose human pose estimation model to obtain a first preset number of human key points;
[0047] Extracting a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair;
[0048] If there is a point in a default state in the forearm key point pair, obtaining a first prediction result for the forearm key point pair based on an optimized Kalman filter forearm tracker;
[0049] Adaptively generate a local hand region using the first prediction result, and input the RGB image corresponding to the local hand region into a trained BlazePalm hand detection model to obtain a hand detection frame;
[0050] If there are points in the hand detection frame in a default state, a second prediction result is obtained for the hand detection frame based on the optimized Kalman filter hand detection frame tracker as a real-time hand perception result.
[0051] A fourth aspect of the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:
[0052] Acquire an RGB image and preprocess the RGB image;
[0053] Input the preprocessed RGB image into the trained OpenPose human pose estimation model to obtain a first preset number of human key points;
[0054] Extracting a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair;
[0055] If there is a point in a default state in the forearm key point pair, obtaining a first prediction result for the forearm key point pair based on an optimized Kalman filter forearm tracker;
[0056] Adaptively generate a local hand region using the first prediction result, and input the RGB image corresponding to the local hand region into a trained BlazePalm hand detection model to obtain a hand detection frame;
[0057] If there are points in the hand detection frame in a default state, a second prediction result is obtained for the hand detection frame based on the optimized Kalman filter hand detection frame tracker as a real-time hand perception result.
[0058] The beneficial effects of the present application are as follows: the present application utilizes an optimized Kalman filter forearm tracker and a hand detection frame tracker to make up for the insufficient detection of the OpenPose human posture estimation model and the BlazePalm hand detection model, making the hand detection results more real-time and accurate. Due to the prediction error in the human posture estimation model, factors such as illumination changes, occlusion, and background may cause the predicted position of the wrist point to "drift", which will also cause the local hand area generated based on the wrist point to shift. Therefore, the present application adaptively generates a local hand area and optimizes the Kalman filter to detect the hand, and uses the length of the upper arm to determine the size and position of the hand area frame, thereby getting rid of the problem of over-reliance on the wrist point, making hand perception more stable, and can be applied to a variety of different application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present application and, together with the description, serve to explain the principles of the present application.
[0060] The present application can be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
[0061] Figure 1 A schematic diagram showing the steps of a real-time hand perception method based on adaptive positioning and Kalman filter tracking in an exemplary embodiment of the present application is shown;
[0062] Figure 2 A schematic diagram of the structure of a real-time hand perception device based on adaptive positioning and Kalman filter tracking according to an exemplary embodiment of the present application is shown;
[0063] Figure 3 A schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application is shown;
[0064] Figure 4 A schematic diagram of a storage medium provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0065] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present application. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present application. It is obvious to those skilled in the art that the present application can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present application, some technical features known in the art are not described.
[0066] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should also be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of the features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0067] Now, exemplary embodiments according to the present application will be described in more detail with reference to the accompanying drawings. However, these exemplary embodiments may be implemented in a variety of different forms and should not be construed as being limited to the embodiments described herein. The accompanying drawings are not drawn to scale, and certain details may be magnified and certain details may be omitted for the purpose of clear expression. The shapes of the various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are merely exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.
[0068] The following is attached to the instruction manual Figure 1-4 Several embodiments are given to describe exemplary implementations according to the present application. It should be noted that the following application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementations of the present application are not limited in this regard. On the contrary, the implementations of the present application can be applied to any applicable scenario.
[0069] Embodiment 1:
[0070] This embodiment implements a real-time hand perception method based on adaptive positioning and Kalman filter tracking. Figure 1 As shown, including:
[0071] S1, obtaining an RGB image and preprocessing the RGB image;
[0072] S2, inputting the preprocessed RGB image into the trained OpenPose human posture estimation model to obtain a first preset number of human key points;
[0073] S3, extracting a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair;
[0074] S4. If there is a point in a default state in the forearm key point pair, obtaining a first prediction result for the forearm key point pair based on the optimized Kalman filter forearm tracker, wherein the point in the default state indicates a point where position value regression fails;
[0075] S5. Adaptively generate a local hand region using the first prediction result, and input the RGB image corresponding to the local hand region into a trained BlazePalm hand detection model to obtain a hand detection frame;
[0076] S6. If there are points in the hand detection frame in a default state, a second prediction result is obtained for the hand detection frame based on the optimized Kalman filter hand detection frame tracker as a real-time hand perception result.
[0077] It should be noted here that Kalman filtering is a state equation based on a linear system. It is an algorithm for optimally estimating the state of the system by inputting and outputting observation data from the system. SSD is the abbreviation of Single Shot MultiBox Detector, which represents a target detection algorithm. BlazePalm is a hand detection model developed by Google. BlazeFace is a face detection model developed by Google. BlazeBlock is a sub-network module developed by Google, and BlazeFace and BlazePalm are composed of multiple sub-network modules. OpenPose is an open source human posture estimation model developed by the CMU Perceptual Computing Lab. The Hungarian algorithm is a combinatorial optimization algorithm for solving task allocation problems in polynomial time. IoU is the abbreviation of Intersection over Union, which is a standard for measuring the accuracy of detecting corresponding objects in a specific data set.
[0078] Furthermore, the method also includes: if the forearm key point pair is in a complete state and is in the first frame image, setting a forearm key point tracker for the forearm key point pair, wherein the forearm key point tracker requires initialization parameters.
[0079] Specifically, the optimized Kalman filter forearm tracker obtains a first prediction result for the forearm key point pair, including:
[0080] The forearm tracker predicts the state of the forearm key point pair at time t-1 and the state at time t is recorded as the predicted value;
[0081] Obtain the observation state of the forearm key point pair at time t and record it as the observation value;
[0082] The best matching pair of forearm key points based on the predicted value and the observed value is recorded as the first prediction result.
[0083] Further preferably, before obtaining the best matching pair of forearm key point pairs based on the predicted value and the observed value and recording it as the first prediction result, the method further includes:
[0084] Calculate the Euclidean distances corresponding to the wrist point and elbow point respectively;
[0085] The average distance is calculated based on the Euclidean distances corresponding to the wrist point and the elbow point to obtain the loss matrix;
[0086] The Hungarian algorithm is used based on the loss matrix to obtain the minimum loss.
[0087] More specifically, using the first prediction result to adaptively generate a local hand region includes:
[0088] Obtaining the wrist point and the elbow point in the first prediction result;
[0089] Calculate the two-dimensional vector modulus of the forearm based on the wrist point and the elbow point;
[0090] Calculate the two-dimensional vector modulus of the upper arm based on the elbow point and the shoulder point;
[0091] The coordinates and length and width values of the local area of the hand are calculated based on the determination formula of the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm;
[0092] Adaptively adjust the coordinates and length and width to obtain the local area of the hand.
[0093] Furthermore, the coordinates and length and width values of the local area of the hand are calculated based on the determination formula of the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm, and the formula is:
[0094]
[0095]
[0096]
[0097] Among them, c x , c y Respectively represent the x-axis coordinate and y-axis coordinate of the local area of the hand, Dist af Represents the two-dimensional vector norm of the forearm, Dist au represents the two-dimensional vector norm of the upper arm, w i Indicates wrist point, e i Indicates the elbow point, s i represents the shoulder point, l represents the width of the local area of the hand, x wi 、x ei 、x si The x-axis coordinates of the wrist point, elbow point, and shoulder point are respectively wi ,y ei,y si These are the y-axis coordinates of the wrist point, elbow point, and shoulder point, respectively.
[0098] Further preferably, the optimized Kalman filter includes a prediction phase and an update phase and a correction to the update phase; the correction to the update phase is based on the Kalman gain, wherein the Kalman gain is multiplied by an enhancement factor or by an attenuation factor.
[0099] Embodiment 2:
[0100] The present embodiment provides a real-time hand perception method based on adaptive positioning and Kalman filter tracking, including: acquiring an RGB image and preprocessing the RGB image; inputting the preprocessed RGB image into a trained OpenPose human posture estimation model to obtain a first preset number of human key points; extracting a second preset number of wrist points, elbow points and shoulder points from the first preset number of human key points to form a forearm key point pair and an upper arm key point pair; if there are points in a default state in the forearm key point pair, obtaining a first prediction result for the forearm key point pair based on an optimized Kalman filter forearm tracker; using the first prediction result to adaptively generate a local hand area, and inputting the RGB image corresponding to the local hand area into a trained BlazePalm hand detection model to obtain a hand detection frame; if there are points in a default state in the hand detection frame, obtaining a second prediction result for the hand detection frame based on an optimized Kalman filter hand detection frame tracker as a real-time hand perception result.
[0101] In a possible implementation, an RGB image is obtained and the RGB image is preprocessed. The RGB image can be read from a camera device, the RGB image is preprocessed, the size of the RGB image is adjusted to the input size of the human posture estimation module, the pixel value of the RGB image is normalized, and so on. Then the preprocessed image is input into the OpenPose human posture estimation model to obtain the position information of 18 key points of the human body. A total of 6 points, including left and right wrists, left and right elbows, and left and right shoulders, are extracted from the 18 key points of the human body. The left and right wrist points and the left and right elbow points constitute the left and right forearms, while the left and right elbow points and the left and right shoulder points constitute the left and right upper arms. Taking into account the instability of the OpenPose human posture estimation module, this instability may cause the above-mentioned human body key points to default, that is, the position value regression fails, and the xy-axis position information of the human body key points in the default state is assigned to -1. Therefore, if there is a point in the forearm key point pair in the default state, the first prediction result is obtained for the forearm key point pair based on the optimized Kalman filter forearm tracker. For example: the i-th forearm key point pair af i Contains the corresponding wrist point wi and elbow point ei, that is, af i ={w i, e i Similarly, the i-th upper arm key point pair au i Contains the corresponding elbow point e i and shoulder points i , that is, au i ={e i ,s i}, where the forearm key point pair can be divided into the default forearm key point af null Key points of the forearm and the complete forearm vaild Two. If a certain forearm key point is aligned with the wrist point i or elbow point i If both are in the default state (i.e., the xy-axis position information is -1), then this forearm key point is classified as a default forearm key point, otherwise it is classified as a complete forearm key point pair.
[0102] As a transformable implementation, in some embodiments, it further includes: if the forearm key point pair is in a complete state and is in the first frame image, a forearm key point tracker is set for the forearm key point pair, wherein the forearm key point tracker needs to initialize parameters. For example, if the input is the first frame image, based on each complete forearm key point pair, i vaild Wrist point and elbow points The position information is used as the initialization input to initialize a forearm key point tracker Assuming that there are currently m complete forearm key point pairs, then m forearm key point pair trackers can be obtained, and the m forearm key point pair trackers constitute the forearm key point pair tracker set The superscript 0 refers to the initial frame time point.
[0103] In a specific implementation, a forearm tracker based on an optimized Kalman filter obtains a first prediction result for a forearm key point pair, including: the forearm tracker predicts the state of the forearm key point pair at time t-1 and records the state at time t as a predicted value; obtains the observed state of the forearm key point pair at time t and records it as an observed value; obtains the optimal matching pair of the forearm key point pair based on the predicted value and the observed value and records it as the first prediction result.
[0104] Further preferably, before obtaining the optimal matching pair of forearm key point pairs based on the predicted values and the observed values and recording it as the first prediction result, it also includes: respectively calculating the Euclidean distances corresponding to the wrist point and the elbow point; calculating the average distance based on the Euclidean distances corresponding to the wrist point and the elbow point to obtain a loss matrix; and using the Hungarian algorithm based on the loss matrix to obtain the minimum loss.
[0105] More specifically, using the first prediction result to adaptively generate a local area of the hand includes: obtaining the wrist point and elbow point in the first prediction result; calculating the two-dimensional vector modulus of the forearm according to the wrist point and the elbow point; calculating the two-dimensional vector modulus of the upper arm according to the elbow point and the shoulder point; calculating the coordinates and length and width values of the local area of the hand based on the determination formula of the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm; and adaptively adjusting the coordinates and length and width values to obtain the local area of the hand. The calculation formulas for the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm are:
[0106] Dist af =||w i -e i || 2
[0107] Dist au =||e i -s i ‖ 2
[0108] Furthermore, the coordinates and length and width values of the local area of the hand are calculated based on the determination formula of the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm, and the formula is:
[0109]
[0110]
[0111]
[0112] Among them, c x , c y Respectively represent the x-axis coordinate and y-axis coordinate of the local area of the hand, Dist af Represents the two-dimensional vector norm of the forearm, Dist au represents the two-dimensional vector norm of the upper arm, w i Indicates wrist point, e i Indicates the elbow point, s i represents the shoulder point, l represents the width of the local area of the hand, x wi 、x ei 、x si The x-axis coordinates of the wrist point, elbow point, and shoulder point are respectively wi ,y ei ,y siThese are the y-axis coordinates of the wrist point, elbow point, and shoulder point, respectively. Since the aspect ratio of the hand detection frame is a 1:1 square, the length and width of the hand area frame are also the same, set to l. The 0.33 in the above formula is obtained by counting the ratio of the human palm length to the forearm length and the upper arm length, 0.9 is obtained by counting the ratio of the human forearm length to the upper arm length, and 1.6 is the optimal regional scale factor found in practice. The final hand area frame can be expressed in the form of "(upper left corner x-axis position, upper left corner y-axis position, width, height)", which is as follows:
[0113] Area hand =(cx-l*0.5, cy-l*0.5, l, l)
[0114] Through the above formula, the algorithm can make adaptive adjustments to the hand area box according to the current arm condition. For example, when the hand is stretched forward, the wrist point and the elbow point almost overlap on the two-dimensional plane, and the distance between the two is very small, while the elbow point to the shoulder point still maintains a certain distance. Therefore, the algorithm can use the length of the upper arm to determine the size and position of the hand area box, thereby getting rid of the problem of over-reliance on the wrist point.
[0115] It should be noted that the forearm key point tracker and hand detection frame tracker in the present application are implemented based on the modified enhanced Kalman filter. Compared with the traditional Kalman filter, the correction stage is optimized, that is, the optimized Kalman filter includes a prediction stage and an update stage and a correction to the update stage; the correction to the update stage is based on the Kalman gain, where the Kalman gain is multiplied by an enhancement factor or by an attenuation factor. The tracking algorithm of the traditional Kalman filter includes a prediction stage and an update stage. In the prediction stage, it is first assumed that the coordinates (x t ,y t ), and its transport speed is (v x , v y ), then the status value stat t =(x t ,y t , v x , v y ) T , observed value The state transition matrix A in the system state prediction equation is:
[0116]
[0117] The general tracking algorithm does not have the input of control variables by default, so the state equation can be defined as:
[0118]
[0119] In addition to the state prediction equation, an observation equation is also required, where the observation matrix is H. Its purpose is to transform the shape of the observation value matrix to correspond to the shape of the state matrix. The observation equation can be defined as:
[0120]
[0121]
[0122] Based on the above definition, is the prior state estimate at time t, which is an unreliable estimate made by the algorithm based on the posterior estimate at the previous time point. Combining the state equation, the corresponding prediction equation is: Among them, w t It is expressed as:
[0123]
[0124] In addition, let the prior estimated covariance at time t be where Q is the covariance of the excitation noise.
[0125] In the update phase, the main task is to make a correction to the unreliable estimate. The update formula is as follows:
[0126]
[0127]
[0128]
[0129] in, Indicates an unreliable estimate. represents the posterior state estimate, K t represents the Kalman gain, Represents the posterior estimated covariance. The modified enhanced Kalman filter is mainly used in the update phase To optimize, we first need to calculate the error between the posterior estimated state value and the observed value at the previous time point. The error calculation method is different for different applications. The error calculation of the forearm key point tracker is based on the Euclidean distance, and the hand detection frame tracker is based on the IoU value. When the error value is less than the set weak qualified threshold, the Kalman gain will be multiplied by an enhancement factor; if the error value is greater than the set strong qualified threshold, the Kalman gain will be multiplied by an attenuation factor; if the error value is between the weak qualified threshold and the strong qualified threshold, the Kalman gain will not change. The corresponding error formula is as follows:
[0130]
[0131] The error calculation of the forearm keypoint tracker is based on the Euclidean distance (corresponding to the formula below), and the hand detection box tracker is based on the IoU value (corresponding to the formula above). The corresponding prior state estimation value correction formula is as follows:
[0132]
[0133] Where Φ is the enhancement factor, which is optimally set to 2 in practice; Γ is the attenuation factor, which is preferably set to 0.9 in practice.
[0134] The Kalman gain actually plays a balancing role between the prior state estimate and the observation value. If the Kalman gain is enhanced, it means that the system currently "trusts" the observation value more, thus increasing the correction strength of the prior state estimate; if the Kalman gain is attenuated, it means that the system believes that the current posterior state estimate may overfit the observation value, resulting in reduced robustness. If there is an error in the observation value, the system estimate will also be easily affected, thus weakening the correction strength of the prior state estimate.
[0135] The optimized Kalman filter provides support for the forearm tracker and the hand detection frame tracker, so that the forearm tracker and the hand detection frame tracker can obtain the best matching pair. Through the correction of the update phase by the optimized Kalman filter, the first prediction result and the second prediction result obtained by the forearm tracker and the hand detection frame tracker are clear, stable and achieve real-time technical effects. For example, assuming that the current frame is the tth frame and there are m t-1 trackers, first m t-1 Each tracker needs to predict the state at the current time point t based on the state value at time t-1, and obtain the wrist point prior prediction value and the elbow point prior prediction For example, get n forearm key point pairs, including all af null and af vaild Two, each af i Wrist point w i and elbow point e i Need to be with m t-1 wrist point prior prediction value of each tracker and the elbow point prior prediction Calculate the corresponding Euclidean distances respectively and get dw ij and de ij Then calculate the average distance Get the loss matrix D∈Rn*m t-1 Then, based on the loss matrix D, the Hungarian algorithm is used to find the minimum loss combination and calculate the minimum loss pairing set of all current forearm key point pairs and all current trackers. Where k means there are k pairs of optimal matching pairs km T ={af, kt t-1}, k is less than or equal to m t-1 And K is greater than or equal to n. If there are k′ forearm key points that cannot be paired, af miss , and among the k′ forearm key points, k′ vaild The forearm key point pair tracker is initialized based on the wrist point and elbow point position information of each complete forearm key point pair as the initialization input and put into the forearm key point pair tracker set KTt; if there are k″ trackers that cannot be paired Then the life counter of k″ trackers is incremented by 1. When the life counter reaches the clearing threshold, the tracker is cleared from KT t Eliminate from the del trackers, then the final forearm key point pair tracker set KT at the tth frame t The number of trackers in the update is: m T =m t-1 +k′ vaild -m del .
[0136] The working process of the hand detection frame tracker is similar to that of the forearm tracker. The difference is that before the hand detection frame tracker based on the optimized Kalman filter obtains the second prediction result for the hand detection frame as the real-time hand perception result, it also includes: calculating the Iou values corresponding to the wrist point and the elbow point respectively; obtaining the loss matrix based on the Iou value; and using the Hungarian algorithm based on the loss matrix to obtain the minimum loss. Other working processes similar to the forearm tracker will not be repeated here. In addition, when the tracker cannot be paired, it is most likely because the corresponding missing key points cannot be predicted through human posture estimation, that is, the human key points in the default state. Therefore, the prior prediction values will be supplemented to the corresponding missing key points.
[0137] This application uses an optimized Kalman filter forearm tracker and a hand detection frame tracker to make up for the insufficient detection of the OpenPose human posture estimation model and the BlazePalm hand detection model, making the hand detection results more real-time and accurate. Due to the prediction error of the human posture estimation model, factors such as lighting changes, occlusion, and background may cause the predicted position of the wrist point to "drift", which will also cause the local hand area generated based on the wrist point to shift. Therefore, this application uses adaptive generation of the local hand area and optimized Kalman filter to detect the hand, and uses the length of the upper arm to determine the size and position of the hand area frame, thereby getting rid of the problem of over-reliance on the wrist point, making hand perception more stable, and can be applied to a variety of different application scenarios.
[0138] Embodiment 3:
[0139] This embodiment provides a real-time hand sensing device based on adaptive positioning and Kalman filter tracking. Figure 2 As shown, the device comprises:
[0140] An acquisition module 301 is used to acquire an RGB image and preprocess the RGB image;
[0141] A preprocessing module 302 is used to input the preprocessed RGB image into a trained OpenPose human posture estimation model to obtain a first preset number of human key points;
[0142] An extraction module 303 is used to extract a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair;
[0143] A first prediction module 304, if there is a point in a default state in the forearm key point pair, obtains a first prediction result for the forearm key point pair based on an optimized Kalman filter forearm tracker, wherein the point in the default state indicates a point where position value regression fails;
[0144] A hand detection module 305, configured to adaptively generate a local hand region using the first prediction result, and input an RGB image corresponding to the local hand region into a trained BlazePalm hand detection model to obtain a hand detection frame;
[0145] The second prediction module 306 obtains a second prediction result for the hand detection frame as a real-time hand perception result based on the optimized Kalman filter hand detection frame tracker if there is a point in the default state in the hand detection frame.
[0146] Please refer to the following Figure 3 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 3 As shown, the electronic device 2 includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, and the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and when the processor 200 runs the computer program, it executes the real-time hand perception method based on adaptive positioning and Kalman filter tracking provided in any of the aforementioned embodiments of the present application, and the electronic device can be an electronic device with a touch-sensitive display.
[0147] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 203 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0148] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving the execution instructions. The real-time hand perception method based on adaptive positioning and Kalman filter tracking disclosed in any implementation of the above-mentioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.
[0149] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.
[0150] The electronic device provided in the embodiment of the present application and the real-time hand perception method based on adaptive positioning and Kalman filter tracking provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.
[0151] The present application also provides a computer-readable storage medium corresponding to the real-time hand perception method based on adaptive positioning and Kalman filter tracking provided in the above-mentioned embodiment. Please refer to Figure 4 , Figure 4 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is executed by a processor, the real-time hand perception method based on adaptive positioning and Kalman filter tracking provided in any of the aforementioned embodiments will be executed.
[0152] In addition, examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0153] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the real-time hand perception method based on adaptive positioning and Kalman filter tracking provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0154] The present application embodiment also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the real-time hand perception method based on adaptive positioning and Kalman filter tracking provided in any of the aforementioned embodiments, the steps of the method including: acquiring an RGB image and preprocessing the RGB image; inputting the preprocessed RGB image into a trained OpenPose human posture estimation model to obtain a first preset number of human key points; extracting a second preset number of wrist points, elbow points and shoulder points from the first preset number of human key points to form a forearm key point pair and an upper arm key point pair; if there are points in a default state in the forearm key point pair, obtaining a first prediction result for the forearm key point pair based on an optimized Kalman filter forearm tracker; using the first prediction result to adaptively generate a local hand area, and inputting the RGB image corresponding to the local hand area into a trained BlazePalm hand detection model to obtain a hand detection frame; if there are points in a default state in the hand detection frame, obtaining a second prediction result for the hand detection frame based on an optimized Kalman filter hand detection frame tracker as a real-time hand perception result.
[0155] It should be noted that the algorithms and displays provided herein are not inherently related to any particular computer, virtual device or other device. Various general devices can also be used together with the teachings based thereon. According to the above description, it is obvious that the structure required for constructing such devices is constructed. In addition, the present application is not directed to any specific programming language. It should be understood that the content of the present application described herein can be implemented using various programming languages, and the above description of specific languages is to disclose the best implementation mode of the present application. In the specification provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this specification.
[0156] Similarly, it should be understood that in order to streamline the present application and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: the claimed application requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, the inventive aspects lie in less than all the features of the single embodiment disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present application.
[0157] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition they can be divided into multiple submodules or subunits or subassemblies. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification and all processes or units of any method or device disclosed in this manner can be combined in any combination. Unless otherwise clearly stated, each feature disclosed in this specification can be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0158] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the creation device of the virtual machine according to the embodiment of the present application. The present application can also be implemented as a device or device program for executing part or all of the methods described herein. The program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0159] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A real-time hand perception method based on adaptive positioning and Kalman filter tracking, characterized in that: The method comprises: Acquire an RGB image and preprocess the RGB image; Input the preprocessed RGB image into the trained OpenPose human pose estimation model to obtain a first preset number of human key points; Extracting a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair; If there is a point in a default state in the forearm key point pair, a first prediction result is obtained for the forearm key point pair based on an optimized Kalman filter forearm tracker, wherein the point in the default state represents a point where position value regression fails; Adaptively generate a local hand region using the first prediction result, and input the RGB image corresponding to the local hand region into a trained BlazePalm hand detection model to obtain a hand detection frame; If there are points in the hand detection frame in a default state, a second prediction result is obtained for the hand detection frame based on the optimized Kalman filter hand detection frame tracker as a real-time hand perception result.
2. The real-time hand perception method based on adaptive positioning and Kalman filter tracking according to claim 1 is characterized in that: The method further includes: if the forearm key point pair is in a complete state and is in the first frame image, setting a forearm key point tracker for the forearm key point pair, wherein the forearm key point tracker requires initialization parameters.
3. The real-time hand perception method based on adaptive positioning and Kalman filter tracking according to claim 1 or 2, characterized in that: The optimized Kalman filter forearm tracker obtains a first prediction result for the forearm key point pair, including: The forearm tracker predicts the state of the forearm key point pair at time t-1 and the state at time t is recorded as the predicted value; Obtain the observation state of the forearm key point pair at time t and record it as the observation value; The best matching pair of forearm key points based on the predicted value and the observed value is obtained and recorded as the first prediction result.
4. The real-time hand perception method based on adaptive positioning and Kalman filter tracking according to claim 3 is characterized in that: Before obtaining the best matching pair of forearm key points based on the predicted value and the observed value and recording it as the first prediction result, the method further includes: Calculate the Euclidean distances corresponding to the wrist point and elbow point respectively; Calculate the average distance based on the Euclidean distances corresponding to the wrist point and the elbow point to obtain a loss matrix; The minimum loss is obtained by using the Hungarian algorithm based on the loss matrix.
5. The real-time hand perception method based on adaptive positioning and Kalman filter tracking according to claim 3 is characterized in that: The step of adaptively generating a local hand region using the first prediction result includes: Obtaining the wrist point and the elbow point in the first prediction result; Calculating a two-dimensional vector modulus of the forearm according to the wrist point and the elbow point; Calculate the two-dimensional vector modulus of the upper arm based on the elbow point and the shoulder point; Calculate the coordinates and length and width values of the local area of the hand based on the determination formula of the forearm two-dimensional vector modulus and the upper arm two-dimensional vector modulus; Adaptively adjusting the coordinates and length and width values to obtain a local area of the hand; Wherein, the determination formula of the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm is: Dist af =||w i -e i ||2 Dist au =||e i -s i || 2 Among them, Dist af Represents the two-dimensional vector norm of the forearm, Dist au represents the two-dimensional vector norm of the upper arm, w i Indicates wrist point, e i Indicates the elbow point, s i Indicates the shoulder point.
6. The real-time hand perception method based on adaptive positioning and Kalman filter tracking according to claim 5 is characterized in that: The determination formula based on the two-dimensional vector modulus of the forearm and the two-dimensional vector modulus of the upper arm is used to calculate the coordinates and length and width values of the local area of the hand, and the formula is: Among them, c x , c y They represent the x-axis and y-axis coordinates of the local area of the hand, and l represents the width.
7. The real-time hand perception method based on adaptive positioning and Kalman filter tracking according to claim 4 is characterized in that: The optimized Kalman filter includes a prediction phase and an update phase and a correction to the update phase; the correction to the update phase is based on the Kalman gain, wherein the Kalman gain is multiplied by an enhancement factor or by an attenuation factor.
8. A real-time hand sensing device based on adaptive positioning and Kalman filter tracking, characterized in that: The device comprises: An acquisition module, used for acquiring an RGB image and preprocessing the RGB image; A preprocessing module, used for inputting the preprocessed RGB image into a trained OpenPose human posture estimation model to obtain a first preset number of human key points; An extraction module is used to extract a second preset number of wrist points, elbow points and shoulder points from the first preset number of human body key points to form a forearm key point pair and an upper arm key point pair; A first prediction module, if there is a point in a default state in the forearm key point pair, obtains a first prediction result for the forearm key point pair based on an optimized Kalman filter forearm tracker, wherein the point in the default state indicates a point where position value regression fails; A hand detection module, used to adaptively generate a local hand area using the first prediction result, and input an RGB image corresponding to the local hand area into a trained BlazePalm hand detection model to obtain a hand detection frame; The second prediction module obtains a second prediction result for the hand detection frame as a real-time hand perception result based on the optimized Kalman filter hand detection frame tracker if there is a point in the default state in the hand detection frame.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
