NCDD: Nearest Centroid Distance Deficit for Out-Of-Distribution Detection in Gastrointestinal Vision
Sandesh Pokhrel, Sanjay Bhandari, Sharib Ali, Tryphon Lambrou, Anh Nguyen, Yash Raj Shrestha, Angus Watson, Danail Stoyanov, Prashnna Gyawali, Binod Bhattarai
TL;DR
This work tackles the reliability issue of deep learning in gastrointestinal vision by treating abnormality detection as an out-of-distribution (OOD) problem. It introduces Nearest Centroid Distance Deficit (NCDD), a post-hoc score that leverages both the nearest-centroid distance and the dispersion to non-nearest centroids in the feature space to differentiate in-distribution (ID) normal anatomical landmarks from OOD abnormalities. Centroids are computed per ID class in the learned feature space, and the final OOD score combines D_μm and D_μn with data-dependent weighting, enabling effective OOD detection across multiple backbones on two GI benchmarks (Kvasirv2 and GastroVision). Experimental results show NCDD outperforms state-of-the-art OOD methods (e.g., MSP, ODIN, Energy, Entropy, MaxLogit, KNN-OOD) in AUC and FPR95 across architectures, demonstrating its potential as a simple, post-hoc, and clinically relevant tool with possible clinician-in-the-loop deployment. The work highlights the practical impact of centroid-based feature-space analysis for reliable GI endoscopy AI applications.
Abstract
The integration of deep learning tools in gastrointestinal vision holds the potential for significant advancements in diagnosis, treatment, and overall patient care. A major challenge, however, is these tools' tendency to make overconfident predictions, even when encountering unseen or newly emerging disease patterns, undermining their reliability. We address this critical issue of reliability by framing it as an out-of-distribution (OOD) detection problem, where previously unseen and emerging diseases are identified as OOD examples. However, gastrointestinal images pose a unique challenge due to the overlapping feature representations between in- Distribution (ID) and OOD examples. Existing approaches often overlook this characteristic, as they are primarily developed for natural image datasets, where feature distinctions are more apparent. Despite the overlap, we hypothesize that the features of an in-distribution example will cluster closer to the centroids of their ground truth class, resulting in a shorter distance to the nearest centroid. In contrast, OOD examples maintain an equal distance from all class centroids. Based on this observation, we propose a novel nearest-centroid distance deficit (NCCD) score in the feature space for gastrointestinal OOD detection. Evaluations across multiple deep learning architectures and two publicly available benchmarks, Kvasir2 and Gastrovision, demonstrate the effectiveness of our approach compared to several state-of-the-art methods. The code and implementation details are publicly available at: https://github.com/bhattarailab/NCDD
