Abstract
Monitoring the process of musculoskeletal rehabilitation is of great importance for ensuring a person’s health after suffering from illnesses, especially during the outpatient period when medical supervision is absent. The aim of this study is to create an accessible tool (a mobile application) that allows for the monitoring of the execution of musculoskeletal rehabilitation exercises. To achieve this goal, the architecture of a mobile application has been developed, along with its functioning algorithm, and the methods for processing information from two tracking systems (inertial navigation and computer vision) have been examined to assess the quality of performed exercises. During the experimental research, procedures for processing data from mobile inertial navigation sensors were refined, a solution to the classification task of musculoskeletal rehabilitation exercises was explored (with an accuracy of 93–100%), and prototyping of the mobile application was carried out. The results obtained can be used for evaluating outpatient rehabilitation and as a basis for more complex and functional mobile systems for musculoskeletal rehabilitation.
1. Introduction
About 80% of the population faces various issues related to the musculoskeletal system. The causes can include injuries, diseases, and strokes, which have a significant negative impact on the brain and physical functions of a person [1,2]. Conducting necessary rehabilitation is a lengthy and complex process that must be carried out under the strict supervision of a treating physician. However, an equally important stage is outpatient rehabilitation. If a patient does not engage in therapeutic physical exercises after discharge, motor functions after a stroke may not recover. This leads to partial or even complete loss of functionality in the upper or lower limbs, accompanied by muscle weakness, poor endurance, lack of muscle control, and paralysis [3].
It has been proven that systematic performance of labor-intensive and complex therapeutic exercises results in better functional recovery [4]. Therefore, organizing control and monitoring of a person’s activities without the personal observation of a treating physician is an important stage in the overall rehabilitation process.
One of the main components of outpatient rehabilitation is ensuring a comprehensive approach to performing exercises: individuals must receive the necessary tools for obtaining information about required exercises (both textual and visual) as well as for collecting data on physical activity during these exercises for subsequent assessment and monitoring of rehabilitation progress. Due to the high availability of wearable technologies, devices, and smartphones, improvements in their performance, and a wide range of built-in sensors, new opportunities have emerged for collecting a broad, comprehensive, and continuous set of characteristics related to human bodily functions [5,6]. Existing research in this area is discussed below.
Mobile devices have been successfully applied in the diagnosis and treatment of cardiovascular [7], visual [8], and skin [9] diseases and many other areas of medicine. Smart wearable devices combined with software that supports advanced analytics can provide the capability to track the dynamics of the rehabilitation process at home in the absence of constant medical supervision. Mobile applications can enhance the accessibility of rehabilitation in both rural and urban settings, reduce travel time and costs, increase engagement in therapeutic activities, and facilitate shared decision-making with healthcare providers regarding treatment processes [10].
Mobile technologies can extend the observation period after discharge from the emergency department, thereby lengthening the rehabilitation period. For example, a study [11] describes an application that compensates for the lack of motor activity in the upper limbs of patients who have experienced an acute ischemic stroke. In another article [12], patients were encouraged to engage in systematic home workouts regulated by receiving instructions via mobile phone. As a result of this study, an average or significant improvement in motor activity was observed among patients using the mobile application compared to those who did not have it.
An urgent problem is also the elimination of speech disorders, for which several mobile applications have been developed, such as “Talk Around It Home” and “Reading Aphasia” [13].
A mobile application for analyzing movements of the cervical spine is presented in work [14]. The authors applied a computer vision-based approach using a mobile phone camera to assess the range of motion of the user’s neck and implemented some exercises in a game format.
A systematic review [15] showed that, in the 14 studies examined, positive dynamics in balance and gait indicators were identified after four or more weeks of rehabilitation using various mobile devices and applications.
In study [16], a large number of applications for musculoskeletal rehabilitation at home were analyzed. The authors of the review note that most applications contain graphical materials (images and videos) for performing exercises, as well as mechanisms for gamification and progress tracking. However, a significant number of the reviewed applications (over 70%) do not include functionality for user feedback and informing about the results of exercise performance.
To assess the dynamics of musculoskeletal rehabilitation, the analysis of human motor activity is actively used, which requires data processing. The use of accelerometers in data collection during human movement provides quantitative measurements of movements and allows for the identification of specific changes in gait among individuals undergoing rehabilitation. It can also be used for objective quantitative assessment of patients’ levels of ambulatory activity [17]. When evaluating human movements, spatial orientation is also an important component, which cannot be determined solely by using accelerometers, as they do not contain information about rotation around a vertical axis. The combination of accelerometers with gyroscopes, which measure angular velocity, allows for a more comprehensive analysis of movements in space [18]. Combinations of accelerometers and gyroscopes (inertial measurement units, or IMUs) are actively used to assess human motor activity during the rehabilitation period [19]. A system based on inertial navigation and surface electromyography sensors was used for automatic monitoring of lumbar load during physical activities [20]. IMUs have also been applied in the rehabilitation process of the cervical spine to assess shoulder range of motion [21]. It is important to note that current research in this area is based on the use of specialized accelerometers and gyroscopes, which limits the applicability of these developments for a wider audience.
A comparison of various tracking systems in the field of musculoskeletal rehabilitation [22] showed that computer vision systems have advantages over IMUs in terms of positioning accuracy and the number of tracked points. The advantages of IMUs and mobile sensors include their ease of use and availability (in the case of mobile phones), which can be an acceptable solution for a number of exercises that require tracking a small number of points (often just one). On the other hand, computer vision systems can also be easily accessible due to the presence of sufficiently high-quality cameras and the necessary performance on most existing smartphones. Computer vision and machine learning models, such as MediaPipe, MoveNet, and OpenPose, allow for high-quality recognition of human body posture and can use this information for classification and assessment of exercises [23,24]. When choosing a neural network model, it is essential to consider its operability on most mobile devices. Among the mentioned models, MediaPipe has the best support on mobile devices, providing performance of about 30 frames per second, which is comparable to real-time processing [25]. The other models do not have adapted versions for mobile devices.
Based on the conducted analysis, the following conclusions can be drawn: it is necessary to improve the accuracy of mobile sensors to enable their application for assessing exercises in musculoskeletal rehabilitation; the use of a single data source limits the application of mobile devices, and support for computer vision systems for recognizing human bodies for activity monitoring needs to be implemented; the architecture of the mobile application and its operational algorithms should ensure integration with these tracking systems.
Thus, this study examines a comprehensive approach to organizing musculoskeletal rehabilitation using mobile devices. The contributions to the subject area are as follows:
- A general architecture for a mobile application for musculoskeletal rehabilitation has been proposed, aimed at supporting various approaches (camera and IMU) for collecting data on user physical activity;
- The processes for information processing in the mobile training system have been formalized, which are used to obtain data from IMUs and computer vision systems;
- Theoretical and practical research has been conducted on filtering and processing signals from mobile sensors (accelerometers), aimed at improving their accuracy;
- Theoretical and practical studies have been carried out on the application of machine learning for classifying exercises in musculoskeletal rehabilitation based on data obtained from mobile devices.
This article has the following structure: The first section discusses the subject area and existing research in the field of mobile rehabilitation. The second section covers the architecture of the simulator, the algorithm for its operation, and the data processing processes from positioning systems. The third section presents experimental studies on filtering and processing data from IMUs to obtain information on the execution of exercises in musculoskeletal rehabilitation, addressing the classification of exercises based on data from various positioning systems as well as the implementation of the mobile application. This article concludes with a discussion of the results obtained and conclusions.
2. Materials and Methods
2.1. Architecture of a Mobile Application for Musculoskeletal Rehabilitation
The analysis of existing rehabilitation systems and the requests from physicians in neurology diagnostics revealed the main requirements for the functionality of a mobile training system for musculoskeletal rehabilitation. To meet these requirements, the architecture of the mobile application was developed in the first stage of the research (Figure 1). The architecture includes three main subsystems.
Figure 1.
Mobile application architecture.
The reference subsystem includes the necessary set of components for working with the exercise database. The Exercise Visualization Module is used to present exercises based on those recorded in the database, consisting of multiple vectors. Standard Android vector animation is used for the functioning of this module. Each exercise, in addition to visualization, also includes a textual description. This description outlines the main stages of performing the exercises, conditions, and limitations, as well as recommendations regarding amplitude, frequency, and duration of the exercises. The user’s personal card is used for identification and storing data about physical parameters and medical conditions. The card is filled out under the supervision of a physician, with the option to lock changes later (read-only mode). A database is used to operate the aforementioned modules, and its overall structure includes the following tables:
- Exercises: for storing data used to generate a list of possible activities;
- Animation: for visualizing exercises in the reference system;
- Training: for recording information about an individual completed exercise of a specific category, indicating duration, number of repetitions, and evaluation;
- Trajectory: an auxiliary table that stores an array of recorded points of phone movement during training;
- Trajectory (camera): an auxiliary table that stores an array of recorded points of human body model movement during training, obtained from a computer vision system;
- User: for storing personal data of the user, as well as some medical information.
The User State Assessment Subsystem is responsible for the entire process of evaluating the quality of musculoskeletal rehabilitation. The Exercise search and filter module is used to implement corresponding functions within the mobile application. To obtain a list of exercises, search through them, and save favorites, the module interacts with the SQLite database.
The Module for recording reference values for each exercise is called once under the supervision of a physician. After selecting an exercise, the user performs an initial calibration, during which the amplitude, frequency, and trajectory of limb movements for each exercise are recorded. The calibration stage can be performed multiple times, after which the collected data are averaged, allowing for the determination of a range of changes in the tracked variables for each exercise that the user needs to adhere to in the future.
The Training module directly implements the rehabilitation process. The user can choose the necessary exercise and perform it for a specified amount of time. Depending on the data source, there are two options: all movements of the phone, attached to the specified part of the body in the exercise, are recorded using the position sensor subsystem; or the entire human body model is recorded, which for MediaPipe Pose includes 33 key points representing the positions of the arms, legs, head, and torso.
The Module for assessing the quality of exercise performance compares the data obtained during training with reference values based on amplitude, frequency, movement speed, and so on, depending on the specifics of the exercise.
Next, modules for data collection and processing from tracking systems are implemented to function within the Human positioning subsystem. The Camera data processing module is based on integrating the MediaPipe Pose model into Android through MediaPipe Pose Landmarker. Necessary parameters (tracking and detection thresholds) are set for the model. During its operation, poseLandmarkerResult objects are formed, which include the coordinates of all 33 points that can then be used in exercise analysis algorithms, machine learning, such as clustering or classification, etc. [26]. The Module for collecting and processing data from the accelerometer and gyroscope implements functionality for obtaining information from sensors and storing it in intermediate arrays.
The Trajectory generation module includes necessary calculation formulas for constructing a continuous trajectory of human movement, which is then used in the Module for assessing the quality of exercise performance when comparing with reference values.
The Logging module is necessary for administrative purposes and allows saving collected values in CSV format for subsequent graphing of trajectories and their analysis.
2.2. Algorithm of the Mobile Application for Musculoskeletal Rehabilitation
Based on the presented architecture of the mobile application, an algorithm for its functioning has been implemented, which includes the main actions of the user, the necessary stages of the application’s life cycle, and procedures for data collection and processing. Let us consider the main components of the algorithm (Figure 2).
Figure 2.
Algorithm of mobile application functioning.
The operation of the application begins with demonstrating the main screen to the user for page selection. When transitioning to the Help page, the user can select an exercise and view reference information about it, including text descriptions and animations, as well as the option to save the exercise to a favorites list. The other auxiliary pages allow access to personal information about the user and provide an option to exit the application.
In the main operating cycle of the simulator, training is initiated, and a specific exercise is selected. After that, depending on the type of exercise and its corresponding positioning system (accelerometer-gyroscope or computer vision system), the phone is secured to the user’s body or at a specified distance accordingly.
For the IMU, it is suggested to secure the phone at a designated point on the body for each exercise and then press the “Start” button again. This procedure can be performed with an assistant who carries out all actions related to securing the device and interacting with the touch interface. Next, automatic calibration of all sensors is performed, and necessary constants are determined to reduce measurement errors. The main training cycle is initiated, during which acceleration data from the accelerometer/gyroscope is recorded at regular intervals, ultimately transforming into a trajectory of device movement along three axes.
For computer vision, the phone is set up at the required distance for recognizing the entire human body, after which the assistant presses the “Start” button. An automatic training start via a timer is also possible. The data recording procedure is similar but differs in that all points of the body are fixed and normalized relative to the person’s position in the frame and their height (to eliminate distortions caused by their position relative to the camera).
Based on the recorded data, key metrics are calculated—deviation of the trajectory of a point (or set of points) from the reference, as well as minimum and maximum values of spatial and spatiotemporal characteristics. The results of the training session are presented to the user in a positively motivating form.
Each training session is recorded in a file, allowing for subsequent analysis of the dynamics of the rehabilitation process, generalization, and statistical analysis of data from multiple patients. The collected data can also be used for training classification or clustering algorithms [27].
Thus, an important component of the application is the Training History page, which includes an overview of all completed exercises with the ability to view their results, recalculate scores (in case of application updates and changes in calculation methods), and add specific training sessions to a favorites list. Additionally, developers and healthcare providers have access to view the trajectory of device movement for each training session, allowing for a visual assessment of exercise performance quality.
2.3. Human Positioning Systems Data Processing
When implementing a mobile application, it is essential to consider that sensors (gyroscope and accelerometer) installed on various devices, especially in the entry-level price segment, may have high inaccuracies. The cameras in such devices also do not always allow for correct recognition of a person in the frame, which may require additional optimization. First, let us consider the main methods for processing information from an IMU.
The initial data consists of a tuple of accelerations along three axes, obtained from the accelerometer of the mobile device:
where , , are the accelerations along the , , and axes, respectively.
, , and are sets of acceleration values along the corresponding axes. When forming the tuple , it is necessary to consider data from the device’s gyroscope (using standard software methods of the Android system) to account for the tilt angle of the device in space.
Each -th measurement of data is taken at a time interval . Then, in the next step, the speed of movement of the device is determined:
where , , and are the speeds along the , , and axes, respectively.
, , and are sets of speed values along the corresponding axes.
The next stage is obtaining increments of trajectories along three axes. Initially, variables , , and have zero values (at ). , , and are sets of trajectory points along the corresponding axes. At each step with a time interval , the following is obtained:
Thus, the triad from uniquely determines the position of the device at time from the start of recording. Then, reflects the trajectory of the device’s movement during the exercise for seconds.
However, it is necessary to understand that the data obtained from the accelerometer may be noisy and distorted due to the high inaccuracies of mobile sensors. The application of filters such as Butterworth or Kalman can partially rectify the situation [28], which is discussed in more detail in Section 3.1.
Next, let us consider the data processing from the computer vision system. The data obtained from the MediaPipe model has the following characteristics: the coordinates of body model points are given in relative values (from 0 to 1) based on their position in the frame. This may lead to the necessity of performing transformations on the original data to obtain coordinates along the -axis; however, in basic (non-LiDAR-equipped) mobile devices, solving this problem is challenging. On the other hand, obtaining data on the and coordinates of points is often sufficient for recognizing and evaluating most exercises, since the user can take a correct position relative to the camera, allowing for reading essential motion characteristics during exercise performance.
Thus, during operation, the positioning system generates a set of points , from each frame , obtained at time :
where , , and are the coordinates of point in frame along three axes. Most neural network models perform the positioning of points based on two coordinates ( and ) due to the complexity of depth estimation when using a camera. MediaPipe simulates the determining coordinate relative to some reference point, but this value is imprecise.
Given the assumption that when describing an exercise for musculoskeletal rehabilitation, a user can be instructed to take a correct initial position, inaccuracies in can be neglected.
Next, it is necessary to transform the coordinates into normalized values relative to the user’s height and their position in the frame:
The final step is to convert the normalized coordinates into metric values:
where is the user’s height in meters.
Since in the case of the computer vision system, the initial data consists of the positions of the person’s points, obtaining the speed and acceleration of these points is possible through differentiation (since the time between measurements is known, this operation is trivial).
The coordinates of the tracked points of the human body obtained after processing are further used to evaluate exercises for musculoskeletal rehabilitation. Let us introduce some basic concepts. Let be a set of exercises and be a specific exercise from this set. Each exercise can be associated with a certain tuple of its parameters:
where is the time interval for performing the exercise in seconds;
is the boundary value of spatial and spatiotemporal characteristics of movement:
where is the minimum value of the trajectory along the -axis, and similarly for and for the and axes, respectively;
is the maximum value of the trajectory along the -axis, similarly for and for the and axes, respectively;
is the maximum value of speed along the -axis, similarly for and for the and axes, respectively;
is the maximum value of acceleration along the -axis, similarly for and for the and axes, respectively.
Each exercise can also be associated with its type , which corresponds to a set of required actions, descriptions, and other information stored in a database reflecting the list of necessary actions and movements required for quality execution of that exercise:
The type of exercise can be automatically recognized using machine learning algorithms, as successfully demonstrated by previous studies [22].
The evaluation of an exercise can be carried out based on a comparison of current performance characteristics defined by Formula (8) and the values of these characteristics recorded during rehabilitation under the supervision and assistance of a treating physician. Let us consider a subset of exercises with reference trajectories and movement characteristics. Then, if a new exercise with specified characteristics and type enters the database, it is compared with a reference exercise of the same type according to formulas:
where is the arithmetic mean of the time intervals between data measurements in seconds;
is the ratio of the time taken to perform the exercise relative to the reference one;
, , and are evaluations of the differences between spatial and spatiotemporal characteristics of the assessed exercise and those of the reference exercise, respectively: the difference in trajectory amplitude, speeds, and accelerations.
Then, maximum quality for the assessed exercise is achieved under the following conditions:
The presented model allows for necessary procedures to transform information from sensors (accelerometer and gyroscope, computer vision system) and evaluate the results of exercise performance for musculoskeletal rehabilitation.
3. Results
In the next stage of the research, necessary experiments were conducted to verify and improve the accuracy of positioning systems launched on mobile devices. The section concludes with the development of a mobile application for musculoskeletal rehabilitation.
3.1. Improving the Accuracy of the Inertial Navigation System of a Mobile Device
To calibrate and assess the accuracy of the mobile IMU, an experiment was conducted in which the mobile device was repeatedly moved along a specified trajectory. To ensure the repeatability of the experiment, an industrial manipulator from Fanuc was used, which performed uniform repetitive movements with a phone fixed at the end of the manipulator (Figure 3). Several trajectories of the phone’s movement were recorded. Without using any filters or processing, the obtained values exhibited high inaccuracies, although they demonstrated repeatability.
Figure 3.
Experimental setup for testing the IMU of a mobile device.
During data analysis, a disproportion was identified in trajectory calculations when moving in the negative direction compared to the positive direction. This indicates some accumulation of error in the speed calculations. Testing the application on a linear trajectory, which included movement forward and backward (Y-axis) and upward and downward (Z-axis) (Figure 4), revealed that the system was non-functional (Figure 5). Significant distortions were observed, which did not correspond to the actual movement trajectories. This necessitated additional data processing operations.
Figure 4.
Manipulator movement route.
Figure 5.
Initial trajectories obtained during the experiment on the manipulator.
To eliminate error accumulation, an analysis of the original accelerometer data and the calculated speed values derived from them was performed. In the first stage, wavelet scalograms of acceleration were constructed for both axes (Figure 6, upper graphs). The graphs clearly show three peaks on each axis corresponding to accelerations and decelerations at key points. However, at frequencies above 10 Hz, there is a significant amount of pronounced noise caused by the imperfections of the phone’s sensors. Therefore, in the second stage, this noise was filtered using 3rd–4th order Butterworth filters, cutting off data with frequencies above 10 Hz. The results of the filtering are presented in Figure 6, lower graphs.
Figure 6.
Wavelet scalograms of accelerations before and after filtering.
Filtering significantly improved the acceleration values obtained from the accelerometer, with a comparison of the original and filtered data presented in Figure 7. Analyzing the filtered values revealed certain issues with the original data, which had a considerable impact on the movement trajectories and their inconsistency with actual motion processes. The problem lay in some inertial characteristics of the acceleration values: after a spike in acceleration, the sensors showed elevated acceleration values in the opposite direction for some time. This leads to error accumulation and a decrease in speed during moments when it remained constant in the actual experiment (ensured by using an industrial manipulator). These segments are marked with red lines in Figure 7.
Figure 7.
Comparison of original and filtered acceleration values.
To eliminate the errors caused by these segments, the following algorithm is proposed for calculating speed:
- Obtain the i-th acceleration value.
- Calculate m_cur—the average of ten acceleration values from i to i + 10 (exclusive).
- Calculate m_future—the average of ten acceleration values from i + 10 to i + 20 (exclusive).
- If |m_cur| is greater than the threshold value of 0.7, compare m_cur and m_future. If they differ in sign, store the acceleration value m_cur in the variable m_max and set the flag “do not track acceleration.”
- If the threshold condition is not met, but m_max and m_cur differ in sign, assign the acceleration value m_cur to the variable m_max.
- Also, if condition 5 is met and m_future becomes less than the threshold of 0.05, it indicates a damping of data values, and the flag “do not track acceleration” is reset, as well as the value of m_max.
- When calculating speed, if the flag “do not track acceleration” is set, use m_max instead of the current acceleration for speed calculation.
- Restrictions are imposed on the values of m_max and current acceleration; if their absolute values are below the threshold, the acceleration is considered an error and not used in speed calculations.
After analyzing the trajectory point values and speeds post-processing, distortions were found when moving along the Y-axis. A background acceleration was observed, leading to significant movement in the positive direction along the Y-axis, which caused deceleration when moving in the negative direction. This effect prevents returning to the starting point when moving back and forth along the Y-axis and also shifts trajectories when moving up and down along the Z-axis. Therefore, an additional filter on speed was introduced to minimize this effect.
Taking into account the proposed information processing algorithm, graphs of speeds based on original and filtered values were constructed (Figure 8), allowing for a more visual assessment of the contribution made by these transformations.
Figure 8.
Raw and filtered speeds.
The application of the proposed data processing algorithm significantly changed the situation in speed calculations: the effect of smooth deceleration, which should not have been observed when using a programmed manipulator, disappeared. The use of calculated speeds resulted in obtaining the following trajectory (Figure 9).
Figure 9.
Trajectories based on raw, filtered, and processed data.
Now, the trajectory correctly reflects movement 30 cm forward and a return to almost the initial point (with an error of a few centimeters), after which there is a vertical movement upward and a return to the initial position with some error (caused by the fact that downward movement could occur with greater acceleration).
In the considered algorithm of data processing from the inertial navigation system, gravity correction is not performed. This is realized by the basic functions of the sensorManager in Android, which allows acceleration to be obtained without taking gravity into account.
At the end of the preliminary tests, final testing of the developed approach on a set of different mobile devices was carried out. The 11 devices of different manufacturers and price segments took part in the test. The results of the trajectory calculation before and after processing are presented in Table 1. The last column shows compliance with the condition that the trajectory calculation error is less than 0.5 m along any of the axes. Exceeding this limit will be considered unacceptable for the use of the device. Therefore, several devices do not fulfil this condition due to the quality of the sensors.
Table 1.
Comparing accuracy of trajectory calculation on different mobile devices.
Device trajectories before data processing (Figure 10 top) and after processing (Figure 10 bottom) are also presented as an additional visualization. It can be seen that the spread of values has decreased significantly, and the trajectory is closer to the actual one. On the enlarged fragment of processed data, it can be noted that most devices form similar trajectories by the character of movements, but there are certain exceptions and differences.
Figure 10.
Trajectories of different devices before and after processing.
Significant differences were found between devices, depending on the quality of the sensors used by manufacturers or software settings that process sensor data at a low level. This leads to the conclusion that there are some limitations to the use of inertial sensors for the task in question. This aspect is analyzed in detail further in the Discussion section.
3.2. Processing of Computer Vision System Data from Mobile Device Cameras
In processing data from a mobile phone camera, the limitations and capabilities of this class of devices must be taken into account. Significant developments in technology have led to modern devices incorporating multiple cameras with the ability to zoom in and capture video up to 4 K (and even 8 K on some devices). Most devices on the market have lower specifications but still provide video recording in Full-HD resolution (1920 × 1080 pixels) with satisfactory quality under normal light levels.
As part of this stage in the research, preliminary experiments have been conducted to evaluate the capabilities of the computer vision system using mobile device cameras. The limits of the MediaPipe Pose neural network in different environmental conditions and video qualities were also revealed.
The first experiment tested the performance of MediaPipe Pose on different combinations of video resolution and quality (bitrate). The 30-s test video was shot in medium light conditions (about 150–200 lux) from a distance of 4 to 5 m. During the video, the user performs two exercises (raising and lowering the arm and stepping on the box) in combination with some movements and motions in the frame. The video is processed to produce a variety of bitrate (from 5 Kbps to 10 Mbps) and resolution options (from 40 × 68 to 1080 × 1920 pixels). Here and further in the experiments, the vertical orientation of the video is used, as this position provides the best capture of the human body in frame. However, horizontal orientation can be useful for exercises involving significant movement in the frame. The used tool (MediaPipe Pose) has no restrictions on use in both horizontal and vertical orientations.
Figure 11 shows the results of MediaPipe Pose at various combinations of video resolution and bitrate. The Y-axis shows recognition accuracy (the percentage of frames on which a human model is detected). The X-axis presents bitrate (in logarithmic scale) and video resolution. Thus, the left column captures video resolution and varies bitrate, while the right column considers different video resolutions and captures bitrates.
Figure 11.
Testing MediaPipe Pose on different video qualities.
As a result, we can conclude that, in order for MediaPipe Pose to work, the following minimum video parameters must be provided: at least 100 Kbps and a resolution of at least 160 × 280 pixels. All modern mobile device cameras fulfil these requirements. As can be seen from Figure 11, when these conditions are met, the recognition accuracy tends to 100% (i.e., the ratio of frames in which the human body model is recognized to the total number of frames).
The second experiment tested the recognition of a person in the frame under different conditions: at a distance of 1.8 m against a white background (the person occupies most of the frame), at a distance of 4.8 m under the same conditions, at a distance of 1.8 m under low light conditions (80 lux vs. 150–200 lux in other tests), and with a complex background, which is marked as (B) in the figure. The MediaPipe Pose results for each exercise and test are shown in Figure 12. The tests were conducted at a resolution of 1920 × 1080; the standard video bitrate was from 20 to 40 Mbit/s, depending on the device. The experiment involved a user with a height of 1.83 m.
Figure 12.
Testing computer vision under different conditions.
Therefore, it has been observed that the computer vision system operates stably under all conditions, due to the sufficient quality of modern mobile cameras. No additional processing operations are required for the mobile video, and it can be used for exercise recognition in its original quality.
3.3. Classification of Exercises in Musculoskeletal Rehabilitation
This part of the experiment examines the possibility of classifying exercises in musculoskeletal rehabilitation using various machine learning algorithms and tracking systems. This procedure can be performed remotely by transmitting information about the exercise to a central server to enhance performance. This additionally allows for the use of any machine learning models without restrictions on their execution on mobile devices.
Based on a study comparing various tracking systems [22] for the considered mobile application, eight machine learning models were selected (Table 2).
Table 2.
Parameters of selected machine learning algorithms.
Data were then prepared for two standard exercises in musculoskeletal rehabilitation:
Task 1 (“Arm Lift”): raising the arm upward;
Task 2 (“Leg Lift”): raising the leg (stepping onto a step).
Data from two tracking systems were collected from a group of users. Figure 13 presents an analysis of the collected data for each exercise and each tracking system: the maximum displacement along the X, Y as well as Z axes (for the IMU) and along the X, Y axes (for computer vision); and the mean squared error (MSE) from actual values. The actual values were determined based on the physical characteristics of users in the final positions of each exercise.
Figure 13.
Analysis of collected data from two exercises and two tracking systems.
The total data consists of, for Task 1, 49 measurements for the IMU and 69 for computer vision and, for Task 2, 53 measurements for the IMU and 73 for computer vision. The unequal number of measurements is due to the fact that some data from the IMU was not used because of high error. Even under ideal experimental conditions (as in Table 1), a similar defect was observed in several devices. In the “Arm Lift” exercise, the range of change in values along the Y-axis is in the area of 0.44 ± 0.38 m (IMU) and 0.71 ± 0.24 (computer vision system), which corresponds to the actions actually performed. By comparing the obtained results with the actual values for which participants in the experiment raised their arms, a mean squared error (MSE) of 0.49 ± 0.22 m was obtained for the IMU and 0.07 ± 0.22 m for the computer vision system. For the second exercise, “Leg Lift”, due to smaller movement amplitudes, the results are more accurate: the average distance traveled along the Y-axis is 0.14 ± 0.11 m (IMU) and 0.18 ± 0.08 (computer vision system). The MSE from actual values is 0.07 ± 0.03 m and 0.01 ± 0.05 for the IMU and computer vision system, respectively. Since, in these exercises, the magnitude of vertical movement is determinative, the obtained results show that the mobile training system successfully tracks the quality of exercises in musculoskeletal rehabilitation. It should be noted that there is a large error in the X and Z axes for the IMU during the exercises. The movement along these axes is not fully consistent with reality compared to computer vision. The reason for this fact may be imperfect sensors and insignificant acceleration in these axes. For the purposes of this study, it does not cause a significant problem, but, in general, it significantly limits the applicability of IMUs across a wide range of exercises. The Z-axis is not used in Figure 11 for computer vision because MediaPipe does not provide reliable information about this axis. Accordingly, the Z coordinate in the case of computer vision does not carry useful information and can only reduce the efficiency of the model learning process.
The collected data were processed as follows: 100 values were taken for each measurement; if the trajectory is longer than 150 values, the cycle is shifted by 50 values and the next 100 values are taken. Thus, machine learning algorithms do not analyze the whole sequence but some fixed fragment of it, which allows for the classifying of exercises after some time (about 3–4 s). Accordingly, for Task 1, the input data has the format (100, 3), for Task 2, (100, 2). As a result, we obtained the following sample for model training and testing was obtained (Table 3).
Table 3.
Sampling parameters for model training and testing.
Next, the effectiveness of the selected machine learning models used for classifying these exercise data is considered. The error matrices for each tracking system and each model are presented in Figure 14.
Figure 14.
Error matrices for classification models: (a) based on the IMU data; (b) based on computer vision system data.
The accuracy and F1-score values for each exercise by each tracking system are presented in Table 4. Stacking Classifier performed best on both tracking systems. NN, DecisionTreeClassifier and Stacking Classifier all showed comparable results on the computer vision system. The best results are highlighted in bold.
Table 4.
Parameters of selected machine learning algorithms.
The results presented in Table 2 lead to the conclusion that classification of basic exercises is possible using both tracking systems.
3.4. Practical Implementation of a Mobile Application for Musculoskeletal Rehabilitation
Based on the developed architecture, database structure, functioning algorithm, and formalized information processing processes, the corresponding software for the mobile application for musculoskeletal rehabilitation was implemented on the Android operating system. The Android Studio development environment was used to create this application. The application utilizes Android SDK 14.0, Android Build-tools 34.0.0, and NDK version 25.1.
The overall interface of the mobile application is presented in Figure 15. When using the application, it is assumed that the user registers and fills out a personal profile under the supervision of a doctor: name, age, gender, height, weight, medical conditions, and card number.
Figure 15.
Mobile application interface.
Upon launching the application, the main page is the exercise selection tab. This page also allows users to view their training history. If necessary, users can study the instructions for performing the exercise, add the exercise to favorites, or view a description of the exercise.
While the user is performing the exercise, a window with a workout timer is displayed. If the exercise is performed using a computer vision system, an image from the camera is shown with an overlay of the body model.
After completing the workout, results will be displayed, such as the success rate of the completed exercise, the number of repetitions performed, and the repetitions per minute.
Thus, the developed mobile application implements the functionality presented in Section 2.2 based on the architecture outlined in Section 2.1. For solving the classification task, the data processing procedures discussed in Section 2.3 have been implemented and applied.
4. Discussion
The organization of musculoskeletal rehabilitation is of immense importance for the quality of life of the population. As the conducted analysis of the subject area has shown, the outpatient period is no less important, as the patient does not have full and constant access to the attending physician during this time and must independently carry out the necessary rehabilitation activities. The lack of control and insufficient information can negatively affect the final outcome of rehabilitation, preventing a person from returning to full activity.
This study has formulated and implemented the concept of a mobile application for musculoskeletal rehabilitation, based on the use of two motion tracking systems to collect data on the quantitative characteristics of the exercises performed. A limitation of this study is the need for large-scale testing of the mobile application on a large focus group of users with musculoskeletal disorders. Furthermore, it is also necessary to expand the list of tracked and evaluated exercises and improve the accuracy of their recognition. Considering that the presented application is a demonstration of the proposed concept, this will be a direction for further research, and the results presented in this work (both theoretical and practical) can be used by other researchers as a basis for implementing various mobile applications.
Comparing the obtained results with the conducted review [16], it is important to note that the proposed mobile application contains mechanisms for collecting, analyzing, and processing data on the exercise performance process to provide feedback to the user, which many existing mobile systems lack.
As shown in the review presented in [29], most scientific works in the field of developing mobile systems for musculoskeletal rehabilitation did not describe the features and functionality of technology for organizing rehabilitation; they lacked details about technological aspects that could benefit other researchers.
Thus, this research expands the knowledge in the chosen field by considering the overall architecture of a mobile application for musculoskeletal rehabilitation, processes for processing and filtering signals from mobile sensors, and the potential application of machine learning for classifying exercises in musculoskeletal rehabilitation.
Summarizing the relevance of the results presented, the following should be noted. The measurement error of mobile inertial navigation systems is found to be significant and high. On the one hand, this restricts the application of this type of sensors in the rehabilitation exercise realization in a mobile application. On the other side, having recorded that even after processing there is a certain drift and accumulation of error (on some axes of coordinates more, on others, less), it is possible to formulate a list of exercises on which the negative impact of the error will be minimal. These are exercises that have significant differences in direction of movement with large amplitude and require only one tracking point. Examples of such exercises are presented in this paper, but, in the future, with the involvement of medical specialists, this list can be expanded by analyzing and selecting suitable exercises for the given conditions from a variety of all possible exercises.
The studies have also shown the high effectiveness of computer vision. In fact, computer vision methods are better at taking into account visual factors (position and orientation of limbs in space, skeletal model of the body as a whole), whereas an IMU measures accelerations and tilt angles as well as being more susceptible to noise and drift. Having at its disposal a large amount of information about the position (even if relative) of all the points of the human body in space, as provided by the computer vision system, the task of classifying different exercises is solved quite effectively. As research has shown, most machine learning algorithms are effective at this task. Expanding the number of exercises should not negatively affect the accuracy of the classification task, because, in case of insufficient accuracy, it is possible to add more points of the body model to the model, which will give additional information about the performed actions. A barrier to using this technology could be the poor quality of a phone’s camera or difficult lighting conditions, but this problem did not arise in this experiment. Consequently, the second part of this study’s contribution to the scientific community is the successful validation of computer vision in the classification of musculoskeletal rehabilitation exercises on a mobile device. This may help other researchers and developers to actively apply this approach when creating their musculoskeletal rehabilitation systems.
Finally, it is necessary to discuss the limitations of this study. First of all, a limited set of applications is considered within the framework of the developed application and conducted experiments. Involvement of medical specialists in the adaptation of musculoskeletal rehabilitation exercises taking into account the limitations of mobile inertial navigation and computer vision systems will make it possible to expand this list in the future.
It should be noted that there is a need for increased exercise data from both mobile IMUs and computer vision systems. This will reveal additional limitations of the mentioned technologies, their dependence on certain parameters of mobile devices, and their applicability for recognizing more exercises.
Further development of the presented project should be carried out with the involvement of a control group of users with musculoskeletal disorders. Obtaining data from this group will be able to identify possible limitations on the use of tracking systems within a mobile application after real-world testing.
5. Conclusions
This work discusses the development of a mobile application for musculoskeletal rehabilitation, based on the use of an IMU and computer vision system to assess the quality of performing rehabilitation exercises.
To address the task, relevant research was conducted, including the development of the architecture of the mobile application and the structure of the database. An algorithm for the functioning of the mobile application was developed, and the processes for processing data from various tracking systems were formalized. Preliminary tests revealed a significant amount of noise in the data from the accelerometer, which necessitated the development of additional information processing algorithms. Based on the theoretical and experimental research conducted, a practical implementation of the mobile application for musculoskeletal rehabilitation for the Android operating system was carried out.
Author Contributions
Conceptualization, A.O.; methodology, A.O.; software, Y.N.; validation, A.V.; formal analysis, A.O. and A.V.; investigation, A.O., A.V. and Y.N.; resources, Y.N.; data curation, Y.N.; writing—original draft preparation, A.O. and A.V.; writing—review and editing, A.O.; visualization, A.O. and Y.N.; supervision, A.O.; project administration, A.O.; funding acquisition, A.O. All authors have read and agreed to the published version of the manuscript.
Funding
This article was carried out with the financial support of the Ministry of Science and Higher Education of the Russian Federation within the framework of the project “Development of medical VR training systems for musculoskeletal rehabilitation with biofeedback” (№ 124032800018-5).
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Informed consent was obtained from all subjects involved in this study.
Data Availability Statement
The datasets are available on request from the corresponding author only, as the data are sensitive and participants may be potentially identifiable.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Sarkodie-Gyan, T.; Yu, H. Challenges and Concerns to Society: The Human Locomotor System; Springer: Cham, Switzerland, 2023; pp. 99–122. [Google Scholar]
- Bendíková, E.; Kostencka, A. Health in terms of functional disorders of the musculoskeletal system. J. Health Sci. 2013, 3, 521–538. [Google Scholar]
- Mayer, K.P.; Thompson Bastin, M.L.; Montgomery-Yates, A.A.; Pastva, A.M.; Dupont-Versteegden, E.E.; Parry, S.M.; Morris, P.E. Acute skeletal muscle wasting and dysfunction predict physical disability at hospital discharge in patients with critical illness. Crit. Care 2020, 24, 637. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Langan, J.; Subryan, H.; Nwogu, I.; Cavuoto, L. Reported use of technology in stroke rehabilitation by physical and occupational therapists. Disabil. Rehabil. Assist. Technol. 2018, 13, 641–647. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zhang, S.; Li, Y.; Zhang, S.; Shahabi, F.; Xia, S.; Deng, Y.; Alshurafa, N. Deep learning in human activity recognition with wearable sensors: A review on advances. Sensors 2022, 22, 1476. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Vijayan, V.; Connolly, J.P.; Condell, J.; McKelvey, N.; Gardiner, P. Review of wearable devices and data collection considerations for connected health. Sensors 2021, 21, 5589. [Google Scholar] [CrossRef] [Scilit]
- Li, K.H.C.; White, F.A.; Tipoe, T.; Liu, T.; Wong, M.C.; Jesuthasan, A.; Yan, B.P. The current state of mobile phone apps for monitoring heart rate, heart rate variability, and atrial fibrillation: Narrative review. JMIR mHealth uHealth 2019, 7, e11606. [Google Scholar] [CrossRef] [Scilit]
- Martins, J.; Cardoso, J.S.; Soares, F. Offline computer-aided diagnosis for Glau-coma detection using fundus images targeted at mobile devices. Comput. Methods Programs Biomed. 2020, 192, 105341. [Google Scholar] [CrossRef] [Scilit]
- Back, S.; Lee, S.; Shin, S.; Yu, Y.; Yuk, T.; Jong, S.; Lee, K. Robust skin disease classification by distilling deep neural network ensemble for the mobile diagnosis of Herpes zoster. IEEE Access 2021, 9, 20156–20169. [Google Scholar] [CrossRef] [Scilit]
- Nizeyimana, E.; Joseph, C.; Plastow, N.; Dawood, G.; Louw, Q.A. A scoping review of feasibility, cost, access to rehabilitation services and implementation of telerehabilitation: Implications for low-and middle-income countries. Digit. Health 2022, 8, 20552076221131670. [Google Scholar] [CrossRef] [Scilit]
- LaPiana, N.; Duong, A.; Lee, A.; Alschitz, L.; Silva, R.M.; Early, J.; Mourad, P. Acceptability of a mobile phone–based augmented reality game for rehabilitation of patients with upper limb deficits from stroke: Case study. J. Rehabil. Assist. Technol. 2020, 7, e17822. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Vahlberg, B.; Lundström, E.; Eriksson, S.; Holmbäck, U.; Cederholm, T. Effects on walking performance and lower body strength by short message service guided training after stroke or transient ischemic attack (the STROKEWALK study): A randomized controlled trial. Clin. Rehabil. 2021, 35, 276–287. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Piran, P.; Thomas, J.; Kunnakkat, S.; Pandey, A.; Gilles, N.; Weingast, S.; Levine, S.R. Medical mobile applications for stroke survivors and caregivers. J. Stroke Cerebrovasc. Dis. 2019, 28, 104318. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Salinas-Bueno, I.; Roig-Maimó, M.F.; Martínez-Bueso, P.; San-Sebastián-Fernández, K.; Varona, J.; Mas-Sansó, R. Camera-Based monitoring of neck movements for cervical rehabilitation mobile applications. Sensors 2021, 21, 2237. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Lee, C.; Ahn, J.; Lee, B.C. A systematic review of the long-term effects of using smartphone-and tablet-based rehabilitation technology for balance and gait training and exercise programs. Bioengineering 2023, 10, 1142. [Google Scholar] [CrossRef] [Scilit]
- Ryan, S.; Chasaide, N.N.; O’Hanrahan, S.; Corcoran, D.; Caulfield, B.; Argent, R. mHealth Apps for musculoskeletal rehabilitation: Systematic search in APP stores and content analysis. JMIR Rehabil. Assist. Technol. 2022, 9, e34355. [Google Scholar] [CrossRef] [Scilit]
- Qiu, S.; Liu, L.; Wang, Z.; Li, S.; Zhao, H.; Wang, J.; Tang, K. Body sensor network-based gait quality assessment for clinical deci-sion-support via multi-sensor fusion. IEEE Access 2019, 7, 59884–59894. [Google Scholar] [CrossRef] [Scilit]
- Tahir, S.B.U.D.; Jalal, A.; Kim, K. Wearable inertial sensors for daily activity analysis based on adam optimization and the maximum entropy Markov model. Entropy 2020, 22, 579. [Google Scholar] [CrossRef] [Scilit]
- Šlajpah, S.; Čebašek, E.; Munih, M.; Mihelj, M. Time-Based and Path-Based Analysis of Upper-Limb Movements during Activities of Daily Living. Sensors 2023, 23, 1289. [Google Scholar] [CrossRef] [Scilit]
- Roossien, C.C.; Baten, C.T.M.; van der Waard, M.W.P.; Reneman, M.F.; Verkerke, G.J. Automatically determining lumbar load during physically demanding work: A validation study. Sensors 2021, 21, 2476. [Google Scholar] [CrossRef] [Scilit]
- Bravi, R.; Caputo, S.; Jayousi, S.; Martinelli, A.; Biotti, L.; Nannini, I.; Minciacchi, D. An Inertial Measurement Unit-Based Wireless System for Shoulder Motion Assessment in Patients with Cervical Spinal Cord Injury: A Validation Pilot Study in a Clinical Setting. Sensors 2021, 21, 1057. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Obukhov, A.; Volkov, A.; Pchelintsev, A.; Nazarova, A.; Teselkin, D.; Surkova, E.; Fedorchuk, I. Examination of the Accuracy of Movement Tracking Systems for Monitoring Exercise for Musculoskeletal Rehabilitation. Sensors 2023, 23, 8058. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kale, S.; Kulkarni, N.; Kumbhkarn, S.; Khuspe, A.; Kharde, S. Posture Detection and Comparison of Different Physical Exercises Based on Deep Learning Using Media Pipe, Opencv. Int. J. Sci. Res. Eng. Manag. 2023, 7, 1–29. [Google Scholar]
- Baranyi, G.; Dos Santos Melício, B.C.; Gaál, Z.; Hajder, L.; Simonyi, A.; Sindely, D.; Lőrincz, A. AI Technologies for machine supervision and help in a rehabilitation scenario. Multimodal Technol. Interact. 2022, 6, 48. [Google Scholar] [CrossRef] [Scilit]
- Bittner, M.; Yang, W.T.; Zhang, X.; Seth, A.; van Gemert, J.; van der Helm, F.C. Towards Single Camera Human 3D-Kinematics. Sensors 2023, 23, 341. [Google Scholar] [CrossRef] [Scilit]
- Garg, S.; Saxena, A.; Gupta, R. Yoga pose classification: A CNN and MediaPipe inspired deep learning approach for real-world application. J. Ambient. Intell. Humaniz. Comput. 2023, 14, 16551–16562. [Google Scholar] [CrossRef] [Scilit]
- Mahmud, M.; Kaiser, M.S.; McGinnity, T.M.; Hussain, A. Deep learning in mining biological data. Cognit. Comput. 2021, 13, 1–33. [Google Scholar] [CrossRef] [Scilit]
- Crenna, F.; Rossi, G.B.; Berardengo, M. Filtering biomechanical signals in movement analysis. Sensors 2021, 21, 4580. [Google Scholar] [CrossRef] [Scilit]
- Pritwani, S.; Shrivastava, P.; Pandey, S.; Kumar, A.; Malhotra, R.; Maddison, R.; Devasenapathy, N. Mobile and Computer-Based Applications for Rehabilitation Monitoring and Self-Management After Knee Arthroplasty: Scoping Review. JMIR mHealth uHealth 2024, 12, e47843. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).














