SAM-MIL: A Spatial Contextual Aware Multiple Instance Learning Approach for Whole Slide Image Classification

Heng Fang, Sheng Huang, Wenhao Tang, Luwen Huangfu, Bo Liu
7/25/2024
cs.CV

Official code: FangHeng/SAM-MIL (42 stars, Apache-2.0, last commit 2025-05-25).

Abstract

Multiple Instance Learning (MIL) represents the predominant framework in Whole Slide Image (WSI) classification, covering aspects such as sub-typing, diagnosis, and beyond. Current MIL models predominantly rely on instance-level features derived from pretrained models such as ResNet. These models segment each WSI into independent patches and extract features from these local patches, leading to a significant loss of global spatial context and restricting the model's focus to merely local features. To address this issue, we propose a novel MIL framework, named SAM-MIL, that emphasizes spatial contextual awareness and explicitly incorporates spatial context by extracting comprehensive, image-level information. The Segment Anything Model (SAM) represents a pioneering visual segmentation foundational model that can capture segmentation features without the need for additional fine-tuning, rendering it an outstanding tool for extracting spatial context directly from raw WSIs. Our approach includes the design of group feature extraction based on spatial context and a SAM-Guided Group Masking strategy to mitigate class imbalance issues. We implement a dynamic mask ratio for different segmentation categories and supplement these with representative group features of categories. Moreover, SAM-MIL divides instances to generate additional pseudo-bags, thereby augmenting the training set, and introduces consistency of spatial context across pseudo-bags to further enhance the model's performance. Experimental results on the CAMELYON-16 and TCGA Lung Cancer datasets demonstrate that our proposed SAM-MIL model outperforms existing mainstream methods in WSIs classification. Our open-source implementation code is is available at https://github.com/FangHeng/SAM-MIL.

View on arXivView PDF

Code Implementations(1)

FangHeng/SAM-MILOfficial100%
Apache-2.0

[ACM MM 2024] SAM-MIL: A Spatial Contextual Aware Multiple Instance Learning Approach for Whole Slide Image Classification

424Python, Jupyter NotebookApr 19, 20241 years agoApache-2.0

Similar Papers

Cite this paper

@article{fang2024sammil,
  title  = {SAM-MIL: A Spatial Contextual Aware Multiple Instance Learning Approach for Whole Slide Image Classification},
  author = {Heng Fang and Sheng Huang and Wenhao Tang and Luwen Huangfu and Bo Liu},
  year   = {2024},
  eprint = {2407.17689},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.17689v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.17689.svg)](https://codeofpaper.com/paper/2407.17689)

Discussion