MedFormer-AbdomenAtlas3.0
This repository contains a MedFormer model trained on AbdomenAtlas 3.0 for 3D abdominal CT segmentation.
MedFormer is a Transformer-based architecture designed for medical image segmentation.
AbdomenAtlas 3.0 is a large-scale, public abdominal CT dataset comprising 9,262 CT scans from 17 public datasets and 138 medical institutions. It provides per-voxel tumor annotations and radiology reports describing liver, kidney, and pancreatic tumors.
- AbdomenAtlas 3.0: https://github.com/MrGiovanni/RadGPT
- MedFormer: https://github.com/yhygao/CBIM-Medical-Image-Segmentation
- Inference code: https://github.com/PedroRASB/SegmentationFromReports
Instructions
Data format
Organize your CT scans in the following format:
/path/to/dataset/
βββ BDMAP_00000001/
β βββ ct.nii.gz
βββ BDMAP_00000002/
β βββ ct.nii.gz
βββ ...
Create a CSV file containing the case IDs to be processed,
with a column named BDMAP ID:
BDMAP ID
BDMAP_00000001
BDMAP_00000002
Format conversion and CSV creation
If your CT scans are stored as NIfTI files in a single
directory, use the following script to convert them to
the AbdomenAtlas format and generate ids.csv.
python convert_to_abdomenatlas.py \
--input_dir /path/to/flat/ \
--output_dir /path/to/dataset/
Installation
git clone https://github.com/PedroRASB/SegmentationFromReports
cd SegmentationFromReports/rsuper_train
conda create -n rsuper python=3.10 -y
conda activate rsuper
pip install -r requirements.txt
Inference
Download the model checkpoint and label_names.yaml
from this Hugging Face repository.
python predict_abdomenatlas.py \
--load ../../checkpoint/fold_0_latest.pth \
--class_list ../../checkpoint/label_names.yaml \
--img_path /path/to/dataset/ \
--ids /path/to/ids.csv \
--save_path /path/to/outputs/ \
--gpu 0
The script saves the predicted segmentation masks as NIfTI files in a separate directory for each CT scan.
The segmentation classes are specified in label_names.yaml.
Saving tumor probability maps
Add the following argument to the inference command to also save tumor probability maps:
--save_probabilities_lesions
Multi-GPU inference
To accelerate inference across multiple CT scans, distribute the cases across multiple GPUs. For example, using four GPUs:
for p in 0 1 2 3; do
python predict_abdomenatlas.py \
--load ../../checkpoint/fold_0_latest.pth \
--class_list ../../checkpoint/label_names.yaml \
--img_path /path/to/dataset/ \
--ids /path/to/ids.csv \
--save_path /path/to/outputs/ \
--gpu $p \
--parts 4 \
--current_part $p &
done
wait
Papers
RadGPT: Constructing 3D Image-Text Tumor Datasets
IEEE/CVF International Conference on Computer Vision (ICCV), 2025.
A Data-scalable Transformer for Medical Image Segmentation: Architecture, Model Efficiency, and Benchmark
Citations
If you use this model in your research, please cite both AbdomenAtlas 3.0 and MedFormer.
@inproceedings{bassi2025radgpt,
title={RadGPT: Constructing 3D Image-Text Tumor Datasets},
author={Bassi, Pedro R. A. S. and Yavuz, Mehmet Can and
Hamamci, Ibrahim Ethem and Er, Sezgin and
Chen, Xiaoxi and Li, Wenxuan and Menze, Bjoern and
Decherchi, Sergio and Cavalli, Andrea and
Wang, Kang and Yang, Yang and Yuille, Alan and
Zhou, Zongwei},
booktitle={Proceedings of the IEEE/CVF International
Conference on Computer Vision},
pages={23720--23730},
year={2025}
}
@article{gao2022data,
title={A Data-scalable Transformer for Medical Image
Segmentation: Architecture, Model Efficiency,
and Benchmark},
author={Gao, Yunhe and Zhou, Mu and Liu, Di and
Yan, Zhennan and Zhang, Shaoting and
Metaxas, Dimitris N.},
journal={arXiv preprint arXiv:2203.00131},
year={2022}
}
Intended Use
This model is intended for research purposes and has not been validated for clinical use.
For independent evaluation, ensure that your test dataset does not overlap with the model's training data, including the original public datasets incorporated into AbdomenAtlas 3.0.
License
This model is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0).