Artificial intelligence-assisted analysis of endoscopic retrograde cholangiopancreatography image for identifying ampulla and difficulty of selective cannulation

Tae-Sung Kim, Jean Hee Kim, Hyuk Soon Choi, Eun Sun Kim, Bora Keum, Yoon Tae Jeen, Hong Sik Lee, Hoon Jai Chun, Sung Yong Han, Dong Uk Kim, Soonwook Kwon, Jaegul Choo, Jae Min LeeScientific 2021 · DOI

Introduction

Endoscopic Retrograde Cholangiopancreatography (ERCP) is a complex procedure for treating biliary and pancreatic disorders. Its success hinges on selective cannulation—the insertion of a catheter into the common bile duct via the Ampulla of Vater (AOV). Due to significant anatomical variation and potential complications like post-procedural pancreatitis, ERCP remains one of the most challenging endoscopic tasks. This paper explores a novel AI-assisted system designed to automate AOV detection and predict cannulation difficulty.

Methodology: The Soft Mask Approach

Traditional object detection models rely on rigid bounding boxes. However, the AOV often lacks distinct boundaries, blending into surrounding duodenal folds. To address this, researchers developed a "soft mask" detection technique.

The soft mask detection process: from raw endoscopic image to a bivariate normal distribution heatmap.

As shown in the figure above, the system transforms expert-annotated bounding boxes into pixel-wise soft masks using a bivariate normal distribution. This creates a probability heatmap where the center of the AOV has the highest value. A U-Net architecture with a VGGNet encoder was utilized for this detection task. For difficulty classification, the study evaluated VGG19, ResNet50, and DenseNet161 architectures, categorizing cases as "easy" or "difficult" based on clinical criteria like procedure time and the need for advanced techniques.

Key Results

The AI system demonstrated high accuracy across both tasks:

  • AOV Detection: The model achieved a mean Intersection-over-Union (mIoU) of 64.1% and a centroid distance of 0.021. Notably, in a head-to-head comparison, the model's mIoU (0.684) surpassed that of a human expert (0.554) when measured against the ground truth.
  • Difficulty Prediction: Using the ResNet50 architecture, the system achieved a recall of 71.9% for easy cases and 61.1% for difficult cases.

Explainability analysis via Grad-CAM revealed that the model focused on specific anatomical cues, such as the "bulging" of the ampulla or specific tissue creases, to determine procedural difficulty.

Discussion and Clinical Implications

The ability to predict cannulation difficulty in real-time could significantly improve ERCP safety by prompting early intervention from senior endoscopists or the use of advanced techniques before repeated attempts cause tissue trauma.

While the study is limited by its use of static images and a retrospective dataset, it proves the feasibility of AI assistance in ERCP. Future work aims to integrate dynamic video analysis and 3D anatomical data (from CT/MRI) to account for internal ductal structures not visible on the mucosal surface.

Conclusion

This AI-assisted system matches human-level performance in locating the AOV and provides promising results for predicting cannulation difficulty. It represents a vital step toward standardized, safer ERCP procedures through real-time computer vision support.

Summary updated

Abstract

The advancement of artificial intelligence (AI) has facilitated its application in medical fields. However, there has been little research for AI-assisted endoscopy, despite the clinical significance of the efficiency and safety of cannulation in the endoscopic retrograde cholangiopancreatography (ERCP). In this study, we aim to assist endoscopists performing ERCP through automatic detection of the ampulla and the identification of cannulation difficulty. We developed a novel AI-assisted system based on convolutional neural networks that predict the location of the ampulla and the difficulty of cannulation to the ampulla. ERCP data of 531 and 451 patients were utilized in the evaluation of our model for each task. Our model detected the ampulla with mean intersection-over-union 64.1%, precision 76.2%, recall 78.4%, and centroid distance 0.021. In classifying the cannulation difficulty, it achieved the recall of 71.9% for the class of easy cases and that of 61.1% for that of difficult cases. Remarkably, our model accurately detected AOV with varying morphological shape, size, and texture on par with the level of a human expert and showed promising results for recognizing cannulation difficulty. It demonstrated its potential to improve the quality of ERCP by assisting endoscopists.
BibTeX
@inproceedings{kim2021artificial,
  author = {Tae-Sung Kim and Jean Hee Kim and Hyuk Soon Choi and Eun Sun Kim and Bora Keum and Yoon Tae Jeen and Hong Sik Lee and Hoon Jai Chun and Sung Yong Han and Dong Uk Kim and Soonwook Kwon and Jaegul Choo and Jae Min Lee},
  title = {{Artificial intelligence-assisted analysis of endoscopic retrograde cholangiopancreatography image for identifying ampulla and difficulty of selective cannulation}},
  booktitle = {Scientific},
  year = {2021},
  doi = {10.1038/s41598-021-87737-3},
}
Figure