For Swin-B (Base variant), the parameters in the last stage (stage 4) are as follows:
Swin-B (Last Stage: Stage 4)
Parameter
Value
Explanation
d_model
1024
Channel dimension doubles at each stage: 128 → 256 → 512 → 1024 (stage 4).
n_heads
32
Heads scale with d_model. Since d_head = 32 (fixed), n_heads = 1024 / 32 = 32.
d_head
32
Head dimension is constant across all stages (32).
n_ctx
49
Window size is fixed at 7×7 tokens per window (7×7 = 49 tokens).
Key Notes:
Stage Progression:
Swin-B has 4 stages. The parameters above apply to the final stage (stage 4), where the feature map resolution is smallest (7×7 tokens for a 224×224 input).
Window Size:
The window size (local attention region) is fixed at 7×7 tokens across all stages. In stage 4, the feature map itself is 7×7 tokens, so the entire feature map is treated as a single window.
Patch Merging:
Each stage reduces the spatial resolution by a factor of 2 (via patch merging) and doubles d_model. For a 224×224 input: