Manuscript Offprint
arXiv:2611.02305Peripheral prototypical contrastive loss for supervised medical image segmentation
ABSTRACT
Robust segmentation of biomedical images remains challenging primarily due to ill-defined object boundaries. Although several loss functions have recently been proposed to enhance object boundary recognition, concerns remain about the susceptibility to unstable annotations resulting from boundary ambiguities. Here, we introduce the Peripheral Prototypical Contrastive (PPC) loss, which leverages prototypical contrastive learning to improve boundary recognition and enable stable training even under noisy annotation conditions. The PPC loss utilizes prototype features obtained from local regions near object boundaries, focusing specifically on ambiguous areas that have been challenging for existing approaches. Extensive experiments across multiple datasets demonstrated that the PPC loss consistently improve segmentation performance even under conditions with noisy labels. A newly proposed strategy, which adaptively determines the local region for prototype calculation, enhanced robustness and outperformed existing methods. Our findings indicate the potential of the PPC loss in facilitating scalable and reliable medical image segmentation, including the development of foundation models with imperfect annotations.
1. INTRODUCTION
Segmentation has long been a crucial task in biomedical image analysis, and its methodologies have continued to advance. In recent years, a continuous stream of foundation models targeting medical imaging has been proposed [1-3], demonstrating that the utilization of large-scale datasets can address many challenges that are specific to the medical domain. Nevertheless, several critical issues still persist despite the rise of these foundation models. For instance, lesions and organs frequently exhibit ambiguous and ill-defined margins, which can introduce several complications such as annotation noise [4] and degradation in object boundary recognition of the foundation model [1]. To address these challenges, various approaches have been explored, including specialized
neural network architecture designs [5, 6], the utilization of labels from multiple annotators [4, 7], and proposals for novel loss functions [8, 9]. Among these, the development of novel loss functions for enhancing boundary recognition can be highly versatile and, as noted in ref. [1], holds promise for further improving foundation models.
Several loss functions have been investigated to improve boundary identification. In the context of generic images, camouflaged object detection (COD) [10, 11] addresses similar challenges, aiming to segment objects whose textures are similar to those of the background. For the COD task, the multi-task learning framework has been commonly applied, in which the model is simultaneously trained to segment boundary pixels using the edge detection loss [10, 11]. In the biomedical field, contour-weighted cross-entropy and Dice (CWCD) loss [8] and ROI-based contrastive loss [9] have been proposed. CWCD loss amplifies cross-entropy and Dice losses near object contours to enhance boundary recognition. ROI-based contrastive loss applies instance-wise contrastive (IC) learning to pixel-wise features randomly sampled around object boundaries, promoting the separation of features around boundaries.
Although the above-mentioned existing methods can be effective when annotations are well-defined and clean, the loss functions can be highly perturbed when annotations are unstable or inconsistent, possibly degrading segmentation performance. The values of the edge detection loss and CWCD loss vary significantly depending on the position of object boundaries, resulting in high susceptibility to annotation errors. Conversely, contrastive learning induces a relative separation of pixel-wise features between foreground and background, without enforcing abrupt changes in the features around object boundaries. While this seems to improve robustness against label noise, it has been pointed out that IC learning underperform when incorrectly assigned negative pairs are present [12], which can be caused by pixel-level annotation errors in medical images.
In this study, we design a prototype-based loss to further enhance robustness against ambiguous object boundaries. Prototypical contrastive (PC) learning [12] incorporates representative features of each class, i.e., prototypes, and has already been applied to segmentation tasks [13, 14]. While IC learning utilizes pixel-wise features to obtain the contrastive
© 2026 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works.

Fig. 1. The overview of the proposed the PPC loss () to enhance boundary recognition of the DNN.
loss, PC learning leverages the mean of pixel-wise features belonging to the same class. Unlike pixel-wise features, the prototypical feature obtained thereby is less affected by pixel-level perturbation of annotation masks, leading to more stable training than IC learning. Although PC learning has been particularly utilized in weakly-supervised settings [15, 16], few studies have explored the enhancement of object boundary recognition in fully-supervised settings. Here we develop the peripheral prototypical contrastive (PPC) loss, where the prototype is computed using pixel-wise features from hard negative pixels around the object boundary. Our work yields the following contributions:
-
We introduce the idea of PC learning instead of IC learning to enhance boundary recognition in fully-supervised medical images with both clean and noisy annotations.
-
We propose a method for adaptively determining the peripheral region for prototype calculation, which further improves the segmentation performance.
-
Through a series of experiments on three datasets, our PPC loss demonstrates the potential applicability across various imaging modalities and robustness against label noise.
2.1. PPC loss
The key concept of our proposed PPC loss lies in performing prototypical contrastive learning using pixel-wise features extracted from the local regions near object boundaries. Among background regions, which often occupy a large portion of medical images, subregions close to the target foreground
are particularly hard to discriminate, and are pivotal for training segmentation models. We therefore define a background subregion around the margin of , and propose the PPC loss for an image :
where , and denote the feature at pixel , the temperature constant, the cosine similarity, and the number of pixels in the specified region, respectively (see Fig. 1). We fixed following ref. [13]. The pixel-wise features for contrastive learning are obtained by applying a convolutional layer, followed by a ReLU activation, to the features output by the deep neural network (DNN) under training. is the prototype, defined as the mean feature vector within the respective region. We train the DNN using , where , and are binary cross-entropy (BCE) loss, Dice loss, and the weighting constants, respectively.
The simplest definition of the background subregion is the set of all background pixels in the image: , which yields the existing PC loss with the background class as defined by the given annotation. To obtain boundary-aware prototypes, the most straightforward way is to define a local region isotropically surrounding , which has been implemented in refs. [15, 16] for weakly-supervised situations. Specifically, letting denote the distance from pixel to the boundary of , one can define as
with a hyperparameter for the threshold distance . Nevertheless, as the subregion is not necessarily isotropic in all cases, a more adaptive approach is desired. To address this, we propose defining using the logit outputs from the DNN during training (Fig. 1). We expect that the background pixels whose is close to 0, satisfying , are difficult to discriminate and are distributed around with an approximate width of . Here denotes the mean logit over the background pixels where . However, such a simple additive operation is so susceptible to noise in that the region specified above might include pixels distant from . We mitigate this by introducing a variance parameter and ultimately obtain
The coefficient of the additive term follows a Gaussian profile, taking larger values for pixels closer to and becomes 1 when . This allows for the adaptive determination of on a per-case basis.
| Methods | Chest X-ray (JSRT) | Clavicle | CT (LIDC-IDRI) | MR (BraTS2020) | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Lung | Heart | Clavicle | Lung nodule | Brain tumor | ||||||
| Clean | Noise | Clean | Noise | Clean | Noise | Clean | Noise | Clean | Noise | |
| BCE loss + Dice loss(Baseline) | 97.50±0.05 | 93.45±0.25 | 89.77±1.40 | 80.88±1.70 | 86.25±1.15 | 77.91±1.09 | 64.21±0.40 | 59.39±0.72 | 83.35±0.29 | 81.18±0.21 |
| + Edge detection loss | 97.75±0.03 | 93.44±0.14 | 86.02±3.74 | 75.09±3.41 | 86.06±0.41 | 78.92±0.89 | 65.06±0.33 | 59.50±0.58 | 82.77±0.66 | 78.99±0.39 |
| + CWCD loss | 97.50±0.09 | 91.08±0.23 | 92.02±0.50 | 81.36±1.46 | 87.29±0.72 | 74.18±1.35 | 60.94±0.35 | 54.53±0.37 | 83.27±0.38 | 80.67±0.38 |
| + ROI-basedcontrastive loss | 97.49±0.03 | 91.81±0.49 | 93.87±0.07 | 87.62±0.31 | 90.88±0.16 | 79.67±2.05 | 64.35±1.91 | 57.90±1.19 | 83.82±0.23 | 82.06±0.14 |
| + PC loss | 97.84±0.03 | 93.30±0.30 | 94.00±0.17 | 88.80±0.48 | 90.32±0.25 | 79.71±0.91 | 64.52±0.42 | 58.88±0.88 | 83.62±0.15 | 80.53±0.34 |
| + Isotropic PPC loss(B = ŜIso) | 97.84±0.03 | 94.44±0.25 | 94.09±0.14 | 89.33±0.29 | 91.66±0.17 | 86.81±0.62 | 65.30±0.25 | 60.64±0.62 | 83.24±0.34 | 81.62±0.24 |
| + Adaptive PPC loss (ours)(B = ŜAda) | 97.96±0.01 | 93.96±0.32 | 94.54±0.05 | 89.85±0.26 | 92.27±0.18 | 87.32±0.70 | 66.04±0.57 | 61.84±0.47 | 84.52±0.18 | 81.92±0.23 |
Table 1. Comparison of segmentation performance using the Dice coefficient. The best and second-best scores are highlighted in bold and underlined, respectively. Gray cells indicate the degradation compared to the baseline.
2.2. Experiments
We adopted U-Net [17] and 3D U-Net [18] as DNNs in Fig. 1 and compared the performance of the PPC loss to existing methods. We used the baseline using only BCE loss and Dice loss, and evaluated each method by additionally incorporating edge detection loss [11], CWCD loss [8], ROI-based contrastive loss [9], PC loss () [13], the isotropic PPC loss () [16], and the adaptive PPC loss (). In addition, to verify the stability of our method against annotation noise, we performed experiments not only with clean labels, but also with noisy labels during the training and validation phases. During the test phase, clean labels were always used as ground truth (GT). We performed five independent training runs and evaluated the performance using the mean and standard error of the Dice coefficient. The hyperparameters were independently optimized for each experiment using grid search, within , , and .
Experiments were conducted using three publicly available datasets as follows. The first is the JSRT database [19], consisting of 247 chest X-ray images with corresponding masks for the lungs, heart, and clavicles. Data preprocessing and splitting were performed according to ref. [20]. Noisy labels were artificially generated by randomly dilating or eroding the masks following the methods in refs. [20,21]. We trained and evaluated models independently for each class. The second dataset is LIDC-IDRI [22], which we extracted and processed to obtain 13,085 two-dimensional slices of CT with lung nodule masks according to refs. [20,23]. This dataset includes annotations from multiple experts, allowing for the use of natural label noise. Specifically, clean labels were obtained by majority voting across all annotation masks, while a randomly selected single mask was used as the noisy
label. The third dataset is BraTS2020 [24–26], which includes 369 three-dimensional MRI images of the brain and corresponding tumor masks. Data preprocessing and splitting were conducted following ref. [20], and label noise was generated in the same manner as in the JSRT database. U-Net was adopted for two-dimensional segmentation tasks on the JSRT database and LIDC-IDRI, while 3D U-Net was used for BraTS2020.
3. RESULTS
As shown in Table 1, the DNN trained with the adaptive PPC loss demonstrated the best performance in the majority of cases. Notably, significant improvement was achieved for clavicles in chest X-rays and lung nodules in CT. A visual comparison of the segmentation results for the aforementioned cases (Fig. 2) shows particularly remarkable differences at ambiguous boundaries, such as at both ends of clavicles and at the interface between normal tissue and nodules.
Regarding previous methods, the Dice coefficient frequently dropped below that of the baseline when using noisy labels for training (see gray cells in Table 1). This suggests that existing methods, particularly witout prototypical contrastive learning, are not sufficiently robust to annotation noise. In contrast, only our adaptive PPC loss exhibited the stable performance without a decrease in the Dice coefficient even when using noisy labels.
The definition of the background subregion indeed significantly affected segmentation performance (Table 1). We visually compared , which was derived using the logit from the DNN (Eq. (3)) after training had converged, with , which is defined isotropically with a fixed (Eq. (2)). exhibited anisotropic spreading, e.g., along the periph-

Fig. 2. Visual comparison of predictions by the DNN trained with noisy labels. The ground truth (GT) is shown in blue. (Left) Results for the clavicles in the JSRT database. (Right) Results for the nodule in LIDC-IDRI.
ery of the heart, around regions where the clavicle overlaps with the pleura, and at the boundaries between nodules and normal tissue (Fig. 3). This suggests that adaptively and selectively incorporates ambiguous regions into the calculation of the PPC loss.
4. DISCUSSION AND CONCLUSION
In summary, we developed the PPC loss to enable robust training of segmentation models even in the presence of ambiguous object boundaries and unstable annotations in medical images. Across multiple datasets and tasks exhibiting diverse characteristics, our proposed method consistently outperformed the baseline in every experiment.
The novelty of the PPC loss lies in its application of prototypical contrastive learning to improve the capability for recognizing ambiguous object boundaries in fully-supervised settings with both clean and noisy annotations. In instance-wise contrastive learning, loss functions are computed by referencing randomly selected pixel-wise features as positive and negative pairs for the anchor. In the presence of label noise or ill-defined boundaries, randomly sampled pixel-wise features are likely to form inappropriate positive or negative pairs. In contrast, the PPC loss utilizes the prototype, i.e., the mean feature within each class, as the reference for the anchor, making it robust to pixel-level perturbations in annotations. Furthermore, by adaptively detecting boundary-aware ambiguous regions for prototype estimation, the PPC loss successfully achieved stable training of the DNN.
Our method offers several avenues for further performance improvement. First, the PPC loss cannot handle all types of annotation noise. For example, the PPC loss

Fig. 3. Visual comparison of the background subregions . was estimated by the DNN trained with noisy labels. (Top) Results for the heart in the JSRT database. (Middle) Results for the clavicles in the JSRT database. (Bottom) Results for the nodule in LIDC-IDRI.
may not be effective when annotations are consistently larger or smaller than the true labels. In such situations, our method should be combined with, e.g., label correction methods [20,21,23]. Second, the adaptive estimation of background subregion requires two hyperparameters, and . The optimal hyperparameter values might vary across different target types, potentially increasing the burden when training multi-class segmentation models. It is therefore necessary to explore solutions, such as making these hyperparameters learnable or establishing a theoretical framework to determine them analytically. Third, while this study conducted prototypical contrastive learning within a single image, we might be able to compute the loss over multiple images, as demonstrated in ref. [9]. Lastly, this study used all pixels in the foreground to obtain the PPC loss since most target objects were sufficiently small. Segmentation performance may be further improved by extracting the foreground subregion when is sufficiently large, in a manner similar to .
Beyond these methodological considerations, we also highlight the broader potential applicability of our method. For instance, while this study evaluated performance on binary segmentation for a specific target, the PPC loss may benefit the training of foundation models. One can simply incorporate our method by adding the PPC loss to the existing BCE or Dice loss, regardless of the network architecture, as long as feature maps can be obtained. Moreover, recent foundation models often utilize pseudo-labels during training [1, 2], making it increasingly challenging to maintain the quality of teacher labels. The PPC loss is, therefore, expected to be even more effective when training foundation models with large numbers of noisy labels.
Compliance with ethical standards
Ethical approval was not required, as confirmed by the license attached with the open data that we used.
Acknowledgments
The authors are employees of NEC corporation.
5. REFERENCES
[1] Junlong Cheng, Jin Ye, Zhongying Deng, Jianpin Chen, Tianbin Li, Haoyu Wang, et al., “SAM-Med2D,” arXiv:2308.16184, preprint.
[2] Jun Ma, Yuting He, Feifei Li, Lin Han, Chenyu You, and Bo Wang, “Segment anything in medical images,” Nat. Commun., vol. 15, pp. 654, 2024.
[3] Theodore Zhao, Yu Gu, Jianwei Yang, Naoto Usuyama, Ho Hin Lee, Sid Kiblawi, et al., “A foundation model for joint segmentation, detection and recognition of biomedical objects across nine modalities,” Nat. Methods, vol. 22, pp. 166–176, 2025.
[4] Suruchi Kumari and Pravendra Singh, “Annotation Ambiguity Aware Semi-Supervised Medical Image Segmentation,” in CVPR, 2025.
[5] Hong Joo Lee, Jung Uk Kim, Sangmin Lee, Hak Gu Kim, and Yong Man Ro, “Structure Boundary Preserving Segmentation for Medical Image With Ambiguous Boundary,” in CVPR, 2020.
[6] Jiacheng Wang, Fei Chen, Yuxi Ma, Liansheng Wang, Zhaodong Fei, Jianwei Shuai, et al., “XBound-Former: Toward Cross-Scale Boundary Modeling in Transformers,” IEEE Trans. Med. Imag., vol. 42, no. 6, pp. 1735–1745, 2023.
[7] Aimon Rahman, Jeya Maria Jose Valanarasu, Ilker Hacihaliloglu, and Vishal M. Patel, “Ambiguous Medical Image Segmentation Using Diffusion Models,” in CVPR, 2023.
[8] Zhengyong Huang and Yao Sui, “Contour-Weighted Loss For Class-Imbalanced Image Segmentation,” in IEEE ICIP, 2024.
[9] Ye Zhang, Ziyue Wang, Yifeng Wang, Hao Bian, Linghan Cai, Hengrui Li, et al., “Boundary-aware Contrastive Learning for Semi-supervised Nuclei Instance Segmentation,” in MIDL, 2024.
[10] Fengyang Xiao, Sujie Hu, Yuqi Shen, Chengyu Fang, Jinfu Huang, Longxiang Tang, et al., “A Survey of Camouflaged Object Detection and Beyond,” CAAI AIR, vol. 3, pp. 9150044, 2024.
[11] Chunming He, Kai Li, Yachao Zhang, Longxiang Tang, Yulun Zhang, Zhenhua Guo, and Xiu Li, “Camouflaged Object Detection with Feature Decomposition and Edge Reconstruction,” in CVPR, 2023, pp. 22046–22055.
[12] Junnan Li, Pan Zhou, Caiming Xiong, and Steven Hoi, “Prototypical Contrastive Learning of Unsupervised Representations,” in ICLR, 2021.
[13] Ye Du, Zehua Fu, Qingjie Liu, and Yunhong Wang, “Weakly Supervised Semantic Segmentation by Pixel-to-Prototype Contrast,” in CVPR, 2022.
[14] Shihuan He, Zhihui Lai, Ruxin Wang, and Heng Kong, “Prototype Contrastive Consistency Learning for Semi-Supervised Medical Image Segmentation,” arXiv:2502.06650, preprint.
[15] Huimin Wu, Xiaomeng Li, and Kwang-Ting Cheng, “Exploring Feature Representation Learning for Semi-Supervised Medical Image Segmentation,” IEEE Trans. Neural Netw. Learn. Syst., vol. 35, no. 11, pp. 16589–16601, 2024.
[16] YongChao Wang, Bin Xiao, Xiuli Bi, Weisheng Li, and Xinbo Gao, “Boundary-Aware Prototype in Semi-Supervised Medical Image Segmentation,” IEEE Trans. Image Process., vol. 33, pp. 5456–5467, 2024.
[17] Olaf Ronneberger, Philipp Fischer, and Thomas Brox, “U-Net: Convolutional Networks for Biomedical Image Segmentation,” in MICCAI, 2015.
[18] Özgün Çiçek, Ahmed Abdulkadir, Soeren S. Lienkamp, Thomas Brox, and Olaf Ronneberger, “3D U-Net: Learning Dense Volumetric Segmentation from Sparse Annotation,” in MICCAI, 2016.
[19] Junji Shiraishi, Shigehiko Katsuragawa, Junpei Ikezoe, Tsuneo Matsumoto, Takeshi Kobayashi, Ken-ichi Komatsu, et al., “Development of a Digital Image Database for Chest Radiographs With and Without a Lung Nodule,” AJR Am. J. Roentgenol., vol. 174, pp. 71–74, 2000.
[20] Jiachen Yao, Yikai Zhang, Songzhu Zheng, Mayank Goswami, Prateek Prasanna, and Chao Chen, “Learning to Segment from Noisy Annotations: A Spatial Correction Approach,” in ICLR, 2023.
[21] Minqing Zhang, Jiantao Gao, Zhen Lyu, Weibing Zhao, Qin Wang, Weizhen Ding, et al., “Characterizing Label Errors: Confident Learning for Noisy-Labeled Image Segmentation,” in MICCAI, 2020.
[22] Samuel G. Armato III, Geoffrey McLennan, Luc Bidaut, Michael F. McNitt-Gray, Charles R. Meyer, Anthony P. Reeves, et al., “The Lung Image Database Consortium (LIDC) and Image Database Resource Initiative (IDRI): A Completed Reference Database of Lung Nodules on CT Scans,” Med. Phys., vol. 38, pp. 915–931, 2011.
[23] Takuro Shimaya and Masahiro Saiko, “Sam-Correction: Fully Adaptive Label Noise Reduction for Medical Image Segmentation,” in ISBI, 2024.
[24] Bjoern H. Menze, Andras Jakab, Stefan Bauer, Jayashree Kalpathy-Cramer, Keyvan Farahani, Justin Kirby, et al., “The Multimodal Brain Tumor Image Segmentation Benchmark (BRATS),” IEEE Trans. Med. Imag., vol. 34, pp. 1993–2024, 2015.
[25] Spyridon Bakas, Hamed Akbari, Aristeidis Sotiras, Michel Bilello, Martin Rozycki, Justin S. Kirby, et al., “Advancing The Cancer Genome Atlas glioma MRI collections with expert segmentation labels and radiomic features,” Sci. Data, vol. 4, pp. 170117, 2017.
[26] Spyridon Bakas, Spyridon Reyes, Andras Jakab, Stefan Bauer, Markus Rempfler, Alessandro Crimi, et al., “Identifying the Best Machine Learning Algorithms for Brain Tumor Segmentation, Progression Assessment, and Overall Survival Prediction in the BRATS Challenge,” arXiv:1811.02629, preprint.