{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreihuezhnkrwm4y2v7hdkluanom5udnskun5fzeitzv27oirrtvf54m",
"uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mope6nzn54g2"
},
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreiclhjhusq2rqn46mbqnhge6etddwdrpwu47eb67ocsxov566lfply"
},
"mimeType": "image/webp",
"size": 64354
},
"path": "/dev48v/pooling-in-cnns-shrink-the-map-keep-what-matters-1p74",
"publishedAt": "2026-06-20T07:02:56.000Z",
"site": "https://dev.to",
"tags": [
"machinelearning",
"deeplearning",
"ai",
"beginners",
"https://dev48v.infy.uk/dl/day9-pooling.html",
"Pool a grid."
],
"textContent": "After a few conv layers you're drowning in feature maps ā too big and slow. Pooling shrinks them while keeping the signal, and it has zero parameters. Four numbers in, one out.\n\nšŖ **Max vs average pooling:** https://dev48v.infy.uk/dl/day9-pooling.html\n\n## The operation\n\n\n for (let y = 0; y < h; y += 2) // stride 2: hop, don't slide\n for (let x = 0; x < w; x += 2) {\n const win = [img[y][x], img[y][x+1], img[y+1][x], img[y+1][x+1]];\n out[y/2][x/2] = reduce(win); // 2Ć2 ā 1 value, halves both dims\n }\n\n\n## Max pool ā keep the strongest\n\n\n const reduce = (w) => Math.max(...w);\n\n\nA feature detector asks \"is this feature here?\" ā max pooling answers \"yes, somewhere in this region it fired\", keeping the feature's presence while discarding its exact location.\n\n## Average pool ā smooth it\n\n\n const reduce = (w) => w.reduce((a,b)=>a+b) / w.length;\n\n\nCommon at the end of a network (global average pooling) to summarise each map before the classifier.\n\n## The real point: translation tolerance\n\nBecause pooling reports \"feature present in region\", shifting the input a pixel barely changes the output. That invariance is why a CNN recognises a cat whether it's top-left or centre.\n\nAnd it's free ā no learnable weights. (Modern nets sometimes use strided convolutions instead, but the intent is identical.)\n\n## The takeaway\n\nHop in 2Ć2s, keep the max ā smaller maps, position-tolerant, zero params. Pool a grid.",
"title": "Pooling in CNNs: Shrink the Map, Keep What Matters"
}