## 3 System Model
### Adaptive Parameter Weighting  
Inspired by the insights of Metric Learning [45], we measure the similarity between images, where image descriptors of different categories are less similar and descriptors of the same category are more similar. To achieve this, we implement adaptive parameter weighting in the similarity measurement. First, we provide the analysis and definition of the enhancement factor \(\alpha\). Based on previous analysis, if the values on the diagonal of the similarity matrix are significantly larger than the values on the off-diagonal, there is a high probability of encountering a loop closure. Therefore, we enhance the difference between the positive and negative similarity matrix to make it easier to distinguish. The \(\alpha\) is designed to make the positive pair similarity close to 1 and the negative similarity score as small as possible. The possibility \(\alpha\) can be defined as:  
\[\alpha= \begin{cases}\frac{e^{d}-1}{e-1},&d\geq 0\\ 0,&d<0\end{cases}  \tag{8}\]  
Figure 4: The input images and the corresponding similarity matrixes. The winter1 in (**a**) and summer1 in (**b**) is a positive pair, while summer1 in (**b**) and winter2 in (**c**) is negative one. (**d**) similarity matrix of winter1 and summer1. (**e**) similarity matrix of summer1 and winter2. where \(e\) is the natural constant. \(d\) represents the difference between diagonal and off-diagonal values based on the average value of diagonal similarities \(S_{dia}\) and off-diagonal similarities \(S_{off}\) in the matrix:  
\[d=S_{dia}-S_{off} \tag{9}\]  
\[S_{dia}=\frac{1}{4}\sum_{i=0}^{3}M_{ii} \tag{10}\]  
\[S_{off}=\frac{1}{12}\sum_{i\
eq j}M_{ij} \tag{11}\]  
In this case, if \(S_{dia}\gg S_{off}\), \(\alpha\) is close to 1. It means that the image pair is likely to be collected from the same location. Conversely, if \(\alpha\) is close to 0, it strongly suggests that this image pair is captured from different places. Since the false positive has a significant impact on the back-end optimization in vSLAM, we further improve the prediction accuracy of the method to avoid localization failures. When \(S_{dia}<S_{off}\), we directly set \(\alpha\) to 0 to avoid false positives misjudgment in the location applications. As for the parameter \(\omega_{i}\), it is designed to address the situation where the same place has distinct appearance variations at different sampling times. Since the environment is constantly changing over time, images collected from the same location at different times are likely to undergo local changes. If the average value of the main diagonal elements is used directly, the overall similarity value will be low. As shown in Figure 5, two images are taken from the same location but have apparent differences in the lower left patches due to the pedestrian obstruction. Therefore, the diagonal value (\(M_{22}\)) computed by the corresponding patches is smaller than the other off-diagonal values, where we refer to \(M_{22}\) as an outlier and need to reduce its weight to minimize its impact on the overall similarity. In addition, when two images collected from different locations contain an amount of textureless information (such as walls, sky, etc. ), resulting in uniformly high element values in the similarity matrix, using the average value will yield a very high similarity score, leading to false positive misjudgments. As for perceptual aliasing and perceptual bias, it is necessary to assign different elements importance according to the influence of diagonal values on the overall similarity. The \(\omega_{i}\) weight can be formulated as  
\[\gamma_{i}=\frac{\left(\sum_{i,j\
eq i}M_{ij}+\sum_{j,j\
eq j}M_{ij}\right)}{6} \tag{12}\]  
\[k_{i}=\left\{ \begin{aligned} & M_{ii}-\gamma_{i},M_{ii}\geq \gamma_{i}\\ & 0,M_{ii}<\gamma_{i}\end{aligned} \right. \tag{13}\]  
\[\omega_{i}=\frac{k_{i}}{\sum_{i}k_{i}} \tag{14}\]  
Figure 5: The frames and corresponding similarity matrix captured at the same place have apparent appearance variations. (**a**) image captured during day time.