Models / ResNet-50
code
rebase_editIndustry-Standard Backbone · 04

ResNet-50

Fifty layers, a bottleneck block built from three convolutions wrapped in a shortcut, and 76.01% top-1 on ImageNet-1k's 1000 classes. This page is the convergence point for everything the concept pages built up separately — convolution, receptive field, and the residual fix for vanishing gradients — and every probe in the gallery runs on this model.

analytics76.01% top-125.6M paramsImageNet-1k
Concepts in play
play_circleOne 224×224 image, four stages, one prediction
  1. A 224×224×3 image enters the 7×7 stride-2 stem and max-pool, collapsing to 56×56×64 before a single bottleneck block runs — most of the spatial downsampling happens before stage 1 even starts.
  2. The pulse sweeps through Layer 1 (3 bottlenecks, 56×56×256), Layer 2 (4 bottlenecks, 28×28×512), Layer 3 (6 bottlenecks, 14×14×1024), and Layer 4 (3 bottlenecks, 7×7×2048) — each stage halves resolution and doubles channel width.
  3. Inside every bottleneck, a thin 1×1→3×3→1×1 path runs in parallel with a shortcut that adds the block's input straight back to its output — the residual highway from the Vanishing Gradients page, sixteen blocks deep.
  4. Global average pooling collapses the final 7×7×2048 volume to a 2048-vector, and a linear layer scores all 1000 ImageNet classes — 25.6M parameters total, 76.01% top-1 on the validation set.
  5. Then the cinnamon gradient pulse runs the other way — right to left through every bottleneck's 1×1→3×3→1×1 trunk and every shortcut arc, at full strength. Nothing dims with depth: the residual shortcuts hand the gradient a clean path all the way back to the stem, which is the entire reason a 50-layer network trains at all (the vanishing-gradients fix, sixteen blocks deep).
scienceOpen Workspace

Every model in this gallery is built from the convolution operation, but ResNet-50 is the one that takes the bottleneck variant seriously. A basic block (the kind in CIFAR-100 ResNet-18) is two stacked 3×3 convolutions plus a shortcut. A bottleneck block — ResNet-50's unit, 16 of them stacked across four stages — is three convolutions: a 1×1 that reduces channel count, a 3×3 that does the actual spatial work at that reduced width, and a 1×1 that restores the channel count back up, all wrapped in the same kind of shortcut. The name describes the shape: wide → narrow → wide, like a bottle.

Why squeeze first? Recall the parameter formula for a convolution: params=Cout(k⋅k⋅Cin+1)\text{params} = C_{\text{out}}(k \cdot k \cdot C_{\text{in}} + 1). The cost of a 3×33\times3 layer scales with Cin⋅CoutC_{\text{in}} \cdot C_{\text{out}} — squaring the channel count squares the cost. A 1×1 convolution has k=1k=1, so its only job is channel mixing: it reads every input channel at one spatial position and writes a new, smaller (or larger) set of channels, at a cost of just Cout⋅CinC_{\text{out}} \cdot C_{\text{in}} — no k2k^2 multiplier at all. Put a cheap 1×1 before the expensive 3×3 to shrink CinC_{\text{in}}, and the same 1×1 trick after to restore it, and the expensive op runs at a fraction of the width.

filter_center_focusConcept refresherConvolutionOne small grid of weights, slid across every position, turns pixels into feature maps by dot product.Revisitarrow_forward

A concrete bottleneck from Layer 1, where the block operates on 64-channel, 56×56 feature maps and outputs 256 channels (matching the stage table below). Compare the bottleneck's parameter count against the naive alternative — a single ordinary 3×3 convolution mapping 64 channels straight to 256:

LayerShapekC_inC_outParams
1×1 reduce56×561646464×(1⋅1⋅64+1)=4,16064 \times (1{\cdot}1{\cdot}64+1) = 4{,}160
3×3 work56×563646464×(3⋅3⋅64+1)=36,92864 \times (3{\cdot}3{\cdot}64+1) = 36{,}928
1×1 restore56×56164256256×(1⋅1⋅64+1)=16,640256 \times (1{\cdot}1{\cdot}64+1) = 16{,}640
Bottleneck total————57,728
Naive 3×3 (64→256)56×56364256256×(3⋅3⋅64+1)=147,712256 \times (3{\cdot}3{\cdot}64+1) = 147{,}712
The bottleneck's three convolutions together cost 57,728 parameters — well under half the 147,712 a single 3×3 mapping the same 64→256 channel change would cost, because the expensive k⋅k⋅Cin⋅Coutk{\cdot}k{\cdot}C_{\text{in}}{\cdot}C_{\text{out}} term only appears once, at the squeezed 64-channel width, not at 256.

This is the same factorisation idea as the convolution page's depthwise-separable sidebar, applied differently: instead of splitting spatial from channel-mixing work, the bottleneck keeps the spatial 3×33\times3 but runs it at reduced width, and uses cheap 1×11\times1 channel-mixing convolutions to do the width changes on either side. Across all 16 bottlenecks the saving compounds — it's a large part of why ResNet-50 (25.6M params) sits so much lighter than its layer count alone would suggest, while ResNet-18's 11M basic-block parameters cover only 18 layers.

Each bottleneck also carries a shortcut: the block's input is added back to the 1×1→3×3→1×11\times1{\to}3\times3{\to}1\times1 output, hl+1=hl+F(hl)h_{l+1} = h_l + F(h_l). Where the shapes don't match — the first block of each stage, where channel count or spatial resolution changes — the shortcut itself is a 1×11\times1 convolution (with stride 2 where the stage downsamples) that projects hlh_l into the new shape before the addition. Every other block in a stage uses a pure identity shortcut, no extra parameters at all. The mechanism, and why it exists, is the subject of the Gradient Flow tab.

Zoom out from one block to the whole network and the stage table below is the real architecture. A 224×224×3224\times224\times3 image first passes through a 7×77\times7, stride-2 stem convolution and a max-pool, both before any bottleneck runs — together they take 224→112→56224 \to 112 \to 56, three-quarters of the network's total downsampling, in two non-residual layers. Then four stages of bottlenecks (3, 4, 6, 3 — 16 blocks, 48 convolutions, plus the stem and the final linear layer = 50 weight layers, the '50' in ResNet-50) each halve resolution again while doubling channel width, until Layer 4 outputs 7×7×20487\times7\times2048. Global average pooling and a 1000-way linear layer finish the job.

Stage breakdown

HE_NORMAL INIT
StageOutput ShapeBlocksParams
Stem (Conv1 / Pool)112×112×647×7, 64, stride 29.4K
Layer 156×56×2563 Bottlenecks215.8K
Layer 228×28×5124 Bottlenecks1.21M
Layer 314×14×10246 Bottlenecks7.09M
Layer 47×7×20483 Bottlenecks14.96M
AvgPool & FC1000 (Softmax)Global Avg + Linear2.05M

Receptive Field Growth

7px
11px
43px
107px
235px
483px
InS1S2S3S4Pool

The effective receptive field grows to 483×483 by the final stage.

The real stage breakdown: output shape, block count, and parameter count per stage, plus the receptive-field growth bars reaching 483×483 by the final stage. He-normal initialization throughout — the He init from the Vanishing Gradients page, chosen because every activation here is ReLU.

Now read the receptive field story off that same table, stage by stage, using the recurrence rl=rl−1+(kl−1)jl−1r_l = r_{l-1} + (k_l-1)j_{l-1} and jl=jl−1slj_l = j_{l-1} s_l. The stem alone is doing heavy lifting: a 7×77\times7 stride-2 convolution takes rr from 1 to 7 and jj from 1 to 2 in one layer, then the stride-2 max-pool doubles jj again to 4 — by the time the first bottleneck runs, j=4j=4, meaning every subsequent stride-1 layer's (k−1)=2(k-1)=2 contribution to rr is already worth 2×4=82 \times 4 = 8 input pixels, not 2.

view_in_arConcept refresherReceptive FieldsThe patch of the input a neuron can see — tiny at first, growing with depth, stride, and dilation.Revisitarrow_forward

Each stage transition (the first block of Layer 2, 3, and 4) carries a stride-2 3×33\times3 inside the bottleneck, doubling jj again — so jj climbs 1→2→4→8→16→321 \to 2 \to 4 \to 8 \to 16 \to 32 across stem, pool, and the three stage transitions. By Layer 4, j=32j=32: every remaining stride-1 3×33\times3 adds (3−1)×32=64(3-1)\times32 = 64 pixels of receptive field in a single layer. That's the accelerators mechanism — stride multiplying the jump for everything downstream — running at full strength, and it's why a 7×77\times7 kernel near the output can correspond to a receptive field hundreds of pixels wide on the input. The bars in the figure above show the result: RF reaches roughly 483×483 by the last stage — larger than the 224×224 input itself. Every unit in Layer 4 is structurally capable of being influenced by the entire image, with margin to spare for the padding effects that push theoretical RF past the input size.

That headroom matters because of the effective-vs-theoretical distinction: the effective RF — where the gradient signal actually concentrates — is reliably smaller than the theoretical one, and grows roughly with depth\sqrt{\text{depth}} rather than additively. A theoretical RF of exactly 224 would risk an effective RF that doesn't quite reach the image corners; 483 gives the Gaussian-shaped effective RF (Luo et al., 2016) room to cover the full frame even after it falls off from its theoretical ceiling. This is the architecture-time RF budgeting the receptive-field page describes in the abstract, made concrete: 50 layers, four stages, and a stem aggressive enough that the budget closes with room to spare.

Sources & further reading