## 2 Methodology
### Class Adaptive MRF  
Considering an image \(\textbf{X}=\{\textbf{x}_{1},\textbf{x}_{2},\cdots\textbf{x}_{i},\cdots, \textbf{x}_{n}\}\), \(x_{i}\in R_{B}\), represents a dataset in the \(B\)-dimensional vector space, \(n\) is the number of pixels, and \(c\) is the number of classes (\(2\leq c<n\)) in the image.  
The MRF is widely used to incorporate spatial contextual information into image classification by the dependence among neighboring pixels [10]. In which the prior probability serves as an operator for directly exploiting the contextual information. According to the Harmmersley-Clifford theorem and Gibbs theory [4], for pixel \(x_{i}\), the prior probability is described as  
\[P_{k}(x_{i})=\frac{\exp(-\beta E_{k}(x_{i}))}{\sum\limits_{k^{c}=1}^{c}\exp(- \beta E_{k^{\prime}}(x_{i}))} \tag{1}\]  
where \(\beta\) is a smoothing parameter that reflects the interaction between two neighboring pixels, \(E_{k}(x_{i})\) is the energy function of pixel \(x_{i}\) belongs to the \(k\)th class, it is defined as  
\[E_{k}(x_{i})=\sum\limits_{j\in N_{i}}\left(1-\delta(k(x_{i}),k(x_{j}))\right) \tag{2}\]where \(N_{i}\) is the neighbors of pixel \(x_{i}\), \(i\
otin N_{i}\), often defined as a second order neighboring system (8-neighborhood connectivity) in the traditional MRF, \(k(x_{i})\) and \(k(x_{j})\) denotes the label of pixel \(x_{i}\) and its neighboring pixel \(x_{j}\), respectively. \(\delta(k(x_{i}),k(x_{j}))\) is the Kronechker's delta function.  
\[\delta(k(x_{i}),k(x_{j}))=\begin{cases}1&k(x_{i})=k(x_{j})\\ 0&\text{otherwise}\end{cases} \tag{3}\]  
In the MRF, \(\beta\) is a very important coefficient which controls the effect between two pixels, while its selection is difficult and time-consuming in practice. In the traditional MRF, equal influences are put on the central pixel \(x_{i}\) from the neighboring pixels without considering the local image statistics characteristics and whether the neighboring pixel is an edge pixel or not. As a result, it performs well in homogeneous areas, while edge pixels are at the risk of oversmooth. Besides, \(\beta\) is fixed for all neighbor windows for the whole image and the local image information may be overlooked. To address above problems, we propose a new class adaptive coefficient \(\beta^{*}\).  
\[\beta^{*}=\frac{1}{N_{R}}\sqrt{\sum\limits_{j\in N_{i}}\left(u_{k}(x_{i})-u_{ k}(x_{j})\right)^{2}} \tag{4}\]  
where \(N_{R}\) is its cardinality, \(u_{k}(x_{i})\) and \(u_{k}(x_{j})\) denotes the fuzzy memberships of pixels \(x_{i}\) and \(x_{j}\) belongs to the \(k\)th class, respectively. Based on the above-mentioned discussion, a novel prior probability function \(P_{k}^{*}(x_{i})\) is proposed as  
\[P_{k}^{*}(x_{i})=\frac{\exp(-\beta^{*}E_{k}(x_{i}))}{\sum\limits_{k^{\prime}=1 }^{c}\exp(-\beta^{*}E_{k^{\prime}}(x_{i}))} \tag{5}\]  
here, the shape of local window (\(N_{i}\)) is square, but other shape windows can also be used, and the neighborhood size is not just only 8-neighborhood, other more big window size can also be used.  
As seen from Equations (4) and (5), there are no experimental parameters. The determination of \(\beta^{*}\) is based on fuzzy memberships differences between two pixels, and it is adaptive to classes and anisotropic in the neighborhood, which is consistent with the fact the image is anisotropic, thus it can preserve more details than using the fixed one.