MedMamba-T checkpoints for 16 medical imaging datasets

PyTorch checkpoints of MedMamba-T, a Vision Mamba (state-space model) image classifier, one per dataset. The architecture and training recipe come from MedMamba: Vision Mamba for Medical Image Classification (Yue & Li, 2024). The model code is at github.com/YubiaoYue/MedMamba.

Each .pth file is a plain state_dict, about 58 MB, with about 14.5M parameters.

Checkpoints

Dataset Modality Classes Accuracy* Epoch* File
BloodMNIST Blood cell microscopy 8 97.78% 68 BloodMNIST/Medmamba.pth
BreastMNIST Breast ultrasound 2 85.26% 63 BreastMNIST/Medmamba.pth
CPN X-ray Chest X-ray (COVID / pneumonia / normal) 3 97.13% 75 CPN X-ray/MedMamba.pth
Cervical-US Cervical ultrasound 4 86.22% 54 Cervical-US/MedMamba.pth
DermaMNIST Dermatoscopy 7 77.86% 85 DermaMNIST/Medmamba.pth
Fetal-Planes-DB Fetal ultrasound 6 93.97% 88 Fetal-Planes-DB/MedMamba.pth
Kvasir GI endoscopy 8 78.83% 38 Kvasir/MedMamba.pth
OCTMNIST Retinal OCT 4 92.80% 19 OCTMNIST/Medmamba.pth
OrganAMNIST Abdominal CT (axial) 11 95.23% 12 OrganaMNIST/Medmamba.pth
OrganCMNIST Abdominal CT (coronal) 11 93.50% 26 OrgancMNIST/Medmamba.pth
OrganSMNIST Abdominal CT (sagittal) 11 82.92% 24 OrgansMNIST/Medmamba.pth
Otoscopy2024 Otoscopy 9 89.46% 98 Otoscopy2024/MedMamba.pth
PAD-UFES-20 Smartphone skin lesion photos 6 58.81% 13 PAD-UFES-20/MedMamba.pth
PathMNIST Colon pathology 9 95.25% 3 PathMNIST/Medmamba.pth
PneumoniaMNIST Chest X-ray 2 89.90% 62 PneumoniaMNIST/Medmamba.pth
RetinaMNIST Fundus photography 5 54.25% 20 RetinaMNIST/Medmamba.pth

* Accuracy and epoch come from the original checkpoint filename (model-<epoch>-<accuracy>), which records the evaluation accuracy at the epoch each checkpoint was saved. They aren't independently re-evaluated here.

Some folders use Medmamba.pth and others MedMamba.pth, so copy the path from the table.

Architecture

MedMamba-T, the default VSSM configuration in the MedMamba repo:

  • Patch size 4, 3 input channels
  • Stage depths [2, 2, 4, 2], widths [96, 192, 384, 768]
  • d_state=16, drop_path_rate=0.1
  • Linear head 768 β†’ num_classes

Usage

MedMamba needs a Linux machine with an NVIDIA GPU, plus mamba_ssm and causal_conv1d. See the MedMamba installation notes. Download MedMamba.py from that repo, then:

import torch
from huggingface_hub import hf_hub_download
from MedMamba import VSSM  # MedMamba.py from github.com/YubiaoYue/MedMamba

path = hf_hub_download("Rithvik762/medmamba", "BloodMNIST/Medmamba.pth")
model = VSSM(num_classes=8)  # use the class count from the table
model.load_state_dict(torch.load(path, map_location="cpu"))
model = model.cuda().eval()

Preprocess images the way the MedMamba training script does:

from torchvision import transforms

preprocess = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
])

Output indices follow the class order used in training. The MedMamba script loads data with torchvision.datasets.ImageFolder, which sorts class folder names alphabetically.

Limitations

  • These are research checkpoints. They are not validated for clinical use and must not be used for diagnosis.
  • Accuracy varies a lot between datasets. The models for RetinaMNIST and PAD-UFES-20 are weak.
  • Each model only knows the classes of its own dataset and isn't calibrated for images from other sources.

Licenses

The upstream MedMamba repository doesn't state a license. Each dataset has its own license and terms of use (for example, MedMNIST is CC BY 4.0). Check those before reusing these weights, and cite the datasets you use.

Citation

@article{yue2024medmamba,
  title={MedMamba: Vision Mamba for Medical Image Classification},
  author={Yue, Yubiao and Li, Zhenzhang},
  journal={arXiv preprint arXiv:2403.03849},
  year={2024}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Paper for Rithvik762/medmamba