Recognizing Images with a Neural Network
Learn how to recognize images using a neural network with forward propagation.
Introduction
In this example, we are working on recognizing handwritten digits using a neural network. Specifically, we’ll classify the digits zero and one.
Input Image Representation
We use a simplified 8x8 grayscale image where each pixel intensity ranges from 0 (black) to 255 (white).
Example Image of a Digit
This grid represents the digit '1' as a matrix of pixel intensity values:
Neural Network Architecture
We use a neural network with:
- Input layer: 64 features (from the 8x8 pixel values).
- Hidden layer 1: 25 neurons.
- Hidden layer 2: 15 neurons.
- Output layer: A single neuron predicting whether the input is a '1' or '0'.
Step-by-Step Process
-
Input Layer: Takes in the 64 pixels as features.
-
Hidden Layer 1: Uses 25 neurons to process the input, computing activations:
-
Hidden Layer 2: Uses 15 neurons to compute new activations based on (a1):
-
Output Layer: Finally, the output layer computes (a3) using just one neuron:
This gives the final prediction, which we threshold at 0.5 to determine if the digit is '1'.
Forward Propagation Summary
The process of calculating activations from input to output is known as forward propagation
.
Next Steps
After learning the math and computations, you'll now implement this using TensorFlow in the next section.