Understanding Convolutional Neural Networks: A Simplified Approach
Eyes and Distances
Understanding Convolutional Neural Networks: A Simplified Approach
Eyes and Distances

A Convolutional Neural Network (CNN) operates like a series of eyes (filters) observing an image from various distances (layers):
Filters as Eyes (Lenticular images): Each filter acts as a specialized eye, focusing on specific features of the image, such as edges, textures, or patterns. Just as a lenticular card shows a different image from different angles, each filter “sees” a distinct aspect of the input, allowing the network to capture a wide variety of features.

Layers as Distances (Telescope): The layers in a CNN represent different distances from which the image is observed, akin to how a telescope allows us to see distant objects at varying levels of detail:
Shallow layers act like a telescope with low zoom, looking closely at fine details, such as edges and textures.
Intermediate layers resemble a telescope with medium zoom, stepping back to recognize parts and shapes.
Deep layers are like using a telescope with maximum zoom, seeing the image from a distant perspective to identify whole objects and abstract patterns.
By combining the effects of filters as “eyes” observing from various angles and layers representing different observation distances, a CNN can build a rich, multi-level understanding of an image, just like how lenticular cards and telescopes provide varying perspectives of a scene.
Building the Eyes and Setting the Distances
With the conceptual framework in mind — where filters are specialized eyes and layers represent observation distances — let’s see how this idea comes to life in a practical CNN implementation for recognizing handwritten digits.
# Define the Convolutional Neural Network (CNN) architecture
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(1, 32, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1)
self.pool = nn.MaxPool2d(2, 2)
self.fc1 = nn.Linear(64 * 7 * 7, 128)
self.fc2 = nn.Linear(128, 10)
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = x.view(-1, 64 * 7 * 7) # flatten the X
x = F.relu(self.fc1(x))
x = self.fc2(x)
x = F.softmax(x, dim=1)
return x
In this implementation, the CNN is designed to take a grayscale image of a handwritten digit (28x28 pixels) and classify it into one of 10 digit classes (0–9). Here’s how the framework maps to the code:

- First Layer: Close-Up Observation
self.conv1 = nn.Conv2d(1, 32, kernel_size=3, padding=1)
— Filters as Eyes: The first layer uses 32 filters (eyes), each focusing on small details in the grayscale image (1 input channel).
— Close-Up View: These filters are like magnifying glasses, detecting basic patterns like edges or tiny curves.
— Why Padding? The padding=1 ensures that even the edges of the image are fully observed, preserving spatial dimensions during the close-up examination.
After applying conv1, the CNN activates these features using:
x = F.relu(self.conv1(x))
This introduces ReLU, which ensures the eyes focus only on meaningful patterns by discarding irrelevant negative activations.
- Pooling: Summarizing the Key Observations
x = self.pool(F.relu(self.conv1(x)))
— The pooling layer acts like a summarizing step, reducing the size of the image while retaining the most important details detected by the close-up eyes. — MaxPool (2x2): This takes a 2x2 patch of pixels and keeps the most prominent feature, halving the spatial dimensions (28x28 → 14x14).
3. Second Layer: Mid-Range Observation
self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1)
— Filters as Eyes: Now, the network employs 64 filters, each analyzing the outputs from the first layer.
— Mid-Range View: These filters step back to detect combinations of the previously identified edges and curves, recognizing more complex patterns like loops, strokes, or parts of a digit.
— The outputs are further activated (ReLU) and pooled:
x = self.pool(F.relu(self.conv2(x)))
— After this step, the image representation shrinks again (14x14 → 7x7), condensing the mid-range observations.
- Flattening: Transitioning from Eyes to Concept
x = x.view(-1, 64 * 7 * 7)
— The feature maps, now reduced to a size of 64 channels, each 7x7, are flattened into a single vector. — This marks a shift from spatial representation to a conceptual understanding of the image.
5. Fully Connected Layers: Holistic Observation
self.fc1 = nn.Linear(64 * 7 * 7, 128)
self.fc2 = nn.Linear(128, 10)
— The first fully connected layer takes the flattened vector and combines all the detected features into a high-level representation, refining the global understanding. — The second fully connected layer maps this representation to the 10 output classes, each representing a digit (0–9).
Finally, a softmax function converts the output into probabilities:
x = F.softmax(x, dim=1)
— This ensures the network confidently identifies the digit.
Connecting Back to the Framework
- Filters as Eyes: Each filter, from
conv1toconv2, specializes in observing specific features of the digit, from fine details to abstract patterns. - Layers as Distances: The progression from
conv1(close-up) toconv2(mid-range) to the fully connected layers (far view) mirrors the increasing levels of abstraction in understanding the image. - Pooling: By summarizing the outputs, the pooling layers ensure that the network retains the most crucial observations while reducing complexity.
This practical implementation exemplifies how the conceptual framework of eyes and distances guides the CNN to recognize handwritten digits with remarkable accuracy. Check the full code here.
메타데이터
- post_id
- b4f5befced8e
- slug
- understanding-convolutional-neural-networks-a-simplified-approach-b4f5befced8e
- url
- https://medium.com/@uzairg/understanding-convolutional-neural-networks-a-simplified-approach-b4f5befced8e
- canonical_url
- https://medium.com/@uzairg/understanding-convolutional-neural-networks-a-simplified-approach-b4f5befced8e
- author_url
- https://medium.com/@uzairg
- status
- ok
- fetched_at
- 2026-07-22 02:17:40