arXiv:2611.00396cs.CVOct 2026

Manuscript Offprint

arXiv:2611.00396

Evaluating SAM-based and Convolutional Architectures in Thin Retinal Vessel Segmentation: Model Capacity, Computational Cost and Foundation Pre-training

Carlos Eduardo Fontaneli, Cesar Henrique Comin

Carlos Eduardo Fontaneli¹,* and Cesar H. Comin¹,†

¹Department of Computer Science, Federal University of São Carlos, Rod. Washington Luís, km 235, 13565-905, São Carlos, SP, Brazil

In retinal vessel segmentation, plain Vision Transformers (ViTs) are commonly expected to perform worse than convolutional neural networks (CNNs) on thin vessels, for reasons such as their coarse patch tokenization, their weak locality bias and their need for large training sets. Although this expectation is widely shared in the literature, how plain ViTs actually compare with CNNs on thin vessels has not been systematically quantified. We address this question by comparing a model with a plain ViT encoder (MEDSAM), a hybrid Transformer (LITEMEDSAM) and three CNNs of different sizes on three retinal datasets (DRIVE, HRF, FIVES) and, as a second-domain check, a microscopy dataset (VessMap). We measured the centerline recall and precision of thin vessels and compared the models while also considering their computational cost and how many epochs they needed to train. We found that the pre-trained MEDSAM had a centerline recall of thin vessels that was not significantly different from that of the best CNN on all four datasets (-0.6 to +2.5 percentage points). A compact plain ViT obtained through architecture search but trained from scratch did not retain this performance. For pre-trained plain ViTs, our results do not support the expectation that they miss thin vessels, although similar thin-vessel performance can be obtained with much smaller models.

Keywords: Vessel segmentation, Thin vessels, Vision Transformers, Foundation models, Pre-training, Computational cost

I. INTRODUCTION

Segmentation of the retinal vessels in fundus images provides quantitative markers for the diagnosis and follow-up of diseases such as diabetic retinopathy and glaucoma [1, 2]. Thin vessels are a particular challenge in this task: they are only a few pixels wide, have low contrast, and contribute little to overlap metrics such as Dice, in which a wide vessel counts more pixels than a thin vessel of the same length.

Convolutional neural networks (CNNs) have dominated vessel segmentation since the U-Net [3-7], and a carefully trained minimal U-Net, with far fewer parameters than the best published models, comes close to their results on retinal benchmarks [8]. Vision Transformers (ViTs) [9] and the foundation models built on them, such as the Segment Anything Model [10] and its medical version MEDSAM [11], offer an alternative: large pre-trained encoders. These models are designed to be general-purpose and can be fine-tuned for specific tasks. A plain ViT, however, splits the image into fixed-size patches, 16 × 16 pixels in MEDSAM [11], and encodes each patch as one token. Its output is therefore a single low-resolution feature map, considered unsuitable for dense prediction [12-14], and Transformers that encode such patches without convolutional features have been reported to lose the low-level detail needed for precise localization [15]. SAM-based models have been reported to struggle with thin and branching structures such as vessels [11, 16-18]. This is a

strong reason to expect a plain ViT to miss thin vessels. In addition, plain ViTs lack the locality bias of convolutions [9, 19]: without large-scale pre-training they do not learn to attend locally in their early layers [20] and are more data-hungry than CNNs [21, 22]. Vessel datasets, in contrast, have only tens to hundreds of annotated images.

To our knowledge, the thin-vessel performance of plain ViTs has not been systematically quantified or compared with that of CNNs. We therefore address three research questions:

  1. Can a plain ViT (MEDSAM) match the thin-vessel segmentation performance of CNNs, regardless of computational cost?

  2. How does a plain ViT compare with CNNs in thin-vessel performance relative to their computational cost?

  3. How much segmentation performance on thin vessels does foundation pre-training add to transformer-based models?

To answer these questions, we trained the plain ViT MEDSAM, the hybrid Transformer LITEMEDSAM, which combines convolutions and attention, and three CNNs of different sizes, CONVNEXT [23], CONVUNEXT [24] and LW-NET [8]. We used three retinal datasets, DRIVE [25], HRF [26] and FIVES [1], and VessMap [27], a microscopy dataset that we used to test the models in a second imaging domain. The two Transformers were also trained from scratch to quantify the contribution of foundation pre-training. In addition, we optimized the architecture of compact versions of the two Transformers on each dataset to test whether smaller models could reach the same performance.

Among our main results, fine-tuned MEDSAM had a centerline recall of thin vessels that was not significantly different from that of the best CNN on each dataset. Pre-training was essential for this performance, and a compact plain ViT found by architecture search and trained from scratch did not reach the performance of the pre-trained model. On HRF and FIVES, fine-tuned MEDSAM also had a significantly higher overall Dice than the best CNN.