The short answer
A convolutional neural network (CNN) uses convolutional layers, which apply small filters that slide across the input and reuse the same weights at every position. A traditional neural network, often called a fully connected or dense network, connects every input value to every neuron in the next layer, with its own weight for each connection. Both are neural networks, but CNNs are built for data with a grid-like structure, such as images, and they need far fewer weights to handle it.
What a traditional neural network does
In a fully connected layer, each neuron receives every value from the layer before it, and each connection has its own weight. This is flexible and works well for many kinds of structured data. The design has a cost when the input is an image.
A color image of 224 by 224 pixels has 224 × 224 × 3 = 150,528 values. A fully connected layer with 1,000 neurons would need about 150 million weights for that first layer alone. The layer also treats each pixel as an unrelated input, with no built-in sense that neighboring pixels tend to belong together.
What a CNN does differently
A convolutional layer uses small filters, often 3 by 3 or 5 by 5 pixels. Each filter looks at one small patch of the input, computes a weighted sum and then slides to the next patch. The same filter weights are reused at every position. This is called weight sharing.
A 3 by 3 filter for a color image has 3 × 3 × 3 = 27 weights, plus a bias term, and that count stays the same no matter how large the image is. Each output value depends only on a small neighborhood of the input, which fits the idea that nearby pixels are often related.
The question “What is the purpose of a convolutional layer?” comes down to this. The layer finds local patterns, such as edges, wherever they appear in the input. In trained networks, early filters often respond to simple features like edges, and stacked layers combine them into more complex patterns.
Pooling and the final layers
CNNs often include pooling layers, which shrink the spatial size of the feature maps, commonly by keeping the maximum value in each small region. Pooling reduces the amount of data for later layers and makes the output less sensitive to the exact position of a feature.
Many CNNs end with one or more fully connected layers that turn the learned features into a final prediction, such as a class label. So the difference is not all or nothing. A CNN is usually a mix: convolutional layers for local patterns, and fully connected layers near the output.
Why the difference matters
Images, audio spectrograms and some sensor data have local structure, where nearby values relate to one another. A CNN uses that structure, so it needs fewer weights and often generalizes better from the same amount of data. A traditional network on the same data would need many more parameters and would have to learn the structure from scratch. This is a large part of why convolutional neural networks are preferred for computer vision applications.
Limits of CNNs
CNNs are not always the best choice. Their built-in assumption of local structure helps on images but can limit them on data where relationships span long distances. Vision transformers apply attention to patches of an image and have become strong competitors on many vision tasks. The question “Which is better, CNN or ViT?” depends on the data, the amount of training data available and the compute budget.
Comparison at a glance
| Traditional fully connected network | Convolutional neural network | |
|---|---|---|
| Connections | Every input to every neuron | Small filters on local patches |
| Weights for an image layer | Very many | Far fewer, shared across positions |
| Built-in assumption | None about the input’s layout | Nearby inputs are related |
| Typical data | Structured data and general vectors | Images, grids, some audio and sensor data |
| Common extras | None needed | Pooling layers and fully connected output layers |
Summary
- A traditional network connects every input to every neuron.
- A CNN reuses small filters across the input, which means far fewer weights for grid-like data.
- CNNs are neural networks and are often deep.
- Choose a CNN when the data has local structure, such as images.