Home

Awesome

HiFormer: Hierarchical Multi-scale Representations Using Transformers for Medical Image Segmentation, WACV 2023

Hierarchical Multi-scale Representations for medical image segmentation with state of the art results on synapse multi-organ segmentation, skin lesion segmentation, multiple myeloma cell segmentation. This method designs two multi-scale feature representations using the seminal Swin Transformer module and a CNN-based encoder, then using a Double-Level Fusion (DLF) module, it allows a fine fusion of global and local features. If this code helps with your research please consider citing the following paper: </br>

Moein Heidari*, Amirhossein Kazerouni*, Milad Soltany*, R. Azad, Ehsan Khodapanah Aghdam, Julien Cohen-Adad and Dorit Merhof , "HiFormer: Hierarchical Multi-scale Representations Using Transformers for Medical Image Segmentation", download link.

Please consider starring us, if you found it useful. Thanks!

Updates

This code has been implemented in python language using Pytorch library and tested in ubuntu OS, though should be compatible with related environment. following Environement and Library needed to run the code:

Prepare data, Train/Test

Please go to "Instructions.ipynb" for complete detail on dataset preparation and Train/Test procedure or follow the instructions below. Open In Colab

  1. Download the Synapse Dataset from here.

  2. Run the following code to install the Requirements.

    pip install -r requirements.txt

  3. Run the below code to train HiFormer on the synapse dataset.

    python train.py --root_path ./data/Synapse/train_npz --test_path ./data/Synapse/test_vol_h5  --model_name hiformer-b --batch_size 10 --eval_interval 20 --max_epochs 400 
    

    --root_path [Train data path]

    --test_path [Test data path]

    --eval_interval [Evaluation epoch]

    --model_name [Choose from [hiformer-s, hiformer-b, hiformer-l]]

  4. Run the below code to test HiFormer on the synapse dataset.

    python test.py --test_path ./data/Synapse/test_vol_h5 --model_name hiformer-b --is_savenii --model_weight './hiformer-b_best.pth'
    

    --test_path [Test data path]

    --model_name [choose from [hiformer-s, hiformer-b, hiformer-l]]

    --is_savenii [Whether to save results during inference]

    --model_weight [HiFormer trained model path]

Quick Overview

Diagram of the proposed method

Results

For evaluating the performance of the proposed method, three challenging tasks in medical image segmentaion has been considered. In bellow, results of the proposed approach for synapse multi-organ segmentation is illustrated. </br>

Performance Comparision on Synapse Multi-Organ Segmentation

<h3 align="left">Methods </h3><p>DSC↑</p><p>HD↓</p><p>Aorta</p><p>Gallbladder</p><p>Kidney(L)</p><p>Kidney(R)</p><p>Liver</p><p>Pancreas</p><p>Spleen</p><p>Stomach</p>
DARR69.77-74.7453.7772.3173.2494.0854.1889.9045.96
R50 U-Net74.6836.8787.7463.6680.6078.1993.7456.9085.8774.16
U-Net76.8539.7089.0769.7277.7768.6093.4353.9886.6775.58
R50 Att-UNet75.5736.9755.9263.9179.2072.7193.5649.3787.1974.95
Att-UNet77.7736.0289.5568.8877.9871.1193.5758.0487.3075.75
R50 ViT71.2932.8773.7355.1375.8072.2091.5145.9981.9973.95
TransUnet77.4831.6987.2363.1381.8777.0294.0855.8685.0875.62
SwinUnet79.1321.5585.4766.5383.2879.6194.2956.5890.6676.60
LeVit-Unet78.5316.8478.5362.2384.6180.2593.1159.0788.8672.76
DeepLabv3+ (CNN)77.6339.9588.0466.5182.7674.2191.2358.3287.4373.53
HiFormer-S80.2918.8585.6373.2982.3964.8494.2260.8491.0378.07
HiFormer-B80.3914.7086.2165.6985.2379.7794.6159.5290.9981.08
HiFormer-L80.6919.1487.0368.6184.2378.3794.0760.7790.4482.03

Perceptual visualization results on test data

Synapse Multi-Organ Segmentation result

References

Query

All implementations are done by Amirhossein Kazerouni, Milad Soltany and Moein Heidari. For any query, please contact us for more information.

amirhossein477@gmail.com

soltany.m.99@gmail.com

moeinheidari7829@gmail.com

Citation

@inproceedings{heidari2023hiformer,
  title={Hiformer: Hierarchical multi-scale representations using transformers for medical image segmentation},
  author={Heidari, Moein and Kazerouni, Amirhossein and Soltany, Milad and Azad, Reza and Aghdam, Ehsan Khodapanah and Cohen-Adad, Julien and Merhof, Dorit},
  booktitle={Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
  pages={6202--6212},
  year={2023}
}