Multi-SWAV: Self-Supervised Learning for Spatio-Temporal Enhanced Ultrasound-Based Prostate Cancer Detection
This repository contains the implementation of a novel multi-modal framework for prostate cancer detection in ultrasound data, published at ISBI 2025
This repository is the official implementation of the ISBI 2025 paper:
Self-supervised Prototype Learning for Spatio-Temporal Enhanced Ultrasound-based Prostate Cancer Detection.
Prostate cancer detection in ultrasound data presents significant challenges due to the highly heterogeneous nature of the cancer and its appearance in ultrasound images. In this work, we introduce a novel multi-modal framework that integrates spatial information in ultrasound images with temporal time-series signals across a sequence of ultrasound images for robust prostate cancer detection. Our framework employs a clustering-based self-supervised learning approach, which allows the model to learn shared, complementary representations from combined spatio-temporal data. This approach not only captures the unique properties of spatial and temporal information, but also enhances the model's ability to handle noisy labels due to imperfect alignment between imaging data and histopathology reports, resulting in improved classification performance. Our method achieves a 7% improvement in AUC and a 10% increase in balanced accuracy compared to models relying on spatial or temporal ultrasound data alone.
- Multi-modal Architecture: Integrates spatial ultrasound images with temporal time-series signals
- Self-supervised Learning: Clustering-based approach for learning complementary representations
- Robust to Noisy Labels: Handles imperfect alignment between imaging data and histopathology reports
- Multiple Model Support: Includes InceptionTime, TimesNet, Transformer, and ResNet architectures
- Comprehensive Evaluation: Supports various evaluation metrics and cross-validation
- Python 3.8+
- PyTorch 1.9+
- CUDA (optional, for GPU acceleration)
- Clone the repository:
git clone https://github.com/DeepRCL/Multi-SWAV.git
cd Multi-SWAV- Install dependencies:
pip install -r requirements.txt- Install the package in development mode:
pip install -e .The code includes a default file_resolver function in main.py that maps dataset metadata to file paths. You may need to modify this function based on your specific data structure and file naming conventions.
The expected dataset structure should be organized as follows:
data/
├── BK_CENTER_CORES/
│ ├── patXX_corX_rf.npy # RF ultrasound data
│ ├── patXX_corX_needle.npy # Needle segmentation masks
│ ├── patXX_corX_prostate.npy # Prostate segmentation masks
│ ├── patXX_corX_bmode.npy # B-mode ultrasound images
│ └── patXX_corX_roi.npy # Region of interest masks
└── metadata.csv # Dataset metadata with splits
The metadata.csv file should contain the following columns:
id: Unique identifier for each corePatientId: Patient identifiercenter: Data collection centerfiletemplate: File naming templatefold_idx: Cross-validation fold index (0-4)set_name: Dataset split (train/val/test)TrueLabel: Ground truth label (0: benign, 1: cancer)Involvement: Cancer involvement percentageGleasonScore: Gleason score
Train a model with default settings:
python main.py --dataset_name patch_1d --model_name inception --epochs 100Use configuration files for complex setups:
python main.py --config configs/baseline_16_16.yaml- InceptionTime:
--model_name inception - TimesNet:
--model_name timesnet - Transformer:
--model_name transformer - ResNet:
--model_name resnet
- 1D Patch:
--dataset_name patch_1d - 2D Patch:
--dataset_name patch_2d - 3D Patch:
--dataset_name patch_3d - TeUS Patch:
--dataset_name patch_teus - Needle TeUS:
--dataset_name needle_teus
Enable unsupervised pre-training:
python main.py --dataset_name patch_1d --model_name inception \
--unsupervised_epochs 10 --unsupervised_lr 0.001Use co-teaching for robust training with noisy labels:
python main.py --dataset_name patch_1d --model_name inception \
--use_coteaching --forget_rate 0.2--epochs: Number of training epochs--batch_size: Batch size for training--learning_rate: Learning rate--fold_idx: Cross-validation fold (0-4)--seq_len: Sequence length for temporal models--patch_dim: Patch dimensions (height, vertical_stride, horizontal_stride)--min_inv: Minimum cancer involvement threshold--min_gs: Minimum Gleason score threshold
--criterion ce: Cross-entropy loss--criterion isomax: IsoMax loss--criterion focal: Focal loss
--optim adam: Adam optimizer--optim sgd: SGD optimizer--optim novograd: NovoGrad optimizer--optim lion: Lion optimizer
The framework evaluates models using:
- AUC: Area Under the ROC Curve
- Balanced Accuracy: Balanced classification accuracy
- Sensitivity: True positive rate
- Specificity: True negative rate
The framework supports 5-fold cross-validation:
for fold in {0..4}; do
python main.py --dataset_name patch_1d --model_name inception --fold_idx $fold
doneOur Multi-SWAV framework achieves:
- 7% improvement in AUC compared to spatial-only models
- 10% increase in balanced accuracy compared to temporal-only models
- Robust performance across different data splits and noise levels
Multi-SWAV/
├── main.py # Main training script
├── build.py # Model and data loader setup
├── configs.py # Configuration classes
├── src/
│ ├── data/ # Data loading and preprocessing
│ ├── networks/ # Model architectures
│ └── training/ # Training loops and utilities
├── utils/ # Utility functions and loss functions
├── configs/ # Configuration files
└── notebooks/ # Jupyter notebooks for analysis
If you use this code in your research, please cite our paper:
@INPROCEEDINGS{10981217,
author={Elghareb, Tarek and Jamzad, Amoon and Nhat To, Minh Nguyen and Fooladgar, Fahimeh and Wilson, Paul F.R. and Sojoudi, Samira and Reznik, Gabrielle and Leveridge, Michael and Siemens, Robert and Chang, Silvia and Black, Peter and Mousavi, Parvin and Abolmaesumi, Purang},
booktitle={2025 IEEE 22nd International Symposium on Biomedical Imaging (ISBI)},
title={Self-supervised Prototype Learning for Spatio-Temporal Enhanced Ultrasound-based Prostate Cancer Detection},
year={2025},
volume={},
number={},
pages={1-5},
keywords={Ultrasonic imaging;Accuracy;Biological system modeling;Prototypes;Self-supervised learning;Data models;Robustness;Noise measurement;Prostate cancer;Principal component analysis;Prostate Cancer;Ultrasound Imaging;Multi-Modal SSL learning;Robustness},
doi={10.1109/ISBI60581.2025.10981217}}