Research
Multi-head automated segmentation by incorporating detection head into the contextual layer neural network
Overview Research area: Medical image analysis / computer vision for radiotherapy — automated contouring (auto-segmentation) of organs on CT scans using deep learning. Technical level: Advanced. The p

- arXiv
- 2602.02471
- Published
- 2026-02-02
- Authors
- Edwin Kys, Febian Febian
AI summary
Overview
Research area: Medical image analysis / computer vision for radiotherapy — automated contouring (auto-segmentation) of organs on CT scans using deep learning.
Technical level: Advanced. The paper assumes familiarity with U-Net, Swin Transformers, windowed self-attention, patch embedding, skip connections, Tversky loss, and multi-task learning.
Scope: The paper proposes and evaluates a dual-head (detection + segmentation) Swin U-Net variant called "N2" that uses detection outputs to gate segmentation predictions, tested on the TCIA Prostate-Anatomical-Edge-Cases dataset.
What This Paper Is About
Deep-learning segmentation models for radiotherapy planning frequently produce "hallucinated" contours — plausible-looking but anatomically impossible structures drawn on CT slices where the organ does not actually exist. The authors' goal is to stop this by giving the network an explicit way to decide, per slice, whether a structure is present at all, and to use that decision to switch off segmentation where it should not fire.
Key Contributions
- A gated multi-head Transformer architecture (N2) built on Swin U-Net that runs two parallel streams: a context-free detection stream ending in an MLP classifier, and a context-enhanced segmentation stream.
- An inter-slice (temporal) context integration mechanism using cross-attention that feeds previous segmentation masks into the encoder, deliberately applied to the segmentation stream only — detection is kept context-free to avoid biased presence decisions driven by neighbouring slices.
- Detection-based gating of segmentation outputs, described in both soft form (scaling segmentation probabilities by detection confidence) and hard form (binary masks based on detection thresholds), used to suppress false positives in anatomically invalid slices.
- A slice-wise Tversky loss training objective that gives each 2D slice equal weight, preventing large structures from dominating the objective under severe class imbalance.
Main Findings
- Gated model dramatically outperforms the baseline on Dice loss: The gated multi-head model achieved a mean volumetric Dice loss of 0.013 ± 0.036, compared with 0.732 ± 0.314 for the non-gated segmentation-only configuration.
- Reduced variability: The gated model showed significantly reduced variability across slices, while the non-gated model displayed pronounced fluctuations in Dice loss across all slices, particularly near anatomical boundaries.
- Detection probabilities track anatomy: The detection head consistently assigned near-zero confidence scores to slices where the target anatomy was absent, which suppressed segmentation via the gating mechanism and produced near-zero Dice loss in those non-anatomical slices.
- Baseline hallucinations are persistent and propagated: The non-gated model produced segmentation outputs regardless of anatomical presence, including spurious bladder segmentations that propagated across sequential slices. Qualitative comparison used slices 45, 60, 61, and 62 from a representative case.
- Baseline matches the gated model only when the structure is genuinely present: When the bladder was actually present in the ground truth, the non-gated model reached segmentation quality comparable to the gated approach — but only after a prolonged sequence of erroneous predictions. The paper notes the Dice loss curves of the two models overlap in those regions, which the authors say demonstrates the strength of the underlying contextual-layer Swin U-Net backbone.
- Evaluation scale: A total of 150 axial slices were analysed for each model, comparing slice-wise Dice loss and detection probability outputs.
Methodology in Plain English
The researchers started from Swin U-Net, a Transformer-based segmentation architecture that splits an image into patches and applies attention within local windows while also shifting those windows to capture wider context. Input tensors of shape (B, 1, 256, 256) are converted into patch tokens with patch size (4, 4) and embedding dimension D = 96, then passed through four encoder stages whose token counts shrink from 4096 to 64 while channel depth grows from 96 to 768.
At each encoder stage, the model adds a "temporal context fusion" step: a context encoder reads a previous frame and combines it with the current features through attention fusion. After the encoder, the features split into two paths. One path goes to an MLP detection head that outputs (8, 3) — three regions of interest — deciding whether each structure is present in that slice. The other path goes through four decoder stages that progressively upsample and merge with encoder features via skip connections, ending with layer normalization, a linear projection to one segmentation class, reshaping into a 64×64 grid, and upsampling back to 256×256.
The detection result then gates the segmentation result, so slices with no detected structure get suppressed. Training used Tversky loss computed slice by slice, with augmentation including min–max intensity scaling, random 90° rotations, horizontal and vertical flips, elastic deformations, brightness and contrast perturbations, Gaussian noise injection, and zero-mean unit-variance normalization. Training ran for 100 epochs with batch size 8 on the AdamW optimizer at an initial learning rate of 1×10⁻⁵, on a network with roughly 110 million trainable parameters implemented in PyTorch, using a single NVIDIA RTX 4000 Ada GPU with 20 GB VRAM, a host with 50 GB RAM and 9 VCPUs.
The dataset was the publicly available Prostate-Anatomical-Edge-Cases collection from The Cancer Imaging Archive: CT scans with RTSTRUCT segmentations from 131 individuals with prostate cancer, totalling roughly 17 GB. It comes from a single-institution retrospective review of 950 consecutive prostate adenocarcinoma patients treated with definitive radiotherapy between 2011 and 2019; 112 cases with notable anatomical variations (hip arthroplasty, enlarged median prostate lobes, "droopy" seminal vesicles, urinary catheters) were designated edge cases, plus 19 randomly selected normal cases. Expert manual segmentations were available for the prostate, rectum, bladder, and bilateral femoral heads.
Why This Matters
The paper reframes hallucination in medical segmentation as a structural limitation of pixel-only optimization rather than a data or tuning problem, and shows a concrete architectural fix. If validated more broadly, this changes how auto-contouring models are designed: presence reasoning becomes a first-class task rather than an emergent property.
Real-world applications:
- Radiotherapy treatment planning: cleaner auto-contours for the prostate, bladder, rectum, and femoral heads reduce the manual correction burden on clinicians.
- Edge-case patient cohorts: the dataset specifically targets anatomical anomalies such as hip arthroplasty and urinary catheters, where conventional models are most likely to fail.
- Structures with limited spatial extent: organs or vessels that appear only across a few slices, where slice-level presence detection matters most.
- Quality assurance in clinical pipelines: detection confidence scores provide an interpretable signal of whether a structure was found at all, which could support review workflows.
Industry relevance: auto-contouring is a commercial segment of radiotherapy software, and false-positive contours cost clinician time and carry safety implications. A gating mechanism that suppresses spurious output without degrading quality on valid slices is directly relevant to vendors building clinical contouring products. The reported gain here is large — mean Dice loss falls from 0.732 ± 0.314 to 0.013 ± 0.036.
Future Directions
- Extending the approach to anatomical sites beyond the prostate.
- Validating generalizability across institutions, since generalization across imaging protocols and patient populations is described in the paper as a barrier to clinical adoption.
- Exploring uncertainty-aware gating mechanisms to further improve clinical safety.
- Open questions the paper raises: whether soft or hard gating is preferable in practice, how detection thresholds should be set clinically, and whether keeping detection strictly context-free is optimal as the model scales to more structures.
Target Audience
Medical imaging and computer vision researchers working on segmentation architecture design; medical physicists and radiation oncologists involved in auto-contouring evaluation; and machine learning engineers building clinical contouring software who need to understand why segmentation-only models hallucinate and what architectural remedies exist.
Authors’ abstract
Deep learning based auto segmentation is increasingly used in radiotherapy, but conventional models often produce anatomically implausible false positives, or hallucinations, in slices lacking target structures. We propose a gated multi-head Transformer architecture based on Swin U-Net, augmented with inter-slice context integration and a parallel detection head, which jointly performs slice-level structure detection via a multi-layer perceptron and pixel-level segmentation through a context-enhanced stream. Detection outputs gate the segmentation predictions to suppress false positives in anatomically invalid slices, and training uses slice-wise Tversky loss to address class imbalance. Experiments on the Prostate-Anatomical-Edge-Cases dataset from The Cancer Imaging Archive demonstrate that the gated model substantially outperforms a non-gated segmentation-only baseline, achieving a mean Dice loss of $0.013 \pm 0.036$ versus $0.732 \pm 0.314$, with detection probabilities strongly correlated with anatomical presence, effectively eliminating spurious segmentations. In contrast, the non-gated model exhibited higher variability and persistent false positives across all slices. These results indicate that detection-based gating enhances robustness and anatomical plausibility in automated segmentation applications, reducing hallucinated predictions without compromising segmentation quality in valid slices, and offers a promising approach for improving the reliability of clinical radiotherapy auto-contouring workflows.