Abstract
We explore the feasibility and potential of building a ground-truth-free evaluation model to assess the quality of segmentations generated by the Segment Anything Model (SAM) and its variants in medical imaging. This evaluation model estimates segmentation quality scores by analyzing the coherence and consistency between the input images and their corresponding segmentation predictions. Based on prior research, we frame the task of training this model as a regression problem within a supervised learning framework, using Dice scores (and optionally other metrics) along with mean squared error to compute the training loss. The model is trained utilizing a large collection of public datasets of medical images with segmentation predictions from SAM and its variants. We name this model EvanySeg (Evaluation of Any Segmentation in Medical Images). Our exploration of convolution-based models (e.g., ResNet) and transformer-based models (e.g., ViT) suggested that ViT yields better performance for this task. EvanySeg can be employed for various tasks, including: (1) identifying poorly segmented samples by detecting low-percentile segmentation quality scores; (2) benchmarking segmentation models without ground truth by averaging quality scores across test samples; (3) alerting human experts to poor-quality segmentation predictions during human-AI collaboration by applying a threshold within the score space; and (4) selecting the best segmentation prediction for each test sample at test time when multiple segmentation models are available, by choosing the prediction with the highest quality score. Models and code will be made available at https://github.com/ahjolsenbics/EvanySeg.
Introduction
The rise of "Segment Anything" models (SAM) has brought powerful, class-agnostic segmentation capabilities to medical imaging. However, these models are not infallible—particularly in complex clinical scans where they may produce "hallucinations" or incomplete masks. Traditionally, performance is validated against human-annotated "ground truth." In real-world clinical settings, such ground truth is often unavailable at the point of care, creating a "trust gap." There is a critical need for automated methods to flag poor segmentations or select the optimal result from multiple AI models without requiring immediate manual radiologist verification.
The EvanySeg Framework
To address this, we propose EvanySeg (Evaluation of Any Segmentation in Medical Images), a secondary "referee" model designed to predict segmentation quality scores directly from image-mask pairs.
The EvanySeg pipeline involves three primary inputs: the raw medical image, the segmentation mask generated by a model (e.g., SAM), and the prompt (such as a bounding box) used for mask generation. During pre-processing, the mask is fused into the red channel of the input image, and the image is cropped based on the bounding box prompt to focus on the region of interest.
The architecture serves as a regressor trained to minimize the Mean Squared Error (MSE) between predicted scores and actual Dice scores. Our theoretical analysis suggests that estimating segmentation quality is computationally simpler than performing the segmentation itself, as the model primarily learns to distinguish anatomical consistency.
Experimental Evaluation
EvanySeg was trained on a massive scale using a subset of the SA-Med2D-20M dataset, comprising over 619,000 image-mask pairs generated by three SAM variants: Original SAM, MedSAM, and SAM-Med2D.
Evaluation was conducted across eight diverse datasets spanning multiple modalities to ensure robustness:
- Public Datasets: TG3K, TN3K, DDTI (Ultrasound), and FLARE21 (Abdominal CT).
- In-house Datasets: MRI-Kidney100, CT-BCT100 (Brachiocephalic trunk), Endo-Polyp1000, and Path-Neuro1406 (Histopathology).
Results and Analysis
Our experiments compared convolution-based (ResNet101) and transformer-based (ViT-b, ViT-l) architectures. Vision Transformers (ViT) significantly outperformed ResNets, indicating that the global context captured via self-attention is vital for assessing whether a segmentation mask "makes sense" relative to the underlying anatomy.
Key findings include:
- High Correlation: Predicted Dice scores showed strong Pearson and Spearman correlations with true Dice scores across almost all modalities.
- Automated Model Selection: EvanySeg effectively acts as a selector. On the TG3K dataset, it correctly identified the best-performing segmentation model 90.83% of the time. On the challenging FLARE21 (CT) dataset, it maintained 77% accuracy.
- Performance Enhancement: Using EvanySeg to ensemble SAM, MedSAM, and SAM-Med2D resulted in a final Dice score of 85.2 on TG3K, surpassing the performance of any individual model (max 84.6).
Conclusion and Future Work
EvanySeg provides a robust mechanism for ground-truth-free evaluation, enabling real-time quality assurance in clinical AI applications. While highly effective, the current version is constrained to 2D images. Future work will focus on extending the model to 3D volumes, which are standard in MRI and CT imaging. Additionally, we aim to refine the model for point-based prompts and improve its sensitivity in distinguishing between high-quality masks that differ by very small margins.
Summary updated