## 3 Proposed Method
### HRNet-CFR Model
#### 3.2.2 CFR Module  
Due to the problem of \"spatial homogeneity and heterogeneity\" in remote sensing image features, it is inevitable to cause pixel mis-segmentation and produce noise similar to \"salt and pepper\" [47]. Since the semantic segmentation of remote sensing ground objects depends more on neighborhood information, the neighborhood around the pixel is considered as the context feature of the pixel at this time [48]. After the backbone network feature fusion was completed, we connected the CFR module to classify the features of the final fusion context to improve the accuracy of cropland extraction.  
As shown in Figure 5, the main processing steps of the CFR module are as follows.  
(1) Generate an Initial Probability Map  
The multi-scale fusion feature map, \(F_{map}\), is obtained through the backbone network, and the feature size is C \(\times\) 256 \(\times\) 256 (the number of channels \(\times\) height \(\times\) width, the same below, in this paper \(C=720\)). Then, connect the Softmax layer to obtain a rough semantic segmentation probability, \(P_{r}\), with the size \(L\times\) 256 \(\times\) 256, where \(L\) is the number of categories (where \(L=3\) in this paper, it includes dry land, paddy field, and others, and where \(L=2\), it includes cropland and others).  
Figure 5: The structure of the CFR module.  
2) Calculate Object Region Representations  
\[F_{orr}=\phi(P_{r})\times\varphi(F_{map}) \tag{4}\]  
According to the semantic segmentation probability map, \(P_{r}\), and the multi-scale fusion feature map, \(F_{map}\), in the previous step, an \(L\times 512\) feature vector can be obtained by matrix operation through the spatial aggregation module in Equation (4). \(\phi(\cdot)\) means to reshape the matrix \(P_{r}\) to size \(L\times 65\),536, \(\varphi(\cdot)\) means to reshape the matrix \(F_{map}\) to size 65,536 \(\times\)\(C\), and the 65,536 is obtained by rearranging the height and width of the two-dimensional feature matrix into one-dimensional. That is, the object region feature represents \(F_{orr}\), in which each vector represents the feature of each category. It is the input reference information for the attention mechanism in the next step (3).  
(3) Obtain Context Feature Representations  
\[F_{CFR}=Attention(Q,K,V)=softmax(\frac{Q^{T}K}{\sqrt{c_{k}}})V \tag{5}\]  
As the above Equation (5) is the context information expression module, it is used to calculate the relationship matrix, \(F_{CFR}\), between the feature map, \(F_{map}\), and the object region feature, \(F_{orr}\). This process will mainly be fused through the attention mechanism. Make the final feature take into account both point-level features and object region representation features.  
\(Q\) is the eigenvalue obtained by \(F_{map}\) after two \(1\times 1\) convolutions and dimensionality reduction, and the feature size is \(c_{k}\times 65\),536. \(K\) and \(V\) are obtained by \(F_{orr}\) after \(1\times 1\) convolution and rearrangement. Both \(K\) and \(V\) are \(c_{k}\times L\) in size. \(c_{k}\) represents the dimension of the current feature, and in this paper \(c_{k}=256\). Then, use the _softmax_ operation to normalize the \(QK^{T}/\sqrt{c_{k}}\) into probability distribution, and then multiply it by matrix \(V\) to obtain the representation of weight summation, which is \(F_{CFR}\).  
Finally, the contextual feature representation, \(F_{CFR}\), and the backbone feature, \(F_{map}\), are connected as contextual information-enhanced feature representation, \(F_{map+CFR}\) (\(512\times 256\times 256\)), which can be used to predict the semantics of each pixel category.  
Considering the possible imbalance of sample categories, we used an Intersection over Union (IoU)-based loss during the training process, namely the LovaszSoftmax method [3], to replace the more traditional cross-entropy loss.