
Issue #20 Architecture Edwin Dong
Convolutional Neural Networks, Explained Mathematically
Free editionPRO edition
Convolutional Neural Networks (CNNs) are a special type of neural network designed to process grid-like data, such as images.
They have revolutionized the computer vision space with their high performance and efficient architecture.
They are particularly effective for image classification tasks due to their ability to capture patterns through convolutional layers.

We’ve gone through the concept, terms, and basics of CNNs in previous issues, so in this one, we’ll focus more on the mathematical process (explained simply).
If you want to read those issues (which are highly recommended), you can find them here:
Convolution Neural Networks (Beginner)
Learn Stride, Padding, Window Size
Modern Convolutional Neural Network Architectures (Intermediate)
Learn CNN blocks, VGGNet, ResNet
To explain how the math behind a CNN works, we’ll go through a worked example using the CIFAR-10 dataset for image classification.
CIFAR-10 consists of 60,000 color images, each of size 32×32 pixels with 3 color channels (RGB), categorized into 10 distinct classes such as airplanes, cars, birds, cats, etc.
The CNN architecture we will cover today is picked quite arbitrarily, but with some purpose. We’ll shape the CNN into blocks (convolution, activation, pooling), which is quite effective.
The CNN architecture we’re using has the following layers:
Input Layer: 32×32×3 RGB image.
Block 1
Convolutional Layer 1 (Conv1)
Activation Function: ReLU.
Pooling Layer 1 (Pool1): Max pooling.
Block 2
Convolutional Layer 2 (Conv2)
Activation Function: ReLU.
Pooling Layer 2 (Pool2): Max pooling.
Flatten Layer: Converts the 3D tensor to a 1D vector.
Fully Connected Layer (FC): 512 neurons.
Activation Function: ReLU.
Output Layer: 10 neurons (one for each class) with softmax activation.

If you remember from a previous issue, the standard CNN block contains convolutional layers with a stride of 1 and a padding of 1 (which maintains the resolution), followed by a nonlinearity (activation function, usually ReLU), then a pooling layer to reduce the resolution.
In our CNN, we use the same type of block to better fit the data.
Let’s get started with the forward propagation.
The input is composed of a tensor of size 32×32×3 (height, width, and depth). We’ll call this tensor X.
This edition is for PRO members.


