# Recurrent Neural Network-Based Hybrid Localization for Worker Tracking in an Offshore Environment
## 3 Materials and Methods
### Learning Data Collection  
RHLS checks the path to collect through the walking survey method, which collects signals during walking at the target site, and then walks along the path to store the Wi-Fi fingerprint and inertial sensor (INS) data along with the collection time. Step detection is a method of estimating when a pedestrian stepped using the accelerometer data collected from a device. Estimating the location of the fingerprint through step detection is based on the assumption that the step stride of the pedestrian is constant. By calculating the length of the path to be collected and the total number of steps generated during collecting, the moving distance per unit step can be determined. By comparing the timestamp of the collected fingerprint with the timestamp of the steps that occurred during walking, it is possible to ascertain how many steps there were up to an arbitrary fingerprint. Then, by multiplying the corresponding value and the moving distance per unit step, it is possible to determine the length from the starting point of the path until the corresponding fingerprint is collected. This can be summarized as Equation (1). \[l(f_{t})=s(f_{t})\times\frac{length}{stepCnt}, \tag{1}\]  
where the function \(s(f_{t})\) receives the timestamp value when any fingerprint \(f\) is collected and returns the accumulated step, _length_ denotes the total length of the collection path, and _stepCnt_ is the total number of steps during collection. If the step detection does not work correctly and a step length different from the step actually taken is determined, the distance from the starting point of any fingerprint estimated through step detection may differ from the actual distance. An optimization algorithm is used to compensate for errors that may occur owing to inaccurate step detection. The location where the random fingerprint was actually collected and the distance on the path to the starting point are the values that the optimization algorithm seeks. We set this value as \(x_{i}\) and use Equation (2) to find the value of \(x_{i}\) that minimizes the objective function. The Nelder-Mead algorithm is used to find the optimal solution of the objective function. \[\arg\min_{\langle x_{0},\,\ldots,x_{n}\rangle}\left(\sum_{i=0}^{n-1}w_{1}( \Delta x_{i}-\Delta s_{i})^{2}+w_{0}(\Delta\theta_{i}-a_{i})^{2}\right), \tag{2}\]  
Figure 3: Parameters of the magnetic field. where \(n\) denotes the number of collected fingerprints, \(\langle x_{0}\),.., \(x_{n}\rangle\) represents the distance from the starting point to each fingerprint, and \(\Delta x_{i}\) means \(x_{i}-x_{i-1}\). As denotes \(s_{i}-s_{i-1}\) when the distance from the starting point of the \(i\)-th fingerprint through step detection is \(s_{i}\). \(\theta_{i}\) represents the angle at which the fingerprint was rotated clockwise relative to the starting path when the distance from the starting point of any \(i\)-th fingerprint is \(x_{i}\). \(a_{i}\) means the angle rotated clockwise from the starting path calculated from the gyroscope values collected when the corresponding fingerprint was collected. \(w_{0}\) and \(w_{1}\) are coefficients for the objective function to work correctly, and they have values of 0.3 and 0.7, respectively. In Equation (2), \(w_{0}\) and \(w_{1}\) are set to values that derive maximum accuracy through iterative simulation. In order to build more accurate learning data, these constants are determined by simulation in the offline phase. However, detailed explanation of this is omitted because the problem of optimizing these coefficients is outside the scope of this paper. The first term of the objective function maintains the gap between the fingerprint locations obtained through step detection as much as possible, and the second term compensates for errors that step detection may contain.