The skip-connections preserve spatial detail, making the intermediate feature maps directly
usable as segmentation-quality attention maps without extra supervision.
This model is part of the
GPModels family — a set of inherently-explainable convolutional
networks for simultaneous brain-tumour
classification and
weakly-supervised segmentation
from multi-contrast MRI.
The models were trained and evaluated on the
BraTS 2020 dataset.
1import torch
2from transformers import AutoModel
3
4model = AutoModel.from_pretrained("soumickmj/GPUNet_BraTS2020T1ce_Axial", trust_remote_code=True)
5model.eval()
6
7# x: (B, 1, 240, 240) — T1CE slice, max-normalised
8x = torch.randn(1, 1, 240, 240)
9with torch.no_grad():
10 logits, heatmap = model(x) # eval mode: logits (B,3) + heatmap (B,3,H,W)
11
12pred_class = logits.argmax(dim=1) # 0=Healthy, 1=LGG, 2=HGG
1with torch.no_grad():
2 logits, heatmap = model(x) # heatmap: (B, 3, H, W)
3
4# Whole-tumour map (max over LGG + HGG channels)
5wt_map = heatmap[:, 1:, :, :].max(dim=1).values # (B, H, W)
6
7# Min-max normalise to [0, 1]
8wt_flat = wt_map.view(wt_map.size(0), -1)
9wt_min = wt_flat.min(dim=1).values[:, None, None]
10wt_max = wt_flat.max(dim=1).values[:, None, None]
11wt_norm = (wt_map - wt_min) / (wt_max - wt_min + 1e-8)
12
13# Binary mask via threshold
14binary_mask = (wt_norm > 0.5).float() # (B, H, W)
For advanced post-processing (multi-Otsu, top-k binarisation, morphological
clean-up, per-slice aggregation) see the
project repository.
1
2@article{chatterjee2026weakly,
3 title={Weakly-supervised segmentation using inherently-explainable classification models and their application to brain tumour classification},
4 author={Chatterjee, Soumick and Yassin, Hadya and Dubost, Florian and N{\"u}rnberger, Andreas and Speck, Oliver},
5 journal={Neurocomputing},
6 pages={133460},
7 year={2026},
8 publisher={Elsevier}
9}