Meet YOLO26: next-gen vision AI.
Ultralytics
Back to Ultralytics Glossary

Identity Mapping

Explore identity mapping in deep learning. Learn how skip connections prevent vanishing gradients to power neural networks like Ultralytics YOLO26.

In mathematics and linear algebra, an identity map or identity matrix is a function that returns the exact same value that was used as its input. In the context of artificial intelligence (AI) and deep learning, identity mapping refers to a specific architectural technique used to pass input data directly to subsequent layers of a convolutional neural network (CNN) without any non-linear transformations. This concept was heavily popularized by the introduction of Residual Networks (ResNet) in 2015, which revolutionized how deep computer vision (CV) models are structured and trained.

Link to this sectionHow Identity Mapping Works#

Deep neural networks frequently suffer from the vanishing gradient problem. During backpropagation, the error signals used to update network weights become exponentially smaller as they travel backward through the layers, preventing early layers from learning effectively. Identity mapping solves this by creating "skip connections" or "shortcut connections."

Instead of forcing sequential layers to learn an entirely new and unreferenced mapping, they are designed to learn a residual function. Mathematically, if the input to a block is x, the layer learns a transformation F(x). The identity mapping adds the original input x directly to the output of that transformation, resulting in the final output F(x) + x. This ensures that even in extremely deep networks, gradients can flow unimpeded directly through the model backbone. Reputable AI research organizations like Google DeepMind and OpenAI frequently leverage these architectural shortcuts to stabilize training in massive foundation models.

Link to this sectionIdentity Mapping vs. Identity Preservation#

It is crucial to distinguish identity mapping from the similarly named identity preservation.

While identity mapping is a structural coding feature of a neural network designed to optimize machine learning (ML) training flow, identity preservation is a distinct computer vision task. Identity preservation focuses on maintaining the visual consistency of a specific person or object across different video frames in object tracking or across generated images in generative AI workflows.

Link to this sectionReal-World Applications#

Identity mapping serves as the foundational building block for many highly accurate models used in production today:

  • Advanced Object Detection: Modern real-time architectures, including the latest Ultralytics YOLO26, utilize advanced residual blocks containing identity maps within their feature extraction layers. This enables them to perform high-speed, precise detection in complex environments like autonomous driving without degrading performance as network depth increases.
  • Image Classification Models: State-of-the-art vision architectures, extensively documented in academic repositories like arXiv and the IEEE Xplore Digital Library, rely on identity mappings to successfully train models with hundreds of layers. High-level frameworks like TensorFlow use these shortcuts to extract highly complex hierarchical features from massive datasets.

Link to this sectionImplementing Identity Mapping in PyTorch#

When building custom neural networks, deep learning frameworks like PyTorch provide native tools to implement these shortcuts effortlessly. You can explicitly use the PyTorch nn.Identity module or simply apply mathematical addition within your nn.Module forward pass.

The following snippet demonstrates a basic residual block utilizing an identity map. Note that developers utilizing the cloud-based Ultralytics Platform for dataset management and model training benefit from these highly optimized architectural structures automatically beneath the hood.

import torch.nn as nn


class ResidualBlock(nn.Module):
    def __init__(self, channels):
        super().__init__()
        # A simple convolutional layer for feature extraction
        self.conv = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
        # Explicit identity mapping module
        self.identity = nn.Identity()

    def forward(self, x):
        # The block output is the sum of the learned features and the identity map
        return self.conv(x) + self.identity(x)

Explore solutions

Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning