CNN에서 풀링: 지도 축소, 중요한 사항 유지

작성자

카테고리:

← 피드로
DEV Community · Devanshu Biswas · 2026-06-20 개발(SW)

Devanshu Biswas

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.

🪟 Max vs average pooling: https://dev48v.infy.uk/dl/day9-pooling.html

The operation

for (let y = 0; y < h; y += 2)        // stride 2: hop, don't slide
  for (let x = 0; x < w; x += 2) {
    const win = [img[y][x], img[y][x+1], img[y+1][x], img[y+1][x+1]];
    out[y/2][x/2] = reduce(win);       // 2×2 → 1 value, halves both dims
  }

Enter fullscreen mode Exit fullscreen mode

Max pool — keep the strongest

const reduce = (w) => Math.max(...w);

Enter fullscreen mode Exit fullscreen mode

A 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.

Average pool — smooth it

const reduce = (w) => w.reduce((a,b)=>a+b) / w.length;

Enter fullscreen mode Exit fullscreen mode

Common at the end of a network (global average pooling) to summarise each map before the classifier.

The real point: translation tolerance

Because 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.

And it’s free — no learnable weights. (Modern nets sometimes use strided convolutions instead, but the intent is identical.)

The takeaway

Hop in 2×2s, keep the max → smaller maps, position-tolerant, zero params. Pool a grid.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다