From an overall architectural perspective, the encoder and decoder primarily consist of alternating convolutional modules (SCGC Blocks) and attention layers used for feature extraction of codebook entries. Taking an input image with spatial dimensions of as an example, the network adopts an encoder-decoder architecture. Both the encoder and decoder consist of alternating stacks of SCGC blocks and attention layers designed to learn features of codebook entries, thereby simultaneously modeling local textures and global dependencies. During the encoding phase, the input first passes through four SCGC Blocks for preliminary feature extraction, enhancing representational capacity while maintaining a spatial resolution of . Subsequently, through three rounds of downsampling, the resolution is progressively reduced to , , and, finally, at the bottleneck layer, with the channel dimension correspondingly increased to enhance semantic expression. At the -level, the features are flattened into a sequence and fed into an attention module for global modeling and then restored to a spatial structure and further processed through SCGC blocks for feature extraction. This alternating SCGC—Attention—SCGC process is repeated twice at the bottleneck to strengthen multiscale information interaction. During the quantization stage, vector quantization is employed to map continuous features to a codebook space to obtain discrete representations and features are restored in stages during the decoding process. In Stage I, after the quantized vectors are restored to features, two rounds of attention computation + SCGC Block are repeated to enhance reconstruction expressiveness. In Stage II, a cross-attention mechanism is additionally introduced to align and fuse the pre-quantization continuous features with the post-quantization discrete representations, thereby improving information compensation and consistency constraints. Finally, the decoder gradually restores the resolution to through four SCGC blocks combined with three rounds of upsampling and computes a reconstruction loss at the output to ensure consistency between the generated results and the true cloud-free imagery. Additionally, the specific implementation details and code for this method are described in the open-source repository provided at the end of the paper.
3.3.1. SCGC Block
Compared to other image reconstruction tasks, such as image defogging, a distinctive feature of the cloud removal task is that the spatial distribution of cloud coverage is highly non-uniform. The degree of cloud coverage varies significantly across different regions; some areas are almost cloud-free, while others are completely obscured by thick clouds. These spatial variations significantly weaken the translation-invariant inductive bias on which convolutional neural networks rely. Furthermore, in the context of this specific task, cloud removal from multispectral remote sensing images is more complex than reconstruction tasks relying solely on the three RGB channels, as there are more intricate inter-channel relationships.
To address these issues, a joint feature extraction module combining gated convolutions and channel attention was designed to enhance feature representation capabilities. The overall module design is shown in
Figure 2.
First, to address the issue of significant variations in degradation levels across different regions, a gated convolutional operator was introduced. Gated convolution is a further refinement of partial convolution [
37]. Unlike partial convolution, which relies on rule-based masks and cannot adaptively learn, gated convolution divides features into a gating component and a feature component, which are then fused via a Hadamard product. This enables it to adaptively detect valid pixels within irregular regions, as shown in Equation (
5) [
38]. Here, ∗ denotes the convolution operation. The convolution kernels
and
act on different branches, respectively. The sigmoid function
maps the gating values to [0, 1] to serve as gating weights, while the activation function
can be freely selected.
Figure 3 provides a more intuitive representation of the computational processes for standard convolution, partial convolution, and gated convolution, respectively. In the ablation experiments, the features of randomly sampled channels during the forward pass at different downsampling levels after model training were analyzed. The gating values after passing through the sigmoid function serve as weights, while “Feature” denotes the feature itself. It can be observed that this mechanism enables the convolution operation to perceive cloud layers across different spatial dimensions, thereby dynamically suppressing or enhancing features.
Then, to address the complex relationships among channels in multispectral images, this paper introduces a channel attention mechanism. The channel attention mechanism aims to adaptively model the relationships between different channels and highlight key information by assigning weights to each channel of the feature map. Compared to tasks that use only RGB or RGBA images, channel attention enables more effective feature extraction in multispectral remote sensing images. The Squeeze-Excitation (SE) attention mechanism is an early channel attention method. It compresses each channel into a scalar vector via global average pooling, then applies a nonlinear transformation through a multi-layer perceptron to learn channel weights, and, finally, weights the original channel features [
39]. Building upon the SE mechanism, numerous studies have proposed various variants. For instance, Qin et al. modeled channel attention as a compression problem, utilizing the Discrete Cosine Transform (DCT) to achieve frequency-domain channel weighting [
40]. Our experiments reveal that despite its relative simplicity, the SE mechanism performs better in multispectral image scenarios; its specific performance will be demonstrated in ablation experiments.
Unlike methods such as HPN-CR that use multi-branch structures to fuse modal data, this paper achieves dynamic fusion of different modal data throughout the entire network through the design of the SCGC module, which constitutes the core of the network. Taking SAR and multispectral images as inputs, they are represented as
and
, respectively. The SCGC module first concatenates them along the channel dimension and performs gated convolutions with a Pre-Norm structure.
This step first suppresses and enhances information across modalities in the spatial dimension. For multispectral images, it effectively detects cloud regions, as shown in ablation studies. For SAR images, spatial information suppression effectively reduces speckle noise that occurs during the imaging process [
23]. After suppressing features in the spatial dimension, the information in the channel dimension still needs to be fused. SCGC automatically weights the relative importance of information across channels via a channel attention mechanism, as shown in Equation (
7).
First, global average pooling is applied to the features computed by spatial attention to obtain their channel-level representations . These are then transformed via an MLP, followed by a Sigmoid function to convert them into weight features within the range . These weight features represent the relative importance of different channels, i.e., the relative importance of weights across different modalities. Finally, multiplying them by the initial features yields the modality-fused features . The method proposed in this paper avoids the design of multi-branch network architectures through its modular design, thereby improving its generalization and efficiency in multi-modal data fusion without the need to design new conditional fusion heads. Experiments demonstrate that without modifying the model structure, the network performs excellently on both dual-modal (SAR + multispectral) and triple-modal (SAR + MODIS + multispectral) inputs.
3.3.2. Self-Attention and Cross-Attention
In recent years, with the widespread adoption of Transformer models, dot-product attention mechanisms have been extensively incorporated into various networks [
41,
42,
43]. This mechanism does not rely on inductive biases, can directly model intrinsic relationships from the data, and possesses the ability to model long-range dependencies [
44]. Its computational form is shown in Equation (
8), where the query (
Q), key (
K), and value (
V) are obtained through linear transformations and the attention matrix is denoted as
A:
In Stage I, after downsampling the image to
, a self-attention module is introduced following the final downsampling step to expand the receptive field of the codebook vectors. The features are flattened and sequentially passed through the self-attention and SCGC blocks; this process is repeated once before quantization. The decoder adopts a “convolution-self-attention” structure that is symmetric to the encoder, thereby enhancing the codebook’s ability to model global semantics. In Stage II, the decoder’s self-attention is replaced with cross-attention, where the queries come from the quantized vectors and the keys and values originate from the convolutional features following the encoder’s self-attention. This design enables the quantized object features to integrate complementary information from the features prior to quantization during the decoding stage, thereby obtaining richer representations.
From a probabilistic perspective, the attention mechanism can be viewed as a conditional probability [
45]; that is, cross-attention can be expressed in terms of conditional expectation, as shown in Equation (
9), where
and
. Therefore, this method can be understood as modeling the expected features extracted by the encoder from the cloud-containing image in Stage II, conditional on the object features learned in Stage I.