**5. Landmark Identification**

The basic concept of landmarks and landmark graph are adopted from previous studies [2,6]. Here, landmarks are the sensory markers in the indoor floor plan that encounter specific signal patterns when one or more sensors meet those markers. A landmark can be identified by detecting a subject's motion modes and by applying a set of rules to those motion modes. Therefore, the landmark identification problem can be described as a motion mode detection problem where the key to efficiently detect a landmark depends on the accuracy of motion mode detection. If the system can detect the motion modes with high accuracy, then the detected motions can be used as inputs to a set of rule-based algorithms to identify the landmarks with high accuracy. Thus, this section mainly focuses on the motion mode detection problem. Before describing the details of the motion mode detection, this section presents an overview of the landmark types along with their detection rules, as well as the landmark graph.

#### *5.1. Landmarks and Landmark Graph*

Although there are various types of landmarks used for indoor localisation in previous works, this study only considers two types of landmarks: door landmarks and turning landmarks, which are useful for localisation in a 2D indoor environment.

Door landmarks are the sensory markers in the indoor floor plan where the state of motion modes of a subject experience a distinct change in signal patterns. In this work, accelerometer readings are utilised to perceive the door landmarks that can present a specific signal pattern. The usual change pattern in motion modes when accessing a doorway is "walking →static →walking", which is exploited to infer the door landmark. Figure 5a illustrates the concept of a door landmark that presents a typical change pattern from accelerometer measurement that can be identified by detecting the corresponding motion modes for walking and static activities, and setting a proper time threshold in between the activities. Mathematically, the rule to detect a door landmark, *Ldoor*, can be defined as follows [6]:

$$L\_{door} = \begin{pmatrix} (x\_{t\prime} \ y\_t) \ \end{pmatrix} \begin{pmatrix} \mmm\_{t - Th\_{t1}:t} == \#alk \end{pmatrix} \land \begin{pmatrix} \mmm\_{t:t + Th\_{t2}} & \newline \perp & \text{match} \end{pmatrix} \tag{5}$$

$$\begin{array}{rcl} \text{attack} & \land \begin{pmatrix} \mmm\_{t + Th\_{t2}:t + Th\_{t1} + Th\_{t2}} == \#alk \end{pmatrix} \end{array} \tag{6}$$

where *mmt* is the subject's motion mode at time *t*, and *Tht*1 and *Tht*2 are the two time thresholds that regulate the time for the corresponding motion status.

**Figure 5.** Illustrations and signal patterns of sensory landmarks: (**a**) door landmark; (**b**) turning landmark.

Turning landmarks are the sensory markers in the indoor map where the motion modes provide distinct signal patterns. In this study, data from both the gyroscope and accelerometer combinedly provide a specific motion pattern such as "walking→turning→ walking", corresponding to the direction of turning. Figure 5b shows the idea of turning landmark when a subject takes right and left turns. The rule for detecting a turning landmark can be expressed as follows:

$$\begin{array}{lcl} \text{L}\_{\text{turning}} = \left( \left( \mathbf{x}\_{l} \mid \mathbf{y}\_{t} \right) \mid \left( \mathbf{m} \mathbf{m}\_{t - Th\_{t1}:t} == \mathbf{w}alk \right) \land \left( \mathbf{m} \mathbf{m}\_{t:t + Th\_{t2}} == \mathbf{w}alk \right) \right) \\ \quad == \text{turn} \; \right) \; \land \left( \mathbf{m} \mathbf{m}\_{t + Th\_{t2}:t + Th\_{t1} + Th\_{t2}} == \mathbf{w}alk \right) \end{array} \tag{6}$$

A landmark graph is a directed graph where the landmarks act as nodes and the path segmen<sup>t</sup> between two adjacent landmarks acts as edges. Let *LG* = (*LM*, *T J*) denote a landmark graph where *LM* is the set of vertices {*lm*1, *lm*2, ... *lmN*}, i.e., the potential set of landmarks, and *T J* is the set of edges {*tj*1, *tj*2, ... *tjN*}, i.e., the potential set of trajectories that connect the landmarks. Each landmark, *lmi*, is represented by its location coordinates, its type, and its unique identifier using the tuple < *xi*, *yi*, *lti*, *idi* >. Each trajectory *tji* is a tuple < *lmj*, *lmk*, *<sup>θ</sup>jk*, *di* > that connects two adjacent landmarks, with the angle difference relative to the x-axis in anticlockwise direction and the accessible path distance between those landmarks. The locations of these landmarks are acquired from the indoor floor plan, and a landmark graph is constructed.

#### *5.2. Motion Mode Detection*

#### 5.2.1. Motion Mode Definition

The understanding and detection of motion mode are helpful to implement IMUassisted indoor localisation. There are different kinds of motions experienced by an IMU which mainly depend on the placement of the sensor on a user's body. Usually, motion models used by the researchers are specific to the position of IMU installation on the body, e.g., foot-mounted [26], handheld [27], head-mounted [28], etc. In this study, we use chest-mounted IMU for landmark detection; the chance of interference by motions coming from the irregular motion class is minimal because of the steadiness of the device. Moreover, the pose of the device will not vary, as in the case of handheld or head-mounted IMU. Thus, to detect a landmark precisely, the following four types of motion modes were considered in this study.


#### 5.2.2. Motion Mode Classification

The purpose of a typical classification system is to allocate an input pattern automatically to a known set of items based on some decision rules. As shown in Figure 6, usually, a typical classification method is performed using four steps, such as data preprocessing, data segmentation, feature extraction, and decision-making. This study adopted the motion mode classification methods as described in [29]. For data preprocessing, a band-pass filter is used that removes both the unwanted low- and high-frequency noises to focus only on the body movement-contributed signal portion. In this study, a band-pass Butterworth filter of order eight was used to remove both the low- and high-frequency noises. The power spectral analysis of the raw data collected from three-axis accelerometer and three-axis gyroscope was performed to determine the signal and noise characteristics. As analysed, most of the energy related to human motion captured by the accelerometer and gyroscope was between 0.75 Hz and 25 Hz. Thus, these two frequencies were applied as the cut-off frequencies to the filter for removing the low- and high-frequency noises, respectively. In this study, though the sensor is body fixed, it can slightly change its orientation regarding the original setup in the x-, y-, and z-axis, because of the generated motions during experiments. This change in sensor orientation affects the acceleration in various degrees towards the x, y, and z coordinate systems by decomposing the gravitational component [30]. To eliminate the dependency on device orientation, the normalised magnitude of the IMU data was considered in this study. As the human movement is a continuous process over time, an individual data point cannot reflect a complete motion mode of a user. Thus, to extract features that can characterise a motion mode, collected sensor data need to be segmented into sequences within a certain time frame, named a window. Here, a window size of 2 s with 50% overlapping was selected, which translates 200 samples for a sampling frequency of 100 Hz. The choice of this type of window is typical and often utilised for motion mode detection, which has already been validated by previous studies [29,31,32]. As this study only considers four types of motion modes, the feature set proposed by Susi et al. [29] was used, which can manage the trade-off between the classification performance and computation cost. The features were extracted from the preprocessed windowed data, which include the energy of the accelerometer and gyroscope, the variance of the accelerometer and gyroscope, and the dominant frequencies of the accelerometer and gyroscope. In addition to those features, this work considered the change of angular velocity along the vertical axis to detect the turning motion.

**Figure 6.** Motion mode detection process pipeline.

As proposed by [29], this work utilised a supervised approach of classification named decision tree for performing the classification task. A decision tree forms a tree-like mapping that comprises leaf nodes, representing the classes, and internal nodes that symbolise the tests regarding the features. The internal nodes contain one (i.e., univariate) or multiple (i.e., multivariate) conditional control statements, and traversing the tree from the root node to leaf nodes can classify a given input pattern. Figure 7 presents the decision tree that was used in this study to detect the abovementioned motion modes. The threshold values for each feature set in every internal node is set by the classifier after performing the training. Initially, the tree characterises the static and dynamic types of motion modes based on the energies and variances of the accelerometer and gyroscope, as well as the raw angular velocity along the vertical axis. As the signal variances for the random movement are significantly higher in short temporal periods than the striding motion, it is utilised to separate the striding motion from other dynamic motions. Moreover, to ascertain whether that motion is from a periodic activity, the periodicity of the dominant frequencies of the accelerometer is evaluated, which reflects the periodic motions generated from human gait. However, the striding motion can be further divided into other classes, such as plain walking, fast walking, running, walking up or down stairs, etc., for other aims that are beyond the scope of this study. Finally, the turning motions are differentiated from other random motions by evaluating the angular velocity of the raw data along the vertical axis.

**Figure 7.** Structure of the decision tree to classify various motion modes.

#### **6. User's Body Shadowing Effect Compensation**

There are two main parts to compensate the effect of user's body shadowing on RSSI calculation: angle estimation and compensation model.
