Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

2 September 2026

20 Pages

Class Distribution-Aware Adversarial Training for Semantic Segmentation of Imbalanced Remote Sensing Imagery

,
,
and
1
Institute of Educational Big Data and Artificial Intelligence, Qiongtai Normal University, Haikou 571100, China
2
Shijiazhuang Campus, Army Engineering University of PLA, Shijiazhuang 050003, China
3
School of Aeronautics Engineering, Air Force Engineering University, Xi’an 710043, China
*
Authors to whom correspondence should be addressed.

Abstract

Class imbalance is a fundamental challenge in semantic segmentation of remote sensing imagery, causing deep convolutional networks to systematically neglect minority categories such as vehicles and small water bodies. To address this, we propose a class distribution-aware adversarial training framework that explicitly penalizes the model’s bias toward dominant classes at the representation level. The framework comprises two key components. First, a Hierarchical Attention U-Net (HAU-Net) integrates a Parallel Hybrid Attention Module (PHAM) at multiple scales, combining spatial and channel attention to amplify feature responses for small and sparsely distributed objects. Second, a distribution discriminator is trained to distinguish the predicted per-class probability distribution from a balanced uniform prior; through a minimax game, the segmentation network is forced to produce class-balanced predictions without manual loss re-weighting. Extensive experiments on the ISPRS Potsdam and Vaihingen datasets demonstrate that our method achieves an overall mIoU of 73.82% and delivers substantial improvements on severely under-represented minority classes, including a +12.11% IoU gain on vehicles and a +19.26% IoU gain on clutter/background, compared to our non-adversarial baseline. Ablation studies confirm that both the hierarchical attention design and the adversarial training contribute independently to these improvements. Our framework offers an effective solution to class imbalance in remote sensing segmentation, with the potential to be integrated into diverse segmentation architectures.

1. Introduction

Semantic segmentation of remote sensing imagery using deep convolutional neural networks (CNNs) has become indispensable for applications such as urban planning, agricultural monitoring, and environmental assessment. However, severe class imbalance remains a critical bottleneck that substantially degrades model performance in real-world scenarios. In typical land cover classification tasks, foreground objects of interest—such as vehicles, roads, or water bodies—often occupy only a tiny fraction of the total pixels, whereas background or dominant classes cover the vast majority. Trained with standard losses, CNNs are biased toward the well-represented classes, leading to severely degraded recognition of minority classes and, consequently, unreliable segmentation maps that fail to capture these sparsely distributed categories [1].
This detrimental effect is starkly illustrated by the ISPRS Potsdam dataset. As shown in Figure 1, the Clutter/Background class (red) overwhelmingly dominates the pixel distribution, while the Vehicles class (yellow) constitutes an extremely small proportion—typically below 2% of total pixels. In such a setting, standard CNN training drives the model to ignore the minority class almost entirely, producing high overall accuracy but a near-zero intersection over union (IoU) for Vehicles. This disconnect between overall metrics and minority-class performance poses a serious risk for downstream decision-making that relies on precise identification of small or rare objects.
Figure 1. Class imbalance in remote sensing imagery: (a,b) display an image sample and its corresponding mask from the ISPRS Potsdam dataset, where severe imbalance exists between the Clutter/Background class (red) and the Vehicles class (yellow); (c) plots the statistical distribution of category ratios for the Potsdam dataset.
To mitigate class imbalance, existing methods generally fall into three categories: data-level resampling (e.g., random over- or under-sampling), algorithm-level loss modification (e.g., weighted cross-entropy, focal loss), and hybrid approaches. While effective to some degree, each approach exhibits notable limitations when applied to high-resolution remote sensing data. Over-sampling minority instances risks overfitting to repeated patterns, whereas under-sampling discards vast amounts of valuable contextual information from majority classes. Weighted loss functions, though widely adopted, often fail under extreme imbalance ratios as they become numerically unstable or require extensive hand-tuning of class weights. More fundamentally, these methods operate primarily on the loss landscape or the input sample distribution, but do not explicitly enforce the learning of balanced, discriminative feature representations for minority classes—a gap that is particularly damaging in remote sensing images where within-class spectral variability and complex spatial textures already challenge feature extraction [2].
Adversarial training provides a distinct and promising avenue to address this representation-level deficiency. In the standard adversarial framework, a generator and a discriminator are jointly trained in a minimax game, forcing the generator to produce outputs indistinguishable from a target distribution. For semantic segmentation, the segmentation network can serve as the generator, and a discriminator can be trained to assess whether the predicted label maps adhere to a class-balanced prior. Through this competition, the segmentation model is compelled to learn features that are not only discriminative for majority classes but also sufficiently expressive for minority classes, thereby counteracting the bias inherent in the data. Several works have exploited adversarial learning to improve segmentation quality—for instance, by aligning predicted label distributions with ground truth statistics or by using adversarial domain adaptation. Moreover, recent studies have tailored adversarial training specifically to address class imbalance in medical image analysis, where lesion pixels are similarly scarce [3]. Nevertheless, the application of adversarial training to class-imbalanced remote sensing segmentation remains largely unexplored. The high spatial resolution and multi-spectral richness of remote sensing data offer both opportunities and challenges: the added spectral dimensions can provide complementary cues for minority classes [4], yet they also increase the feature space complexity, making naive adversarial objectives prone to instability. Hence, a carefully designed adversarial framework, customized to the peculiarities of remote sensing imagery, is urgently needed.
In this work, we introduce an adversarial training framework specifically devised to tackle class imbalance in remote sensing image semantic segmentation. The framework leverages an improved Attention U-Net as the generator (segmentation model), which integrates a novel attention mechanism to selectively amplify feature responses for small and sparse objects that would otherwise be suppressed by dominant classes. Crucially, a companion discriminator is designed not merely to distinguish real vs. predicted masks, but to minimize category distribution bias by evaluating the per-class probability histograms of output predictions, thereby explicitly penalizing the generator whenever minority classes are under-represented. This design forces the segmentation model to maintain a balanced class distribution during inference, significantly boosting the segmentation accuracy of minority categories without sacrificing overall performance.
The main contributions of this paper are threefold:
(i)
We propose a dedicated adversarial training framework for class imbalance in remote sensing segmentation, which jointly optimizes an improved Attention U-Net generator and a class-distribution-aware discriminator, directly addressing the representation bias toward majority classes.
(ii)
We design an effective attention mechanism integrated into the U-Net architecture to enhance feature extraction for sparse and geometrically fine objects typical of remote sensing minority classes.
(iii)
We provide comprehensive experimental analysis on the ISPRS Potsdam and Vaihingen benchmarks, demonstrating significant and consistent improvements for minority class segmentation over multiple strong baselines, and offering practical insights for adversarial training under extreme imbalance.

3. Proposed Methodology

To explicitly counteract the model’s bias toward majority classes, we introduce an adversarial training framework that jointly optimizes a primary segmentation network and a class-distribution-aware discriminator. The overall architecture is illustrated in Figure 2.
Figure 2. A block diagram of the proposed approach.
Given an input remote sensing image x , the segmentation model S produces a per-pixel class probability map S ( x ) ∈ [ 0 , 1 ] H × W × C , where C is the number of classes. In parallel, the discriminator D operates on the global class distribution of S ( x ) , rather than on individual pixels, and outputs a scalar score indicating whether this distribution is balanced. Through a minimax game, the segmentation model is forced to generate class probability maps whose marginal class distribution approaches a balanced prior, thereby significantly enhancing the recognition of minority classes.

3.1. Hierarchical Attention U-Net (HAU-Net)

HAU-Net serves as the primary segmentation model and the generator in the adversarial framework. It extends the standard U-Net with a novel attention mechanism applied hierarchically across multiple scales, specifically designed to amplify the responses of small and sparsely distributed objects that are typical of minority classes in remote sensing images.

3.1.1. Overall Architecture

As illustrated in Figure 3, HAU-Net follows a symmetric encoder–decoder structure with four down-sampling and four up-sampling stages. The encoder comprises repeated blocks of two 3 × 3 convolutions followed by batch normalization and LeakyReLU activation (slope 0.2), and a 2 × 2 max pooling with stride 2. The number of feature channels starts at 64 and doubles after each down-sampling, reaching 1024 at the bottleneck. The decoder mirrors the encoder, using transposed convolutions for up-sampling, concatenation with skip-connected encoder features, and two 3 × 3 convolutions. A final 1 × 1 convolution projects the feature maps to a C-class SoftMax output, yielding the per-pixel class probability map S ( x ) ∈ [ 0 , 1 ] H × W × C .
Figure 3. Hierarchical Attention U-Net architecture.
Critically, a Parallel Hybrid Attention Module (PHAM) is inserted into each skip connection before the concatenation step, and an additional PHAM is placed after the bottleneck to refine the highest-level semantic features. Table 1 summarizes the detailed layer-wise configuration of HAU-Net.
Table 1. Architectural details of HAU-Net. “Skip” indicates the features taken from the corresponding encoder level; PHAM is applied to those skip features before concatenation, and also to the bottleneck features.
The hierarchical placement of PHAM is designed to recalibrate feature representations at multiple semantic levels: shallow skip connections carry precise localization information that is critical for small object boundaries, while the bottleneck carries global context. Applying attention at these points helps the network suppress irrelevant background and reinforce the activations of minority-class objects throughout the decoding pathway.

3.1.2. Parallel Hybrid Attention Module (PHAM)

The core innovation of HAU-Net lies in the PHAM, which processes an input feature map F ∈ R H × W × C through two parallel attention branches—spatial and channel—and fuses the refined maps via element-wise multiplication. Figure 4 illustrates the module structure.
Figure 4. Structure of PHAM.
Spatial Attention Branch: To capture long-range spatial dependencies and highlight informative spatial locations, we design a query-key–value (QKV) self-attention branch. Given the input feature map F ∈ R H × W × C , We first generate a query–key feature by sequentially applying two 3 × 3 convolutional layers and a 1 × 1 convolutional layer, followed by a SoftMax function, to obtain the spatial similarity matrix S ∈ R H W × H W . The value feature V ∈ R H W × C is obtained by a single 1 × 1 convolution. The spatial attention-enhanced feature is then computed as:
A S =   C o n v 1 × 1   ( S V ) , S = S o f t M a x C o n v 1 × 1 C o n v 3 × 3 C o n v 3 × 3 F I ,   V = C o n v 1 × 1 ( F )
Channel Attention Branch: To determine which feature channels are most relevant to the current segmentation task, we compute a channel descriptor through global average pooling (GAP) and global max pooling (GMP). Let z ∈ R C be the channel-wise average of F C . A bottleneck multi-layer perceptron (MLP) with a reduction ratio r generates the channel attention vector:
A C = σ   ( M L P z a v g + M L P ( z m a x )
where M L P z = W 2   R e L U W 1 z + b 1 + b 2 , with W 1 ∈ R C / r × C , W 2 ∈ R C × C / r , and r = 16 in our implementation. The output A C ∈ [ 0 , 1 ] 1 × 1 × C selectively emphasizes channels that are most discriminative for minority classes, which often correspond to subtle spectral signatures.
Fusion: The refined feature map is obtained by broadcasting both attention maps to the same spatial and channel dimensions and multiplying element-wise with the original features:
F ′ = F ⊙ A S ⊙ A C
This dual-path attention allows the network to jointly optimize “where to look” and “which features to trust,” which is effective for the small and sparsely distributed objects from class imbalance.

3.2. Class Distribution Discriminator

The discriminator D is purposefully designed to detect class distribution bias rather than pixel-level authenticity. This makes it directly suited for class imbalance mitigation. Its architecture is a lightweight MLP that maps a C -dimensional distribution vector to a single scalar.
For any segmentation output S ( x ) of spatial size H × W , we compute the per-class average probability via global average pooling:
v S ( x ) = 1 H W ∑ p = 1 H W S 1 ( x ) p , … , 1 H W ∑ p = 1 H W S C ( x ) p
The vector v S ( x ) ∈ [ 0 , 1 ] C sums to 1 and represents the empirical label distribution predicted by the segmentation model for image x . The discriminator D consists of fully connected layers:
Input layer: C neurons.
Hidden layer 1: 128 neurons, followed by LeakyReLU (negative slope 0.2).
Hidden layer 2: 64 neurons, followed by LeakyReLU (negative slope 0.2).
Output layer: 1 neuron with sigmoid activation, producing a scalar D ( v ) ∈ [ 0 , 1 ] .
We define the balanced prior as the uniform distribution u = [ 1 C , 1 C , … , 1 C ] . During the discriminator’s update step, we assign label 1 to u and label 0 to v S ( x ) from the current segmentation model. This forces the discriminator to learn the manifold of balanced distributions and distinguish it from biased ones. The generator (HAU-Net), in turn, tries to produce segmentation maps whose class distribution v S ( x ) is classified as balanced by D, i.e., D ( v S ( x ) ) → 1 . The formulation offers a global and interpretable way to combat class imbalance, with the added cost of less than 0.5% to the total parameters.

3.3. Adversarial Training Procedure

The training of HAU-Net and the distribution discriminator follow a minimax formulation with alternating optimization. We present the loss functions, then the full training algorithm.

3.3.1. Weighted Cross-Entropy Loss

To ensure pixel-level accuracy while mitigating the dominance of majority classes, we use a weighted cross-entropy (WCE) loss. The weight for each class i is set to w i = ( n i 0.5 ) − 1 , where n i is the total number of pixels of class i in the training set. This square-root compression prevents the weights for extremely rare classes from becoming excessively large, which could cause gradient instability. For a given pixel with one-hot ground truth y i and prediction S i ( x ) , the WCE loss is:
L w c e = − 1 N ∑ p = 1 N ∑ i = 1 C w i · y i ( p ) · log ( S i ( x ) p )
where N = H × W is the total number of pixels per image.

3.3.2. Adversarial Loss

For the discriminator, we employ the standard binary cross-entropy loss to distinguish balanced prior samples from biased predictions:
L D = − E x log D u + log ( 1 − D ( v S ( x ) )
The generator (segmentation model) aims to fool the discriminator, i.e., to maximize the probability that its predicted distribution is classified as balanced:
L a d v = − E x log D v S ( x )
Note that we optimize D using the uniform prior u as the only positive example, rather than using the ground-truth label distribution, because the ground-truth distribution in remote sensing images is itself heavily imbalanced. Using the ground truth as the target would encourage the model to replicate the imbalance rather than correct it.

3.3.3. Full Training Process

The overall objective for HAU-Net is a weighted sum of the segmentation loss and the adversarial loss:
min S L t o t a l = L w c e S + λ L a d v ( S , D )
where λ balances the two terms. We empirically set λ = 0.1 to ensure that pixel accuracy remains the primary objective while the adversarial term provides a meaningful regularization effect. The discriminator is optimized by: max D L ( D ) .
The training is performed via alternating gradient descent. In each iteration, we first update the discriminator D for k D steps, and then update the generator S for one step. We use the Adam optimizer with β 1 = 0.9 , β 2 = 0.999 and a learning rate of 1 × 10 − 4 for both models. Batch size is set to 8, and training proceeds for 200 epochs with a learning rate decay factor of 0.1 at epochs 100 and 150. The complete training procedure is formalized in Algorithm 1.
Algorithm 1. Adversarial Training Procedure
1
Initialize   parameters   of   S (HAU-Net) and D (MLP) with random weights.
2
For   each   training   iteration   do :
3
Sample   a   mini - batch   of   remote   sensing   images   { x 1 , … , x m } with ground truth { y 1 , … , y m }
4
Forward   pass :   compute   S ( x i ) and the distribution vectors v S ( x ) .
5
Generate   balanced   prior   samples   u 1 , … , u m .
6
Update   discriminator   D by maximizing 1 m ∑ j = 1 m [ l o g D ( u j ) + l o g ( 1 − D ( v S ( x j ) ) ] .
7
Compute   L w c e and L a d v for the current batch.
8
Update   generator   S by minimizing 1 m ∑ j = 1 m [ L w c e S x j , y j + λ ( − l o g D ( v S ( x j ) ) ]
9
End   for

4. Experimental Results and Analysis

4.1. Dataset

We evaluate our framework on two widely used sub-datasets of the ISPRS 2D Semantic Labeling benchmark (International Society for Photogrammetry and Remote Sensing (ISPRS), Hannover, Germany) [25]: Potsdam and Vaihingen. Both provide high-resolution aerial imagery with pixel-level land cover annotations across six common categories: impervious surfaces, buildings, low vegetation, trees, vehicles, and clutter/background. The clutter/background class aggregates diverse objects such as water bodies, containers, tennis courts, and swimming pools. The distribution of these six classes is highly imbalanced, as illustrated in Figure 1, with vehicles and clutter/background occupying extremely small pixel proportions.
The Potsdam dataset consists of 38 ortho-rectified RGB images, each of size 6000 × 6000 pixels with a ground sampling distance of 5 cm. The Vaihingen dataset includes 33 images of mixed rural–urban scenes, provided as near-infrared, red, and green bands (IRRG). Because the official ISPRS test labels are not publicly available, we randomly split the official training set into training and validation subsets at a fixed 7:3 ratio. To match the input size of our model, we performed batch cropping on both original images and ground-truth masks to generate non-overlapping 256 × 256 patches. This process yields roughly 20,102 patches from the Potsdam dataset and 1617 patches from the Vaihingen dataset, amounting to a total of 21,719 patches.

4.2. Experimental Setup

All models were implemented using PyTorch 1.11 and Python 3.10, and trained on a single NVIDIA RTX 4090 GPU (24 GB). The system ran on Ubuntu 20.04 LTS with an Intel Xeon W-2255 CPU. Training was performed for 200 epochs with a batch size of 8. We employed the Adam optimizer with β 1 = 0.9 , β 2 = 0.999 , and an initial learning rate of 1 × 10 − 4 , which is decayed by a factor of 0.1 at epochs 100 and 150. A weight decay of 1 × 10 − 4 was applied as L2 regularization to mitigate overfitting. The learning rate schedule was further smoothed using a cosine annealing warm-up during the first 10 epochs.
To improve model generalization, we applied online data augmentation including random horizontal and vertical flipping, random rotation (±30°), random scaling (0.8–1.2×), and photometric jitter (brightness adjustment within ± 15 % , contrast adjustment factor 0.8–1.5). All augmentation operations were applied consistently to both the images and the corresponding labels.
The training progress was monitored via the total loss L t o t a l = L c e + λ L a d v on the training and validation sets. As shown in Figure 5, the loss decreased rapidly during the initial 40 epochs and reached a stable dynamic equilibrium after approximately 80 epochs, with no significant divergence between training and validation curves, indicating that the model did not overfit. The convergence of the loss correlated well with the improvement in test-set mIoU, confirming the stability and effectiveness of the adversarial training process. The key experimental configurations are summarized in Table 2.
Figure 5. Loss function curve.
Table 2. Summary of experimental configurations.
Evaluation Metrics: We evaluate segmentation quality using four complementary metrics. The standard mean Intersection over Union (mIoU) is defined as the arithmetic mean of the per-class IoU values:
mIoU = 1 C ∑ i = 1 C IoU i
where C is the number of classes. To additionally reflect overall pixel-level accuracy, we report the Frequency Weighted IoU (FWIoU):
FWIoU = 1 ∑ i = 1 C n i ∑ i = 1 C n i ⋅ IoU i
where n i denotes the total number of pixels of class i in the evaluation set. FWIoU weights each class by its pixel frequency and therefore emphasizes majority classes, whereas mIoU treats all classes equally and is more sensitive to minority-class performance.
We also report the mean Pixel Accuracy (mPA), defined as the arithmetic mean of per-class pixel accuracies:
mPA = 1 C ∑ i = 1 C TP i n i
where TP i is the number of correctly classified pixels of class i . In addition, the Kappa coefficient is used to measure the agreement between the predicted segmentation and the ground truth, corrected for chance agreement:
κ = p o − p e 1 − p e
where p o is the overall pixel accuracy and p e is the expected agreement by chance, computed from the confusion matrix.
All metrics are computed on the stitched full-resolution test predictions, and classes absent from a given image or patch are excluded from the IoU and pixel accuracy calculations for that image to avoid undefined values.
The convergence curves of the loss function on the training and validation sets are shown in Figure 5.

4.3. Comparative Experiments

We conduct a comprehensive comparison of our method against a representative set of baseline models. The baselines are organized into four categories: (i) CNN-based segmentation architectures (U-Net [17], PSPNet [26], DeepLabV3+ [21], ACNet [27], HRNet + OCR [28]); (ii) Transformer-based and hybrid architectures (SegFormer-B4 [29], Segmenter [30], SwinUperNet [31], UNetFormer [32]); (iii) lightweight networks (BiSeNetV2-L [33], DABNet [34]). The backbone network configurations of these models are tabulated in Table 3. All models were trained with identical data augmentation and for the same number of epochs to ensure a fair comparison.
Table 3. Models’ backbone configurations in comparison experiments.

4.3.1. Quantitative Results

Table 4 reports the global performance metrics. Bold values indicate the best performance for each metric, and the same applies to subsequent tables.
Table 4. Comparative experimental results on the ISPRS dataset.
From the perspective of class-fair evaluation, our method achieves the highest standard mIoU of 73.82%, outperforming all baselines including the strong HRNet + OCR (70.54%) and UNetFormer (71.93%). In terms of Frequency Weighted IoU (FWIoU), which weights classes by pixel frequency and thus favors majority classes, HRNet + OCR attains the best value (79.90%), with our method ranking a very close second (79.57%). This small gap in FWIoU is expected because our adversarial objective intentionally shifts model capacity from over-represented to under-represented classes. Moreover, our method achieves the highest mean Pixel Accuracy (89.04%), indicating superior per-class average recall and confirming that the model does not sacrifice minority-class sensitivity for overall pixel-level accuracy.
The advantage of our method becomes particularly evident when examining the severely imbalanced minority classes. For vehicles, our method achieves 73.04% IoU, surpassing HRNet + OCR by +5.51% (67.53%); for clutter/background, our method reaches 48.16% IoU, outperforming HRNet + OCR by +15.09% (33.07%). These substantial gains directly validate that the proposed adversarial training framework effectively suppresses majority-class bias and greatly enhances the recognition of rare classes. In contrast, on certain majority classes such as impervious surfaces, our method shows a slight decrease compared to the best individual models (e.g., 83.78% vs. 87.23% for HRNet + OCR). This is an expected trade-off: the adversarial loss explicitly penalizes over-confidence on dominant classes, reallocating predictive capacity to minority categories without causing catastrophic degradation on any single class. The competitive mPA (89.04%) and Kappa (65.88%) further support that our method provides a better overall class-wise balance than competing approaches.
To examine whether adversarial training over-equalizes the class distribution or inflates minority-class IoU through excessive false positives, we report the statistics of the predicted class distributions on the test set. The full model yields a mean entropy of 1.42 and a mean KL divergence of 0.63 to the uniform prior, compared with 1.21 and 0.81 for the WCE-only baseline. These values indicate a more balanced yet non-degenerate distribution. For the vehicle class, precision and recall are 82.0% and 87.0% for the full model, versus 80.0% and 71.9% for the WCE-only baseline, confirming that the IoU gains arise primarily from improved recall rather than excessive false positives.

4.3.2. Qualitative Visualization

Figure 6 and Figure 7 present qualitative segmentation results of our method on the Vaihingen and Potsdam datasets, respectively. In each figure, we show the original image, the ground-truth label mask, and our predicted segmentation map.
Figure 6. Visualization of semantic segmentation on the ISPRS Vaihingen dataset.
Figure 7. Visualization of semantic segmentation on the ISPRS Potsdam dataset.
On the Vaihingen dataset (Figure 6), our model accurately delineates the boundaries of buildings and low vegetation. More crucially, it successfully identifies small vehicles scattered in the images, which are often missed by standard models. The tree category also benefits from fine boundary preservation, with minimal confusion with low vegetation.
On the Potsdam dataset (Figure 7), our model produces a clean segmentation of impervious surfaces and buildings. While occasional misclassifications appear in the clutter/background class—particularly around complex structures such as containers and water edges—the overall segmentation remains robust. These residual errors highlight the inherent difficulty of recognizing extremely rare and texture-variant categories, and they point to directions for future improvement, such as incorporating edge-aware constraints.

4.3.3. Comparison of Visual Results

Figure 8 compares the segmentation maps produced by our method and several strong baselines on representative challenging patches. To facilitate detailed comparison, we highlight critical regions with black dashed boxes.
Figure 8. Visualization of the comparison experiments.
In the dashed-box region, HRNet + OCR exhibits noticeable omissions of buildings (blue); Our method, in contrast, recovers these buildings with significantly better completeness and boundary fidelity. And also, most baseline algorithms suffer from substantial misclassification of the clutter/background class (red). Typical failure modes include false positives, where background clutter is erroneously labeled as other land-cover categories, and false negatives, where true clutter areas are incorrectly assigned to surrounding classes. Our method markedly reduces both types of errors, producing a cleaner and more coherent segmentation of the clutter/background regions.
These qualitative gains directly reflect the capacity of the hierarchical attention and adversarial training to strengthen the recognition of minority classes under severe imbalance.

4.4. Ablation Study

We conduct a series of ablation experiments to isolate and quantify the contribution of each key component in our framework. All ablation models in Section 4.4.1 and Section 4.4.2 are trained without the adversarial discriminator, using only the weighted cross-entropy loss, so that the improvements attributable to the architecture design and the adversarial training can be assessed independently.

4.4.1. Backbone Network Ablation

To demonstrate the effectiveness of our proposed Hierarchical Attention U-Net (HAU-Net) as the segmentation backbone, we compare it against several widely used architectures, including the standard U-Net [17], HRNet-w48 [35], Vision Transformer (ViT) [36], and Swin-Tiny [37]. All backbones are trained under identical settings without adversarial training. The results are shown in Table 5.
Table 5. Ablation study on backbone networks.
Under the WCE-only setting, Swin-Tiny achieves the highest mIoU, mPA, and Kappa among the compared backbones, benefiting from its strong global context modeling. Our HAU-Net obtains competitive results—77.44% FWIoU and 82.55% mPA—while requiring only 38.2 M parameters, which is significantly fewer than Swin-Tiny’s 60.8 M and ViT’s 91.2 M. Although HAU-Net’s FLOPs (189.6 G) are higher than Swin-Tiny’s (108.2 G), this is a consequence of the parallel spatial–channel attention design, which is intended to amplify minority-class features rather than maximize computational efficiency.
More importantly, when HAU-Net is integrated into the full adversarial framework, it achieves 79.57% FWIoU and 89.04% mPA, surpassing Swin-Tiny by +0.33% and +0.08%, respectively. This demonstrates that the performance gain of the proposed framework comes primarily from the adversarial training, rather than from the backbone architecture alone.

4.4.2. PHAM Ablation

We next evaluate the efficacy of the Parallel Hybrid Attention Module (PHAM) by replacing it with several established attention mechanisms while keeping the U-Net backbone and all other settings fixed. The compared variants are:
Model A: Standard U-Net without any attention.
Model B: Channel attention SE [38] inserted into skip connections.
Model C: Spatial attention STN [39] inserted into skip connections.
Model D: Joint attention CBAM [40] inserted into skip connections.
Model E: Dual-stream attention DANet [41] inserted into skip connections.
Model F: PHAM inserted into both low-level and high-level feature maps.
Table 6 reports the global metrics and per-class IoU for all variants.
Table 6. Ablation study on attention mechanisms.
Among the attention variants under the WCE-only setting, our PHAM (Model F) achieves the highest standard mIoU (67.23%), outperforming DANet by +1.30% and CBAM by +2.36%. Its FWIoU (77.44%) is also the best among the compared attention modules, surpassing DANet by +0.09% and CBAM by +0.74%. Although its mPA (82.55%) is lower than DANet’s 86.11% and CBAM’s 85.48%, and its Kappa (62.27%) is slightly below the best values, we emphasize that the primary objective of PHAM is not to maximize aggregate pixel accuracy, but to amplify the feature responses of sparse and small objects that are most severely affected by class imbalance. To verify this, we refer to the per-class results reported later in Table 7, where Model I corresponds exactly to Model F in Table 6. Compared with the standard U-Net baseline (Model A in Table 7), PHAM improves the IoU of vehicles from 26.14% to 60.93% and the IoU of clutter/background from 18.54% to 28.90%, confirming its effectiveness in enhancing minority-class features.
Table 7. Ablation study on adversarial training.
Regarding computational cost, PHAM incurs a higher FLOP count (189.6 G) than other attention modules due to its parallel spatial and channel branches. Nevertheless, its parameter count (38.2 M) remains lower than that of DANet (45.2 M), indicating acceptable complexity given the substantial gains on challenging minority categories.

4.4.3. Effectiveness of Adversarial Training

To isolate the contribution of adversarial training, we fix HAU-Net with PHAM as the backbone and compare two training configurations:
Model I: HAU-Net trained with weighted cross-entropy loss L w c e only (no adversarial training).
Model II: HAU-Net trained with the full objective L w c e + λ L a d v   ( λ = 0.1 , adversarial training enabled).
The experimental results are shown in Table 7.
With adversarial training enabled, Model II achieves substantial improvements over Model I in both standard mIoU and FWIoU. Specifically, the standard mIoU increases from 67.23% to 73.82% (+6.59 percentage points), while FWIoU improves from 77.44% to 79.57% (+2.13 percentage points). The gains are disproportionately concentrated on the minority classes: vehicles improve by +12.11% (from 60.93% to 73.04%) and clutter/background by +19.26% (from 28.90% to 48.16%). Concurrently, majority classes such as impervious surfaces exhibit only a marginal decrease (−1.39%, from 85.17% to 83.78%), while buildings improve by +1.99% (from 83.52% to 85.51%), confirming that the adversarial loss effectively reallocates model capacity from over-represented to under-represented categories without catastrophic forgetting of dominant classes. These results provide direct evidence that the proposed adversarial training framework succeeds in its core objective—mitigating class imbalance at the representation level.
To further verify the advantage of the learnable critic over a fixed analytical penalty, we trained a non-adversarial variant in which the adversarial loss was replaced by a direct KL-divergence penalty between the predicted class distribution and the uniform prior, using the same λ = 0.1 . This variant achieved a vehicle IoU of 71.62% and a clutter/background IoU of 45.83%, compared with 73.04% and 48.16% for the adversarial model, confirming the benefit of the learnable critic.

4.4.4. Sensitivity Analysis of the Balance Coefficient λ

The hyper-parameter λ controls the strength of the adversarial regularization relative to the primary segmentation loss. To assess its influence, we train Model II with varying λ values sampled from the set 0.0 ,   0.01 ,   0.05 ,   0.1 ,   0.3 ,   0.5 ,   0.8 ,   1.0 , where λ = 0.0 corresponds to Model I. Figure 9 plots the resulting mIoU as a function of λ .
Figure 9. Impact of the balance coefficient λ on mIoU. Evaluated λ values are {0.0, 0.01, 0.05, 0.1, 0.3, 0.5, 0.8, 1.0}; the best performance is achieved at λ = 0.1.
As λ increases from 0 to 0.1, the mIoU improves from 77.44% to a peak of 79.57%, demonstrating that a moderate adversarial penalty effectively regularizes the model toward balanced predictions. When λ exceeds 0.1, the mIoU begins to decline, falling to 74.31% at λ = 0.5 and dropping sharply to 64.52% at λ = 1.0 . This inverted-U pattern is expected: an excessively large λ forces the model to overly homogenize class distributions at the expense of pixel-level accuracy, leading to degraded overall performance. Based on this analysis, we set λ = 0.1 for all experiments reported in this paper.

5. Conclusions

In this paper, we addressed the critical yet under-explored problem of class imbalance in semantic segmentation of remote sensing imagery. Motivated by the observation that standard CNN training systematically neglects minority classes under extreme pixel distribution skew, we proposed a novel adversarial training framework that couples a Hierarchical Attention U-Net (HAU-Net) generator with a class-distribution-aware discriminator. The discriminator is specifically designed to detect global deviations from a balanced prior, thereby forcing the segmentation model to learn features that are equally expressive for rare and dominant categories.
Extensive experiments on the ISPRS Potsdam and Vaihingen benchmarks demonstrate the effectiveness of our approach. Our method achieves the highest standard mIoU of 73.82% and an FWIoU of 79.57%, along with an mPA of 89.04%, ranking among the top-performing models on this benchmark. On the severely under-represented minority classes, our method improves vehicle IoU by +5.51% (73.04% vs. 67.53%) and clutter/background IoU by +15.09% (48.16% vs. 33.07%) relative to the strongest external baseline (HRNet + OCR).
We note a limitation that is inherent to our design: the adversarial objective explicitly penalizes over-confidence on majority classes, which may result in a marginal accuracy decline on certain dominant categories. We view this not as a failure, but as an expected and desirable trade-off: the model sacrifices a small amount of accuracy on already well-segmented classes to achieve large gains on critically under-segmented ones. The high mPA and Kappa scores confirm that the overall class-wise balance is substantially improved.
Several promising directions emerge from this work. First, the current discriminator operates on a per-image global distribution; extending it to model spatial priors could further refine the balance between local accuracy and global fairness. Second, the fixed uniform prior could be replaced with a learned or task-specific target distribution that reflects realistic planning constraints. Third, the proposed adversarial framework is architecture-agnostic and could be integrated with emerging foundation models to enable class-balanced fine-tuning on large-scale remote sensing benchmarks.

Author Contributions

Y.Y. contributed to conceptualization, methodology, investigation, validation, and wrote the original draft. C.W. performed data curation, formal analysis, investigation, and provided resources. R.K. performed data curation, contributed to methodology, contributed to validation, created visualization, and contributed to writing—review and editing. Q.F. obtained funding, conducted investigation, and handled project administration. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Project of Qiongtai Normal University under Grant No. 620620052, entitled “Research on Low Latency Fault Recovery and Elastic Scaling Methods for General Purpose NFV”.

Data Availability Statement

The datasets used and analyzed during the current study are available in the open-access repository of ISPRS Data Lab, accessible at: https://www.isprs.org/resources/datasets/Default.aspx, accessed on 20 July 2026.

Acknowledgments

The authors thank the members of the research group for their assistance in data preprocessing and programming guidance.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Feng, S.; Hou, F.; Chen, J.; Wang, W. Extracting roads from satellite images via enhancing road feature investigation in learning. Comput. Animat. Virtual Worlds 2024, 35, e2275. [Google Scholar] [CrossRef] [Scilit]
  2. Sun, X.; Weng, X.; Pang, C.; Xia, G.-S. Mitigating representation bias for class-incremental semantic segmentation of remote sensing images. Sci. China Inf. Sci. 2025, 68, 182301. [Google Scholar] [CrossRef] [Scilit]
  3. Hida, G.S.; Alves Do Nascimento, A.C. Overview of machine learning in class imbalance scenarios: Trends, challenges, and approaches. Expert Syst. Appl. 2026, 298, 129592. [Google Scholar] [CrossRef] [Scilit]
  4. Lin, X.; Sun, S.; Huang, W.; Sheng, B.; Li, P.; Feng, D.D. EAPT: Efficient Attention Pyramid Transformer for Image Processing. IEEE Trans. Multimed. 2023, 25, 50–61. [Google Scholar] [CrossRef] [Scilit]
  5. Khorshidi, H.A.; Aickelin, U. A synthetic over-sampling method with minority and majority classes for imbalance problems. Knowl. Inf. Syst. 2025, 67, 5965–5998. [Google Scholar] [CrossRef] [Scilit]
  6. Wang, F.; Wang, H.; Wei, C.; Yuille, A.; Shen, W. CP2: Copy-Paste Contrastive Pretraining for Semantic Segmentation. In Proceedings of the European Conference on Computer Vision (ECCV); Springer: Cham, Switzerland, 2022; Volume 13690. [Google Scholar] [CrossRef] [Scilit]
  7. Lin, T.-Y.; Goyal, P.; Girshick, R.; He, K.; Dollár, P. Focal Loss for Dense Object Detection. In Proceedings of the 2017 IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 22–29 October 2017; pp. 2999–3007. [Google Scholar] [CrossRef] [Scilit]
  8. Cui, Y.; Jia, M.; Lin, T.-Y.; Song, Y.; Belongie, S. Class-Balanced Loss Based on Effective Number of Samples. In Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Long Beach, CA, USA, 15–20 June 2019; pp. 9260–9269. [Google Scholar] [CrossRef] [Scilit]
  9. Zhang, W.; Chen, Y.; Long, Z.; Chen, H.; Zhang, Y.; Zhou, Z.; Chen, W.; Le, X. Focal Difficult-to-Predict Pixels Dice Loss for Mitigating Data Imbalance in Medical Image Segmentation. Expert Syst. Appl. 2025, 290, 128518. [Google Scholar] [CrossRef] [Scilit]
  10. Sun, S.; Lu, H.; Li, J.; Xie, Y.; Li, T.; Yang, X.; Zhang, L.; Yan, J. Rethinking Classifier Re-Training in Long-Tailed Recognition: Label Over-Smooth Can Balance. In Proceedings of the International Conference on Learning Representations (ICLR) 2025, Singapore, 24–28 April 2025; pp. 26681–26697. [Google Scholar] [CrossRef] [Scilit]
  11. Xiong, H.; Man, D.; Lv, J.; Xu, C.; Zeng, F.; Shi, Y.; Lai, M.; Yang, W. Decoupling Representation Learning and Classifier for Long-Tailed Adversarial Training. Pattern Recognit. 2026, 172, 112607. [Google Scholar] [CrossRef] [Scilit]
  12. Luc, P.; Couprie, C.; Chintala, S.; Verbeek, J. Semantic Segmentation using Adversarial Networks. In Proceedings of the NIPS Workshop on Adversarial Training, Barcelona, Spain, 9–10 December 2016. [Google Scholar] [CrossRef] [Scilit]
  13. Hung, W.-C.; Tsai, Y.-H.; Liou, Y.-T.; Lin, Y.-Y.; Yang, M.-H. Adversarial Learning for Semi-Supervised Semantic Segmentation. In Proceedings of the 29th British Machine Vision Conference (BMVC’29); BMVA Press: Newcastle, UK, 2018. [Google Scholar] [CrossRef] [Scilit]
  14. Rezaei, M.; Yang, H.; Meinel, C. Recurrent generative adversarial network for learning imbalanced medical image semantic segmentation. Multimed. Tools Appl. 2020, 79, 15329–15348. [Google Scholar] [CrossRef] [Scilit]
  15. Bissoto, A.; Valle, E.; Avila, S. Debiasing Skin Lesion Datasets and Models? Not So Fast. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPR), Seattle, WA, USA, 14–19 June 2020; pp. 740–741. [Google Scholar] [CrossRef] [Scilit]
  16. Chen, X.; Duan, Y.; Houthooft, R.; Schulman, J.; Sutskever, I.; Abbeel, P. InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets. In Proceedings of the 30th International Conference on Neural Information Processing Systems (NIPS’16), Barcelona, Spain, 5–10 December 2016; pp. 2180–2188. [Google Scholar] [CrossRef] [Scilit]
  17. Ronneberger, O.; Fischer, P.; Brox, T. U-Net: Convolutional Networks for Biomedical Image Segmentation. In Proceedings of the Medical Image Computing and Computer-Assisted Intervention (MICCAI) 2015; Springer: Cham, Switzerland, 2015; Volume 9351, pp. 234–241. [Google Scholar] [CrossRef] [Scilit]
  18. Oktay, O.; Schlemper, J.; Folgoc, L.L.; Lee, M.; Heinrich, M.; Misawa, K.; Mori, K.; McDonagh, S.; Hammerla, N.Y.; Kainz, B.; et al. Attention U-Net: Learning Where to Look for the Pancreas. arXiv 2018, arXiv:1804.03999. [Google Scholar] [CrossRef] [Scilit]
  19. Dimitrovski, I.; Spasev, V.; Loshkovska, S.; Kitanovski, I. U-Net Ensemble for Enhanced Semantic Segmentation in Remote Sensing Imagery. Remote Sens. 2024, 16, 2077. [Google Scholar] [CrossRef] [Scilit]
  20. Chen, L.-C.; Papandreou, G.; Kokkinos, I.; Murphy, K.; Yuille, A.L. DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs. IEEE Trans. Pattern Anal. Mach. Intell. 2018, 40, 834–848. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  21. Chen, L.-C.; Zhu, Y.; Papandreou, G.; Schroff, F.; Adam, H. Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. In Proceedings of the European Conference on Computer Vision, (ECCV) LNCS 11211; Springer: Cham, Switzerland, 2018; pp. 833–851. [Google Scholar] [CrossRef] [Scilit]
  22. Chen, L.-C.; Yang, Y.; Wang, J.; Xu, W.; Yuille, A.L. Attention to Scale: Scale-Aware Semantic Image Segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 3640–3649. [Google Scholar] [CrossRef] [Scilit]
  23. Liu, Z.; Lin, Y.; Cao, Y.; Hu, H.; Wei, Y.; Zhang, Z.; Lin, S.; Guo, B. Swin Transformer: Hierarchical Vision Transformer using Shifted Windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Montreal, QC, Canada, 10–17 October 2021; pp. 9992–10002. [Google Scholar] [CrossRef] [Scilit]
  24. Kirillov, A.; Mintun, E.; Ravi, N.; Mao, H.; Rolland, C.; Gustafson, L.; Xiao, T.; Whitehead, S.; Berg, A.C.; Lo, W.-Y.; et al. Segment Anything. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2–6 October 2023; pp. 3992–4003. [Google Scholar] [CrossRef] [Scilit]
  25. International Society for Photogrammetry and Remote Sensing (ISPRS). The ISPRS Data Set Collection. International Society for Photogrammetry and Remote Sensing. Available online: https://www.isprs.org/resources/datasets/Default.aspx (accessed on 28 June 2025).
  26. Zhao, H.; Shi, J.; Qi, X.; Wang, X.; Jia, J. Pyramid Scene Parsing Network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; pp. 6230–6239. [Google Scholar] [CrossRef] [Scilit]
  27. Ding, X.; Guo, Y.; Ding, G.; Han, J. ACNet: Strengthening the Kernel Skeletons for Powerful CNN via Asymmetric Convolution Blocks. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Seoul, Republic of Korea, 27 October–2 November 2019; pp. 1911–1920. [Google Scholar] [CrossRef] [Scilit]
  28. Yuan, Y.; Chen, X.; Wang, J. Object-Contextual Representations for Semantic Segmentation. In Proceedings of the European Conference on Computer Vision (ECCV) 2020; Springer: Cham, Switzerland, 2020; Volume 12346, pp. 173–190. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  29. Xie, E.; Wang, W.; Yu, Z.; Anandkumar, A.; Alvarez, J.M.; Luo, P. SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers. In Proceedings of the 35th International Conference on Neural Information Processing Systems (NIPS’21) 2021, Online, 6–14 December 2021; pp. 12077–12090. [Google Scholar] [CrossRef] [Scilit]
  30. Strudel, R.; Garcia, R.; Laptev, I.; Schmid, C. Segmenter: Transformer for Semantic Segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), IEEE Computer Society, Montreal, QC, Canada, 10–17 October 2021; pp. 7242–7252. [Google Scholar] [CrossRef] [Scilit]
  31. Wang, Z.; Li, J.; Tan, Z.; Liu, X.; Li, M. Swin-UperNet: A Semantic Segmentation Model for Mangroves and Spartina alterniflora Loisel based on UperNet. Electronics 2023, 12, 1111. [Google Scholar] [CrossRef] [Scilit]
  32. Wang, L.; Li, R.; Zhang, C.; Fang, S.; Duan, C.; Meng, X.; Atkinson, P.M. UNetFormer: A UNet-like Transformer for Efficient Semantic Segmentation of Remote Sensing Urban Scene Imagery. ISPRS J. Photogramm. Remote Sens. 2022, 190, 196–214. [Google Scholar] [CrossRef] [Scilit]
  33. Yu, C.; Wang, J.; Peng, C.; Yu, G.; Gao, C.; Sang, N. BiSeNet: Bilateral Segmentation Network for Real-Time Semantic Segmentation. In Proceedings of the European Conference on Computer Vision (ECCV) 2018; Springer: Cham, Switzerland, 2018; Volume 11217, pp. 334–349. [Google Scholar] [CrossRef] [Scilit]
  34. Li, G.; Jiang, S.; Yun, I.; Kim, J.; Kim, J. Depth-wise Asymmetric Bottleneck with Point-wise Aggregation Decoder for Real-Time Semantic Segmentation in Urban Scenes. IEEE Access 2020, 8, 27495–27506. [Google Scholar] [CrossRef] [Scilit]
  35. Wang, J.; Sun, K.; Cheng, T.; Jiang, B.; Deng, C.; Zhao, Y.; Liu, D.; Mu, Y.; Tan, M.; Wang, X.; et al. Deep High-Resolution Representation Learning for Visual Recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2021, 43, 3349–3364. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  36. Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S.; et al. An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale. In Proceedings of the International Conference on Learning Representations (ICLR), Virtual, 3–7 May 2021. [Google Scholar] [CrossRef] [Scilit]
  37. Sun, X.; Wang, P.; Lu, W.; Zhu, Z.; Lu, X.; He, Q.; Li, J.; Rong, X.; Yang, Z.; Chang, H.; et al. RingMo: A Remote Sensing Foundation Model with Masked Image Modeling. IEEE Trans. Geosci. Remote Sens. 2023, 61, 5612822. [Google Scholar] [CrossRef] [Scilit]
  38. Hu, J.; Shen, L.; Sun, G. Squeeze-and-Excitation Networks. In Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar] [CrossRef] [Scilit]
  39. Jaderberg, M.; Simonyan, K.; Zisserman, A.; Kavukcuoglu, K. Spatial Transformer Networks. In Advances in Neural Information Processing Systems (NeurIPS); Curran Associates: New York, NY, USA, 2015; Volume 28. [Google Scholar] [CrossRef] [Scilit]
  40. Woo, S.; Park, J.; Lee, J.-Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Proceedings of the European Conference on Computer Vision (ECCV); Springer: Cham, Switzerland, 2018; pp. 3–19. [Google Scholar] [CrossRef] [Scilit]
  41. Fu, J.; Liu, J.; Tian, H.; Li, Y.; Bao, Y.; Fang, Z. Dual Attention Network for Scene Segmentation. In Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Long Beach, CA, USA, 15–20 June 2019; pp. 3141–3149. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.