CNN Architecture: Layers, Diagram, Working and Popular Models
By Vikram Singh
Updated on Nov 26, 2026 | 10 min read | 304.03K+ views
Share:
All courses
Certifications
More
By Vikram Singh
Updated on Nov 26, 2026 | 10 min read | 304.03K+ views
Share:
Table of Contents
Key Highlights
Interested in learning how CNNs fit into the broader field of AI? Our machine learning courses cover deep learning, computer vision, neural networks, and real-world AI applications to help you build job-ready skills.
Popular AI Programs
The Convolutional Neural Network consists of a series of layers performing their specific tasks. The early layers extract basic features such as edges and textures, whereas the subsequent layers combine those features to make up shapes, which later evolve into complete objects. The following table provides a summary of the major layer types in the CNN and the settings associated with them.
| Layer | What it does | Key settings |
| Input | Takes the image as pixel values | Height × width × channels |
| Convolution | Detects features with filters | Kernel size, stride, padding |
| Activation (ReLU) | Adds non-linearity | — |
| Pooling | Reduces size, keeps key features | Max / average, pool size |
| Fully connected | Combines features for decisions | Number of neurons |
| Output (softmax) | Class probabilities | Number of classes |
Want to learn how deep learning models process visual data and power computer vision applications? Explore the Master of Science in Machine Learning & AI from LJMU to develop practical skills in neural networks, deep learning techniques, and real-world AI applications.
A CNN (convolutional neural network) is a deep learning architecture for images. CNN processes the input image via convolution layers for detecting features, pooling layers for downsampling the feature maps, and fully connected layers for classifying the output.
Unlike traditional neural network, which treats every input separately, CNN is used to analyse small regions of an image to find patterns of edges, texture, shape etc. Therefore, CNN is extremely useful for various computer vision tasks like image classification, object detection, and image recognition.
CNN architecture is defined by the way different layers work together to recognize and predict the features of an image.
An image is processed through these layers so that the network is able to learn about basic features in the beginning and advanced features in the later stages.
Want to learn how deep learning models process visual data and power computer vision applications? Explore the Master of Science in Machine Learning & AI from LJMU to develop practical skills in neural networks, deep learning techniques, and real-world AI applications.
AI Courses to upskill
Explore Artificial Intelligence Courses for Career Progression

The above diagram illustrates the CNN process of generating predictions from an image. An input image of 224×224×3 of a dog undergoes convolution, ReLU activation and pooling to detect features and then goes through another convolution and pooling to detect further complex features. The detected features are then flattened and fed into the fully connected layer to generate predictions that are converted into class probability scores using the softmax activation function as Dog 0.98, Cat 0.01, Bird 0.01. The above layers are elaborated upon below.
The structure of a typical CNN is composed of 6 layers where each one is designed to serve a particular purpose. Together, these layers take care of converting a raw image into useful features and make predictions using these features.
In this section, we shall examine various parts of the CNN architecture and the mathematical background behind CNN.
The below table describes the function of each layer in a CNN and its output sizes in case of input images of size 224×224×3.
CNN Layer |
What It Does |
Example Output Size |
| Input Layer | Receives the image as pixel values across three RGB channels. | 224 × 224 × 3 |
| Convolution Layer 1 | Applies filters to detect basic features such as edges, corners, and textures. | 224 × 224 × 32 |
| ReLU Activation | Replaces negative values with zero and introduces non-linearity. | 224 × 224 × 32 |
| Pooling Layer 1 | Reduces the spatial dimensions of feature maps while retaining important information. | 112 × 112 × 32 |
| Convolution Layer 2 | Extracts more complex features by identifying patterns and combinations of basic features. | 112 × 112 × 64 |
| Pooling Layer 2 | Further reduces feature map dimensions to lower computational requirements. | 56 × 56 × 64 |
| Flatten Layer | Converts the 3D feature maps into a one-dimensional vector. | 200,704 |
| Fully Connected Layer | Combines extracted features to calculate scores for different classes. | 128 |
| Softmax Output Layer | Converts class scores into probabilities for final classification. | 3 (Dog, Cat, Bird) |
These output shapes are indicative and are computed based on 3 × 3 filters with stride of 1 and same padding, 2 × 2 max pooling with stride of 2, 32 and 64 filters in convolution layers, and 128 neurons in fully connected layer. The final output shape consists of three classes. Different CNN architectures can produce different output sizes.
Input Layer is the first layer of CNN and acts as the starting point for input image. In contrast to human eye, CNN cannot understand the image in its true sense. CNN accepts the image as numbers corresponding to pixel values.
For a monochrome image, the intensity of each pixel ranges between 0 (black) to 255 (white).
For a colored image, each pixel uses three color channels, namely,
And these three channels combined together constitute an RGB image.
For instance, for an image having a dimension of 224 × 224, its input shape will be as follows:
Input Shape = Height × Width × Channels
Input Shape = 224 × 224 × 3
Where,
224 = Height of the Image
224 = Width of the Image
3 = RGB color channels
In other words, CNN receives a 3-dimensional matrix of pixels (also known as Tensor).

Convolution Layer is the most crucial part of the CNN architecture. The main function of the Convolution Layer is to go through the input image and recognize useful visual features such as edges, corners, texture and patterns.
As compared to scanning an entire image at a time, the convolution layer works with a small-sized matrix which is referred to as the filter or the kernel and this filter slides over the image for a region-by-region analysis and then the process known as dot product is performed on the filter and the pixel values of the image.
The output of this process is stored in another matrix which is known as the feature map.
Convolution can be described mathematically as:
Where:
In simpler terms, the neural network computes the product between the filter's numbers and the pixel values, sums them up, and places the final number into the feature map.
Let’s take a Simple Example:
Take, for instance, the input image as follows:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
and the filter is:
1 |
0 |
0 |
-1 |
The first convolution operation is:
(1×1) +(2×0) + (4×0) + (5×-1) = 1 - 5 = -4
The value -4 becomes the first element of the feature map.
The filter then moves to the next region and repeats the same process until the complete feature map is generated.

After convolution, the feature map undergoes activation function. The aim of the activation function is to enable the CNN to learn and capture complex features that cannot be learned via the use of simple mathematical operations.
The most widely used activation function is Rectified Linear Unit (ReLU).
ReLU(x)= max(0, x)
It means:
Example

You Can Also Explore: Math for Machine Learning: Essential Concepts You Must Know
During the convolution layers, the resulting feature maps get bigger and contain a lot of information, which makes the processing expensive and might cause the CNN to overfit (it will perform well on the training data and poorly on the test dataset).
The pooling layer in the CNN architecture solves this problem by reducing the size of the feature map while still keeping the key features in the feature map. It is called the downsampling process, and it makes the CNN faster, memory-efficient, and generalized to unseen images.
There are two types of pooling commonly used:

Having been able to capture the relevant features using the convolution and pooling layers, the next step would be for the CNN to apply those features towards making a prediction. The Fully Connected Layer is that step within CNN architecture.
As the name suggests, before getting to the Fully Connected Layer, the feature maps have to be flattened.
Example:

The Output Layer is the last layer of a CNN. Here, the probabilities associated with all possible classes from the output from the Fully Connected Layer are obtained.
CNNs use Softmax activation function during multi-class image classifications.
Mathematical Formula
Where:
Example
Suppose the Fully Connected Layer produces the following scores:

Ready to apply concepts like CNNs to real-world AI projects? Our Diploma in Machine Learning & AI with MLOps, GenAI & Agentic AI covers everything from AI fundamentals and deep learning to modern GenAI, agentic AI, and production deployment.
A CNN works by performing several operations on an image using its layers in a specific order. Contrary to the idea of learning objects as a whole, the model detects simple patterns like edges and textures in the image and combines these to recognize more complicated shapes, and eventually, complete objects.
Below are the steps involved in transforming the architecture of CNN into making predictions.

The process begins with the input image that is presented as a matrix of pixel intensities. When it comes to the RGB image, each pixel has intensities of R (Red), G (Green), and B (Blue) color channels.
At this point, the model is unaware of what it sees. The only information it receives is the numerical values of pixels.
Then, the image undergoes one or several convolution layers where the model starts to extract useful features. Rather than processing the whole image at once, it processes its patches using some filters to detect simple patterns.
The initial layers of the CNN learn simple features such as:
Want to know more about feature extraction? Explore our blog – Feature Extraction in Machine Learning
As the image is being further processed by the CNN, the network uses the basic features to recognize more relevant patterns.
For instance, once the CNN detects edges and curves, it will be able to detect:
And with further layers, the CNN learns to combine these features and recognize whole objects like cats, cars, and trees. In this way, CNN learns to interpret complicated images without using hand-crafted features.
Once the CNN learns all necessary features from an image, it transforms these features into data that could be used for making predictions. The feature data is passed through the fully connected layer where this data is analyzed and the probabilities for each possible class are calculated.
The class that has the highest probability is selected as the output of the CNN. For example, when classifying animals, the CNN output would be:
Therefore, the CNN would predict that the image is a picture of a cat.
Subscribe to upGrad's Newsletter
Join thousands of learners who receive useful tips
No single CNN architecture can perform all the computer vision tasks efficiently and effectively. With the growing complexity of image data and the increase in size of datasets and problems, it was necessary to find a way to solve these challenges.
Researchers found a solution in the form of new CNN architectures which provided higher accuracy, lowered computational cost, allowed constructing even deeper neural networks, and helped solve such problems as vanishing gradient and overfitting.
Each new CNN architecture utilizes the best characteristics of previous CNN architectures and provides innovation in the field of neural networks design.
Let's look at some of the most successful and influential CNN architectures and analyze what distinguishes them from each other.
One of the first successful CNN architectures was LeNet-5 which was introduced by Yann LeCun in 1998. The network was developed for digit recognition in order to process bank cheques and recognize postal codes.
The architecture of LeNet includes convolution layers, pooling layers and fully connected layers. This small network showed that it is possible to use neural networks to recognize images without using any feature extraction algorithms.
AlexNet was designed by Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton and won the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) competition in 2012, proving the viability of deep learning networks for image classification.
As compared with LeNet, AlexNet used a very deep architecture with eight trainable layers, ReLU activation, Dropout regularization, and trained on GPU, achieving faster and more accurate performance.
AlexNet was one of the triggers that raised attention to deep learning research.
The VGG architecture, developed in 2014 at the University of Oxford, showed that depth in networks can be achieved through the use of smaller 3 × 3 filters, leading to better classification results for images.
VGG was simpler compared to the other architectural designs since it had a simple design consisting of convolution layers, which were easily understandable.
The drawback with the model was that it had many parameters.
As CNNs got deeper, there was an issue called vanishing gradients, where training became challenging, and the accuracy would not improve. ResNet, which is an acronym for Residual Network, introduced by Microsoft Research in 2015, addressed this challenge through skip connections or residual connections.
Rather than learning a mapping directly, ResNet enables skipping some layers, thus making it possible to have a network of 50, 101, or even 152 layers.
Currently, ResNet is among the most popular architectures in CNNs for image recognition and transfer learning.
The introduction of DenseNet took place in 2017 with the purpose of enhancing information passing within deep learning neural networks. While traditional neural networks connect adjacent layers only, in DenseNet each layer is connected to all subsequent layers.
These dense connections lead to the reuse of features and efficient gradient passing while requiring less parameters than comparable deep networks.
In turn, DenseNet demonstrates high efficiency and accuracy at the same time.
EfficientNet was proposed by Google Research in 2019 and solved the problem that usually occurs when designing CNNs: how to boost the accuracy without making too much of an increase in computation.
Traditionally, the improvement in neural networks occurred through an increase in the number of layers or the size of the input images. EfficientNet has implemented compound scaling, which considers network depth, width, and the resolution of the input image at once.
Now, EfficientNet is used in many practical applications.
Also read - Explaining 5 Layers of Convolutional Neural Network
CNN Architecture has revolutionized the manner in which computers are able to analyze and interpret visual data. Through automatic feature learning, CNNs are able to accomplish tasks that would have required a lot of manual labor. In the current day and age, CNNs are employed in a variety of fields, as shown by the table below.
| Application | What Is It? | How Does CNN Help? | Why Is CNN Used? | Examples |
| Medical Imaging | Analyzing images such as X-rays, CT scans, MRI scans, and ultrasounds to identify diseases and abnormalities. | Learns patterns from medical images and detects abnormalities such as tumors, fractures, or lung infections by identifying subtle visual features that may be difficult to notice. | Medical images contain complex patterns that require accurate analysis. CNNs process thousands of images consistently and assist doctors by highlighting suspicious regions, reducing diagnosis time and improving accuracy. | • Detecting breast cancer from mammograms • Identifying pneumonia from chest X-rays • Brain tumor detection using MRI scans • Diabetic retinopathy detection from retinal images |
| Autonomous Vehicles | Using cameras and sensors to understand surroundings and make driving decisions. | Processes images from onboard cameras to identify roads, traffic signs, pedestrians, vehicles, cyclists, and lane markings in real time. | Safe driving requires recognizing multiple objects at once and deciding within milliseconds. CNNs extract visual information quickly and accurately, making them suitable for real-time navigation. | • Lane detection • Traffic sign recognition • Pedestrian detection • Obstacle avoidance |
| Facial Recognition | Identifying or verifying a person's identity using facial features. | Learns unique facial characteristics such as eye position, nose shape, jawline, and facial contours to tell one person from another. | Faces vary with lighting, expressions, and viewing angles. CNNs learn these variations and still recognize the same person with high accuracy. | • Smartphone Face Unlock • Airport identity verification • Employee attendance systems • Secure building access |
In the case of CNN architecture for image classification, there is no universal architecture that suits all purposes perfectly well. There exist some architectures that are aimed at being simple and learnable; there exist other architectures that concentrate on increasing accuracy, minimizing computational complexity, etc.
When choosing the proper CNN architecture for image classification purposes, it is necessary to take into account the size of the dataset, the model complexity, training time, hardware accessibility, etc.
The following table provides a comparative analysis of the most widely used CNN architectures in terms of these characteristics.
Parameter |
LeNet |
AlexNet |
VGG |
ResNet |
DenseNet |
EfficientNet |
| Year Introduced | 1998 | 2012 | 2014 | 2015 | 2017 | 2019 |
| Best For | Learning fundamentals | Medium-scale image classification | Transfer learning | Large-scale image classification | Medical imaging, feature reuse | Production & mobile AI |
| Dataset Size | Small | Medium | Medium–Large | Large | Medium–Large | Medium–Large |
| Network Depth | Shallow | Moderate | Deep | Very Deep | Very Deep | Scalable |
| Training Speed | Very Fast | Fast | Slow | Moderate | Moderate | Fast |
| Computational Cost | Very Low | Moderate | Very High | High | Moderate | Low–Moderate |
| Model Size | Small | Medium | Large | Large | Medium | Small–Medium |
| Accuracy | Moderate | Good | High | Very High | Very High | Excellent |
| Transfer Learning | Limited | Good | Excellent | Excellent | Excellent | Excellent |
| Mobile Deployment | Yes | Limited | No | Possible | Possible | Excellent |
| Key Innovation | First practical CNN | ReLU & GPU training | Small 3×3 filters | Skip connections | Dense connections | Compound scaling |
| Recommended For | Beginners | Learning modern CNNs | Feature extraction | Most real-world projects | Fine-grained recognition | Resource-efficient AI |
| Learning Difficulty | Easy | Easy | Moderate | Advanced | Advanced | Advanced |
The CNN model is widely popular due to the fact that it is capable of learning the image features independently and performing accurate recognition in computer vision tasks. However, there are some limitations to this kind of a model in terms of data, computational power, and complexity.
Prior to choosing CNN as a machine learning model for your assignment, you should know about its advantages and limitations.
Below is presented the comparison of each pair of advantages and limitations put in one row.
Advantages |
Limitations |
| Automatic feature extraction: CNNs automatically learn important features such as edges, textures, and shapes without manual feature engineering. | Limited interpretability: It is often difficult to understand why a CNN makes a particular prediction, making it a "black-box" model. |
| High accuracy: They deliver excellent performance in image classification, object detection, facial recognition , and other computer vision tasks. | Requires large datasets: CNNs generally need a large amount of labeled image data to learn effectively and achieve high accuracy. |
| Fewer parameters: By reusing the same filters across an image, CNNs require fewer parameters than traditional fully connected neural networks. | Requires careful tuning: Selecting the right architecture, learning rate, filter size, and other hyperparameters often requires experimentation. |
| Preserves spatial information: CNNs maintain the relationship between neighboring pixels, helping them recognize objects more accurately. | Computationally expensive: Training deep CNN models requires significant processing power, memory, and often high-performance GPUs. |
| Versatile and scalable: CNNs can be used across a wide range of applications, including healthcare, autonomous vehicles, retail, agriculture, and satellite imagery. | Risk of overfitting: When trained on small datasets, CNNs may memorize the training data instead of learning patterns that generalize well. |
Deep learning consists of various neural networks designed for distinct types of data and tasks. Although CNNs find application mainly in images and videos, there are other neural networks such as ANNs, RNNs, and Transformers that find use in different types of data sets.
The following is a comparison of some of the popular deep learning models in terms of their structure and uses.
Parameter |
CNN (Convolutional Neural Network) |
ANN (Artificial Neural Network) |
RNN (Recurrent Neural Network) |
Transformer |
| Best Input Type | Images, videos, and visual data | Structured/tabular data | Sequential data (text, speech, time series) | Sequential data, text, images, and multimodal data |
| Spatial Learning | Excellent | No | Limited | Good (with attention mechanisms) |
| Sequential Learning | Not designed for sequential data | No | Excellent | Excellent |
| Feature Extraction | Automatic | Mostly manual or limited | Learns sequential patterns | Learns contextual relationships using attention |
| Computational Cost | Moderate to High | Low to Moderate | High | Very High |
| Training Speed | Fast (with GPUs) | Fast | Slower due to sequential processing | Fast but computationally intensive |
| Handles Long-Term Dependencies | No | No | Limited | Excellent |
| Typical Applications | Image classification, object detection, facial recognition | Fraud detection, customer churn prediction, sales forecasting | Language translation, speech recognition, sentiment analysis | Large language models, chatbots, image generation, machine translation |
| Main Strength | Learns visual features while preserving spatial information | Simple and effective for structured data | Learns patterns from sequential data | Captures long-range relationships and context efficiently |
| Main Limitation | Not suitable for sequential data | Poor performance on image and sequence data | Difficult to train on very long sequences | Requires large datasets and significant computational resources |
Now that you know how CNNs compare with other neural networks, dive deeper with our comprehensive guides on ANN, RNN, and Transformer architectures.
Conclusion
The architecture of CNN has revolutionized computer vision because of its ability to enable machines to identify patterns automatically in visual information. Through this structure, it has been able to provide feature extraction and high accuracy in various visual problems.
In this blog, we have covered CNN architecture, the function of layers in CNN, some famous CNN architectures, applications of CNNs, and strengths and weaknesses of CNNs. These topics help us understand the basics of CNN and deep learning computer vision.
With the continued advancement in the development of AI technology, CNN will continue being an essential component of image-based applications. Learning CNN architecture is crucial whether one is a student, developer, or AI lover, and enrolling in deep learning courses is a practical way to build on these fundamentals.
Ready to start your journey? Book a free consultation with upGrad today to find the best path for your career.
A CNN is a model designed to read visual patterns by extracting edges, textures, and shapes. It processes images through layered steps that turn pixels into clear features. This makes it effective for tasks like classification, detection, and medical image analysis.
Core layers include convolution (feature extraction), activation (nonlinearity, often ReLU), pooling (dimension reduction), flattening (vectorization), fully connected (decision-making), and an output layer (Softmax or Sigmoid). Together, these layers transform simple local patterns into high-level representations for accurate predictions.
Traditional networks rely on dense connections and treat every pixel equally, resulting in many parameters. CNNs exploit spatial locality with shared kernels, drastically reducing parameters and improving efficiency. This makes CNNs faster, more scalable, and much better at recognizing structured visual patterns.
A CNN diagram visualizes the data flow: input dimensions, convolution filters, activation functions, pooling operations, output shapes after each block, and the transition to dense layers. It clarifies how features evolve across stages and serves as a blueprint for understanding design decisions and computational requirements.
A kernel (filter) is a small matrix of weights that slides across the image, producing feature maps through convolution. Each kernel learns to respond to particular patterns—edges, corners, textures. During training, kernels adapt automatically, building a repertoire of useful detectors for downstream recognition.
Stride controls how far the kernel moves each step. A stride of one captures fine-grained details with larger feature maps; higher strides reduce spatial resolution and computational load. Selecting stride involves balancing detail preservation against efficiency, depending on the dataset and task complexity.
Padding adds pixels around the image borders before convolution. It preserves edge information, maintains output dimensions (“same” padding), and prevents feature maps from shrinking too quickly. Proper padding ensures kernels can process boundary regions effectively, improving overall feature coverage and model performance.
CNNs reduce overfitting using several techniques. Dropout randomly turns off neurons during training so the network doesn't depend on specific features. Data augmentation creates varied training images through flips, rotations, and crops. Pooling shrinks feature maps and keeps only key features, which cuts unnecessary detail. Together, these help the model generalize to new images instead of memorizing the training set.
Common variations of neural network architectures include LeNet, AlexNet, VGG, ResNet, DenseNet, and EfficientNet. Each builds on the basic CNN design to improve accuracy, depth, or efficiency, for example through skip connections in ResNet or compound scaling in EfficientNet. See the "Popular CNN Architectures Explained" section above for how they compare.
Use a CNN when data has spatial structure, images, videos, medical scans, or document layouts (OCR). CNNs excel when local features and their spatial arrangements are crucial. If the problem is primarily tabular or sequence-based, consider architectures optimized for those data types instead.
138 articles published
Vikram Singh is a seasoned content strategist with over 5 years of experience in simplifying complex technical subjects. Holding a postgraduate degree in Applied Mathematics, he specializes in creatin...
Speak with AI & ML expert
By submitting, I accept the T&C and
Privacy Policy
Top Resources