Contrastive Transformer-Based Multiple Instance Learning for Weakly Supervised Polyp Frame Detection

Yu Tian, Guansong Pang, Fengbei Liu, Yuyuan Liu, Chong Wang, Yuanhong Chen, Johan Verjans, Gustavo Carneiro

Introduction

Colorectal cancer remains a leading cause of mortality worldwide, making the early detection of polyps during colonoscopy procedures a critical clinical objective. However, manual detection is prone to human error, and developing automated systems is challenging due to the "needle in a haystack" nature of the problem. While deep learning has shown promise, the field is often bifurcated between fully supervised methods—which require prohibitively expensive frame-level annotations—and unsupervised anomaly detection (UAD), which frequently fails to distinguish subtle polyps from healthy tissue.

In this work, researchers propose a Weakly-Supervised Video Anomaly Detection (WVAD) framework. By utilizing only video-level labels (indicating whether a polyp is present anywhere in a video), the model learns to localize specific anomalous frames. This approach significantly reduces the annotation burden while maintaining high diagnostic accuracy.

Methodology

The proposed framework addresses the limitations of standard Multiple Instance Learning (MIL) through two primary innovations: a hybrid Transformer architecture and a contrastive learning strategy.

Convolutional Transformer MIL

Standard Transformers excel at capturing long-range dependencies but often overlook the local temporal correlations inherent in video data, where adjacent frames are highly redundant. To bridge this gap, the authors replaced the traditional linear projection layer in the Transformer with 1D depth-wise separable convolutions. This modification allows the network to model local dependencies between neighboring frames while the self-attention mechanism maintains a global view of the entire video sequence.

Contrastive Snippet Mining (CSM)

A significant challenge in WVAD is the presence of "hard" samples—healthy frames that appear anomalous (e.g., due to water, feces, or surgical tools) and subtle polyps that resemble normal tissue. The Contrastive Snippet Mining (CSM) strategy categorizes snippets into four groups: easy normal, hard normal, easy abnormal, and hard abnormal.

To identify "hard abnormal" snippets, the authors employed a temporal edge detection method using an erosion operator. This technique focuses on transitional frames where a polyp enters or exits the camera's field of view. By applying a contrastive loss, the model is trained to cluster "hard" and "easy" snippets of the same class together in the feature space while maximizing the distance between normal and abnormal clusters.

Joint Optimization

The model is optimized using a multi-objective loss function that balances video-level classification accuracy with snippet-level anomaly scoring. A sparsity regularizer is also implemented, based on the clinical observation that polyps typically occupy only a small fraction of the total procedure time.

Experimental Results

The framework was evaluated on a comprehensive benchmark created by merging the Hyper-Kvasir and LDPolypVideo datasets, totaling over one million frames. This dataset provides a diverse range of polyp morphologies and visibility conditions.

The proposed model achieved state-of-the-art results, outperforming existing WVAD methods such as RTFM and DeepMIL. Key metrics include:

  • AUC (Area Under Curve): 98.41% (a 2% improvement over the previous state-of-the-art).
  • Average Precision (AP): 86.63% (an 8.6% improvement over the previous state-of-the-art).

Qualitative analysis demonstrated the model's robustness against common distractors. While previous methods often produced false positives in the presence of fluid or surgical instruments, the Contrastive Transformer maintained low anomaly scores for these "hard normal" cases, only spiking when a polyp was clearly visible.

Discussion and Future Work

The efficiency of the model—averaging 0.06 seconds per frame for inference—suggests potential for near-real-time clinical integration. However, the current reliance on global self-attention poses a challenge for true "online" processing of live video streams. Future research may explore online self-attention mechanisms and the fine-tuning of feature extractors (such as the I3D backbone) specifically on endoscopic datasets to further enhance sensitivity to subtle pathological features.

Conclusion

By combining the local modeling capabilities of convolutions with the global context of Transformers, and introducing a targeted mining strategy for difficult samples, this research sets a new benchmark for weakly supervised polyp detection. The approach offers a scalable path toward automated colonoscopy assistance without the need for exhaustive manual labeling.

Summary updated

BibTeX
@inproceedings{tian2022contrastive,
  author = {Yu Tian and Guansong Pang and Fengbei Liu and Yuyuan Liu and Chong Wang and Yuanhong Chen and Johan Verjans and Gustavo Carneiro},
  title = {{Contrastive Transformer-Based Multiple Instance Learning for Weakly Supervised Polyp Frame Detection}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2022},
}
Figure