Medipe and random forest algorithm-based marathon running posture correction method
By combining Mediapipe and Random Forest algorithms, marathon running posture can be identified and corrected in real time, solving the problem that existing technologies cannot effectively identify and correct it. This achieves accurate identification and correction of running posture, reducing the risk of athlete injury and equipment costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANTONG UNIV
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies cannot effectively and in real time identify and correct marathon running posture, leading to poor athlete performance and health problems. Furthermore, traditional equipment has limitations in data collection and is costly.
The system uses the Mediapipe algorithm to detect 33 key skeletal nodes in the human body, combines them with the random forest algorithm to construct a decision tree, identifies abnormal running postures in real time, and collects images from multiple angles using drones, providing real-time feedback and correction through a lightweight app.
It enables real-time and accurate recognition and correction of marathon running posture, reducing the probability of athlete injury, lowering costs, and is suitable for training needs in multiple scenarios.
Smart Images

Figure CN122024314A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision and pattern recognition technology, specifically to a marathon running posture correction method based on Mediapipe and random forest algorithms. Background Technology
[0002] As a sporting event with broad participation and high spectator appeal, the marathon attracts numerous professional athletes and ordinary people alike. Proper running form is a key factor in improving marathon performance. Incorrect running form (such as incorrect foot strike, knee buckling, excessive forward leaning, etc.) not only affects marathon performance but can also lead to sports injuries such as tibial stress syndrome, iliotibial band syndrome, and plantar fasciitis, seriously impacting runners' experience and health.
[0003] Existing methods for correcting marathon running posture mainly include two types: manual guidance and simple device assistance. Manual guidance relies on the on-site observation of professional coaches, which has the problems of strong subjectivity, high cost, and difficulty in covering the entire exercise. Traditional device assistance methods (such as sports bracelets and pressure-sensing insoles) can only collect partial exercise data (such as cadence and plantar pressure), which cannot fully capture the runner's posture characteristics and lack the ability to accurately identify and correct abnormal running posture in real time. At the same time, wearable sensor devices can affect the athlete's force exertion, further affecting running posture.
[0004] With the development of computer vision and artificial intelligence technologies, the Mediapipe algorithm, an open-source pose estimation framework launched by Google, boasts advantages such as strong real-time performance and accurate skeletal node recognition, enabling rapid extraction of human motion posture data. Currently, however, the Mediapipe algorithm has no application for marathon running posture correction, which is a significant loss for the popularization of marathon running, the improvement of athlete performance, and the protection of athletes' health. Summary of the Invention
[0005] This invention addresses the aforementioned problems by providing a marathon running posture correction method based on Mediapipe and Random Forest algorithms. This method enables real-time, accurate identification, anomaly detection, and personalized correction of running posture, facilitating efficient marathon training, improving athlete performance, and preventing injuries. First, the three-dimensional coordinates of 33 key skeletal nodes throughout the marathon runner's body are selected, and knee flexion angle, arm swing amplitude, torso forward lean angle, take-off height, and movement speed are calculated as feature values. Using the feature importance evaluation function built into the Random Forest algorithm, multiple decision trees are constructed. The split contribution of each feature in the decision trees is calculated, and the importance score of each feature is obtained. The five features with the highest scores are deleted, and the features are subjected to dimensionality reduction processing. Ultimately, this improves the stability and accuracy of marathon running posture recognition, providing technical support for the daily training of professional athletes and marathon enthusiasts.
[0006] This invention provides a marathon running posture correction method based on Mediapipe and Random Forest algorithms, comprising the following steps:
[0007] Step 1: Human posture image acquisition;
[0008] Step 2: Human body and key points of human posture detection;
[0009] Step 3: Feature extraction;
[0010] Step 4: Random Forest Model Training and Evaluation;
[0011] Step 5: Identify running posture errors;
[0012] Step 6: Real-time feedback on running posture issues.
[0013] Furthermore, step 1 includes deploying one drone in each of the four directions—front, back, left, and right—to capture running posture images of the athlete from four angles during training; the drones are set to follow the direction the athlete is moving.
[0014] Furthermore, step 2 utilizes Mediapipe's BlazePose module to process the input image or video frames in real time. Based on a lightweight neural network architecture, it quickly and accurately detects the three-dimensional coordinates of 33 key skeletal nodes of the human body.
[0015] Further, step 3 calculates the knee flexion angle, arm horizontal swing angle, arm vertical swing angle, torso forward tilt angle, height in the air, and movement speed based on the three-dimensional coordinates of 33 key skeletal nodes of the human body, and uses these as feature data; the extracted feature data is checked, and samples with default values are deleted to ensure data integrity.
[0016] Further, step 4 uses the processed feature data and corresponding running posture problem labels to train the random forest classifier. The random forest constructs multiple decision trees through multiple samplings and feature subset selections of the training data, and determines the final classification result through a voting mechanism. The trained model is evaluated using multiple evaluation methods, including confusion matrix, accuracy, precision, and F1 score. The confusion matrix visually displays the model's classification performance across different categories; accuracy measures the proportion of correctly predicted samples out of the total samples; precision reflects the proportion of samples predicted as positive that are actually positive; and the F1 score comprehensively considers both precision and recall.
[0017] Furthermore, step 5 uses the trained random forest model to infer the extracted feature data and output the running posture anomaly type and anomaly confidence level; combined with multi-angle images collected by the drone in four directions, the anomaly judgment results are cross-validated to avoid misjudgment caused by single-angle occlusion.
[0018] Furthermore, step 6 includes building a lightweight running posture real-time correction APP that can be embedded in a sports watch or mobile phone; the built APP supports functions such as real-time display of running posture feature data, voice prompts, and differentiated training.
[0019] The above method uses the angles and distances of joint points as features. First, it detects 33 key skeletal nodes in the human body and calculates the knee flexion angle, arm swing amplitude, trunk forward lean angle, take-off height, and movement speed. Then, it optimizes the knee flexion angle, arm swing amplitude, trunk forward lean angle, take-off height, and movement speed through feature importance analysis and feature reduction. The random forest algorithm is used to train and evaluate the model. The test is packaged into a UI interface, and a real-time feedback APP that can be embedded in a sports watch is built to realize real-time feedback and correction of marathon running posture.
[0020] The present invention has the following advantages over the prior art:
[0021] 1. This invention addresses the problems of traditional manual guidance relying on professional coaches for on-site observation, high costs, and inability to cover the entire exercise process. It achieves automated, contactless monitoring of marathon running posture, lowering the threshold and cost of posture correction and reducing the probability of athlete injury. Breaking through the limitations of traditional assistive devices that can only collect localized motion data (such as cadence and plantar pressure), it accurately extracts the coordinates of 33 key skeletal nodes and multi-dimensional motion parameters (knee flexion angle, arm horizontal swing angle, arm vertical swing angle, torso forward lean angle, take-off height, and movement speed) based on the Mediapipe framework, comprehensively capturing running posture characteristics and providing data support for accurate analysis.
[0022] 2. This invention is based on the Mediapipe algorithm, which has high precision in skeletal node extraction and can effectively capture subtle posture changes of marathon runners. The error in identifying key joint angles is no more than 3°. With the help of the Random Forest algorithm, which has good classification performance, the recognition rate of 8 common marathon running posture abnormalities is no less than 95%, and differentiating different types of running posture problems in real time and effectively.
[0023] 3. The system of this invention has a latency of no more than 100ms, enabling real-time recognition and correction feedback of running posture to meet the needs of marathon athletes and dynamic adjustments. It can also generate targeted correction plans based on the runner's physical condition and athletic level, and supports online self-learning of the model to continuously optimize recognition and correction accuracy. Real-time language correction is also supported. By using drone tracking to collect marathon athletes' running posture data and comparing it with a dataset of correct running postures, the system can be used in outdoor tracks, urban tracks, and other scenarios to meet multi-scenario training needs. Attached Figure Description
[0024] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0025] Figure 1 This is a flowchart of the real-time marathon running posture correction system described in this invention;
[0026] Figure 2 This is a schematic diagram of human posture image acquisition according to the present invention;
[0027] Figure 3 This is the human body prediction process based on the BlazePose algorithm described in this invention;
[0028] Figure 4 This is an information diagram of 33 key points of the human body as described in this invention;
[0029] Figure 5 The following is a schematic diagram of the geometric features described in this invention: (a) is the knee bending angle; (b) is the arm swing angle; (c) is the torso forward tilt angle. Detailed Implementation
[0030] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] Example 1:
[0032] This embodiment provides a marathon running posture correction method based on Mediapipe and random forest algorithms;
[0033] As Figure 1As shown, the process includes the following steps: S1: Multi-angle human posture image acquisition; S2: Human body and human posture key point detection; S3: Geometric feature extraction and data preprocessing; S4: Using the random forest algorithm to train the extracted features, obtain a classification model, and perform feature importance analysis, model evaluation and optimization; S5: Identify running posture problems of marathon athletes on the track through the recognition model; S6: Real-time feedback on running posture problems.
[0034] Figure 2 This is a schematic diagram of human posture image acquisition according to the present invention (i.e., step S1); in step S1, the athlete is conducting daily marathon training on the track, and a drone is deployed in each of the four directions of front, back, left and right of the athlete to acquire running posture images of the athlete from four angles; the drone is set to follow function and flies in the direction the athlete is moving.
[0035] Step S2 involves human body and human pose key point detection: This invention uses the BlazePose model in the Mediapipe algorithm, which employs a strategy combining a detector and a tracker (e.g., Figure 3 The specific steps are as follows: (1) Detect the face using the BlazeFace model; (2) Predict the midpoints of the shoulder joints and hip joints of the human body using the BlazePose model, and connect the two points for the alignment operation of the entire human body; (3) Predict 33 key points of the human body ( Figure 4 ).
[0036] Step S4 is geometric feature extraction and data preprocessing. The geometric features involved in this invention include: knee bending angle, arm swing angle, torso forward tilt angle, height in the air, and movement speed. Figure 5 The following is a schematic diagram of the geometric features described in this invention: (a) is the knee flexion angle; (b) is the arm swing angle; (c) is the torso forward lean angle; the specific calculation method for the above geometric features is as follows:
[0037] (1) The calculation of the knee flexion angle is as follows:
[0038] The essence of knee flexion angle is calculating the angle between the thigh and the lower leg. Taking the left side of the body as an example, points 23, 25, and 27 are involved. Let the coordinates of points 23, 25, and 27 be A(x...). 23 , y 23 B(x) 25 , y 25 ) and C(x 27 , y 27 The thigh and calf vectors are as follows:
[0039]
[0040]
[0041] The formula for calculating the knee flexion angle is as follows:
[0042]
[0043] (2) The calculation of the arm swing angle is as follows:
[0044] Arm swing angles are divided into horizontal swing angles (left and right arm swings) and vertical swing angles (forward and backward arm swings).
[0045] ① The calculation of the arm swing angle is divided into horizontal swing angle (left and right arm swing). Taking the right side of the body as an example, the direction of the torso midline is used as the horizontal reference vector, involving points 12, 16 and the midpoint of the hip; let the coordinates of points 12 and 16 be F(x) and F(x) respectively. 12 ,y 12 ) and G(x 16 , y 16 The x-coordinate of the torso midline is:
[0046]
[0047] The horizontal swing vector and the horizontal reference vector (direction of the torso midline) are as follows:
[0048]
[0049]
[0050] The formula for calculating the horizontal swing angle is as follows:
[0051]
[0052] ② Calculate the angle between the arm and the vertical direction (reflecting arm swing height and forward / backward swing amplitude). Taking the right side of the body as an example, the horizontal swing vector and vertical reference vector are as follows:
[0053]
[0054]
[0055] The formula for calculating the vertical swing angle is as follows:
[0056]
[0057] (3) The calculation of the forward tilt angle of the torso is as follows:
[0058] The forward tilt angle is the angle between the central axis of the human torso and the vertical direction. The core is to construct a torso vector by using the midpoint of the shoulder and the midpoint of the hip, and calculate the angle between it and the vertical direction, which reflects the degree of body tilt during running.
[0059] midpoint of shoulder S(x) s , y s ) and the midpoint of the hip H(x) h , y h The coordinates of ) are as follows:
[0060]
[0061]
[0062] The torso vector and vertical direction vector are as follows:
[0063]
[0064]
[0065] The formula for calculating the forward tilt angle of the torso is as follows:
[0066]
[0067] (4) The calculation of the take-off height is as follows:
[0068] The core of calculating the height of flight is detecting the vertical displacement of key points on the ankle joint. Let the average y-coordinate of the ankle joint when standing be y. base The average y-coordinate of the ankle joint during takeoff is y jump The formula for calculating takeoff height is as follows:
[0069]
[0070] (5) The calculation of human movement speed is as follows:
[0071] Human movement speed is the distance the human body travels per unit time, here expressed as the distance H(x) at the midpoint of the hip. h , y h The speed of human movement is represented by the specific movement within a unit time Δt. Let H(x) be the coordinate of the midpoint of the hip at time t. h ,y h At time t+Δt, the coordinates of the midpoint of the hip are H(x). h+1 , y h+1 The calculation of human movement speed is as follows:
[0072]
[0073] In summary, the geometric features used in this invention for correcting marathon running posture are (θ1, θ2, θ3, θ4, Δy, v), namely: knee flexion angle, horizontal arm swing angle, vertical arm swing angle, torso forward lean angle, take-off height, and movement speed.
[0074] Before proceeding to step S4, the acquired geometric feature data needs to be preprocessed, specifically including loading the original data, grouping by category, deleting duplicate samples, handling missing values, handling outliers, and saving the processing results.
[0075] Step S4 involves using the random forest algorithm to train the extracted features, obtain a classification model, and perform feature importance analysis, model evaluation, and optimization. The feature data used for training is the geometric feature data of the standard postures of professional athletes collected from the model.
[0076] The process of training marathon running posture geometric feature data using the random forest algorithm includes: processing marathon running posture geometric feature data, dataset partitioning, model construction and training, model evaluation, and parameter tuning.
[0077] The processing of marathon running posture geometric feature data includes processing outliers and duplicate values in the dataset.
[0078] The dataset partitioning refers to using the pre-processed and saved geometric feature data of standard running posture of professional athletes as the training set, and the collected geometric feature data of running posture of ordinary runners or those with non-standard postures as the test set.
[0079] The aforementioned model construction and training refers to using the formed classification features and corresponding labels as input to the training set, feeding them into a random forest classifier for training, and obtaining a trained random forest classification model.
[0080] The model evaluation involves using the trained model to predict the test set X_test, and obtaining the prediction result Y_pred.
[0081] The parameter adjustment mentioned above refers to adjusting the parameters of the trained model based on the error between the predicted results and the actual results.
[0082] Step S5 is for identifying running posture errors:
[0083] Real-time acquisition of running posture images of athletes during training; inference on the extracted feature data through a pre-trained random forest model; output of running posture abnormality type (excessive forward lean of the trunk, insufficient arm swing amplitude, knee valgus, etc.) and abnormality confidence (threshold set at 0.85, those above the threshold are judged as valid abnormalities).
[0084] By combining multi-angle images collected by drones from four directions, the anomaly detection results are cross-validated to avoid misjudgments caused by occlusion from a single angle (e.g., drones from the rear can supplement the verification of whether the foot landing method is different).
[0085] Step S6 provides real-time feedback on marathon running posture issues:
[0086] A lightweight running posture real-time correction app is built that can be embedded in sports watches or mobile phones; it adopts TTS speech synthesis technology to broadcast the type of abnormality and correction prompts in real time, with a voice broadcast delay of no more than 100ms; the app interface displays the current running posture key feature values, abnormality types and standard range references in real time, and supports historical data review; based on the user's body data and training goals, combined with the abnormality types identified by the model, targeted correction suggestions are generated; the app allows users to mark feedback results, and user feedback data and new running posture samples are regularly added to the training set to continuously optimize the model's recognition accuracy through incremental training and adapt to the individual differences of different athletes.
[0087] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A marathon running posture correction method based on Mediapipe and Random Forest algorithms, characterized in that, Includes the following steps: S1: Acquire multi-angle human posture images; S2: Human body and key points of human posture detection; S3: Geometric feature extraction and data preprocessing; S4: Use the random forest algorithm to train the extracted features, obtain a classification model, and perform feature importance analysis, model evaluation and optimization; S5: Identify running posture issues of marathon runners on the track using a recognition model; S6: Real-time feedback on running posture issues.
2. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 1, characterized in that, The acquisition process in step S1 mainly includes athletes conducting daily marathon training on the track, deploying drones around the athletes, and acquiring images of the athletes' running postures during training.
3. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 2, characterized in that, Step S2 specifically includes the following steps: S21: Detect faces using the BlazeFace model; S22: Use the BlazePose model to predict the midpoints of the two shoulder joints and the midpoints of the hip joints of the human body, and connect the two points for alignment operations of the entire human body. S23: Predicts 33 key points in the human body.
4. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 3, characterized in that, The geometric features in step S3 mainly include knee bending angle, arm swing angle, torso forward lean angle, height in the air, and movement speed.
5. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 4, characterized in that, The data preprocessing in step S3 includes loading the original data, grouping by category, deleting duplicate samples, handling missing values, handling outliers, and saving the processing results.
6. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 5, characterized in that, The process of training marathon running posture geometric feature data using the random forest algorithm in step S4 includes: processing marathon running posture geometric feature data, dividing the dataset, building and training the model, evaluating the model, and adjusting the parameters.
7. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 6, characterized in that, Step S5 specifically includes real-time acquisition of running posture images of athletes during training, inference of the extracted feature data through a pre-trained random forest model, outputting the running posture anomaly type and anomaly confidence; and cross-validating the anomaly judgment results by combining multi-angle images acquired by drones from multiple directions to avoid misjudgments caused by single-angle occlusion.
8. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 7, characterized in that, Step S6 specifically includes building a lightweight running posture real-time correction APP that supports embedding into sports watches or mobile phones, providing real-time feedback on running posture problems.
9. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 2, characterized in that, In step S1, a drone is deployed in each of the four directions of the athlete: front, back, left, and right, to capture images of the athlete's running posture from four angles.
10. The marathon running posture correction method based on Mediapipe and Random Forest algorithm according to claim 9, characterized in that, Step S4 includes processing the geometric feature data of marathon running posture and handling outliers and duplicate values in the dataset; dataset partitioning refers to using the preprocessed and saved geometric feature data of standard running posture of professional athletes as the training set. The collected geometric feature data of running postures from ordinary runners or runners with non-standard postures are used as the test set.