TopoSwin-TA36-Research
Research checkpoint with verified offline inference. CT and MR passed both Tesla T4 image execution and actual Docker CPU isolation/geometry checks. Organizer submission remains untested.
A trained Swin UNETR research checkpoint for 36 brain-vessel classes plus background in CT and MR angiography. This is a small, bounded study on the TopBrain/TopAneu TA36 public training release. It is not a clinical system, a challenge winner or a hidden-leaderboard result.
The candidate checkpoint is
pretrained_topology.safetensors (SHA-256
d9e25925150ad389a504a0cb61ff0a9f4b67bf8c19b28f393af7682ce4d62acc).
It has 62,188,423 parameters. The matched Dice-only checkpoint is included under controls/. Aggregate failed-baseline
reports are retained for comparison; failed weights are excluded.
Data and training
TopBrain Challenge Organizers, TopBrain Challenge Data Release, version3 contains 25 paired CT/MR patients. Both modalities of a patient stay in the same partition: 18 patients for training, three for validation and four for descriptive test evaluation. These partitions were already opened in earlier pilots. Follow-up results are descriptive, and the public release's patients cannot be treated as the competition's hidden test set. Raw scans, annotations and patient prediction masks are excluded from the model repository.
The 48-channel Swin UNETR uses 0.6mm resampling, 96Β³ patches, batch2 and 3,000 updates
per condition. Both conditions use the same pretrained encoder, sampling, optimizer and schedule.
The topology condition adds coefficient0.1 soft-clDice after update500 to the Dice/CE loss.
Checkpoint selection uses validation native-grid macro Dice at updates500,1500,3000.
The complete settings, patient split and selection history are in
swin_pretrained_campaign/evaluation.json.
Initialization is the official 2022 self-supervised Swin encoder, pretrained on approximately
5,050 CT scans, released as model_swinvit.pt:
SHA-256 1cf19eca3ed0472daf33dedd2f095b118db16edac0fc53d9e878f328ca68c988.
See the MONAI pretraining source.
Overlap between pretraining patients and TopBrain cannot independently be excluded.
No organizer challenge-trained checkpoint was used.
Measured results
Scores below are means over eight CT/MR cases from four paired test patients. They describe this fixed local split; they are not challenge ranking scores.
| Condition | Native-grid class macro Dice | Merged foreground Dice |
|---|---|---|
| Matched pretrained Swin, Dice/CE | 0.439768 | 0.759012 |
| Matched pretrained Swin, topology loss, BF16 | 0.442193 | 0.787865 |
| Same selected topology checkpoint, FP16 helper | 0.443974 | See FP16 report |
| Bounded full-pipeline nnU-Net,4,000 updates | 0.009902 | 0.554401 |
The nnU-Net run used training-only planning and the standard pipeline but a short schedule. It is a failed bounded baseline, not evidence that Swin beats a converged nnU-Net. The matched BF16 topology gain is small; patient-paired uncertainty and all official metrics must be read before drawing a topology-effect conclusion. FP16 changes predictions slightly and is evaluated independently rather than described as numerically identical.
The frozen organizer evaluator is
CoWBenchmark/TopBrain_Eval_Metrics@7d02e250d22330d3a9fe2408b86f1a3a271d3217.
Its unchanged source tree supplies the neighbor JSON resource missing from its wheel.
FP16 official class Dice is0.443974, class clDice0.448317, class B0 error13.332371,
and class HD95 77.289425mm. Lower is better for the last two; the large distance and
topology errors remain material limitations. The complete per-class and per-case reports
are in swin_fp16_official_metrics/evaluation.json and nnunet_official_metrics/evaluation.json.
Matched-condition official scoring is complete in
swin_pretrained_official_metrics/evaluation.json:
| Official test metric | Dice/CE | Topology loss | Topology minus Dice/CE, paired-patient95% bootstrap interval |
|---|---|---|---|
| Class Dice β | 0.439768 | 0.442193 | +0.002425 [β0.007299,+0.012150] |
| Class clDice β | 0.430877 | 0.446101 | +0.015223 [β0.002728,+0.032665] |
| Class B0 component error β | 21.938430 | 13.363021 | β8.575409 [β10.974311,β6.587605] |
| Class HD95 mm β | 80.362341 | 78.218735 | β2.143605 [β5.310915,+1.275978] |
This supports a descriptive component-error reduction on these four patient groups; Dice, clDice and distance improvements remain uncertain. Bootstrap intervals from four already opened patient groups cannot establish broad generalization.
Local inference
predict.py accepts a locally supplied checkpoint and makes no automatic model or data download.
It converts MHA LPS physical coordinates to NIfTI RAS, applies the training preprocessing,
uses Gaussian sliding-window inference and returns labels on the original physical grid.
Install the pinned dependencies from requirements.txt, download the selected
checkpoint, and run the helper locally. Example:
python predict.py --input-root ./input/images --output-root ./output/images/extended-head-angio-segmentation --weights pretrained_topology.safetensors
The exact tested container can be loaded and run without an account credential:
docker load -i containers/topbrain-swin-fp16.tar
docker run --rm --gpus all --network none --read-only --cap-drop ALL --security-opt no-new-privileges --tmpfs /tmp:rw,size=1g -v /absolute/input:/input:ro -v /absolute/output:/output:rw topbrain-swin:study
Use an output directory writable by UID1000. CPU inference is supported, with
substantially longer runtime. Rebuilding requires putting the root selected
checkpoint beside Dockerfile and predict.py.
The default image entrypoint expects one CT or MR .mha file under
/input/images/head-ct-angio or /input/images/head-mr-angio and writes
/output/images/extended-head-angio-segmentation/<input-filename>.mha.
Output labels are uint8,0β36, with the input origin, spacing, direction and size.
The default CUDA precision is FP16, compatible with a T4; BF16 requires an appropriate newer GPU.
Two native reloads exactly reproduced the cached BF16 predictions. CT/MR MHA round trips
preserved geometry and agreed with their native-grid masks above99.999%.
Container status
The credential-free Dockerfile pins PyTorch2.6/CUDA12.6 and copies only inference code
and the selected checkpoint. Its image archive is3,679,463,936bytes; uncompressed layers
total6,839,424,512bytes. The exact tested archive is included at
containers/topbrain-swin-fp16.tar, SHA-256
18cb9643b46179900217b1cfa2937861b4978a57aebe324f83ab35286acb01e9.
Remote size and digest were verified before the owned temporary bucket was deleted;
containers/archive_verification.json records both checks.
Actual image application execution passed on a Tesla T4 through udocker1.3.17/PRoot.
CT and MR validation inputs retained their size, origin, spacing and direction;
voxel agreement with the independently measured A100 FP16 helper was99.999864% and
99.999927%, respectively. Runtime was34.46s and38.39s. The GPU probe and inherited
network-denial probe also passed. Inputs had read-only file permissions and unchanged
hashes after inference. An additional actual Docker 28.3.2 CPU run of the same image passed both CT and MR
with read-only inputs and root filesystem, no networking, no credentials, non-root
UID1000 and unchanged input hashes. Both outputs preserve size, origin, spacing
and direction and use uint8 labels0β36. Both attempts to write protected paths
failed with EROFS; the outbound connection failed with ENETUNREACH. The report is
local_docker/verification.json. CPU runs took38.67/47.85minutes with a varying
2-to-4CPU quota; these are functional checks, not controlled runtime benchmarks.
No organizer upload, hidden-test evaluation or Grand Challenge acceptance is claimed. The full functional report
is container_verification/verification.json.
The source image and training code preserve their upstream licenses.
Use and limitations
Research use only. Dataset use requires attribution to its owners; commercial use requires their prior permission, as described in the source release. No broader commercial rights to the source data or pretrained components are granted here. The scope is vessel segmentation in this small, fixed dataset; robustness across institutions, scanners, pathologies and clinical workflows has not been established. Small-vessel and rare-class failures are substantial.
Please cite the TopBrain preprint and TopCoW paper listed in the data release, and Tang et al., Self-supervised pre-training of Swin transformers for3D medical image analysis, CVPR2022.