CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Artificial Intelligence / How Machines See and Hear

Pooling: Zooming Out

Lesson 4 of 10 · 7 min · Free, no account needed

What you will learn

  • Max pooling cuts a feature map into 2 × 2 blocks and keeps only the biggest number in each.
  • Each pooling halves the width and height: 32 × 32 becomes 16 × 16, then 8 × 8.
  • A small shift changes most of a detailed map but very little of a pooled one: shift tolerance.
  • Too much pooling blurs the shape away, so networks pool a little at a time.

Start the lesson

How the lesson goes

  1. Move your face a little and your phone still knows you. Why doesn't one pixel fool it?

    First, a guess. Drag the marker, then Check.

  2. Zoom out a feature map: keep only the strongest number in each block.

    Tap the biggest number in each colored 2 × 2 block, then Check.

    Max pooling keeps the largest value of each block. A feature map says how strongly a pattern was found; the strongest value tells you the pattern is somewhere in that block.

  3. Now shift the critter by a pixel and count what changes.

    Drag it, or use Left and Right. Compare the detailed map with the pooled one.

  4. This zooming out has a name.

    Tap to reveal.

    Keeping the biggest number of each block is max pooling.

    Each 2 × 2 pooling halves the width and height, so it keeps a quarter of the numbers.

    Because a pattern only has to be somewhere in the block, small moves barely matter: shift tolerance.

  5. Game: speed pool. Two maps, as fast as you can.

    Tap the biggest number in every block. Misses count.

  6. How far should a model zoom out? Choose your pooling.

    Slide through 0 to 4 poolings, then press Use this size. Your choice races at the end.

  7. Code: this program should pool one block, but it prints 1. Fix it.

    Tap the wrong line, pick a replacement, then Check.

    top + bottom joins the two rows into one list of four numbers. Max pooling keeps the largest, so the line must use max, not min or sum.

  8. A 64 × 64 feature map goes through three 2 × 2 poolings. How wide is it now?

    Each 2 × 2 pooling halves the width: 64 / 2 / 2 / 2 = 8.

  9. The race: five photos of the same critter, a little moved.

    Your pooling against a model without pooling. Start the race.

Previous lesson: Stacking Filters: Convolution Layers · Next lesson: Filters Learn Themselves · Part of the course: How Machines See and Hear

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab