Adaptive Confidence-Wise Loss for Improved Lens Structure Segmentation in AS-OCT

Zunjie Xiao, Xiao Wu, Tianhang Liu, Lingxi Hu, Yinling Zhang, Xiaoqing Zhang, Risa Higashita, Jiang Liu

Abstract

Precise lens structure segmentation is essential for the design of intraocular lenses (IOLs) in cataract surgery. Existing deep segmentation networks typically weight all pixels equally under cross-entropy (CE) loss, overlooking the fact that sub-regions of lens structures are inhomogeneous and that boundary regions often suffer from poor segmentation calibration. We propose an Adaptive Confidence-Wise (ACW) loss to group lens structure sub-regions into different confidence levels via a dynamic threshold, exploiting expert annotation confidence priors. Specifically, ACW clusters target regions into low-confidence and high-confidence groups, applying a region-weighted loss to reweigh them. Furthermore, we introduce Boundary Expected Calibration Error (BECE) to better quantify miscalibration in boundary regions. Extensive experiments demonstrate that ACW significantly outperforms competitive methods, achieving a 6.13% IoU gain and a 4.79% BECE reduction in lens structure segmentation using U-Net.

Introduction

In cataract surgery, highly precise segmentation of lens structures—including the nucleus, cortex, and capsule—from Anterior Segment Optical Coherence Tomography (AS-OCT) images is a prerequisite for successful intraocular lens (IOL) design. While deep learning has advanced medical image segmentation, standard loss functions like Cross-Entropy (CE) treat every pixel with equal importance. This approach ignores the inherent "inhomogeneity" of medical images: certain structures, like the lens capsule, have much more ambiguous boundaries and smaller proportions than others. Clinically, experts naturally focus more on these low-confidence regions. Models trained with uniform weighting often become overconfident yet inaccurate at boundaries, leading to poor calibration—a significant safety concern in clinical applications.

Methods

Adaptive Confidence-Wise (ACW) Loss

The proposed ACW loss shifts the focus from a pixel-level perspective to a region-level perspective. It operates in two primary stages:

  1. Clustering via Adaptive Confidence Threshold Optimization (ACTO): Instead of using a static threshold, the ACTO algorithm dynamically sets a confidence threshold based on the 80th percentile ($Q_{80}$) of predicted probabilities. This ensures a stable 8:2 ratio between high-confidence ($R_h$) and low-confidence ($R_l$) pixels throughout training, preventing loss collapse as the model's overall certainty increases.
  2. Region-Weighted Loss: Once pixels are grouped, ACW applies a suppression term to downweight "easy" high-confidence pixels and an enhancement term to amplify "hard" low-confidence pixels. This forces the network to concentrate its learning capacity on ambiguous boundaries and small, difficult structures.

Boundary Expected Calibration Error (BECE)

To address the limitations of standard Expected Calibration Error (ECE), which measures global calibration, we propose BECE. This metric specifically calculates the discrepancy between accuracy and confidence at structural boundaries, where segmentation errors are most clinically impactful.

Overview of confidence distribution and the proposed BECE metric. (a) AS-OCT image, (b) Confidence map showing lower confidence at boundaries, (c) Confidence distribution across a cross-section, (d) Standard ECE, and (e) Proposed BECE focusing on boundary regions.

Experimental Results

The ACW loss was evaluated on a clinical Lens AS-OCT dataset (857 images), a multi-structure AS-OCT dataset, and the public Synapse multi-organ CT dataset.

Performance Gains

On the Lens AS-OCT dataset using a U-Net backbone, ACW achieved:

  • 6.13% increase in IoU and 4.33% increase in Dice Similarity Coefficient (DSC) compared to standard CE.
  • 4.79% reduction in BECE, indicating significantly improved reliability at structural boundaries.
  • Small Structure Improvement: The capsule region, typically the most challenging to segment, saw a DSC increase from 71.28% (CE) to 81.96% (ACW).

Generalization

The method demonstrated robustness across various architectures, including TransUNet and MedSAM. On the Synapse dataset, ACW improved IoU by 3.08% and DSC by 2.48%, proving its utility beyond ophthalmic imaging.

Discussion and Conclusion

The ACW loss effectively translates clinical intuition—that difficult regions deserve more attention—into a mathematical framework. By dynamically weighting regions based on confidence and introducing the BECE metric, this work provides a path toward more accurate and better-calibrated medical image segmentation. While imaging artifacts remain a challenge, the significant gains in both accuracy and calibration highlight the potential of confidence-wise optimization in safety-critical medical AI applications.

The code for this project is available at: https://github.com/XiaoLing12138/Adaptive-Confidence-Wise-Loss

Summary updated

Abstract

Precise lens structure segmentation is essential for the design of intraocular lenses (IOLs) in cataract surgery. Existing deep segmentation networks typically weight all pixels equally under cross-entropy (CE) loss, overlooking the fact that sub-regions of lens structures are inhomogeneous (e.g., some regions perform better than others) and that boundary regions often suffer from poor segmentation calibration at the pixel level. Clinically, experts annotate different sub-regions of lens structures with varying confidence levels, considering factors such as sub-region proportions, ambiguous boundaries, and lens structure shapes. Motivated by this observation, we propose an Adaptive Confidence-Wise (ACW) loss to group each lens structure sub-region into different confidence sub-regions via a confidence threshold from the unique region aspect, aiming to exploit the potential of expert annotation confidence prior. Specifically, ACW clusters each target region into low-confidence and high-confidence groups and then applies a region-weighted loss to reweigh each confidence group. Moreover, we design an adaptive confidence threshold optimization algorithm to adjust the confidence threshold of ACW dynamically. Additionally, to better quantify the miscalibration errors in boundary region segmentation, we propose a new metric, termed Boundary Expected Calibration Error (BECE). Extensive experiments on a clinical lens structure AS-OCT dataset and other multi-structure datasets demonstrate that our ACW significantly outperforms competitive segmentation loss methods across different deep segmentation networks (e.g., MedSAM). Notably, our method surpasses CE with 6.13% IoU gain, 4.33% DSC increase, and 4.79% BECE reduction in lens structure segmentation under U-Net. The code of this paper is available at https://github.com/XiaoLing12138/Adaptive-Confidence-Wise-Loss.
BibTeX
@misc{xiao2025adaptive,
  author = {Zunjie Xiao and Xiao Wu and Tianhang Liu and Lingxi Hu and Yinling Zhang and Xiaoqing Zhang and Risa Higashita and Jiang Liu},
  title = {{Adaptive Confidence-Wise Loss for Improved Lens Structure Segmentation in AS-OCT}},
  year = {2025},
  eprint = {2508.08705},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.08705},
}
Figure