README.md

March 21, 2025 Β· View on GitHub

MambaMIC: An Efficient Baseline for Microscopic Image Classification with State Space Models

[Paper] [Project Page]

Abstract

In recent years, CNN and Transformer-based methods have made significant progress in Microscopic Image Classification (MIC). However, existing approaches still face the dilemma between global modeling and efficient computation. While the Selective State Space Model (SSM) can simulate long-range dependencies with linear complexity, it still encounters challenges in MIC, such as local pixel forgetting, channel redundancy, and lack of local perception. To address these issues, we propose a simple yet efficient vision backbone for MIC tasks, named MambaMIC. Specifically, we introduce a Local-Global dualbranch aggregation module: the MambaMIC Block, designed to effectively capture and fuse local connectivity and global dependencies. In the local branch, we use local convolutions to capture pixel similarity, mitigating local pixel forgetting and enhancing perception. In the global branch, SSM extracts global dependencies, while Locally Aware Enhanced Filter reduces channel redundancy and local pixel forgetting. Additionally, we design a Feature Modulation Interaction Aggregation Module for deep feature interaction and key feature re-localization. Extensive benchmarking shows that MambaMIC achieves state-of-the-art performance across five datasets.

Overview

accuracy


πŸ’ŽLet's Get Started!

A. Installation

Note that the code in this repo runs under Linux system.

The repo is based on the VMama repo, thus you need to install it first. The following installation sequence is taken from the VMamba repo.

Step 1: Clone the repository:

Clone this repository and navigate to the project directory:

git clone https://github.com/zs1314/MambaMIC.git
cd MambaMIC

Step 2: Environment Setup:

It is recommended to set up a conda environment and installing dependencies via pip. Use the following commands to set up your environment:

Create and activate a new conda environment

conda create -n MambaMIC
conda activate MambaMIC

Install dependencies

pip install -r requirements.txt
cd kernels/selective_scan && pip install .

B. Data Preparation

The five datasets RPE, MHIST , SARS ,TissueMnist and MedMf_colon are used for MIC experiments. Please download them and make them have the following folder/file structure:

${DATASET_ROOT}   # Dataset root directory, for example: /home/username/data
β”œβ”€β”€ RPE
    β”œβ”€β”€ train
    β”‚   β”œβ”€β”€ class 1
    β”‚   β”‚   β”œβ”€β”€00001.png
    β”‚   β”‚   β”œβ”€β”€00002.png
    β”‚   β”‚   β”œβ”€β”€00003.png
    β”‚   β”‚   ...
    β”‚   β”‚
    β”‚   β”œβ”€β”€ class 2
    β”‚   β”‚   β”œβ”€β”€00001.png
    β”‚   β”‚   ... 
    β”‚   β”‚
    β”‚   └── class n
    β”‚       β”œβ”€β”€00001.png 
    β”‚       ...   
    β”œβ”€β”€ val
    β”‚   β”œβ”€β”€ ...
    β”œβ”€β”€ test
    β”‚   β”œβ”€β”€ ...
    β”‚   ...
β”œβ”€β”€ MHIST
β”œβ”€β”€ SARS
β”œβ”€β”€ TissueMnist
β”œβ”€β”€ MedMf_Colon

Or you can download it from here: baidu Netdisk

C. Model Training

python train.py 

D. Model Testing

python test.py 

πŸ₯: Before training and testing, configure the relevant parameters in the script. You are better off calculating the mean and std for each data set, which also helps to further improve model performance. get_means.py

πŸ”Ž Results

  • results in Table 1 of the main paper

  • results in Figure 1 of the main paper

🀝Acknowledgments

This project is based on VMamba (paper, code). Thanks for their excellent works!!

πŸ™‹Q & A

For any questions, please feel free to contact us.

πŸ“œReference

If this code or paper contributes to your research, please kindly consider citing our paper and give this repo ⭐️ 🌝

@article{zou2024microscopic,
  title={MambaMIC: An Efficient Baseline for Microscopic Image Classification with State Space Models},
  author={Zou, Shun and Zhang, Zhuo and Zou, Yi and Gao, Guangwei},
  journal={ICME},
  year={2025}
}