DILITHIUM: Attention WNet, weakly supervised, single-axis MIP
3D WNet (Attention WNet) for cerebral vessel segmentation in 7T Time-of-Flight MRA, from the paper DILITHIUM: Deep learning with limited supervision for the segmentation of vessels in high-resolution 7T MRAs using unsupervised and weakly-supervised learning (citation to be added). Code: https://github.com/soumickmj/DILITHIUM
All six models: DILITHIUM collection. Step-by-step instructions for using these models on your own data, recalibrating the binarisation and training: see the GitHub README.
These weights are the models reported in the paper. They replace the earlier upload of this repository.
Contents
Five models, one per cross-validation fold (fold0 ... fold4). Each folder holds config.json, model.safetensors, the modelling code and postprocessing.json, the binarisation rule chosen for that fold.
| fold | validation volumes | checkpoint epoch | binarisation rule | validation Dice (median) |
|---|---|---|---|---|
| fold0 | sub007, sub018, sub020 | 29 | c3 > q=0.993 | 49.1 |
| fold1 | sub015, sub009, sub012 | 32 | c3 > q=0.993 | 52.1 |
| fold2 | sub005, sub011, sub008 | 29 | c2 > q=0.995 | 52.1 |
| fold3 | sub017, sub004, sub014 | 47 | c3 > q=0.997 | 55.3 |
| fold4 | sub006, sub019 | 43 | c3 > q=0.995 | 54.4 |
Training
- Data: StudyForrest 7T TOF-MRA (0.3 mm isotropic) with SMILE-UHURA annotations. 5-fold cross-validation on 14 volumes; each fold is validated on the volumes listed above and trained on the others. The four test volumes were never used for training, checkpoint selection or rule selection.
- Loss: MIP loss (Focal Tversky, weight 0.1) on the axial (z) maximum intensity projection of the annotation, and perceptual reconstruction loss (weight 1.0).
- 50 epochs, learning rate 1e-4, batch size 15, 32x32x32 patches (8,000 per epoch), each patch min-max normalised to [0, 1], 3 % histogram pre-threshold, mixed precision, gradient clipping at norm 1. The checkpoint with the lowest validation loss is released.
Inference, as in the paper
- Pre-threshold: build the intensity histogram of the volume and set voxels at or below 3 % of the intensity range to zero.
- Divide the volume by its maximum (one scale per volume; do not normalise patch by patch at inference).
- Run the encoder on 32x32x32 patches with an overlap of 16 voxels and average overlapping predictions. Outputs: 5 softmax channels (
c0...c4) and a sigmoid single-channel map (feat). - Binarise with the fold's
postprocessing.json: threshold the named channel at the given per-volume quantile (computed on the subsamplex[::5, ::5, ::3]; polarity<means the negated channel), remove connected components smaller than 32 voxels (skimage.morphology.remove_small_objects, connectivity 1) and dilate withskimage.morphology.ball(1).
Label-free binarisation (brightest arg-max cluster, or Otsu thresholding of feat) does not work for these models; the rule in postprocessing.json was chosen on two to three annotated validation volumes.
from transformers import AutoModel
model = AutoModel.from_pretrained("soumickmj/DILITHIUM_WeaklySup_AttWNet3D_MIP", subfolder="fold0", trust_remote_code=True).eval()
class_probs, feature_map = model.model(patches, ops="enc") # patches: (B, 1, 32, 32, 32), volume-normalised
Test results (paper, label-calibrated binarisation, Dice median [IQR] over folds x volumes)
- Three artefact-free test volumes (15 segmentations): 60.6 [55.9, 63.8]
- Test volume with wrap-around artefacts (5 segmentations): 35.0 [32.8, 35.8]
Alternative: calibration without 3D labels
Each postprocessing.json also holds alternative_2d_calibration: the output channel and polarity chosen on the axial MIPs of the validation annotations (2D only), and a threshold set per volume so that the final mask contains the expected vessel fraction of the volume (vessel_fraction, about 1.1 % of the voxels; median of the training annotations). Bisect the per-volume quantile until the post-processed mask has vessel_fraction x (number of voxels) voxels.
Paper results with this alternative (Dice median [IQR]): artefact-free test volumes 64.7 [56.7, 65.1]; test volume with wrap-around artefacts 35.9 [34.6, 36.0].