NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Kernel Self-Attention for Weakly-supervised Image Classification using Deep Multiple Instance Learning

Dawid Rymarczyk, Adriana Borowa, Jacek Tabor, Bartosz Zielinski

Abstract

Multiple Instance Learning (MIL) is a critical framework for weakly-supervised image classification, especially in medical imaging where patch-level labels are often unavailable. Traditional approaches like Attention-based MIL Pooling (AbMILP) assume instance independence, failing to capture spatial and biological context. This paper introduces SA-AbMILP, which integrates a Self-Attention mechanism and explores various kernel functions (e.g., RBF, Laplace) to model inter-instance dependencies. Our results across histology, microbiology, and synthetic datasets demonstrate that SA-AbMILP significantly improves classification performance and interpretability by enabling patches to "communicate" before aggregation.

Introduction

In many real-world scenarios—especially medical imaging—labeling every single pixel or patch is prohibitively expensive. Instead, we use Multiple Instance Learning (MIL), where a "bag" (an entire image) is given a single label, but the "instances" (small patches within that image) are not individually labeled.

The reigning champion for this task has been Attention-based MIL Pooling (AbMILP), which learns to weigh the importance of each patch to determine the bag's label. However, AbMILP has a major blind spot: it assumes every patch is independent. In reality, the biological significance of one tissue patch often depends on its neighbors or the global context of the organ. This paper tackles the challenge of modeling these inter-instance dependencies to move beyond simple "presence-based" classification.

Methods

The authors propose a four-step pipeline called Self-Attention Attention-based MIL Pooling (SA-AbMILP):

  1. Feature Extraction: A CNN (like ResNet or LeNet) converts image patches into feature vectors.
  2. Self-Attention (SA) Layer: This is the core innovation. Before aggregating the patches, the model uses a Self-Attention mechanism to let patches "talk" to each other. Each patch's representation is updated based on its relationship with every other patch in the bag.
  3. Kernel Variations: Standard self-attention uses a dot product to calculate similarity. The authors experiment with replacing this with different kernels—such as Radial Basis Function (RBF), Inverse Quadratic (IQ), and Laplace—to better handle small datasets or non-linear relationships.
  4. AbMILP Aggregation: The "context-aware" patches are then passed through a standard attention-based pooling layer to produce a final, fixed-size vector for classification.
The SA-AbMILP architecture, illustrating the flow from bag of instances to final classification through self-attention and MIL pooling.

Experimental Results

The model was evaluated across five diverse datasets: MNIST-MIL, Breast and Colon Cancer histology, DIFaS microbiology, and Messidor retinal imaging.

Quantitative Performance

SA-AbMILP consistently outperformed the baseline AbMILP, particularly as the MIL assumptions became more complex. On the colon cancer dataset, the proposed method achieved an AUC of 98.1%, outperforming the baseline's 97.3%. It also showed significantly higher recall, which is critical in medical settings to avoid false negatives. In microbiological tasks (DIFaS), SA-AbMILP reached an accuracy of 80.1%, a notable jump from the 77.5% achieved by standard AbMILP.

Performance comparison (AUC) across three MIL assumptions: (a) Standard, (b) Presence-based, and (c) Threshold-based, showing the advantage of kernel-based self-attention.

Key Insights

  • Contextual Awareness: By using Self-Attention, the model can recognize that a specific cell is more important if it appears near other specific structures.
  • Kernel Robustness: The dot product isn't always the best way to measure similarity, especially when training data is scarce. The authors found that Laplace and Inverse Quadratic kernels often provided more robust results on smaller or more complex datasets.
  • Interpretability: Qualitative results showed that SA-AbMILP is more selective than standard attention, highlighting fewer, more relevant patches (like specific nuclei in cancer biopsies), which aids human interpretation.

Discussion and Conclusion

While SA-AbMILP offers significant performance gains, its computational complexity scales quadratically with the number of instances, which may be a bottleneck for extremely high-resolution whole-slide images. Additionally, the choice of kernel adds a layer of hyperparameter tuning. Future work will focus on scaling these methods to larger bag sizes and integrating prototype networks to further enhance interpretability. Overall, SA-AbMILP demonstrates that modeling instance dependencies is vital for robust weakly-supervised image classification.

Summary updated

BibTeX
@inproceedings{rymarczyk2021kernel,
  author = {Dawid Rymarczyk and Adriana Borowa and Jacek Tabor and Bartosz Zielinski},
  title = {{Kernel Self-Attention for Weakly-supervised Image Classification using Deep Multiple Instance Learning}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2021},
  doi = {10.1109/wacv48630.2021.00176},
}
Figure