Convolutional Neural Network (Classification)

Machine Learning
Introduced by
LeCun, Y. et al.
Year
1998
Type
Deep neural network (convolutional)

What does it do?

A Convolutional Neural Network (CNN) is a deep learning model that learns local patterns directly from images and other grid-structured data in order to classify them.

Stacked convolutional filters build increasingly abstract features, which can reduce the need for manual feature engineering. A 1998 review by LeCun and colleagues, widely cited in this area, reports that convolutional networks outperformed the other techniques compared on a standard handwritten digit recognition task.

The intuition behind the method

Instead of hand-crafting features, a CNN slides small learnable filters across the input to detect local patterns such as edges, textures, or motifs, regardless of where they appear. Early layers pick up simple cues; deeper layers combine them into higher-level concepts. Because the same filter is reused across the whole input, the network learns efficiently and recognises a pattern wherever it occurs.

History

Yann LeCun and colleagues are widely associated with the convolutional approach to handwritten character recognition. The cited 1998 paper reviews gradient-based learning methods applied to handwritten character and document recognition and compares them on a standard handwritten digit recognition task. It reports that convolutional neural networks, designed to deal with the variability of 2D shapes, outperform all other techniques compared. Convolution, pooling, and end-to-end gradient training are now common elements of image classification architectures.

When to use it

Use a CNN when your inputs are images or other grid-structured data, you have a large labelled dataset, and you want features to be learned rather than engineered by hand. The sample size needed depends on the task, the input dimensionality, the use of data augmentation, and whether pretrained weights are available. Be cautious when the dataset is small: with few observations the network tends to overfit, and a Random Forest or SVM is usually a safer first model. Limited data can still be workable with data augmentation, fine-tuning a pretrained CNN (transfer learning), and regularisation such as dropout or weight decay, but each choice should be confirmed on held-out data. Also avoid CNNs for tabular variables with no spatial or grid structure, since the convolutional filters then have no local pattern to exploit. The method does not require normally distributed data.

Limitations and considerations

  • Needs a large labelled dataset to train reliably; the amount required depends on the task, input size, augmentation, and use of pretrained models.
  • With small samples the network tends to overfit, and classification performance can drop.
  • Training is computationally demanding, and the learned representation is hard to interpret.
  • The weight-sharing design assumes that useful patterns are local and position-independent; data without that structure gains little from convolution.
  • Convolution is equivariant to translation, and pooling gives only approximate invariance; pooling and strides also reduce spatial resolution, which can discard fine detail.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Learns local patterns automatically, reducing the need for manual feature engineering.
  • Weight sharing lets the network recognise a pattern wherever it appears and keeps the parameter count manageable.
  • Builds a hierarchy of features, from simple edges to more abstract concepts, which suits image data.
  • No normality requirement on the data.
  • The cited 1998 study reports that convolutional networks outperformed the other techniques compared on a standard handwritten digit recognition task.

Applications

  • Image classification and recognition tasks.
  • Classification of structured, grid-like data where local patterns matter.
  • Document and handwritten character recognition.
  • Feature learning where manual feature engineering is impractical.

How it works

How it works

1

Learnable filters (kernels) are slid across the input, and at each position the filter computes a weighted sum over the local patch, producing a feature map. Each filter responds to a specific local pattern, such as an edge, a texture, or a shape fragment. Because the same weights are applied at every position, the network can detect that pattern anywhere in the input while keeping the number of parameters low.

Formula
(I * K)(i,j) = \sum_{m}\sum_{n} I(i+m, j+n)\, K(m,n)
2

Pooling layers (for example max pooling) downsample each feature map, summarising neighbourhoods into a single value. This shrinks the spatial dimensions, makes the representation more robust to small shifts and distortions, and lets later layers build progressively more abstract features over a wider receptive field.

3

The high-level feature maps are flattened and passed through fully connected layers ending in a softmax that outputs class probabilities. The whole network, filters and weights together, is trained end to end by gradient-based learning, minimising classification loss via backpropagation.

Formula
\hat{y} = \operatorname{softmax}(W h + b)

Common pitfalls

  • Training on too little data and overfitting instead of falling back to Random Forest or SVM.
  • Skipping a held-out validation or test split and trusting training accuracy.
  • Ignoring class imbalance instead of re-weighting or resampling the classes.
  • Reporting only accuracy without precision, recall, F1, or a confusion matrix.
  • Forgetting to normalise inputs or applying no regularisation against overfitting.
  • Choosing kernel size, network depth, and pooling settings without checking them on held-out data.

Frequently asked questions

How much data does a CNN need?

CNNs are data-hungry, and the amount needed depends on the task, the input size, the use of augmentation, and whether pretrained weights are used. With small samples they tend to overfit, so a Random Forest or SVM is often a safer starting point, or a pretrained CNN combined with augmentation and careful validation.

Why convolution instead of a plain neural network?

Convolution shares the same small filter across all positions of the input, so a pattern is detected wherever it appears and the parameter count stays low. A fully connected network would need vastly more weights and would not exploit the spatial structure of the data.

What does pooling do?

Pooling downsamples feature maps by summarising local neighbourhoods, which reduces spatial size, adds robustness to small shifts, and lets deeper layers build more abstract features over a wider receptive field.

What should I check before relying on a CNN?

Confirm you have a large enough labelled dataset, normalise the inputs, set up a proper train/validation/test split, address any class imbalance, and evaluate with precision, recall, F1, and a confusion matrix rather than accuracy alone.

Related methods

Sources

  1. LeCun, Y., Bottou, L., Bengio, Y. & Haffner, P. (1998). Gradient-Based Learning Applied to Document Recognition. Proceedings of the IEEE, 86(11), 2278–2324.

    Open DOI reference