Disclosure of Invention
Aiming at the defects of the prior art, the invention aims to provide a human motion assessment method which can be suitable for multiple motion assessments, so that the efficiency of human motion assessment can be improved.
In order to solve the technical problems, the invention adopts the following technical scheme:
A human motion assessment method based on visual images, comprising the steps of:
s1, acquiring a video to be tested of a tester;
S2, performing skeleton analysis and gesture analysis on video frames of the video to be detected to generate a corresponding human body key point coordinate graph;
S3, calculating corresponding action evaluation auxiliary information based on the human body key point coordinate graph and combining corresponding action evaluation standards;
and S4, completing action evaluation according to the action evaluation auxiliary information and the corresponding action evaluation decision basis so as to generate a corresponding action evaluation result.
Preferably, in step S3, the motion estimation assistance information includes a counterclockwise rotation angle between key points;
The counterclockwise rotation angle is calculated by:
s301, acquiring key point coordinates A, B, C for calculating a counterclockwise rotation angle;
S302, calculating corresponding key point vectors based on key point coordinates A, B, C Key point vector
S303, vector key pointsRotated in the counterclockwise direction until it is aligned with the key point vectorCoinciding, then the key point vectorRotated to a keypoint vectorAs the corresponding counter-clockwise rotation angle.
Preferably, in step S3, the motion estimation auxiliary information includes a similarity between a counterclockwise rotation angle to be measured in the video to be measured and a counterclockwise rotation angle of a corresponding template in the template video, wherein the similarity between the counterclockwise rotation angle to be measured and the counterclockwise rotation angle of the corresponding template is calculated based on a dynamic time warping algorithm.
Preferably, the similarity between the counterclockwise rotation angle to be measured and the counterclockwise rotation angle of the corresponding template is calculated by the following steps:
S311, acquiring a counter-clockwise rotation angle sequence P (P 1,p2,…,pn) to be detected and a corresponding template counter-clockwise rotation angle sequence Q (Q 1,q2,…,qm);pi represents a counter-clockwise rotation angle to be detected corresponding to an ith frame of video frame in the video to be detected, and Q i represents a template counter-clockwise rotation angle corresponding to the ith frame of video frame in the template video;
S312, constructing an n multiplied by m two-dimensional matrix C based on the counter-clockwise rotation angle sequence to be detected and the counter-clockwise rotation angle sequence of the template, wherein C (i, j) represents Euclidean distance between the ith counter-clockwise rotation angle to be detected in the counter-clockwise rotation angle sequence to be detected and the jth counter-clockwise rotation angle of the template in the counter-clockwise rotation angle sequence of the template;
S313, in the two-dimensional matrix C, calculating the accumulated distance from the starting point position C (0, 0) to the end point position C (n, m) and recording the corresponding matching path;
and S314, calculating a corresponding similarity score based on the minimum accumulated distance D and the path step number K.
Preferably, the cumulative distance is calculated by the following formula:
d(i,j)=c(i,j)+min{d(i-1,j-1),d(i-1,j),d(i,j-1)};
the optimal matching path is selected by the following formula:
the similarity score is calculated by the following formula:
in the above expression, d (i, j) represents the cumulative distance from the start position C (0, 0) to the end position C (i, j), C k represents the kth element in the two-dimensional matrix C, s represents the similarity score, and h represents the adjustment coefficient, which is set to 0.2.
Preferably, the types of the anticlockwise rotation angle comprise a left forearm-left big arm angle, a left big arm-left shoulder angle, a left big arm-trunk angle, a trunk-left thigh angle, a left thigh-left calf angle, a right big arm-right forearm angle, a right shoulder-right big arm angle, a trunk-right thigh angle, a right thigh-right calf angle, and a similarity between the anticlockwise rotation angle to be measured and the anticlockwise rotation angle of the template, and the similarity between the anticlockwise rotation angle to be measured and the anticlockwise rotation angle of the template can only be calculated at a time.
Preferably, in step S3, when calculating the action evaluation auxiliary information, the recommended key points are selected to participate in the calculation through the following steps:
S321, calculating variances of all anticlockwise rotation angles in the human body key point coordinate graph;
S322, calculating motion information proportion corresponding to the anticlockwise rotation angle based on the variance of each anticlockwise rotation angle;
s323, selecting a key point corresponding to the anticlockwise rotation angle with the largest motion information proportion as a recommended key point.
Preferably, the variance of the counterclockwise rotation angle is calculated by the following formula:
calculating a motion information proportion of the counterclockwise rotation angle by the following formula:
in the formula, sigma 2 represents the variance of the anticlockwise rotation angle, R represents the anticlockwise rotation angle, u r represents the average value of the anticlockwise rotation angles in the human body key point coordinate graph, N represents the number of the anticlockwise rotation angles in the human body key point coordinate graph, and I n represents the motion information proportion of the nth anticlockwise rotation angle in the human body key point coordinate graph; The variance of the n counter-clockwise rotation angle in the human body key point coordinate graph is represented, and e represents a natural constant.
Preferably, in step S3, the motion estimation auxiliary information includes euclidean distances between key points;
By the formula Calculating Euclidean distance between key points;
in the above formula, d (A, B) represents the Euclidean distance between the key points A (x 1,x2,…,xn) and B (y 1,y2,…,yn).
Preferably, in step S3, the motion estimation auxiliary information includes a positional relationship between the key points, and the positional relationship between the key points includes a slope and a difference.
Compared with the prior art, the human body action evaluation method has the following beneficial effects:
1. The human body action evaluation method suitable for the evaluation of the multiple actions can be provided according to the action evaluation standard and the action evaluation decision basis of the corresponding actions, so that the corresponding evaluation method does not need to be designed for each action, and the efficiency of human body action evaluation can be improved.
2. According to the method, the human body key point coordinate graph is generated in a skeleton analysis and gesture analysis mode, and then the action evaluation auxiliary information is calculated by combining corresponding action evaluation standards, and the action evaluation is completed by combining action evaluation decision basis, so that the calculation of the action evaluation auxiliary information and the action evaluation thereof can be associated with the corresponding action evaluation standards and the action evaluation decision basis, and the calculation accuracy of the action evaluation auxiliary information and the accuracy and effect of the action evaluation can be ensured.
Detailed Description
The following is a further detailed description of the embodiments:
Examples:
first, the meaning of the action evaluation criterion and the action evaluation decision basis will be described.
Action evaluation criteria are items to be evaluated during action evaluation.
Taking squat as an example, the action evaluation criteria include 1) whether the test stick is directly above the top of the head, 2) whether the trunk is parallel to the lower leg or perpendicular to the ground, 3) whether the thigh is below horizontal when squatting, and 4) whether the knees remain consistent with the direction of the feet.
The action evaluation decision basis refers to scoring criteria in action evaluation.
Taking deep squat as an example, the action evaluation decision basis comprises 1) that a test rod is right above the top of the head, the trunk is parallel to the lower leg or vertical to the ground, the thighs are lower than the horizontal line when squatting down, the directions of the knees and feet are kept consistent to obtain 3 points, 2) the required action can not be completed or the heel lower board is completed to obtain 2 points, 3) the heel lower board upper board still can not complete the required action to obtain 1 point, and 4) pain occurs to any part of the body in the test process to obtain 0 point.
Based on the above description, a human motion evaluation method based on visual images is disclosed in the present embodiment.
As shown in fig. 1, the human motion estimation method based on the visual image includes the following steps:
s1, acquiring a video to be tested of a tester;
And S2, performing skeleton analysis and gesture analysis on video frames of the video to be detected to generate a corresponding human body key point coordinate graph, wherein in the embodiment, the skeleton analysis and gesture analysis are performed on the video frames of the video to be detected through AlphaPose models proposed by Shanghai transportation university.
S3, calculating corresponding action evaluation auxiliary information based on the human body key point coordinate graph and combining corresponding action evaluation standards;
and S4, completing action evaluation according to the action evaluation auxiliary information and the corresponding action evaluation decision basis so as to generate a corresponding action evaluation result.
According to the human body action evaluation method, the evaluation of various actions can be completed according to the action evaluation standard and the action evaluation decision basis of the corresponding actions, namely the human body action evaluation method suitable for the evaluation of the various actions is provided, so that the corresponding evaluation method does not need to be designed for each action, and the efficiency of human body action evaluation can be improved. Meanwhile, the human body key point coordinate graph is generated in a skeleton analysis and gesture analysis mode, and then motion evaluation auxiliary information is calculated by combining corresponding motion evaluation standards, motion evaluation is completed by combining motion evaluation decision basis, so that the calculation of the motion evaluation auxiliary information and the motion evaluation thereof can be associated with the corresponding motion evaluation standards and the motion evaluation decision basis, and the calculation accuracy of the motion evaluation auxiliary information and the accuracy and effect of the motion evaluation can be ensured.
In a specific implementation process, the motion estimation auxiliary information includes a counterclockwise rotation angle between key points, and the type of the counterclockwise rotation angle includes a left forearm and left forearm angle, a left forearm and left shoulder angle, a left forearm and torso angle, a torso and left thigh angle, a left thigh and left calf angle, a right forearm and right forearm angle, a right shoulder and right thigh angle, a torso and right thigh angle, and a right thigh and right calf angle, as shown in fig. 2.
The counterclockwise rotation angle is calculated by:
s301, acquiring key point coordinates A, B, C for calculating a counterclockwise rotation angle;
S302, calculating corresponding key point vectors based on key point coordinates A, B, C Key point vector
S303, vector key pointsRotated in the counterclockwise direction until it is aligned with the key point vectorCoinciding, then the key point vectorRotated to a keypoint vectorAs the corresponding counter-clockwise rotation angle.
The skeleton analysis and the gesture analysis are carried out on the video frame to obtain a two-dimensional gesture, and the key points in the human body key point coordinate graph are actually projections of the real gesture on a two-dimensional plane, so that a simple limb angle is difficult to accurately represent a motion limb characteristic. As shown in fig. 3, the limb angle between the right large arm and the right small arm is the same when the right arm is bent in front of the chest and bent on one side of the body, respectively. From the data, the action limb characteristics of the right arm are the same, because the limb angles between the right big arm and the right small arm are the same, and the two actions can be greatly different in practice.
Therefore, the invention adds the direction information, namely the rotation direction, on the basis of the limb angle, so that the generated anticlockwise rotation angle simultaneously has the angle information and the direction information (shown in fig. 4), thereby solving the problem that part of posture information is lost when the real posture is projected to the two-dimensional plane, accurately representing the motion limb characteristics and ensuring the accuracy of human motion assessment. Meanwhile, the ten anticlockwise rotation angles designed by the invention can basically cover important action limb characteristics of the human body posture, so that the effect of human body action evaluation can be further ensured.
In the specific implementation process, the action evaluation auxiliary information comprises the similarity between the counter-clockwise rotation angle to be detected in the video to be detected and the counter-clockwise rotation angle of the corresponding template in the template video, wherein the similarity between the counter-clockwise rotation angle to be detected and the counter-clockwise rotation angle of the corresponding template is calculated based on a dynamic time warping algorithm. In this embodiment, when calculating the similarity between the counterclockwise rotation angle to be measured and the counterclockwise rotation angle of the template, only the similarity between a certain type of counterclockwise rotation angle can be calculated at a time.
The similarity between the anticlockwise rotation angle to be measured and the anticlockwise rotation angle of the corresponding template is calculated through the following steps:
S311, acquiring a counter-clockwise rotation angle sequence P (P 1,p2,…,pn) to be detected and a corresponding template counter-clockwise rotation angle sequence Q (Q 1,q2,…,qm);pi represents a counter-clockwise rotation angle to be detected corresponding to an ith frame of video frame in the video to be detected, and Q i represents a template counter-clockwise rotation angle corresponding to the ith frame of video frame in the template video;
S312, constructing an n multiplied by m two-dimensional matrix C based on the counter-clockwise rotation angle sequence to be detected and the counter-clockwise rotation angle sequence of the template, wherein C (i, j) represents Euclidean distance between the ith counter-clockwise rotation angle to be detected in the counter-clockwise rotation angle sequence to be detected and the jth counter-clockwise rotation angle of the template in the counter-clockwise rotation angle sequence of the template;
S313, in the two-dimensional matrix C, calculating the accumulated distance from the starting point position C (0, 0) to the end point position C (n, m) and recording the corresponding matching path;
and S314, calculating a corresponding similarity score based on the minimum accumulated distance D and the path step number K.
In the specific implementation process, the accumulated distance is calculated by the following formula:
d(i,j)=c(i,j)+min{d(i-1,j-1),d(i-1,j),d(i,j-1)};
the optimal matching path is selected by the following formula:
the similarity score is calculated by the following formula:
In the above expression, d (i, j) represents the cumulative distance from the start position C (0, 0) to the end position C (i, j), C k represents the kth element in the two-dimensional matrix C, s represents the similarity score, and h represents the adjustment coefficient, which is set to 0.2. DTW in the formula refers to the best matching path algorithm.
In actual action evaluation, the video to be tested and the template video are compared and the similarity is calculated, so that the action evaluation is completed through the similarity. Video images are typically in time series form, so that it is the similarity of the two time series that needs to be calculated. However, since different persons do the same action at different speeds, even if the same person repeatedly does the same action, there is a difference between body parts, resulting in that the lengths of the two time series do not substantially coincide. At this time, the existing method for calculating the similarity based on the euclidean distance cannot effectively calculate the similarity between time sequences.
Therefore, the method introduces a dynamic time warping algorithm to calculate the similarity between the video to be detected and the template video, calculates the accumulated minimum distance between the two sequences by adjusting the time corresponding relation (namely the length relation) of the two sequences so as to find the optimal matching path, so that the time sequence similarity of the two sequences with unequal lengths can be calculated, and the accuracy of human motion assessment can be ensured. Meanwhile, the anticlockwise rotation angle can accurately represent the action limb characteristics, so that the similarity between the video to be detected and the template video can be effectively represented through the similarity between the anticlockwise rotation angles, and further human action evaluation can be better assisted.
In the specific implementation process, when the action evaluation auxiliary information is calculated, the recommended key points are selected to participate in calculation through the following steps:
S321, calculating variances of all anticlockwise rotation angles in the human body key point coordinate graph;
S322, calculating motion information proportion corresponding to the anticlockwise rotation angle based on the variance of each anticlockwise rotation angle;
s323, selecting a key point corresponding to the anticlockwise rotation angle with the largest motion information proportion as a recommended key point.
The variance of the counterclockwise rotation angle is calculated by the following formula:
calculating a motion information proportion of the counterclockwise rotation angle by the following formula:
in the formula, sigma 2 represents the variance of the anticlockwise rotation angle, R represents the anticlockwise rotation angle, u r represents the average value of the anticlockwise rotation angles in the human body key point coordinate graph, N represents the number of the anticlockwise rotation angles in the human body key point coordinate graph, and I n represents the motion information proportion of the nth anticlockwise rotation angle in the human body key point coordinate graph; The variance of the n counter-clockwise rotation angle in the human body key point coordinate graph is represented, and e represents a natural constant.
When the actual motion is evaluated, most of the motions only carry out main motions of a small part of limbs, and the motion amplitude of other limbs is not large or does not carry out motions. The limb angle change range of the main movement is larger, the limb change range of the non-movement is smaller, and the limb which performs the main movement is generally considered in the action evaluation.
Therefore, the method selects the recommended key points with large movement amplitude to participate in calculation by calculating the variance of the anticlockwise rotation angle, the movement information proportion and the Euclidean distance difference value among the key points, on one hand, the recommended key points can accurately reflect the limb which performs main movement, so that the accuracy of human body movement evaluation can be ensured, and on the other hand, the key points corresponding to the limb which does not perform movement or does not perform movement do not participate in calculation, so that the calculation amount of human body movement evaluation can be reduced.
In the specific implementation process, the action evaluation auxiliary information comprises Euclidean distances among key points;
By the formula Calculating Euclidean distance between key points;
in the above formula, d (A, B) represents the Euclidean distance between the key points A (x 1,x2,…,xn) and B (y 1,y2,…,yn).
In the implementation process, the action evaluation auxiliary information comprises the position relation among key points, wherein the position relation among the key points comprises a slope and a difference value.
According to the method and the device, the action evaluation auxiliary information such as Euclidean distance among the key points and the position relation among the key points can be calculated to assist in completing the action evaluation, so that the method and the device can be better applied to evaluation of various actions, and therefore efficiency and accuracy of human action evaluation are guaranteed.
Specifically, when a human body key point coordinate graph is generated, firstly inputting a corresponding video frame into a pre-trained gesture estimation model to output a corresponding heat map;
the method comprises the steps of acquiring a gesture data set for training when a gesture estimation model is trained, converting a label marked in advance on a training chart in the gesture data set into a corresponding heat chart label to obtain a corresponding label heat chart;
when a label heat map is generated, firstly, setting the size (W h×Hh) of the label heat map to generate an all-zero matrix with the size of W h×Hh, and then calculating the heat distribution of a pre-marked label on the label heat map through the following formula to generate a corresponding label heat map;
Obtaining a heat map with the size of W h×Hh when the coordinates of the key points are calculated, reducing the dimension of the heat map to 1*W h*Hh, calculating the maximum heat value index of the corresponding key points in the heat map through the following formula, and finally calculating the coordinates of the corresponding key points through the index corresponding to the maximum heat value in the heat map and the heat map dimension, wherein the quotient obtained by dividing the index by the corresponding W h is the number x of the key points with the size of W h×Hh, and the remainder is the number y of the key points with the size of W h×Hh, namely the coordinates (x, y) of the key points are obtained;
In the above, g represents a heat value, x 0、y0 represents real coordinates of a label marked in advance, x and y represent coordinates of the label in a label heat map, sigma represents standard deviation, the value of which is 2 or 3;e represents a natural constant, i and j respectively represent indexes of a one-dimensional heat map, x i、xj represents heat values corresponding to the indexes i and j, and beta represents a calibration coefficient.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will understand that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Meanwhile, the common general knowledge of the specific construction and characteristics of the embodiment is not described here too much. Finally, the scope of the invention as claimed should be determined by the claims, and the description of the embodiments and the like in the specification should be construed to explain the content of the claims.