CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Artificial Intelligence / How Machines See and Hear

Reading Digits

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

What you will learn

  • A convolutional network (CNN) stacks filters, pooling and a final layer that weighs everything into one score per answer.
  • The scores become class probabilities: chances that add up to 100%. The tallest bar is the answer.
  • Split bars mean the network is unsure. A confusion matrix shows which digits it mixes up.
  • In code, the answer is the position of the biggest score: scores.index(max(scores)).

Start the lesson

How the lesson goes

  1. Your phone can read a handwritten answer or a number on a shirt. Where does it slip?

    Tap the two digits you think a digit reader mixes up most, then Check.

  2. Draw a 7 for the reader.

    It's a small convolutional network trained on 1,400 handwritten digits. Its bars update as you draw.

  3. Follow your 7 through the network.

    Press Step three times.

  4. What you just used has a name, and a history.

    Tap to reveal.

    Filters, pooling and a final layer together make a convolutional neural network, or CNN.

    The bars are class probabilities: one chance per digit, adding up to 100%.

    In the 1990s a CNN called LeNet read handwritten numbers on bank checks in the US. Yours is a tiny cousin.

  5. The reader is sure this is a 1. Change at most 3 cells to make it read 7.

    Tap cells to switch them. Changed cells get a yellow ring. Then Check.

    The network learned that a stroke along the top right is strong evidence for 7. Add it and the 7 score jumps past the 1 score.

  6. Game: torn. Draw something the reader can't decide on.

    Win when its top two bars are less than 15 points apart.

  7. Six test digits and their bars. Which answers is the reader sure about?

    Drag each into Sure or Unsure, then Check.

    Probabilities add up to 100%. If one digit takes almost all of it, the network is sure; if two or three share it, it is guessing between them.

  8. Code: what does this print?

    Tap the bar of the printed number, then Check.

    The list has one score per digit in order 0 to 9, so the position of the biggest score is the digit the network picks.

  9. The reader took a test on 397 new digits. Find its most common mistake.

    Tap a cell, then Check.

    Each row is the true digit and each column the answer. Off-diagonal cells count mistakes, so the biggest off-diagonal number is the most common mix-up.

  10. Earn your badge: draw your best digit.

    Any digit. When the reader is at least 80% sure, it becomes your badge.

Previous lesson: Filters Learn Themselves · Next lesson: Fooling a Vision Model · Part of the course: How Machines See and Hear

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

Loading TwiddleLab