Comparative Performance Analysis of Machine Learning Algorithms for Arm and Shoulder Exercises Using Wrist-Worn Band

The COVID-19 pandemic forcing many individuals to exercise at home without the supervision of a professional trainer, and maintaining proper posture during arm and shoulder exercises has become a concern. In this study, the dataset is collected from various individuals performing different exercises with different variations in the range of motion. The wrist-worn band captures the motion data using the MPU6050 sensor, which measures acceleration data. The collected data is pre-processed, and features are extracted from the raw data. Machine learning-based classification algorithms are employed to classify the collected data. An App prototype has been developed, which is integrated with a WIFI module and Cloud for real-time data collection. The collected data is then used to train the selected machine learning models, which can accurately analyze an individual’s workout session and provide feedback on their performance through the App. Overall, this methodology provides a solution for individuals to continue their regular exercises at home without the need for a professional gym trainer or environment while minimizing the risk of injury due to poor posture. The results of this study will provide insight into the effectiveness of different machine learning algorithms for arm and shoulder exercises using a wrist-worn band, which can help in designing personalized exercise programs for individuals. We applied four machine learning algorithms to the dataset which are weighted KNN, Bagged Trees, Decision Trees, and Fine Gaussian SVM. The experimental results show that the Weighted KNN Model gives the best accuracy of 92%.


I. INTRODUCTION
Regular physical exercise is crucial for maintaining good health, particularly for improving strength, flexibility, and endurance.Arm and shoulder exercises are particularly important for building upper body strength and improving posture.With the recent advancements in wearable The associate editor coordinating the review of this manuscript and approving it for publication was Pasquale De Meo .
technology, wrist-worn bands have emerged as an effective tool for tracking and analyzing exercise performance.These bands are equipped with sensors that collect data on various parameters such as acceleration, rotation, and orientation, which can be used to monitor the execution of arm and shoulder exercises [1].
Machine learning algorithms can be used to analyze the data collected by these sensors and provide insights into the effectiveness of the exercise regimen.The MPU6050 sensor is a popular choice for these types of wrist-worn devices due to its small size, low power consumption, and ability to measure both acceleration and rotation.However, the performance of different machine learning algorithms for analyzing arm and shoulder exercises using wrist-worn bands remains largely unexplored.Therefore, in this study, we aim to compare the performance of different machine learning algorithms for analyzing arm and shoulder exercises using data collected from wrist-worn bands [2].
The study will collect data from participants performing different arm and shoulder exercises using a wrist-worn band.The data will be pre-processed and divided into training and testing datasets.We will then evaluate the performance of different machine learning algorithms on the collected data, such as decision trees, support vector machines, and artificial neural networks [3].The accuracy, precision, recall, and F1 score of each algorithm will be calculated and compared to identify the most effective algorithm for analyzing arm and shoulder exercises using wrist-worn bands.The findings of this study will have significant implications for the development of personalized exercise programs and the optimization of exercise performance using wrist-worn bands and machine-learning algorithms [4].
A wrist-worn will be made using an MPU-6050 allowing the collection of data from the user's arm movements.The data will be sent to a microcontroller that will measure the magnitude of the movement through an accelerometer.The output of the actual MPU-6050 will be compared with the pre-set value through the microcontroller which will be suppressed by the classification algorithms.This will ensure that the muscles contract and movement are suppressed.This operation will continue in a loop and ensure a stable body.The person will be able to use Android and cloud applications to view the statistics produced by the sensor and signals to the accelerometer to suppress the movement.The wrist-worn will also be used as a fashion statement and can be customized in color as per the taste of the patient making it want to be worn [5].

II. RELATED WORK
Designed and implemented a wearable system for exercise recognition based on inertial sensors, including the MPU6050 sensor.The system was able to accurately recognize 14 different arm and shoulder exercises with an average accuracy of 87%.The authors suggested that the system could be used for exercise monitoring and guidance for patients undergoing rehabilitation [6].
IMU sensors are increasingly being used to track and evaluate how people move while engaging in physical activities, such as arm and shoulder exercises.Numerous studies have investigated the use of IMUs for machine learning algorithms to identify these workouts [7].
A study looked into how to identify various arm and shoulder exercises using a wearable device with IMUs.Support vector machines ranked the best with an average accuracy FIGURE 1. Glove system with multiple sensors [8].
of 85% in the study's comparison of four machine learning methods, including decision trees, random forests, and k-nearest neighbors [9]. Figure 1 shows the methodology of the glove and how it gathers data.
The data gathered from these sensors has been successfully analyzed by machine learning algorithms, demonstrating its potential for creating customized workout plans and improving exercise performance.However, nothing is known about how well various machine-learning algorithms work when used to analyze arm and shoulder exercises utilizing wrist-worn bands [10].The research discussed in this study demonstrates how well machine learning algorithms can identify various upper-body exercises and determine when a repetition begins and ends [11].To find the best machine-learning algorithms for assessing arm and shoulder exercises with wrist-worn bands, more investigation is required.Wearable technology has been the subject of numerous studies looking at how to monitor exercise performance [12].The majority of these studies, like those that examined cyclists' or runners' performance, have a lower body focus.To analyze upper-body exercise performance, particularly for arm and shoulder activities, wearable technology has drawn more and more attention [13].
Another study suggested combining IMUs and a deep learning algorithm to identify arm and hand motions.Convolutional neural networks were used to train the model, which recognized 20 gestures with an accuracy of 91.92% [14].In a similar vein, an upper-limb movement identification system was suggested employing IMUs.A deep learning model with long short-term memory networks was employed in an investigation, which yielded a recognition accuracy of 97.2% [15].Additionally, investigated the use of IMUs to identify upper limb ADLs and evaluated the performance of five machine learning techniques, including logistic regression, support vector machines, decision trees, random forests, and random forests [16].According to the study, support vector machines had the highest recognition accuracy for ADLs, at 91.25% [17].
Working out using a motion sensor, such as an IMU or an accelerometer, might offer quantitative information on the efficiency of the exercise.Potential applications include enhancing training loads and exercise performance, as well as assisting with the rehabilitation of individuals with neurological diseases.Medical, sporting, and therapeutic applications of sensor-assisted arm exercises have been investigated [18].
The speed and force with which persons could bench press were tracked by accelerometers in a sensor system as shown in Figure 2.After testing the sensor system, researchers discovered that it provided accurate measurements of speed and power that could be used to fine-tune training and provide better results [20].An evaluation of the use of electromyography (EMG) sensor for monitoring biceps activation during dumbbell curls.Using the sensor technology's precise measurements of muscle activation patterns, researchers were able to modify training load and boost exercise performance [21].The force generated by isometric contractions of the elbow flexor muscles was also measured using a force sensor.Researchers concluded that the sensor device's accurate estimates of force production might help rehabilitate and treat patients with elbow injuries.These results imply that arm exercises may be used to accurately and objectively evaluate training effectiveness and muscle activation patterns [22].These devices include accelerometers, force gauges, and electromyography (EMG) sensors.If this method becomes popular, people may have fewer injuries, spend less time and money on physical treatment and rehabilitation, and enjoy their activities more [23].
In another study, we monitored the speed and force with which subjects could deadlift using an IMU sensor.Researchers discovered that the IMU sensor provided reliable estimates of velocity and power, allowing them to track development over time and evaluate the value of individual workouts [24].An MPU6050 sensor was used to decode the kinematics and muscle activation patterns of the bench press.
Based on the findings, it seems that the MPU6050 sensor might be used to offer reliable assessments of bench press form and muscle activation patterns, which could be used to improve training and cut down on injury risk [25].The number of people who use fitness trackers while working out has increased.Based on the findings, these sensors may be used to track parameters associated with physical activity, including velocity, power production, and muscle activation patterns [26].
This study compared different measures for quantifying upper limb use from wrist-worn inertial measurement units.Machine learning measures performed better than traditional measures, but the hybrid activity counting and gross movement score measure was a reasonable alternative in the absence of annotated data [27].This study developed a machine learning method to estimate shoulder load in wheelchair-related activities of daily living using wearable sensors.The method was validated using data from 10 non-disabled participants and showed promising results [28].Human activity recognition (HAR) based on wearable sensor data is a rapidly developing field with many practical applications.Machine learning algorithms are widely used in HAR [29].This study used a smartwatch to monitor shoulder physiotherapy exercise adherence.The study found that a convolutional recurrent neural network (CRNN) algorithm was the most accurate for classifying exercises [30].This study compared four machine learning algorithms for academic performance prediction.The Naïve Bayes algorithm performed the best, while the Multilayer Perceptron algorithm took the longest time to run [31].A physical activity advisory system was developed using inertial sensors and machine learning algorithms.The system achieved satisfactory accuracy in recognizing sports activities and counting repetitions [32].

III. PROBLEM STATEMENT
The problem addressed in this study is the need for accurate and reliable monitoring and analysis of arm and shoulder exercises during physical therapy and fitness training.Wrist-worn bands equipped with motion sensors such as the MPU6050 can provide real-time data on the movements and positions of the wrist, which can be used to infer the exercises being performed.However, there is a need for an analysis of the performance of different machine learning algorithms for accurately detecting and classifying arm and shoulder exercises based on wrist-worn band data.This study aims to compare the performance of different machine learning algorithms for the classification of arm and shoulder exercises based on wrist-worn band data, to identify the most accurate and reliable approach.

IV. METHODOLOGY
In this section, we provided a detailed description of how the data is collected, how the postures are determined, and how the algorithms recognize these postures.

A. HARDWARE
Creating a bracelet starts with an idea, allowing complete freedom in choosing dimensions and aesthetics.The customer's wrist size is used for the correct bracelet size.Then you can connect the microcontroller and sensors and start sewing.Sew the leather together and add a zipper for closure using a needle and thread or sewing machine.Finally, attach the bracelet closure, whether it's a buckle or some other method.Consider including a polishing or finishing step to increase its aesthetic value and longevity.Repair any defects in the tape that may affect the fit.The hardware components are shown in Figure 3.
The bracelet's Li-ion battery runs the NODEMCU ESP8266, two OLED displays, and Pressure Sensor MAX30102.It also features a Digital Accelerometer and Gyroscope MPU-6050.The NODEMCU processes acceleration data obtained during exercise with the help of the MPU-6050 sensor; this data is then transferred to the cloud and provided on an Android mobile App for analysis and feedback on the technique.The user's heart rate is shown on the 0.91-inch OLED, while the 0.96-inch OLED shows the time and temperature.The results from the pressure sensors are converted into a pulse rate.The block diagram is shown in Figure 4.

B. SOFTWARE
In this section, we will provide a detailed description of how the data is collected, how postures are determined, and how the algorithms recognize these postures.

1) DATA COLLECTION
The data collection process begins with a dataset consisting of four columns, including three inputs and one output.These inputs are derived from the accelerometer values obtained from the MPU-6050 sensor.The output is binary in nature.The collected dataset is comprised of 5000 input-output samples, 70% of the collected data is used for training the selected algorithms and 30% is used for testing.

2) POSTURE DETERMINATION
Positions are determined based on accelerometer data.This data captures the movements and orientation of the bracelet on the wrist during arm and shoulder exercises.Specific locations are identified by analyzing this data.

3) ALGORITHM RECOGNITION OF POSTURES
One of the selected machine learning algorithms is Fine Gaussian SVM.This algorithm is trained using features extracted from accelerometer data as input and corresponding exercise labels as output.It uses a fine Gaussian kernel to efficiently separate and classify different positions.Another algorithm used in this analysis is weighted KNN.It works by considering the k-closest data points to the current data point in the feature space.The weights of these neighbors are assigned based on their proximity, allowing accurate location recognition.The decision tree algorithm is used to create a decision tree structure based on the data properties of the accelerometer.This tree helps in categorizing the positions by traversing the various decision nodes, which ultimately leads to the correct identification of the position.The Bagged Trees algorithm is used to improve location recognition accuracy.It combines multiple decision trees to create an ensemble model.Each tree contributes to the final posture classification, leading to robust and reliable results.

4) MODEL TRAINING AND EVALUATION
Machine learning algorithms are trained using a portion of the collected data known as the training set.This process involves feeding the algorithm with feature data and corresponding exercise labels so that it can learn and recognize the positions.After training, the models are evaluated using a separate part of the data called the test set.Several performance metrics such as accuracy, precision, recall, and F1 score are used to assess the effectiveness of each algorithm in arm and shoulder exercise recognition.
In this study, the Arduino IDE was used which is considered a cross-platform App that was constructed with Java language.Arduino IDE is used for NODEMCU ESP8266 configuration and place to input the program to each sensor  node.The Arduino IDE supports both C and C++ programming languages in performing particular rules to construct code as Figure 5 depicts.

5) DATA FLOW
Arduino IDE is used to configure the ESP8266 NODEMCU and program input to each sensor node.Data is transferred to ThingSpeak using the Arduino IDE.Data from ThingSpeak is transferred to MATLAB.Real-time prediction can be done in MATLAB.Figure 6 shows the Ax accelerometer readings along with the corresponding data.
ThingSpeak provides a visual representation of the accelerometer readings as shown in Figure 7 and Figure 8. MATLAB is capable of real-time prediction and classification of exercise into binary outcomes (0 for incorrect, 1 for correct) and output display on the application interface.This output serves as valuable feedback to the user regarding the correctness of their exercise positions.

C. APP DEVELOPMENT
The final part of our methodology is to design a user-friendly and visually appealing mobile application interface, as shown in Figure 9.The application starts with a welcome page  with user registration and login options.After logging in, users are redirected to a home screen that offers options for arm and shoulder exercises.After selecting an exercise, users go to the next screen and click the Start button to start the prediction process.The App displays real-time feedback to show if the exercise is being performed correctly.This user interface design ensures a seamless and intuitive user experience during the exercise monitoring process.

V. RESULTS AND DISCUSSION
Positive results were found in the comparative performance analysis of machine learning algorithms for arm exercises employing a wrist-worn band.Figure 10 shows the hardware attached to the Veroboard and ready for testing.
The accuracy of the applied machine-learning algorithms is shown in Table 1 with their precision, recall, and F1-score.
The weighted k-nearest neighbors (KNN) approach exceeded all other machine learning algorithms when compared to the other examined algorithms, with the greatest accuracy of 92% as shown in Figure 11.Also, weighted 111602 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.matrix was created to assess the weighted KNN algorithm's performance.The classification performance of the algorithm for each arm and shoulder workout is revealed by the confusion matrix.The matrix displays the algorithm's total number of accurate and inaccurate predictions.
The weighted KNN algorithm's performance is thoroughly evaluated by the ROC (Receiver Operating Characteristics) curve which is shown in Figure 12, which also demonstrates the algorithm's capacity to balance true positive and false positive rates.Better classification performance is indicated by a curve that is closer to the upper-left corner, displaying great sensitivity while maintaining a low false positive rate.
The data points are shown visually in a scatter plot, which enables us to evaluate how well the algorithm can distinguish between and categorize various workouts.Successful categorization is indicated by clusters or unique groupings of data points reflecting various workouts.We may learn more about the algorithm's performance in differentiating between exercises with changing speed, range of motion, and complexity by looking at the scatter plot as shown in Figure 13.
As Figure 14 shows the parallel coordinates curve offers a thorough understanding of the patterns and interactions between the data that were derived for various arm and shoulder activities.It aids in seeing any recurring trends or patterns in the feature values that affect how well the  algorithm classifies data.We may evaluate how successfully the algorithm uses differences in feature values to distinguish across exercises by examining the parallel coordinates curve.
The weighted KNN algorithm's higher performance can be attributed to its capability to weigh the closest neighbors according to their importance.As a result, the algorithm may take into account each neighbor's importance and closeness when classifying data, producing more accurate predictions.It shows off its capability in real-time reaction and efficient categorization of basic and complicated action modes, in contrast to the Support Vector Machine (SVM) approach, which has less accuracy than the weighted KNN.
While SVM is renowned for its effectiveness with complicated action modes, the arm and shoulder exercises evaluated  in this study show that the KNN algorithm is extremely precise and effective.The findings also highlight the significance of taking the MPU6050 characteristics into account when utilizing motion.Accurate action recognition is possible by utilizing the MPU6050 features and monitoring changes in axes.It is important to note that several actions' threshold ranges of motion presented difficulties because they required sizable motions.This could affect the algorithm's feature detection when determining the motion parameter threshold.To overcome these restrictions and improve the algorithm's performance, more investigation and optimization are needed.
The results of this study demonstrate the effectiveness of the weighted KNN algorithm for assessing and categorizing arm and shoulder exercises utilizing a wrist-worn band.The findings provide useful information for creating individualized exercise regimens and giving people feedback in real-time to improve their exercise performance, ensure good posture, and lower the chance of accidents during at-home  workouts.To increase accuracy and generalize the results, future studies can concentrate on growing the dataset, investigating various machine learning techniques, and further improving the classification process.
Figure 15 shows the values of Ax, Ay, and Az. Figure 16 shows the real-time prediction of the exercise, which is correct because it shows the value 1.
Figure 17 shows the prediction on the application interface as bicep correct form.

VI. CONCLUSION
This research shows that wristband data may accurately reflect different types of arm and shoulder movement when processed using machine learning techniques.We applied four different types of machine learning algorithms for the best and most accurate results which are obtained for Weighted KNN with an accuracy of 92%.The accuracy of Bagged Trees is 91.6%.The accuracy of Decision Trees is 91.4% and the accuracy of Fine Gaussian SVM is 86.1%.
The k-nearest neighbors (KNN) algorithm has a 92% success rate and is the most effective method.The data demonstrate that wristbands are an accurate method for tracking upper-body workouts.This information might be used to train machine learning algorithms to anticipate which types of exercise would provide the best results.
Taken as a whole, the findings suggest that machine learning algorithms may significantly change our understanding of the benefits of upper-body activities.This algorithm may aid users in achieving their fitness objectives by delivering fast and accurate feedback on exercise performance.These were the primary results, although the study also highlighted certain caveats for future studies.For instance, just some of the research literature on arm and shoulder exercises was considered.Results from machine learning are more reliable and accurate when larger data sets are used.Wristbands were also used just in the context of the research.To further increase the accuracy of the classification system, we may experiment with other band combinations in future studies.Despite these caveats, the research yielded some encouraging findings.They contend that machine learning techniques have the potential to vastly improve the assessment of arm and shoulder training.More investigation into these algorithms may one day lead to safer, more efficient arm workouts that also give individuals more specific feedback based on their individual needs.

VII. FUTURE WORK
The efficacy of machine learning methods for detecting arm exercise needs more investigation.One strategy for doing so is to make use of more data or more intricate characteristics while training the model.Furthermore, future research may focus on building machine-learning algorithms for personalized exercise plans.Then, consumers might get guidance specific to their fitness objectives and insights into their development.In this study, the free version of ThingSpeak is used which produces a lag time of 15 seconds.After a user completes an exercise, the system categorizes it in 15 seconds.If the standard license of ThingSpeak is used for commercial users then this lag time is only 1 second.Physical activity levels may be incorporated into future studies.When applied to a broader population, the benefits of using wrist-worn bands and machine-learning algorithms to improve exercise performance and endurance have a greater chance of being proven.

FIGURE 15 .
FIGURE 15.Graph showing the accelerometer axis on MATLAB.

FIGURE 16 .
FIGURE 16.Correct form of prediction on MATLAB.

FIGURE 17 .
FIGURE 17.The app shows the predicted output.
MAHAM MAJEED received the B.S. degree in computer engineering from COMSATS University Islamabad, Lahore Campus, Pakistan, in 2023.Her main research interests include machine learning, artificial intelligence, web development, and app development.ABDULLAH TASEER (Member, IEEE) received the B.S. degree in computer engineering from COMSATS University Islamabad, Lahore Campus, Pakistan, in 2023.His main research interests include machine learning, artificial intelligence, web development, and app development.

TABLE 1 .
Accuracy of machine learning algorithms.
FIGURE 11.Confusion matrix of weighted KNN.