57 J Global Clinical Engineering Vol.6 Special Issue 6: 2024 Conference Paper Human Muscle State Machine Using Electromyography Classification with Machine Learning George Lyssas1,*, Konstantinos Mitsopoulos1, Dimitris Zantzas2, Anestis Kalfas2 and Panagiotis D. Bamidis1 1 Lab of Medical Physics & Digital Innovation, School of Medicine, Faculty of Health Sciences, Aristotle University of Thessaloniki (AUTH), Thessaloniki, Greece. 2 Laboratory of Fluid Mechanics and Turbomachinery, Department of Mechanical Engineering, Aristotle University of Thessaloniki (AUTH), Thessaloniki, Greece. * Corresponding Author Email: georgios.lyssas@gmail.com ABSTRACT This research aims to create a tool that can recognize the state of the human skeletal muscle from surface Electromyography (sEMG) signals. The goal of this muscle state machine is for use in the functional rehabilitation of people suffering from Spinal cord injury and for stroke survivors who have lost mobility in their upper body limbs. The use of machine learning techniques for the classification of these muscle states brought forth the need for database creation to train the generated ML model. For the data collection process, an experimental protocol was proposed, and tests were conducted in healthy individuals with a Nexus MKII medical device. Following the data collection, a signal analysis procedure was performed to extract features from the sEMG signals that directly relate to the muscle state. In addition to the signal analysis, a Machine Learning classification model was created to recognize and classify the sEMG signals in different states of the muscle. This classification had a high enough accuracy of producing the correct result, given that the training and sampling size of the database was considerably small provided that in similar cases of ML classifying models the size of the Databases includes way more samples than the one in this research. The future steps for this research are the creation of a more extensive and diverse database and using this model in real-time situations. Keywords—Electromyography, Machine learning, Signal classification. Copyright © 2024. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY): Creative Commons - Attribution 4.0 International - CC BY 4.0. The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduc- tion is permitted which does not comply with these terms. http://www.globalce.org http://globalce.org http://globalce.org mailto:georgios.lyssas@gmail.com https://creativecommons.org/licenses/by/4.0/ https://creativecommons.org/licenses/by/4.0/ J Global Clinical Engineering Vol.6 Special Issue 6: 2024 58 INTRODUCTION People who suffer from Spinal Cord Injury or are stroke survivors experience a loss in their mobility as an after- effect of their condition.1 To combat these aftereffects, functional rehabilitation is used. In cases of movement loss, the activation of the muscles is not visible in most cases, this is a problem that is impacting rehabilitation practitioners and a solution needs to be proposed. In this research, a solution to this problem was explored with the creation of a Machine Learning model that is trained to recognize and categorize the Electromyogra- phy signals that are produced from the activation of the skeletal muscles. This model simulates a state machine of the human skeletal muscle and the states recognized were the state of no activation, the activation state, and the muscle fatigue state. These states were selected due to their high importance in the procedure of patient reha- bilitation. To train the model for recognizing the muscle states an extensive database of electromyography signals must be produced.2 MATERIALS AND METHODS In this research there were no open-source databases that were relevant to the recognition of the muscle states, therefore the creation of such a database was imminent. For the creation of a database, a measurement protocol was made and introduced in this research with the scope of measuring the states of the human skeletal muscle. This protocol targeted the muscles of the upper extremi- ties specifically the bicep and triceps muscles of both arms as it is illustrated in Figures 1 and 2. The exercises introduced were a set of 10 isometric contractions of the muscle without any external weight for measuring the baseline activation of the muscle, a continuous maximum contraction of the muscle that was held for 10 seconds so that the maximum contraction signal could be measured and lastly, a set of isometric contractions with an external weight of 5 kg until the subject was unable to continue, which was the start of muscle fatigue. In the last set of exercises, the goal was to have an electromyography sig- nal that included all the muscle states and the transition between those states. Those exercises were performed for both the bicep and tricep muscles of both arms of the subjects. The number of subjects that participated in this procedure was 20. 13 of which were male and 7 were female with a mean age of 27, and the subjects that were a part of this research were selected. The measurements were recorded by a Nexus MKII medical device, and the files of the measurements were later extracted for a signal processing sequence that created the final database for training the machine learning model.3 After the extraction of the files of the measurements the procedure followed is shown in Figure 3, the timeline of the signal is in the form of a Raw-EMG signal, this form includes noise from the recording and measuring process and it is imminent to denoise the signal, for the features and the information of the signal to be clear and readable, the creation of the envelope of the signal was the result of FIGURE 1. Measurement protocol. FIGURE 2. Example of measurement. http://www.globalce.org http://globalce.org http://globalce.org 59 J Global Clinical Engineering Vol.6 Special Issue 6: 2024 the denoising procedure. Having completed the denoising procedure the signal was later separated into parts that contained an event in the timeline of the signal; those parts are referred to as epochs and are the data points of the database that was created. From the epochs created features of high importance to the classification of muscle states were extracted, those features were based on the time and frequency domain and parameters of the signal shape. Those parameters were the mean and median frequency, the mean Amplitude, the Hjorth Parameters (activity, mobility, complexity), the skewness and kurtosis of the signal, and also the Continuous Wavelet Transform of the epochs.4–6 The features underwent a power analy- sis the results of which can be seen in Figure 4. All those features were later introduced to the Machine Learning model for the creation of the classifier (Figure 4). After the creation of the database three machine learning techniques were implemented and compared. The techniques used were a Random Forest classifier7 model (a representation of a tree can be seen in Figure 5), an SVM model, and a Shallow Neural Network, which were created with Python programming language and with the use of the SciKit Learn and Tensorflow Keras libraries. Those models were trained with the created Database and their speed and reliability in their results were measured so that the optimal between the three models could be chosen as the Muscle state machine.8 RESULTS AND DISCUSSION For the comparison between the efficiency and reliability of the machine learning models the use of metrics is the discerning factor between those models. The metrics that were used can be seen in Figure 6 where it is apparent that The Random Forest classifier model achieved the highest score among the other models. DISCUSSION In conclusion, the reliability and the adaptability of the Random Forest model is the best choice for the recogni- tion and classification of EMG signals to muscle states, in this application with a small sample size. Although these results show that the Random Forest model is the best choice among the other models the effective database for the training of these models was quite limited and the accuracy with which those models recognize the muscle states is certainly influenced. This leads to the need for the creation of a completed and reliable Electromyography signals database to further encourage the use of ML in Biomedical applications. FIGURE 3. Signal analysis procedure. FIGURE 4. Signal features power analysis. http://www.globalce.org http://globalce.org http://globalce.org J Global Clinical Engineering Vol.6 Special Issue 6: 2024 60 ACKNOWLEDGMENTS This study was conducted as a part of the research program “NeuroSuitUp: Neurorehabilitation through synergistic man-machine interfaces promoting dormant neuroplasticity in spinal cord injury” (MIS 5047840) and will be implemented and clinically validated in the context of the project “HEROES: Human Extremity Robotic Rehabilitation and Outcome Enhancement for Stroke funded by H.F.R.I.” Special thanks to Dr. Alkinoos Athanasiou, Alexander Astaras, Athanasios Arvanitidis, Niki Pandria, and Vasileia Petronikolou. REFERENCES 1. Athanasiou, A., Mitsopoulos, K., Praftsiotis, A., et al. Neurorehabilitation Through Synergistic Man Ma- chine Interfaces Promoting Dormant Neuroplasticity in Spinal Cord Injury: Protocol for a Nonrandomized Controlled Trial. JMIR Res Protoc. 2022;11(9):e41152. https://doi.org/10.2196/41152. 2. Let, A.M., Filip, V., Let, D., et al. A Review in Biomechanics Modeling. In Proceedings of the International Conference of Mechatronics and Cyber—MixMechatronics—2020. Gheorghe G.I., eds. Springer International Publishing: FIGURE 5. Visualization example of a random forest tree. FIGURE 6. Result of comparison with metrics (closer to 100% is better). http://www.globalce.org http://globalce.org http://globalce.org https://doi.org/10.2196/41152 61 J Global Clinical Engineering Vol.6 Special Issue 6: 2024 Zurich, Switzerland; 10–11 September 2020; pp.156–164. https://doi.org/10.1007/978-3-030-53973-3_17. 3. Briouza, S., Gritli, H., Khraief, N., et al. Classification of sEMG Biomedical Signals for Upper-Limb Rehabilita- tion Using the Random Forest Method. In 2022 5th International Conference on Advanced Systems and Emergent Technologies (IC_ASET). IEEE Xplore: 22–25 March 2022; pp. 161–166. https://doi.org/10.1109/ IC_ASET53395.2022.9765871. 4. Cifrek, M., Medved, V., Tonković, S., et al. Surface EMG based muscle fatigue evaluation in biomechanics. Clin Biomech. 2009;24(4):327–340. https://doi. org/10.1016/j.clinbiomech.2009.01.010. 5. Karthick, P.A. and Ramakrishnan, S. Analysis of fatigue conditions in biceps brachii muscles using surface electromyography signals and strip spectral correlation. In 2014 19th International Conference on Digital Signal Processing. IEEE Xplore: 20–23 Au- gust 2014; pp. 190–194. https://doi.org/10.1109/ ICDSP.2014.6900826. 6. Rangayyan, R.M. Biomedical Signal Analysis. 2nd ed. Wiley-IEEE Press: Hoboken, NJ, USA; 2015. 7. Gokgoz, E. and Subasi, A. Comparison of decision tree algorithms for EMG signal classification using DWT. Biomed Signal Process Control. 2015;18:138–144. https://doi.org/10.1016/j.bspc.2014.12.005. http://www.globalce.org http://globalce.org http://globalce.org https://doi.org/10.1007/978-3-030-53973-3_17 https://doi.org/10.1109/IC_ASET53395.2022.9765871 https://doi.org/10.1109/IC_ASET53395.2022.9765871 https://doi.org/10.1016/j.clinbiomech.2009.01.010 https://doi.org/10.1016/j.clinbiomech.2009.01.010 https://doi.org/10.1109/ICDSP.2014.6900826 https://doi.org/10.1109/ICDSP.2014.6900826 https://doi.org/10.1016/j.bspc.2014.12.005 Editor’s Corner Biomedical Technology and Clinical Engineering in Greece after the Pandemic: Highlighted Works from the Panhellenic Conference of Biomedical Technology Aris Dermitzakis1,2,*, Vasiliki Zilidou1,3, Eleftheria Vellidou1,4, Alkinoos Athanasiou1,3 Digital Transformation Management in Health Services: Health Professionals Perceptions as an Implementation Factor Theodoros S. Tanis*, Chryssoula Chatzigeorgiou, Ioanna Simeli, and Evangelia Stalika Validating the ID-GAMING e-Training Toolkit for People with Intellectual Disabilities in Greece Niki Pandria*, Anastasia Barboudi, Vasileia Petronikolou, Panagiotis Antoniou and Panagiotis D. Bamidis Novel Functional Electrical Stimulation Parameter Optimization for Neurorehabilitation Using Both Conventional and AI Techniques Arsenios Arsenidis1, Alexandros Moraitopoulos2, Alkinoos Athanasiou2, Alexandros Vildiridis3, Panagiotis Bamidis2, Petros Stefaneas4 and Alexandros Astaras5 Leveraging Web Scraping and API Integration for Efficient Medical Device Data Management Agapi Konstantina Liontou1,*, Spilios Zisimopoulos2 and Aris Dermitzakis1 Human Muscle State Machine Using Electromyography Classification with Machine Learning George Lyssas1,*, Konstantinos Mitsopoulos1, Dimitris Zantzas2, Anestis Kalfas2, Panagiotis D. Bamidis1 Kinematic and Dynamic Analysis of Lower Limb Movement: Towards the Design of a Wearable Rehabilitation Assistant Device Filippos Margaritis1,*, Konstantinos Mitsopoulos1, Kostas Nizamis2, Alkinoos Athanasiou1 and Panagiotis D. Bamidis1 A Novel Dermatological Diagnosis Support Device Based on Electrical Impedance Spectroscopy Alexandros Moraitopoulos1,*, Konstantinos Mitsopoulos1, Christina Kemanetzi2, Panagiotis Bamidis1 and Alexandros Astaras3 Software Skills Identification: A Multi-Class Classification on Source Code Using Machine Learning Dimitris Bamidis, Ilias Kalouptsoglou, Apostolos Ampatzoglou, Alexandros Chatzigeorgiou* Improvement of Aortic Valve Stenosis Classification in Patients Through Computational Fluid Dynamics Model Ioannis Makropoulos, Dimitris Zantzas, Vasilis Gkoutzamanis, Anestis Kalfas* Kinematic and Dynamic Analysis of the Human Hand’s Articulation for Wearable Soft-Robotic Device Applications Paschalina-Danai Sarra, Vasiliki Fiska, Konstantinos Mitsopoulos, Diamanto Mylopoulou, and Panagiotis D. Bamidis* Deep Learning Classification of Epileptic Magnetoencephalogram Andreas Stylianou1, Lefteris Koumakis2, Maria Hadjinicolaou3, Adam Adamopoulos1,* and Alkinoos Athanasiou4