## 4 Building the Walker Dataset
### Training Data Labeling  
After recording the data on the computer, several steps were taken to process it. The first step involved downsampling the data from approximately 100 Hz to 80 Hz. This adjustment was necessary because the original sampling rate was not consistent, and the acceleration and gyro data were received separately, each with its own timestamp. By downsampling the data to a lower rate, interpolation was applied to ensure a fixed time delay of 12.5 ms between samples, corresponding to a sampling rate of 80 Hz. This process effectively synchronized the gyro and acceleration data, resulting in six dimensions for each timestamp. Once the sampling rate was normalized and the data dimensions unified, the next step was to separate the groups of steps within the recorded data. In the experimental setup, each recording file contained multiple clusters of steps mixed with some turning movements. Typically, 20 to 25 steps forward were taken, followed by a turn and then another series of walking steps. To facilitate this separation, a Java interface was developed that allows step groups to be manually identified and isolated from turning movements, ensuring that each group is extracted individually for further analysis and classification. The interface provides the ability to set a lower and upper threshold, as seen in Figure 3, allowing information between the defined ranges to be exported to a new, separate JSON file. This feature allows the extraction of specific segments of logged data, providing more focused datasets for further analysis and processing. An algorithm was developed to extract and analyze individual steps after isolating groups of steps. This algorithm uses signal processing and machine learning techniques to process the recorded data. To create a single motion metric, accelerometer and gyroscope data were combined using the root mean square (RMS) calculation. This involves normalizing the data and calculating the square root of the average of the squared values, providing a concise representation of the overall motion intensity for each timestamp. After RMS calculation and normalization, a running window averaging filter with 50 samples was applied to smooth the data. This filter reduces noise and jitter in the signal, resulting in a smoother representation of the motion intensity over time. Subsequently, the dataset was analyzed using a hidden Markov model (HMM) algorithm to identify hidden states. The HMM algorithm is a statistical model that analyzes sequential data with unobservable states. In this context, it distinguishes between steps and non-steps based on the intensity of movement captured from the RMS values, as observed in Figure 4.  
Figure 4: Root mean square motion values and hidden Markov model observed states, representing detected steps. Figure 3: The Java interface is a user-friendly graphical tool designed for identifying and separating step groups from turning movements. Step identification using the HMM algorithm allows for various analyses and measurements. It can determine the average length of a step by analyzing the step patterns identified in the dataset. This information provides valuable insight into the characteristics of the steps recorded during the experiment and allows the selection of an appropriate window size. By selecting the window size based on the average length of steps recorded in the dataset, it is possible to capture the correct number of features needed to represent a step, optimizing classification accuracy and adhering to microcontroller limitations. Choosing a window size that is too short can result in insufficient information for accurate step identification, while a window size that is too long could consume too much memory and exhaust the processing capabilities of the microcontroller. After analyzing the step lengths in the recorded data, a window size of 160 samples was chosen for further processing. Using this window size, all steps were extracted by calculating the centroid of each step, as determined by the HMM algorithm.