MCPcopy Index your code
hub / github.com/SLDGroup/EMCAD

github.com/SLDGroup/EMCAD @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
244 symbols 572 edges 20 files 17 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

EMCAD

Official Pytorch implementation of the paper EMCAD: Efficient Multi-scale Convolutional Attention Decoding for Medical Image Segmentation published in CVPR 2024. arxiv code video

Md Mostafijur Rahman, Mustafa Munir, Radu Marculescu

The University of Texas at Austin

🔍 Check out our papers: LoMix [NeurIPS 2025], EfficientMedNeXt [MICCAI 2025], EffiDec3D [CVPR 2025], MK-UNet [ICCVW 2025], PP-SAM [CVPRW 2024], G-CASCADE [WACV 2024], MERIT [MIDL 2023], CASCADE [WACV 2023]

Update

🚀 January 12, 2026: Polyp training and inference code released!!!!

➡️ Please follow our CASCADE training and inference code for ACDC dataset!!!

🚀 May 6, 2025: Synapse inference code released!!!

🚀 September 12, 2024: Synapse training code released!!!

Architecture

Quantitative Results

Qualitative Results

Usage:

Recommended environment:

Please run the following commands.

conda create -n emcadenv python=3.8
conda activate emcadenv

pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html

pip install -r requirements.txt

Data preparation:

  • Synapse Multi-organ dataset: Sign up in the official Synapse website and download the dataset. Then split the 'RawData' folder into 'TrainSet' (18 scans) and 'TestSet' (12 scans) following the TransUNet's lists and put in the './data/synapse/Abdomen/RawData/' folder. Finally, preprocess using python ./utils/preprocess_synapse_data.py or download the preprocessed data and save in the './data/synapse/' folder. Note: If you use the preprocessed data from TransUNet, please make necessary changes (i.e., remove the code segment (line# 88-94) to convert groundtruth labels from 14 to 9 classes) in the utils/dataset_synapse.py.

  • ACDC dataset: Download the preprocessed ACDC dataset from Google Drive and move into './data/ACDC/' folder.

  • Polyp datasets: Download the splited polyp datasets from Google Drive and move into './data/polyp/' folder.

Pretrained model:

You should download the pretrained PVTv2 model from Google Drive or PVT GitHub, and then put it in the './pretrained_pth/pvt/' folder for initialization.

Training:

cd into EMCAD
python -W ignore train_synapse.py --root_path /path/to/train/data --volume_path path/to/test/data --encoder pvt_v2_b2         # replace --root_path and --volume_path with your actual path to data.

Trained Weights on Synapse Dataset:

You can download the trained weights on Synapse dataset from Google Drive.

Testing:

cd into EMCAD 

Acknowledgement

We are very grateful for these excellent works timm, CASCADE, MERIT, G-CASCADE, PP-SAM, PraNet, Polyp-PVT and TransUNet, which have provided the basis for our framework.

Citations

@inproceedings{rahman2024emcad,
  title={Emcad: Efficient multi-scale convolutional attention decoding for medical image segmentation},
  author={Rahman, Md Mostafijur and Munir, Mustafa and Marculescu, Radu},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={11769--11779},
  year={2024}
}

Core symbols most depended-on inside this repo

resize
called by 13
utils/dataloader.py
act_layer
called by 6
lib/decoders.py
structure_loss
called by 5
train_polyp.py
_pad
called by 4
utils/misc.py
MSCBLayer
called by 4
lib/decoders.py
_make_layer
called by 4
lib/resnet.py
step
called by 3
utils/misc.py
get_loader
called by 3
utils/dataloader_polyp.py

Shape

Method 135
Function 55
Class 54

Languages

Python100%

Modules by API surface

lib/pvtv2.py43 symbols
utils/joint_transforms.py34 symbols
lib/decoders.py32 symbols
utils/utils.py24 symbols
utils/misc.py24 symbols
lib/resnet.py16 symbols
utils/dataloader.py15 symbols
utils/transforms.py14 symbols
utils/dataset_synapse.py9 symbols
utils/dataset_ACDC.py9 symbols
utils/dataloader_polyp.py6 symbols
train_polyp.py5 symbols

For agents

$ claude mcp add EMCAD \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact