## 2 Materials and Methods
### Feature Compression  
In dynamic environments, selecting appropriate output feature maps for convolutional layers from a CNN is crucial. The closer the chosen convolutional layer is to the input, the more internal redundant information it contains. For ResNet152, when dealing with a large number of test samples, extracting high-level feature representations for low-resolution input images involves many abstract uncertainties. In loop detection, the goal is for the system to accurately identify previously visited scenes in dynamic environments, a task susceptible to such uncertainties. [PERSON] et al. (2019) used a recursive least squares-type algorithm for sequential training of feature extraction in images, extracting principal components of the input part. They successfully demonstrated that a certain dimensionality-reduction method could compress feature information in color images, addressing the aforementioned issues. Following this approach, our study employs KL transformation to preprocess the output feature maps from a CNN, aiming to compress and retain crucial information in the image while minimizing the impact of non-essential information on subsequent image similarity detection. The KL transformation (Kal  
\[U= \begin{bmatrix}u_{11}&u_{12}&\dots&u_{1m}\\ u_{21}&u_{22}&\dots&u_{2m}\\ \dots&\dots&\dots&\dots\\ u_{m1}&u_{m2}&\dots&u_{mm}\end{bmatrix} _{m\times m}=\left[u_{1},u_{2},\dots u_{m} \right]_{m\times m} \tag{12}\]  
\[\Lambda= \begin{bmatrix}\lambda_{1}&0&\dots&0\\ 0&\lambda_{2}&\dots&0\\ \dots&\dots&\dots&\dots\\ 0&0&\dots&\lambda_{m}\end{bmatrix} _{m\times m} \tag{13}\]  
To reduce the dimensionality of \(X_{l}\), let \(k\) be the index of the selected eigenvectors. The key to using the KL transformation is as follows:  
\[Y_{l}=UX_{l}=\left[u_{1},u_{2},\dots u_{k}\right]_{k\times m} \begin{bmatrix}x _{1}^{l}(1)&x_{2}^{l}(1)&\cdots&x_{n}^{l}(1)\\ x_{1}^{l}(2)&x_{2}^{l}(2)&\cdots&x_{n}^{l}(2)\\ \vdots&\vdots&\ddots&\vdots\\ x_{1}^{l}(m)&x_{2}^{l}(m)&\cdots&x_{n}^{l}(m)\end{bmatrix} _{m\times n} \tag{14}\]  
where \(k\) must be smaller than the value of \(m\); otherwise, compression cannot be performed. \(Y_{l}\) is the new matrix obtained by applying the transformation matrix \(U\) to \(X_{l}\). This matrix contains fewer elements than \(X_{l}\) and is of size \(k\times n\), and its eigenvectors corresponding to different eigenvalues are linearly independent with minimum variance. In the KL transform, each eigenvector of the matrix is called a principal component, where the eigenvector corresponding to the largest eigenvalue is the first principal component and the \(k\)-th eigenvalue \(x_{k}\) measures the coherent energy magnitude of the \(k\)-th principal component. The energy of the input features can be represented by the eigenvalues of the covariance matrix:  
\[E_{n}=\frac{\sum_{i=1}^{k}\lambda_{i}}{\sum_{i=1}^{m}\lambda_{i}} \tag{15}\]  
Equation (15) expresses the total energy captured by the selected principal components. The KL transformation allows capturing the most significant features while discarding less relevant information. In Equation (15), \(m\) is the original length of the eigenvectors and \(k\) is the length of the eigenvectors to be truncated. This equation indicates that to find the linear transformation matrix \(U\), when representing \(k\) eigenvectors, the top \(k\) larger eigenvalues should be selected in descending order. As \(\lambda_{j}\) represents the magnitude of variance, for the newly transformed features, we aim for larger variances. Information content reflects the complexity and diversity of the data and is thus directly related to its uncertainty. Variance measures the deviation between a random variable and its mean; smaller deviations indicate smaller variances, higher correlation between pieces of information, and greater repetitiveness. By contrast, larger variances suggest a lower correlation between pieces of information, the presence of more information, and greater distinguishability between different samples.