CENet: Context Enhancement Network for Medical Image Segmentation
Official pretrained weights for CENet (MICCAI 2025, early accept, top 9%), a 2D segmentation network for abdominal CT, cardiac MRI and dermoscopy images.
CENet uses a PVTv2-B2 encoder and adds two modules:
- DSEB (Dual Selective Enhancement Block) in the skip connections, which sharpens boundaries and helps with small organs.
- CFAM (Context Feature Attention Module) in the decoder, a multi-scale block that keeps spatial detail and reduces redundant features.
Quick start
You do not need to clone anything. PyTorch Hub fetches the model code from GitHub, and the weights are downloaded from this repository.
pip install torch torchvision timm==1.0.16 monai==1.4.0 "numpy<2" scipy SimpleITK huggingface_hub
Segment your own images
The predictor applies the same preprocessing as in training and returns a mask with the size of your input.
import torch
# Skin lesion (dermoscopy image)
skin = torch.hub.load("xmindflow/cenet", "predictor", dataset="ham10000", trust_repo=True)
mask = skin.predict("lesion.jpg") # (H, W): 0 = background, 1 = lesion
# Abdominal CT (NIfTI volume, processed slice by slice)
ct = torch.hub.load("xmindflow/cenet", "predictor", dataset="synapse", trust_repo=True)
mask = ct.predict("abdomen_ct.nii.gz") # (D, H, W)
print(ct.classes) # label names, index = label value
predict accepts a file path (.png, .jpg, .npy, .nii, .nii.gz), a PIL image or a NumPy array. It runs on the GPU if one is available.
Use the model directly
model = torch.hub.load("xmindflow/cenet", "cenet", dataset="synapse", trust_repo=True)
x = torch.randn(1, 1, 224, 224) # one preprocessed slice
with torch.no_grad():
logits = model(x) # (1, 9, 224, 224)
pred = logits.argmax(dim=1)
The original model reported in the paper for Synapse is available as torch.hub.load("xmindflow/cenet", "cenet_org", trust_repo=True).
Models
dataset |
Task | Input | Labels | File |
|---|---|---|---|---|
synapse |
Abdominal CT, 8 organs | 1 × 224 × 224 | 0 background, 1 aorta, 2 gallbladder, 3 left kidney, 4 right kidney, 5 liver, 6 pancreas, 7 spleen, 8 stomach | synapse_2418962.pth |
acdc |
Cardiac MRI | 1 × 224 × 224 | 0 background, 1 right ventricle, 2 myocardium, 3 left ventricle | acdc_2418732.pth |
ham10000 |
Skin lesion | 3 × 224 × 224 | 0 background, 1 lesion | ham10k_2418602.pth |
ph2 |
Skin lesion | 3 × 224 × 224 | 0 background, 1 lesion | ph2_2418571.pth |
cenet_org |
Abdominal CT, original paper model | 1 × 224 × 224 | same as synapse |
synapse_cenet_org_2352272.pth |
Each file is a plain PyTorch state_dict (about 130 MB).
Preprocessing
The predictor does this for you. If you call the model directly, prepare inputs the same way:
- Synapse (CT): axial slices. Clip Hounsfield units to [-125, 275], scale to [0, 1], resize to 224 × 224 (cubic), then normalize with mean 0.5 and std 0.5.
- ACDC (MRI): short-axis slices. Scale intensities to [0, 1], resize to 224 × 224 (cubic).
- HAM10000 / PH2 (dermoscopy): RGB image. Resize to 224 × 224 (bilinear), divide by 255, then min-max normalize the image to [0, 1].
Predictions are made at 224 × 224 and resized back with nearest-neighbor interpolation.
Results
To reproduce the paper's numbers, use the evaluation scripts in the GitHub repository. The README explains how to get and prepare each dataset.
Download the weights only
hf download afshinbigboy/CENet --include "*.pth" --local-dir weights
or in Python:
from huggingface_hub import hf_hub_download
path = hf_hub_download(repo_id="afshinbigboy/CENet", filename="synapse_2418962.pth")
Intended use and limitations
These models are for research only. They are not a medical device and must not be used for diagnosis or treatment decisions. Each model was trained on a single public dataset and may perform poorly on images from other scanners, protocols or populations.
License
The code and weights are released under the MIT license. The training datasets have their own terms (for example, HAM10000 is CC BY-NC 4.0), so please also respect the license of each dataset.
Citation
If you use CENet, please cite:
@InProceedings{BozAfs_CENet_MICCAI2025,
author = {Bozorgpour, Afshin and Kolahi, Sina Ghorbani and Azad, Reza and Hacihaliloglu, Ilker and Merhof, Dorit},
title = {{CENet}: Context Enhancement Network for Medical Image Segmentation},
booktitle = {Medical Image Computing and Computer Assisted Intervention -- MICCAI 2025},
series = {Lecture Notes in Computer Science},
volume = {15960},
pages = {120--129},
year = {2025},
publisher = {Springer Nature Switzerland},
address = {Cham},
doi = {10.1007/978-3-032-04927-8_12}
}


