## 2 Materials and Methods
### Selective Search Collaborative Representation Detector  
For each pixel \(y\) in HSI, it has a local background composed of its own neighboring pixels, which are falling in a dual-window with the inner window \(w_{in}\times w_{in}\) and the outer window \(w_{out}\times w_{out}\) centered at the pixel \(y\), as shown in Figure 1. Then, a 2D matrix \(X_{lb}=\{x_{i}\}_{i=1}^{s}\) can be used to represent the local background, where \(s\) is the number of local background pixels calculated via \(s=\omega_{out}\times\omega_{out}-\omega_{in}\times\omega_{in}\). In addition, the local background \(X_{lb}=\{x_{i}\}_{i=1}^{s}\) for each pixel has its corresponding pixel label matrix \(P_{lb}=\{0,1\}_{i=1}^{s}\) (of size \(1\times s\)) from the result of the selective search \(P\). Dot-multiplying the local neighborhood matrix \(X_{lb}=\{x_{i}\}_{i=1}^{s}\) and the pixel label matrix \(P_{lb}=\{0,1\}_{i=1}^{s}\) can effectively remove those pixels with higher anomaly probability in the neighborhood matrix, thereby obtaining a purer local background description. The proposed SSCRD is based on the principle that the background pixels can be approximately represented by their adjacent pixels but the anomaly pixels cannot, which is in accordance with that of CRD. This principle can be interpreted into mathematical language, which is used to solve the weight vector \(\alpha\), so that \(\left\|y-(P_{lb}*X_{lb})\alpha\right\|_{2}^{2}\) is minimized under the constraint that \(\left\|\alpha\right\|_{2}^{2}\) is also minimized for obtaining the optimal solution, where \(y\) is the pixel under test. The objective function of SSCRD can be expressed as:  
\[\underset{\alpha}{\text{argmin}}\|y-(P_{lb}*X_{lb})\alpha\|_{2}^{2}+\lambda\| \alpha\|_{2}^{2} \tag{7}\]where \(\lambda\) is the Lagrange multiplier. Equation (7) can be expanded as:  
\[\underset{\alpha}{\text{argmin}}\Big{[}\alpha\Big{(}(P_{lb}*X_{lb})^{T}(P_{lb}*X_{ lb})+\lambda I\Big{)}\alpha-2\alpha^{T}(P_{lb}*X_{lb})^{T}y\Big{]} \tag{8}\]  
Then, taking the partial derivative of \(\alpha\) and setting the resultant equation to zero can obtain:  
\[\hat{\alpha}=\Big{(}(P_{lb}*X_{lb})^{T}(P_{lb}*X_{lb})+\lambda I\Big{)}^{-1}(P_ {lb}*X_{lb})^{T}y \tag{9}\]  
where \(I\) is the identity matrix of \(s\times s\). For surrounding pixels that are quite different from the center pixel, the coefficients should be small. Therefore, a distance-related weight to each pixel of \(P_{lb}*X_{lb}\) is assigned by introducing the Tikhonov regularization matrix \(\Gamma_{s}\) used in [38; 39]. The objective function of SSCRD can be expressed as:  
\[\underset{\alpha}{\text{argmin}}\|y-(P_{lb}*X_{lb})\alpha\|_{2}^{2}+\lambda \|\Gamma_{s}\alpha\|_{2}^{2} \tag{10}\]  
where \(\Gamma_{s}\) is defined as:  
\[\Gamma_{s}= \begin{bmatrix}\big{\|}y-P_{lb_{1}}*X_{lb_{1}}\big{\|}_{2}&0\\ &\ddots\\ 0&&\big{\|}y-P_{lb_{s}}*X_{lb_{s}}\big{\|}_{2}\end{bmatrix}  \tag{11}\]  
Similarly, taking the partial derivative of \(\alpha\) and setting the resultant equation to zero can obtain:  
\[\hat{\alpha}=\Big{(}(P_{lb}*X_{lb})^{T}(P_{lb}*X_{lb})+\lambda\Gamma_{s}^{T} \Gamma_{s}\Big{)}^{-1}(P_{lb}*X_{lb})^{T}y \tag{12}\]  
Then, the residual image can be obtained by subtracting the original hyperspectral data and the predicted background data, expressed as:  
\[\gamma=\big{\|}y-(P_{lb}*X_{lb})\hat{\alpha}\big{\|}_{2} \tag{13}\]  
If \(\gamma\) is larger than a threshold, then the corresponding pixel is claimed to be an anomalous pixel. The flow of the proposed selective search collaborative representation anomaly detection algorithm is summarized in Algorithm 1. Figure 1: Sketch of the dual-window in CRD with the San Diego-II data set. Some aircraft pixels in the image may fall into the outer window.