%0 Journal Article %T Real-Time Sensor-Based Human Activity Recognition for eFitness and eHealth Platforms. %A Czekaj Ł %A Kowalewski M %A Domaszewicz J %A Kitłowski R %A Szwoch M %A Duch W %J Sensors (Basel) %V 24 %N 12 %D 2024 Jun 15 %M 38931675 %F 3.847 %R 10.3390/s24123891 %X Human Activity Recognition (HAR) plays an important role in the automation of various tasks related to activity tracking in such areas as healthcare and eldercare (telerehabilitation, telemonitoring), security, ergonomics, entertainment (fitness, sports promotion, human-computer interaction, video games), and intelligent environments. This paper tackles the problem of real-time recognition and repetition counting of 12 types of exercises performed during athletic workouts. Our approach is based on the deep neural network model fed by the signal from a 9-axis motion sensor (IMU) placed on the chest. The model can be run on mobile platforms (iOS, Android). We discuss design requirements for the system and their impact on data collection protocols. We present architecture based on an encoder pretrained with contrastive learning. Compared to end-to-end training, the presented approach significantly improves the developed model's quality in terms of accuracy (F1 score, MAPE) and robustness (false-positive rate) during background activity. We make the AIDLAB-HAR dataset publicly available to encourage further research.