# Pose Estimation Utilizing a Gated Recurrent Unit Network for Visual Localization
## 2 System Overview
### Framework of Pose Estimation Utilizing GRU Network  
#### 2.3.1 Network Architecture  
The proposed pose estimation method utilizes a GRU network shown in Figure 6a for predicting the yaw angle at the current timestep. The predicted yaw angle is to be used to minimize rotation error defined in x-z plane. In this study, sequential yaw angles obtained for the time interval \(t_{-5}\) to \(t_{-1}\) are applied as the network inputs and go through the GRU layers and then the prediction that corresponds to the yaw angle at \(t_{0}\) is obtained through the output layer.  
The GRU network consists of 5 GRU layers, each consisting of 5 GRU cells with 200 hidden units in each GRU cell, and 3 fully connected layers, each consisting of 256, 128, and 64 neurons. The structure of the GRU network architecture and GRU cell is shown in Figure 6a,b, respectively. The GRU network shown in Figure 6a consists of 25 (= 5 cells/layer \(\times\) 5 layers) GRU cells, where 5 cells/layer represents the number of feature dimension (input dimension), in other words, the length of the input sequence. After the GRU layers, there are 3 fully connected layers before the final output layer that predicts the yaw angle. In the \(l\)-th GRU cell in Figure 6b, where \(l=1,\ldots,5\), forward transfer formulation of GRU is calculated for each processing step as follows  
\[r_{t}=\sigma(W_{t}[h_{t-1},x_{t}]+b_{r}), \tag{9}\]  
\[z_{t}=\sigma(W_{z}[h_{t-1},x_{t}]+b_{z}), \tag{10}\]  
\[\widetilde{h}_{t}=tanh(W_{\widetilde{h}}[r_{t}\odot h_{t-1},x_{t}]+b_{ \widetilde{h}}), \tag{11}\]  
\[h_{t}=(1-z_{t})\odot h_{t-1}+z_{t}\odot\widetilde{h}_{t} \tag{12}\]  
Figure 5: Turn-in, mid-corner, and exit involved with a cornering section [38].  
where \(r_{t}\) is the reset gate which determines how much information in the previous GRU cell should be forgotten and \(z_{t}\) is the update gate which determines how much information should be transferred from the current GRU cell to the next GRU cell and \(\widetilde{h_{t}}\) is the intermediate state and \(h_{t}\) is the hidden state and \(\sigma(\cdot)\) is the sigmoid function and \(tanh(\cdot)\) represents the hyperbolic tangent function and \(W_{r}\), \(W_{z}\), \(W_{\widetilde{h}}\) are entries of weight matrix \(W\) and \(b\) is bias vector and \(\odot\) is element-wise multiplication. For the reset gate, large value of \(r_{t}\) means much information from previous cell is forgotten. For the update gate, large value of \(z_{t}\) means that much information is transferred to the next cell [34; 39].  
The 5 historical yaw angles estimated by the VO are the input to GRU layer at each time and the current output of each GRU cell is determined by both past and current inputs. A dropout layer is placed between each GRU layer to prevent overfitting. The overall structure is determined by a grid search to define the best hyperparameter values providing the best accuracy. The GRU network is trained by time series data, so continual training is required. The GRU network learns the cornering tendency in terms of yaw angle variation of the camera and then operates when the camera enters the cornering section so that it can predict the next yaw angle on cornering. This novel method can improve the performance of the VO by correcting the yaw angle estimation of the VO.