## 3 Proposed Method
### Nearest Map Node Search with WH-KNN  
The next step for the localization nodes within the map coverage area was to retrieve the nearest map node. This paper employed the WH-KNN algorithm [50] for searching the nearest map node. The WH-KNN algorithm tackled the problem of ambiguity recognition by introducing the weight values. Figure 7 illustrates the WH-KNN algorithm. First, the current localization node \(L_{m}\) was matched with the localization candidate set \(M_{\text{candi}}\) using SURF and ORB holistic feature matching. Based on the matching results, SURF and ORB decision spaces were constructed separately. In the SURF decision space, the Euclidean distance was used as the metric [37], while in the ORB decision space, the Hamming distance was used as the metric [38]. Figure 6: Coarse localization involved checking whether the localization node was within the map coverage area based on the predicted pose. If it was within the coverage area, a preliminary selection of map nodes was performed based on the predicted pose. Then, the KNN algorithm was used to search for the \(N_{\text{F}}\) neighbors in the SURF decision space, and similarly, to search for the \(N_{\text{B}}\) neighbors in the ORB decision space. Based on this, a weight was assigned to each neighbor, where the weight of the nearest neighbor was the smallest, and the weights of the remaining neighbors increased accordingly. In the SURF decision space, the weight assignment formula for the \(N_{\text{F}}\) searched neighbors was as follows:  
\[W_{\text{F}}(M_{\eta})=\beta\cdot\frac{D_{\text{F}}\big{(}L_{m},\ M_{\eta} \big{)}}{\sum_{\eta\,=1}^{N_{\text{F}}}D_{\text{F}}\big{(}L_{m},\ M_{\eta} \big{)}}, \tag{10}\]  
where \(D_{\text{F}}\) (\(L_{m},M_{\eta}\)) represents the Euclidean distance between the SURF holistic features of the current localization, \(L_{m}\), and the \(\eta\)-th nearest map node, \(M_{\eta}\). In the ORB decision space, the weight assignment formula for the \(N_{\text{B}}\) searched neighbors was as follows:  
\[W_{\text{B}}(M_{\tau})=\sigma\cdot\frac{D_{\text{B}}(L_{m},\ M_{\tau})}{\sum_{ \tau\,=1}^{N_{\text{B}}}D_{\text{B}}(L_{m},\ M_{\tau})}, \tag{11}\]  
where \(D_{\text{B}}\) (\(L_{m},M_{\tau}\)) represents the Hamming distance between the ORB holistic features of the current localization, \(L_{m}\), and the \(\tau\)-th nearest map node, \(M_{\tau}\). The weighting coefficients \(\beta\) and \(\sigma\) represented the weights assigned to the two different types of holistic features, and the calculation formulas were as follows:  
\[\beta=\frac{N_{\text{F}}}{N_{\text{F}}+N_{\text{B}}},\ \ \sigma=\frac{N_{\text{B}}}{N_{ \text{F}}+N_{\text{B}}}, \tag{12}\]  
Next, \(\{M_{\eta}\,|\,\eta\in[1,N_{\text{F}}]\}\) and \(\{M_{\tau}\,|\,\tau\in[1,N_{\text{B}}]\}\) were merged to create a new decision space \(\{M_{\xi}\,|\,\xi\leq(N_{\text{F}}+N_{\text{B}})\}\). The weight calculation was performed for each map node, \(M_{\xi}\), in the fused decision space. \[W(M_{\xi})=\prod_{M_{\eta}=M_{\xi}}W_{\text{F}}\big{(}M_{\eta}\big{)}\cdot \prod_{M_{\tau}=M_{\xi}}W_{\text{B}}(M_{\tau}), \tag{13}\]  
As can be seen from the above formula, if a map node belonged to both \(\{M_{\eta}\,|\,\eta\in[1,\,N_{\text{F}}]\}\) and \(\{M_{\tau}\,|\,\tau\in[1,N_{\text{B}}]\}\), its fusion weight was smaller. If a map node only belonged to either \(\{M_{\eta}\,|\,\eta\in[1,N_{\text{F}}]\}\) or \(\{M_{\tau}\,|\,\tau\in[1,N_{\text{B}}]\}\), its final weight was equal to its initial weight. Figure 7: The illustration of WH-KNN. The SURF decision space refers to the holistic SURF feature matching results between the current localization node, \(L_{m}\), and the localization candidate set, \(M_{\text{candid}}\). Similarly, the ORB decision space refers to the holistic ORB feature matching results between the current localization node, \(L_{m}\), and the localization candidate set, \(M_{\text{candid}}\). If a map node was closer to the current localization node, \(L_{m}\), its fusion weight should have been smaller.