# Efficient Human Activity Recognition Using Machine Learning and Wearable Sensor Data
## 2 Data Collection and Preprocessing
### Data Collection  
We utilize accelerometers and gyroscopes to recognize human motion states. These sensors measure linear acceleration and angular velocity changes along the three axes (X, Y, Z) of the human body. When the sensors detect changes in acceleration, the accelerometer captures the data and transmits them to the processor for storage or analysis. By processing the data from both the accelerometer and gyroscope, the processor can identify changes in body posture, angle, and direction, using the appropriate algorithms to determine or track the user's activity patterns.  
We recruited 10 participants to wear motion state sensors, i.e., accelerometer and gyroscope, during their daily activities, allowing us to collect comprehensive movement data. Table 1 presents the relevant details of the participants. To ensure stability, comfort, and minimal interference with natural movement, accelerometer and gyroscope sensors were securely mounted on their waists. A dedicated data collection system was utilized to initialize the sensors and commence data acquisition from both devices. In order to effectively recognize human activities, when determining the activities chosen by participants, we adhere to a multi-dimensional set of considerations to ensure rationality. On the one hand, the selected activities comprehensively cover human daily behaviors. For instance, walking, which is prominently included, owes its universality to its ability to help us accurately capture the key characteristics of daily activities, ensuring that the research findings can be widely applied to real-world scenarios. On the other hand, including different activities such as walking to the left and walking to the right, which possess subtle yet distinguishable and representative features, contributes to a deeper understanding of the human body's movement control mechanisms. Additionally, based on the characteristics of the experimental equipment, we selected activities that can be easily and accurately measured by accelerometers and gyroscope sensors. This ensures the reliability of the data, lays a solid foundation for subsequent analysis and model training, and propels the research towards drawing scientific conclusions. Thus, participants were instructed to perform 12 distinct activities: walking forward, walking left, walking right, walking upstairs, walking downstairs, running forward, jumping, sitting down, standing up, lying down, moving up in an elevator, and moving down in an elevator. For each activity, five sets of experimental data were recorded, with each set capturing several seconds of linear acceleration and angular velocity data. The sensors operated at a sampling rate of 100 Hz. The accelerometer measured acceleration within a range of \(\pm\)6 g, while the gyroscope recorded angular velocity within a range of \(\pm\)500 degrees per second (dps). Regarding sensor orientation, the X-axis of both the accelerometer and gyroscope aligned with the direction of gravity, the Y-axis corresponded to the participant's forward direction, and the Z-axis was perpendicular to the XY-plane, pointing toward one side of the body.