Manuscript Offprint
arXiv:2611.09436The Role Of Recurrent Refinement In Medical Image Segmentation
ABSTRACT
While feed-forward segmentation networks perform well on large cohorts, they degrade in constrained clinical settings with few training samples and imaging artifacts. Human vision, by contrast, remains robust under these conditions, a property partly attributed to the recurrent and feedback connectivity of the visual cortex, which refines visual information over time. Inspired by this, we append lightweight recurrent refinement blocks to segmentation backbones, namely Conditional Random Fields (CRFs), modern Hopfield networks and convolutional GRUs, and study their behaviour as the number of iterations increases at test time (including beyond the training horizon). Evaluated on two open-source datasets, Kvasir-SEG and ARCADE, our recurrent blocks add less than 1.5% parameters and yield gains on clean data (up to 1.4 pp) and under noise (up to 17 pp) while reducing HD95.
Index Terms— Image Segmentation, Recurrence
1. INTRODUCTION
Semantic segmentation is a critical task in clinical workflows, as it provides spatial delineations essential for surgical navigation, lesion tracking, and morphology quantification [1]. Over the past decade, architectures ranging from standard convolutional U-Nets [2] to hierarchical Vision Transformers [3] and medical foundation models like MedSAM [4] have demonstrated exceptional performance, particularly when trained on very large benchmarks. However, real-world clinical settings rarely involve large scale cohorts, as most accessible medical datasets are severely constrained by small training sets, acquisition artifacts and label noise [5]. As a consequence, these models struggle in many scenarios and clinical deployment requires the capacity of extracting the most utility from such conditions.
In contrast to artificial networks, the primate visual system exhibits remarkable robustness in noisy and low-data regimes [6, 7]. While architectures like the U-Net try to mirror hierarchical receptive fields, these models remain strictly feed-forward, mapping inputs to predictions in a single static computational pass without the capability to re-evaluate intermediate features. Instead, the human visual cortex functions as an active dynamical system with pervasive recurrent and
top-down feedback pathways, refining decisions over time to resolve spatial ambiguity and sensory noise [8, 9, 10]. Therefore, incorporating recurrent feedback mechanisms into segmentation models offers an intuitive approach to equip them with iterative, dynamic error correction mechanisms.
Prior studies have used recurrent computation through various paradigms, such as Deep Equilibrium Models (DEQ) that enforce convergence toward stable fixed points [11], unrolled recurrent convolutions within U-Net blocks [12]. Similarly, formulating Dense Conditional Random Fields (CRF) with Gaussian edge potentials as Recurrent Neural Networks (CRF-as-RNN) [13, 14] demonstrated that mean-field message passing can iteratively sharpen boundary beliefs. In parallel, Modern Hopfield Networks [15, 16] established a formal bridge between associative memory retrieval and attention, proving that spatial tokens can converge toward stable energy attractors. Beyond energy-based and probabilistic frameworks, RAFT [17] introduced an alternative by leveraging Convolutional Gated Recurrent Units (ConvGRUs) [18] to keep a spatial memory state and iteratively emit bounded, residual corrections over time. Nevertheless, existing recurrent segmentation methods predominantly evaluate performance under a fixed, small number of unrolled iterations (), leaving open whether segmentation quality improves and remains stable as increases at test time, including beyond the training horizon.
In this work, we investigate the role of recurrent blocks plugged into a pre-trained segmentation backbone. Specifically, we evaluate CRF [14], modern Hopfield networks [15] and ConvGRU [18] integrated at the output of a segmentation model. We benchmark these architectures across varying iterations at test time under synthetic corruptions and few-shot constraints on gastrointestinal polyp segmentation (Kvasir-SEG [19]) and coronary angiography (ARCADE [20]). All code available at https://github.com/joaodsmarques/recurrencehelpsegmentation.
2.1. The Datasets
This study is evaluated on two medical image segmentation benchmarks of contrasting complexity: Kvasir-SEG [19] and the syntax split of ARCADE [20]. All images and corresponding ground-truth masks were resized to a fixed resolution of pixels. For Kvasir-SEG, the cohort was partitioned into an 80%–10%–10% split from a total of 1000 pairs using a fixed random seed; the held-out test set remained isolated across experiments, while validation partitions varied across folds. For ARCADE, we adopted the official benchmark partition comprising 1000 training, 200 validation, and 300 test images. These datasets provide complementary evaluation settings: Kvasir-SEG represents a localized lesion delineation task with different textures, whereas ARCADE poses a difficult tubular tracking scenario composed of thin scale vascular geometry, connectivity constraints and high noise. Both tasks were framed as single target binary segmentation: polyp identification in Kvasir-SEG and coronary vessel delineation in ARCADE.
2.2. Recurrent Refinement Framework
Let denote a feed-forward backbone (U-Net for example) that maps an input image to unary logits [13]. A shared recurrent operator , where is a parameterized recurrent correction operator that computes a bounded residual update conditioned on optional feature/image context , is executed for iterations starting from :
where denotes optional context and . Here, works as a persistent skip-connection anchoring every step to the initial prediction and preventing an unbounded divergence as scales. By re-injecting at every step, the operator predicts bounded residual corrections relative to static feed-forward evidence rather than accumulating unbounded state drift across successive unrolled passes. All residual projection heads in are initialized to zero, ensuring that the model at is strictly identical to the base network. To encourage that increasing the iteration count progressively refines the prediction rather than destabilizing it, we adopt a step-weighted supervision strategy inspired by RAFT [17], using linearly increasing rather than exponential weights. By supervising intermediate outputs across all recurrent passes, the loss penalizes later iterations more heavily:
where , and . This weighting lets early iterations establish coarse structure while placing more emphasis on the accuracy of later steps, favouring fine-grained corrections. The chosen composed loss function balances region overlap with pixel-level classification: the Dice

Fig. 1. Overview of the recurrent refinement framework.
component addresses severe foreground-background imbalance inherent to thin vessels and localized lesions, while Cross-Entropy provides smooth, well-calibrated gradients that stabilize backpropagation across recurrent iterations.
2.3. Recurrent blocks
The full pipeline using each of the chosen recurrent blocks is shown in Figure 1.
CRF: Following CRF-as-RNN [14], computes local bilateral filtering over a window on downsampled logits and routes the resulting messages through a learnable compatibility matrix. This explicitly enforces spatial and color-dependent label consistency. The detailed mean-field derivation can be found in Zheng et al. work [14].
Hopfield Network: The block unfolds centered probabilities , with (background and target), into overlapping patches (stride = 8), retrieves prototypical shape patterns from a learned dictionary of 512 memories via continuous modern Hopfield attention [15], and folds them back into logit space. The associative memory functions as a data driven geometric prior.
ConvGRU: Parameterized as a convolutional GRU [18, 17], updates an internal spatial hidden state conditioned on decoder feature context c and current label probabilities. At each iteration, it emits a bounded residual correction via a convolutional head initialized at 0, that expands its effective receptive field with every step.
ConvGRU-local: To emulate an unconstrained, non-linear CRF without semantic shortcuts, ConvGRU-local restricts the context c exclusively to raw input image patches. In addition, step-0 unary supervision is disabled ( ), enabling the feed-forward backbone to provide coarse proposals that are systematically refined through local propagation.
3. EXPERIMENTS AND RESULTS
We structure our evaluation around three setups: (i) a clean data benchmark, evaluating whether appending recurrent refinement blocks improves performance over the feed-forward;
Table 1. Clean test set results for recurrent steps at test time: mean (std) across 5 training seeds. Dice and precision in %, HD95 in pixels. Best values in bold.
| Model | ARCADE | Kvasir-SEG | |||||
|---|---|---|---|---|---|---|---|
| Dice | Prec. | HD95 | Dice | Prec. | HD95 | ||
| U-Net | - | 79.7(.2) | 82.3(.2) | 62.4(1.8) | 89.1(.4) | 90.1(2.6) | 42.2(.9) |
| CRF | 5 | 79.3(.2) | 82.7(1.3) | 62.7(1.5) | 89.0(.7) | 87.8(2.9) | 40.7(2.4) |
| 20 | 79.5(.2) | 83.6(1.3) | 64.4(1.8) | 89.0(.7) | 89.3(2.4) | 41.1(3.1) | |
| Hopf | 5 | 80.9(.2) | 83.9(.3) | 60.0(1.4) | 89.8(1.7) | 90.0(1.9) | 39.7(3.2) |
| 20 | 80.6(.2) | 84.3(.3) | 60.2(1.3) | 89.9(1.7) | 90.1(1.9) | 39.6(3.9) | |
| GRU | 5 | 79.5(.3) | 85.8(.9) | 61.0(.4) | 89.8(1.3) | 91.4(1.7) | 37.7(6.5) |
| 20 | 79.4(.3) | 85.7(1.2) | 61.3(.7) | 89.5(1.3) | 91.3(1.4) | 38.8(8.1) | |
| GRU-L | 5 | 80.3(.3) | 83.2(.7) | 60.8(2.7) | 90.5(1.3) | 89.8(1.3) | 39.4(4.8) |
| 20 | 80.1(.3) | 83.4(.5) | 61.6(2.3) | 90.1(1.3) | 91.6(1.2) | 39.6(4.0) | |

Fig. 2. Recurrence visual effect on masks.
(ii) a low data regime, where models are trained on progressively smaller subsets of the training split, while keeping validation and test sets fixed to assess data efficiency; (iii) an input corruption stress test, where we add synthetic noise profiles (Gaussian, Poisson, and blur) to measure architectural resilience against degraded visual inputs.
3.1. Implementation details
For the main backbone, we chose a U-Net featuring an EfficientNet-B4 encoder [21] initialized with ImageNet pretrained weights as it provides a strong trade-off between performance and parameter efficiency. Hyperparameters were optimized using Optuna across 100 trials with median pruning over a 30 epoch limit, maximizing the validation Dice score. To ensure a fair comparison, all recurrent variants were initialized directly from the ImageNet pre-trained U-Net rather than the one fine-tuned with Optuna.
The learning rates were set to approximately for the baseline U-Net, for the CRF, and for both Hopfield and ConvGRU configurations. The parameters associated with the recurrent blocks were assigned a learning rate scaled by a factor of 3 relative to the backbone, with weight decay disabled. All models were trained for 50 epochs using a batch size of 8, weight decay of (backbone), and a cosine learning rate scheduler across four 32 GB NVIDIA V100 GPUs installed on a Dell PowerEdge C4140 server. The quality of each architecture is evaluated via the Dice similarity coefficient and precision for regional

Fig. 3. How iterations influence the Dice score in limited samples settings.
accuracy, along with the 95th-percentile Hausdorff Distance (HD95) to quantify boundary preservation and topological connectivity, which is particularly important for the ARCADE dataset. All recurrent blocks are trained with deep supervision: the loss is applied to the output of every step t with weight , so later steps are weighted more and each step is encouraged to improve on the previous one (for ConvGRU-local, step 0 is not supervised, so the base network only provides a proposal). The CRF and Hopfield blocks are trained with a fixed T=5. The ConvGRU blocks are trained with T drawn uniformly from for every batch, so that the output is usable after any number of steps. The Hopfield update converges mostly in the first steps, and training it with presented differences within seed variability, so we keep T=5 for consistency with the CRF. All experiments were run on 5 different seeds and k-fold validation with 5 different folds for Kvasir dataset.
3.2. Clean data benchmark
Table 1 reports results on the clean test sets. Because the intermediate outputs are supervised during training (deep supervision), all blocks produce valid predictions for any T at test time, including beyond the training horizon; the only exception is step 0 of ConvGRU-local, which is not supervised. Statistical significance was assessed with a two-sided paired Wilcoxon signed-rank test on per-image metrics (averaged over training seeds), with Holm correction for multiple comparisons. On clean data, gains over the feed-forward baseline are modest. The best recurrent variant improves Dice by +1.2 pp on ARCADE (Hopfield, T=5) and +1.4 pp on Kvasir-SEG (ConvGRU-local, T=5). The largest HD95 reductions are 2.4 px on ARCADE (Hopfield, T=5) and 4.5 px on Kvasir-SEG (ConvGRU, T=5), although this last one is smaller than its standard deviation across seeds (±6.5 px).
The blocks mainly shift the operating point towards precision. On ARCADE, all blocks increase precision over the U-Net (), with ConvGRU showing the largest gain (+3.5 pp). The CRF does not improve Dice on either dataset, but it exhibits the clearest step-wise behaviour: on ARCADE,

Fig. 4. Noise robustness test in ARCADE and Kvasir-SEG.
precision rises from 79.4% at T=1 to 82.7% at T=5 and 83.6% at T=20 (p < 0.001, consistent in 5/5 seeds), with no significant change in Dice. On Kvasir-SEG, CRF precision also increases with T (87.8% to 89.3%) but remains below the baseline. Mean-field message passing therefore acts as a refinement that suppresses low confidence foreground pixels. Extending inference from T=5 to T=20 changes Dice by at most 0.5 pp for every block.
3.3. Limited samples study
Figure 3 shows Dice as a function of T for models trained on n=24 (Kvasir-SEG) and n=34 (ARCADE) images, about 3% of the respective training sets. ConvGRU-local starts below the baseline at T=0 because its step-0 output is unsupervised. However, this block improves with each iteration and surpasses the U-Net on both datasets (at T=3 in Kvasir-SEG and T=1 at ARCADE). The Hopfield block remains near the baseline and ConvGRU, although it improves with iterations, never surpasses the baseline. Variance across seeds is high in this regime and with larger subsets the gap between the best recurrent blocks and the baseline shrinks. We therefore read these results as suggestive rather than conclusive: iterative refinement can partially compensate for scarce data, but the benefit depends on the block and diminishes as data increase.
3.4. Robustness to input corruption
All models were trained on clean images and evaluated under Gaussian noise, Poisson noise, and Gaussian blur of increasing severity and results were reported in Figure 4. On ARCADE, the Hopfield block (T=5) is the most robust model under all three noise types: at Gaussian 10%, Poisson 40% and blur 40% it improves Dice by +17 pp, +10 pp and +8
Table 2. Cost of each block on our setting. We consider GFLOPs per image as a function of the number of recurrent steps T and memory as the peak GPU memory of one training step (batch 8, fp32, AdamW) at the training T (5 for CRF and Hopfield, 8 for ConvGRU).
| Model | Params (M) | GFLOPs | Mem. (GiB) |
|---|---|---|---|
| U-Net | 20.23 | 36.9 | 11.0 |
| + CRF | 20.23 (+0.0%) | 36.9 + 0.1T | 13.8 (+25%) |
| + Hopfield | 20.49 (+1.3%) | 36.9 + 4.2T | 12.4 (+13%) |
| + ConvGRU | 20.40 (+0.8%) | 38.1 + 20.8T | 16.3 (+48%) |
pp and reduces HD95 by 129, 62 and 51 px over the U-Net (p < 0.001). At high severities all models collapse, since no refinement can recover structure absent from the unary predictions. The pattern of larger gains in HD95 than in Dice suggests that the blocks mainly remove distant false positives.
3.5. Compute cost
To confirm that performance gains come from recurrence rather than increased model size, we report the number of trainable parameters, inference GFLOPs, and peak GPU training memory in Table 2. The parameter overhead introduced by recurrence is marginal: both ConvGRU and Hopfield add less than 1.5% capacity, while the CRF adds only six trainable parameters. Nevertheless, per-step costs differ substantially: while the CRF adds only 0.1 GFLOPs per iteration, ConvGRU adds 20.8 GFLOPs, so at T=8 its inference cost is roughly 5× that of the base U-Net.
3.6. Other backbones
With a SegFormer (MiT-B2) [3] backbone (5 seeds), the CRF behaviour replicates: precision increases with T on both datasets (+4 pp, p < 0.001), and the CRF improves Dice and HD95 over the backbone under all three corruptions on ARCADE (p < 0.02). However, the best block under noise is backbone-dependent (CRF for SegFormer, Hopfield for U-Net). We also observed that when the base model is weak, recurrence barely changes the output, suggesting that the blocks refine the unary prediction rather than correct it.
4. CONCLUSION
We evaluated lightweight recurrent refinement blocks across test-time iteration counts. On clean data, gains are small. Nevertheless, under input corruption the blocks generally reduce HD95, mainly by suppressing spurious predictions. Predictions remain stable beyond the training horizon (Dice changes by at most 0.5 pp from T=5 to T=20), which we attribute to anchoring each step to the unary logits. Although the gains are modest, the impact on segmentation quality can be meaningful as presented by Figure 2.
5. COMPLIANCE WITH ETHICAL STANDARDS
This research study was conducted using open-access human subject data from the Kvasir-SEG [19] and ARCADE [20] benchmarks. Ethical approval was not required for the use of these anonymized, publicly available datasets, as confirmed by their respective licenses.
6. ACKNOWLEDGMENTS
This work was supported by national funds through Fundação para a Ciência e a Tecnologia, I.P. (FCT) under projects UID/50021/2025 (http://doi.org/10.54499/UID/50021/2025) and UID/PRR/50021/2025 (http://doi.org/10.54499/UID/PRR/50021/2025).
7. REFERENCES
[1] Md. Eshmam Rayed, S.M. Sajibul Islam, Sadia Islam Niha, et al., “Deep learning for medical image segmentation: State-of-the-art advancements and challenges,” Informatics in Medicine Unlocked, vol. 47, pp. 101504, 2024. [2] Olaf Ronneberger, Philipp Fischer, and Thomas Brox, “U-Net: Convolutional networks for biomedical image segmentation,” in Medical Image Computing and Computer-Assisted Intervention – MICCAI 2015, Cham, 2015, pp. 234–241. [3] Enze Xie, Wenhai Wang, Zhiding Yu, et al., “Seg-Former: Simple and efficient design for semantic segmentation with transformers,” in Advances in Neural Information Processing Systems, 2021, vol. 34, pp. 12077–12090. [4] Jun Ma, Yuting He, Feifei Li, et al., “Segment anything in medical images,” Nature Communications, vol. 15, no. 1, pp. 654, 2024. [5] Jialin Shi, Kailai Zhang, Chenyi Guo, et al., “A survey of label-noise deep learning for medical image analysis,” Medical Image Analysis, vol. 95, pp. 103166, 2024. [6] Robert Geirhos, Carlos R. M. Temme, Jonas Rauber, et al., “Generalisation in humans and deep neural networks,” in Advances in Neural Information Processing Systems, 2018, vol. 31. [7] Kohitij Kar, Jonas Kubilius, Kailyn Schmidt, et al., “Evidence that recurrent circuits are critical to the ventral stream’s execution of core object recognition behavior,” Nature Neuroscience, vol. 22, no. 6, pp. 974–983, 2019. [8] Rajesh P. N. Rao and Dana H. Ballard, “Predictive coding in the visual cortex: a functional interpretation of some extra-classical receptive-field effects,” Nature Neuroscience, vol. 2, no. 1, pp. 79–87, 1999. [9] Courtney J. Spoerer, Tim C. Kietzmann, Johannes Mehrer, et al., “Recurrent neural networks can explain
flexible trading of speed and accuracy in biological vision,” PLOS Computational Biology, vol. 16, no. 10, pp. 1–27, 10 2020. [10] Lore Goetschalckx, Lakshmi N. Govindarajan, Alekh K. Ashok, et al., “Computing a human-like reaction time metric from stable recurrent vision models,” in Advances in Neural Information Processing Systems, 2023, vol. 36, pp. 14338–14365. [11] Shaojie Bai, J. Zico Kolter, and Vladlen Koltun, “Deep equilibrium models,” in Proceedings of the 33rd International Conference on Neural Information Processing Systems, Red Hook, NY, USA, 2019. [12] Nahian Siddique, Sidike Paheding, Md. Zahangir Alom, and Vijay Devabhaktuni, “Recurrent residual U-Net with EfficientNet encoder for medical image segmentation,” in Pattern Recognition and Tracking XXXII, 2021, vol. 11735 of Proceedings of SPIE, p. 117350L. [13] Philipp Krähenbühl and Vladlen Koltun, “Efficient inference in fully connected CRFs with Gaussian edge potentials,” in Advances in Neural Information Processing Systems, 2011, vol. 24 of NIPS’11, pp. 109–117. [14] Shuai Zheng, Sadeep Jayasumana, Bernardino Romera-Paredes, et al., “Conditional random fields as recurrent neural networks,” in Proceedings of the 2015 IEEE International Conference on Computer Vision, 2015, ICCV '15, pp. 1529–1537. [15] Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, et al., “Hopfield networks is all you need,” in International Conference on Learning Representations, 2021. [16] Benjamin Hoover, Yuchen Liang, Bao Pham, et al., “Energy transformer,” in Advances in Neural Information Processing Systems, 2023, vol. 36, pp. 27532–27559. [17] Zachary Teed and Jia Deng, “RAFT: Recurrent all-pairs field transforms for optical flow,” in ECCV 2020, 2020, Lecture Notes in Computer Science, pp. 402–419. [18] Nicolas Ballas, Li Yao, Chris Pal, and Aaron Courville, “Delving deeper into convolutional networks for learning video representations,” in International Conference on Learning Representations (ICLR), 2016. [19] Debesh Jha, Pia H. Smedsrud, Michael A. Riegler, et al., “Kvasir-SEG: A segmented polyp dataset,” in MultiMedia Modeling (MMM 2020), 2020, p. 451–462. [20] Maxim Popov, Akmaral Amanturdieva, Nuren Zhaksylyk, et al., “Dataset for Automatic Region-based Coronary Artery Disease Diagnostics Using X-Ray Angiography Images,” Scientific Data, vol. 11, no. 1, pp. 20, 2024. [21] Mingxing Tan and Quoc Le, “EfficientNet: Rethinking model scaling for convolutional neural networks,” in Proceedings of the 36th International Conference on Machine Learning, 09–15 Jun 2019, vol. 97 of Proceedings of Machine Learning Research, pp. 6105–6114.