Standard Multi-Layer Perceptrons (MLPs) struggle with image data. Flattening a modest $224 \times 224 \times 3$ RGB image into a 1D vector produces $150,528$ input features; connecting that to a single hidden layer of $1,000$ neurons requires over $150$ million parameters—causing immediate overfitting and destroying spatial relationships between neighboring pixels.

Convolutional Neural Networks (CNNs) solve this by leveraging spatial structure, parameter sharing, and hierarchical feature extraction, forming the backbone of modern computer vision.


1. Core Principles of CNNs

  1. Local Connectivity (Receptive Fields): Neurons in a convolutional layer connect only to a small local region of the input image rather than every single pixel.
  2. Parameter Sharing: The exact same filter (kernel) weights slide across the entire image. If a filter learns to detect a vertical edge in the top-left corner, it automatically detects vertical edges everywhere else.
  3. Translation Equivariance: Shifting an object in the input image shifts its corresponding activation map by the exact same amount without requiring retraining.

2. The Anatomy of a CNN Layer

[Input Image] ---> [Conv2D + ReLU] ---> [Max Pooling] ---> [Flatten] ---> [Dense / Softmax]
  (224x224x3)       (Feature Maps)      (Downsampled)     (1D Vector)      (Class Scores)