Some segmentation networks decide, pixel by pixel, how much to trust each of several "views" of the image. A view might be a small convolution kernel that sees fine detail or a large one that sees wide context. This decision is called pixel-wise scale attention: a small gating network outputs, at every pixel, a set of weights over the views. The gate learns from the same loss as the rest of the network. In abdominal CT that loss is dominated by background and large organs, because structures like the adrenal glands and esophagus occupy under 0.15% of voxels (Gradient-Aware for Class-Imbalanced Semi-supervised Medical Image Segmentation). The gate is shared across all classes, so it mostly learns what scale suits liver and background. Tiny organs are exactly where getting the scale right matters most.
We propose to train the gate on a class-balanced objective in which every organ class has an equal say in how the gate's weights change. The features and the classifier keep the standard loss, or a strong imbalance-aware loss. Put in two sentences: rebalancing the whole network tends to make it over-predict rare organs, but rebalancing only the routing decision could give rare-organ pixels the right receptive field without distorting what the network predicts elsewhere. We test this claim directly, and we also measure, for the first time, whether scale gates actually route tail-class pixels worse than head-class pixels.
Core Claim
Existing scale-attention methods learn routing weights from visual salience alone, under a loss in which rare classes contribute almost nothing. These include multi-scale input fusion (Attention to Scale), nested context and detail crops (HRDA), banks of kernels of different sizes (PARF-Net) and gates built from attention maps (Transformer Scale Gate). Our hypothesis has two parts. First, this coupling makes the gate's choices on tail-class pixels measurably worse than its choices on head-class pixels. Second, giving the gate its own class-balanced gradient, while the feature pathway trains normally, improves tail-organ Dice. It should do so without the rise in false positives that comes from reweighting the whole network.
The closest work does not test this. SvANet carries high-resolution features into deeper layers for very small objects, but it treats the foreground as a single class and never connects its attention to class frequency. PARF-Net evaluates on Synapse but treats imbalance purely as a receptive-field problem. The imbalance methods work on the other side of the divide. Gradient-Aware loss reformulates Dice and cross-entropy so that organs missing from a training patch still produce useful gradients. SKCDF adds a balanced auxiliary output head. Both apply their fixes to fixed-receptive-field backbones, and both apply them to the whole network rather than to a specific decision inside it.
Research Program
The base network is a U-shaped segmenter whose gates follow the Conv-PARF design: parallel 3×3, 7×7 and 11×11 kernels with a per-pixel softmax gate. Unlike PARF-Net, which places these only in the first two encoder stages, we put them in every encoder and decoder stage. Let $g_\phi(x)$ be the gate weights with parameters $\phi$, and let $\theta$ be all other parameters. Training uses two losses on the same forward pass, and each loss sees the other's parameters as frozen.
The first loss trains the features and classifier with the gate weights detached. This is $\mathcal{L}_{\text{main}}(\theta)$, the Gradient-Aware GADice+GACE loss, or plain Dice plus cross-entropy in the controls.
The second loss trains only the gate, with the features detached:
$$\mathcal{L}_{\text{gate}}(\phi) = \frac{1}{|C_{\text{present}}|}\sum_{c \in C_{\text{present}}} \frac{1}{|P_c|}\sum_{p \in P_c} -\log \hat{y}_{p,c} \;+\; \lambda\,\mathcal{L}_{\text{GADice}}^{\text{absent}}.$$
Here $C_{\text{present}}$ is the set of classes present in the patch, $P_c$ is the set of pixels labelled $c$, and $\hat{y}_{p,c}$ is the fused prediction for class $c$ at pixel $p$. The first term averages within each class and then across classes, so a 40-voxel adrenal gland pulls on the gate as hard as the liver does. The term $\mathcal{L}_{\text{GADice}}^{\text{absent}}$ borrows Gradient-Aware's probability-aware gradient for organs absent from the patch, which teaches the gate not to hallucinate routes for them. $\lambda$ weights this term.
Following Attention to Scale's finding that each scale branch needs its own supervision to stay discriminative, every kernel branch also receives a class-balanced auxiliary loss.
The analysis contribution is a diagnostic for routing quality, which we call gate–oracle agreement. For each pixel we find the branch whose prediction, used alone, is most confident in the correct label. We then report how much gate weight falls on that branch, separately for each organ class. This tells us whether tail-class routing is actually worse, before and after the intervention. Without it, any Dice gain would be uninterpretable.
Baselines
The naive reference point is a plain U-Net trained with Dice plus cross-entropy. The strongest receptive-field competitor is PARF-Net itself, which reports 84.27% mean Dice and 72.86% pancreas Dice on 8-class fully supervised Synapse (PARF-Net). We re-implement it in our pipeline with the same gate placement, augmentation and iteration budget. The strongest loss-level competitor is our gated network trained jointly with Gradient-Aware loss and no decoupling. This tests whether a good imbalance loss on a scale-adaptive network already gives the gate enough signal.
For the semi-supervised setting we report the published numbers next to our re-runs. On Synapse, Gradient-Aware raised CPS from 48.49% to 66.39% DSC, and tail classes went from 0% to between 27% and 51%. SKCDF reports 64.27% average Dice on 13-class Synapse with 20% labels and 53.81% on AMOS with 5% labels. We embed our gate training inside both frameworks rather than replacing them, so any gain is additive and directly attributable.
The key ablation separates where the balancing is applied. Applying the class-balanced loss to the gate only is our method. Applying it to the whole network tests whether the decoupling matters. Applying it to the features only, with an ordinary gate loss, is the mirror image. Every arm uses identical data, splits, patch size, iterations and three seeds. Each gets the same hyperparameter search budget over the loss weights.
To count as beating the baselines, our method must raise mean Dice over adrenal glands, esophagus and gallbladder by more than the seed-to-seed spread relative to PARF-Net plus Gradient-Aware loss. It must also stay within half a point on head organs, and it must not increase tail false-positive volume relative to whole-network balancing.
Why not just…?
Why not just reweight the whole loss, or use Gradient-Aware loss, on PARF-Net? This is the most serious threat. It is exactly the joint-training baseline above, and it may close most of the gap. Our bet is that whole-network reweighting buys tail recall at the cost of over-segmenting tail organs. The contrast between balancing only the gate and balancing the whole network, measured with tail false-positive volume and boundary distance, settles the question. If the two arms tie, the decoupling idea is wrong and we will report that.
Why not just oversample patches containing rare organs? Oversampling attacks the specific failure Gradient-Aware identified, which is organs vanishing from patches. It could fix gate starvation as a side effect. It does not change the fact that, within a patch, rare-organ pixels are vastly outnumbered, so the gate's gradient stays majority-driven. We will run class-aware patch sampling as an extra arm, crossed with gate balancing. If sampling alone equalizes gate–oracle agreement across classes, the architectural argument loses its footing.
Why not just add per-scale auxiliary supervision, as in Attention to Scale? Extra supervision keeps each branch discriminative, but it does not tell the gate which branch to trust for rare pixels. It is part of our method, so we ablate it separately to show that the balanced gate loss adds something beyond it.
Proposed Experiments
We run fully supervised 8- and 13-class Synapse using the 2D slice protocol under which PARF-Net reports its numbers. We also run semi-supervised 3D Synapse and AMOS inside the CPS framework used by Gradient-Aware and inside SKCDF, at the label fractions those papers use. Metrics are per-class Dice, 95th-percentile Hausdorff distance, and tail false-positive volume, along with gate–oracle agreement broken down by class.
There are three decisive checks. The first is whether baseline gates show lower oracle agreement on tail classes than on head classes; if not, the premise fails. The second is whether gate-only balancing raises tail agreement and tail Dice beyond whole-network balancing while holding false positives down. The third is whether the gain survives class-aware patch sampling.
References
- Gradient-Aware for Class-Imbalanced Semi-supervised Medical Image Segmentation
- Attention to Scale: Scale-Aware Semantic Image Segmentation
- HRDA: Context-Aware High-Resolution Domain-Adaptive Semantic Segmentation
- PARF-Net: integrating pixel-wise adaptive receptive fields into hybrid Transformer-CNN network for medical image segmentation
- Transformer Scale Gate for Semantic Segmentation
- SvANet: A Scale-variant Attention-based Network for Small Medical Object Segmentation
- A Semantic Knowledge Complementarity based Decoupling Framework for Semi-supervised Class-imbalanced Medical Image Segmentation