## 3 Methodology
### Encoder
Before each block, layer normalization (_LN_) is applied, and after each block, residual connectivity is applied. In SegMine, the multi-scale local spatial feature complementary module interspersed between Transformer blocks consists of a bypass convolution branch and multiple feature injection modules. The bypass convolution branch learns the multi-scale local space features of the image. The feature injection module injects the multi-scale local space features into the input features of Transformer blocks through the cross-attention mechanism and injects the global semantic information output from Transformer blocks into the multi-scale local space features. The convolution kernel has inductive biases such as translation invariance and local sensitivity and is able to capture image local spatial features by means of sliding convolution sharing weights. Multi-scale convolution extracts the features of different scales of mining area, which is favorable for the feature expression of small-scale open-pit mining areas. In order to improve the model's responsiveness to the local visual information and multi-scale feature processing of the image in the open-pit mining area, the multi-scale local spatial features are captured through the serial computational processing of bypassed convolutional branches. First, the input image is passed through three consecutive 3 \(\times\) 3 convolutional downsampling layers in order to obtain three different scales of features with image local relevance, constituting the feature pyramid \(\{Z_{1},Z_{2},Z_{3}\}\). Second, the feature pyramid is sequentially flattened (_Flatten_), concatenated (_Concat_), and activated (_SiLU_). Here, _Flatten_ is used to unfold a tensor in a specific way, e.g., a convolutional layer must be flattened before it is passed to a fully connected layer. _Concat_ is used to stitch together different feature maps according to a certain dimension. _SiLU_ is an improved version of the Sigmoid and _ReLU_ activation functions which is used to convert an input signal into an output signal; has the properties of no upper bound and lower bound, smoothness, and non-monotonicity; and outperforms _ReLU_ on the depth model. Finally, the mapped \(D\)-dimensional multi-scale local correlation features are used as inputs to the information injection module. The process can be represented as (2) and (3):  
\[\hat{Z}=Concat(Flatten(Z_{1},Z_{2},Z_{3})) \tag{2}\]  
\[Z=\mathcal{F}(SiLU(Norm(\hat{Z}))) \tag{3}\]  
The cross-attention mechanism encodes the original sequence and the target sequence separately, and the calculated cross-attention weights can represent the attention paid by each element in the original sequence to each element in the target sequence. According to the cross-attention weights, we selectively pay attention to certain elements of the original sequence in order to realize the information interaction between the two sequences and will not change the shape of the original sequence. This information interaction is accomplished through the information injection module, whose overall flow is shown in Figure 2.  
Figure 2: The overall flow of the information injection module. In order to inject the multi-scale local spatial features output from the convolutional branch into the global semantic features of Transformer blocks and to cause the multi-scale local spatial features to have the long-distance dependency of the image features, this study constructs the information injection module through the cross-attention mechanism. Global semantic features and multi-scale local spatial features are used as inputs to the information injection module. Before each block, layer normalization (\(LN\)) is applied, and after each block, residual connectivity is applied. In order to cause the global semantic features to contain multi-scale local spatial information, the module first injects the multi-scale local spatial features into the global semantic features output from the \(i\)-th Transformer block, as shown in (4).