Code for ISBI-2025 Conference - INSTANCE-AWARE DEEP LEARNING FOR LIVER METASTASIS SEGMENTATION
This project focuses on investigating the use of instance-aware loss approach in deep segmentation models applied to the detection and segmentation of liver colorectal metastases (CRLM).
- Automated liver and tumor segmentation using pre-trained SwinUNETR models
- Support for two model variants: standard SwinUNETR and instance-aware SwinUNETR
- Post-processing with volume-based filtering and connected component analysis
- Output segmentation masks with 3 classes (0: background, 1: liver, 2: tumors)
- CT scans must be provided in NIfTI format (.nii.gz)
- Images will be processed in abdominal CT window settings
- Our models were trained on scans resampled to 1.5×1.5×2.0 mm³ voxels
Pre-trained weights for two SwinUNETR variants are available:
- SwinUNETRb: Baseline model trained with standard Dice+CE loss
- SwinUNETR•: Enhanced model incorporating instance-aware loss for improved small lesion detection
Access to model weights is provided through our cloud archive https://drive.google.com/drive/folders/1II_7cp-it7lI2vnUGDgD33SSSHpaROuV?usp=sharing.
Configure the input/output paths and model selection:
directory = "" # Input directory containing .nii.gz files
output_dir = "" # Output directory for segmentation results
weights_path = "" # Path to pre-trained model weightsInstall the dependencies
pip install -r requirements.txtRun the inference :
python inference.pyThe script will:
- Process all .nii.gz files in the input directory
- Generate segmentation masks with labeled regions:
- 0: Background
- 1: Liver tissue
- 2: Tumor regions
- Apply post-processing to filter small components and retain only significant lesions
- Save the results as NIfTI files in the specified output directory
As detailed in our paper, the models demonstrate different strengths:
- SwinUNETRb achieves balanced performance across lesion sizes
- SwinUNETR• shows improved detection of small lesions (<1000mm³)
- Both variants achieve high recall but may generate more false positives compared to traditional approaches (eg, nn-Unet).
Post-processing helps filter out small artifact components with a fixed volume threshold to reduce false positives generation.
If you use this code in your research, please cite our paper:
@inproceedings{Abbas2025Instance,
author = {Abbas, M. and Andrade-Miranda, G. and Jaouen, V. and Bourbonne, V. and Bert, J. and Visvikis, D. and Badic, B. and Conze, P.-H.},
booktitle = {2025 {IEEE} 22nd {International} {Symposium} on {Biomedical} {Imaging} ({ISBI})},
doi = {10.1109/isbi60581.2025.10980698},
year = {2025},
month = {4},
pages = {1--5},
organization = {IEEE},
title = {Instance-{Aware} {Deep} {Learning} for {Liver} {Metastasis} {Segmentation}},
url = {http://dx.doi.org/10.1109/ISBI60581.2025.10980698},
}