Swin UNETR for 3D Medical Volumes
Swin UNETR slides shifted 3D windows through volumes so long-range context stays affordable for whole-brain masks.
Why Does This Exist?
3D volumes explode attention: voxels cannot all attend. TransUNet handles slices; brains need 3D. Swin UNETR (2022) partitions volumes into windows, shifts them per layer for cross-talk, and decodes with U-Net skips. Pretraining on unlabeled CT and MRI warms the encoder.
Think of It Like This
Apartment census with shifting block teams
Census teams each cover one block, then shift half a block next round to compare notes across borders. After rounds, every apartment's count reflects neighbors without one giant meeting.
Windows are blocks and shifts are reassignments. The analogy stops at pretraining: teams also practice on empty buildings first.
How It Actually Works
Patch embeds to tokens, then four stages halve resolution while doubling channels to . Shifted windows alternate grids offset by . Decoder upsamples with skips to full mask. Loss is Dice plus cross-entropy over whole, core, enhancing zones.
Worked example
A brain volume tiles into patches of with overlap. A cm enhancing core spans voxels; window attention links it to edema voxels away, lifting enhancing Dice to over CNN-only. Pretraining on unlabeled volumes adds more on small sets.
Watch Out For
Patch seams splitting tumors
Tiling without overlap cuts a core across patches and halves its score. The symptom is straight-line mask cuts. Overlap percent plus Gaussian blending before thresholding.
The Quick Version
- Swin UNETR brings shifted windows to 3D medical volumes.
- Four stages balance local detail against whole-brain context.
- Skips restore voxel edges after window mixing.
- Do not tile without overlap; seams cut tumors in half.
- Unlabeled pretraining helps most on small labeled sets.