Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Identity Preservation

Identity preservation keeps a specific person or object recognizable as the same individual across generated images, video frames, and tracking IDs.

Identity preservation is a model's ability to keep a specific subject recognizable as the same individual across its outputs: the same face across a set of generated portraits, the same character from the first frame of a generated video to the last, or the same tracking ID for a pedestrian who walks behind a bus and reappears. Two communities use the term. In generative AI, it describes personalization methods that place a real person or product into new scenes without changing who or what it is. In multi-object tracking (MOT), it describes keeping each object's ID stable through occlusions, crossings, and camera changes. Both measure it with identity embeddings, feature vectors that land close together for the same individual and far apart for different ones.

Identity Preservation in Image and Video Generation#

A text-to-image model knows what "a woman" or "a dog" looks like but not what one particular woman or dog looks like, so personalization methods add that knowledge. Fine-tuning methods learn it from a few photos. Google's DreamBooth (2022) fine-tunes the whole diffusion model on three to five images of a subject tied to a rare token, with a class-specific prior preservation loss that keeps the model generating other dogs normally, and LoRA adapters make the same idea cheap enough to train per person.

Encoder-based methods skip per-subject training. Tencent's IP-Adapter (2023) feeds image embeddings into the diffusion model through a separate cross-attention layer, and InstantID (January 2024) preserves a face from a single photo by combining an embedding from a face recognition network with IdentityNet, a ControlNet conditioned on five facial landmarks. Stronger identity conditioning makes the output look more like the reference and also copies more of its pose, expression, and lighting, so these tools expose a strength setting that trades likeness against how far the prompt can change the scene.

Generated faces are scored by the cosine similarity between ArcFace embeddings of the reference photo and the output; ArcFace, introduced by Jiankang Deng and colleagues at CVPR 2019, trains face embeddings with an angular margin so that identities separate cleanly on a hypersphere. Video adds a second requirement, keeping the subject consistent across frames, which VBench measures as subject consistency by comparing DINO features between frames. In video generation, a character whose face drifts over a few seconds fails this test even when every single frame looks realistic.

Identity Preservation in Tracking#

A tracker assigns IDs by matching each frame's detections to existing tracks. Motion alone, a Kalman filter predicting where each box will be plus an intersection over union (IoU) match, works until two people cross or one disappears behind an obstacle; then the tracker swaps their IDs or starts a new one, an error counted as an identity switch. Appearance features fix much of this. Nicolai Wojke, Alex Bewley, and Dietrich Paulus's DeepSORT (2017) added embeddings from a network trained on a person re-identification dataset to the motion-only SORT tracker and cut identity switches by 45 percent. The IDF1 metric, proposed by Ergys Ristani and colleagues in 2016, scores identity preservation directly as the share of detections assigned their correct identity.

Ultralytics YOLO tracking defaults to TrackTrack (Shim and colleagues, CVPR 2025), which keeps lost tracks alive for 30 frames (track_buffer) so a returning object can reclaim its ID and suppresses duplicate new IDs before creating one. Setting with_reid: True in the tracker YAML adds appearance matching, by default with the detector's own features and optionally with a dedicated encoder such as the 2.8-million-parameter YOLO26n-reid model. The snippet tracks people in a sample video with and without ReID and counts the distinct IDs each run assigns:

from ultralytics import YOLO
from ultralytics.utils import ROOT, YAML

# Copy the default TrackTrack config and turn on appearance re-identification
cfg = YAML.load(ROOT / "cfg/trackers/tracktrack.yaml")
cfg.update(with_reid=True, model="yolo26n-reid.onnx")
YAML.save("tracktrack_reid.yaml", cfg)

video = "https://github.com/ultralytics/assets/releases/download/v0.0.0/decelera_portrait_min.mov"
for tracker in ["tracktrack.yaml", "tracktrack_reid.yaml"]:
    model = YOLO("yolo26n.pt")  # fresh model so each run starts with no tracks
    ids = set()
    for result in model.track(video, tracker=tracker, classes=[0], stream=True, verbose=False):
        if result.boxes.is_track:
            ids.update(result.boxes.id.int().tolist())
    print(f"{tracker}: {len(ids)} person IDs")

On this short clip both runs assign 3 person IDs, so appearance matching changes nothing here; it matters on longer footage where people leave the frame and return. For the same people, fewer distinct IDs means fewer identity switches, which is what downstream counts depend on: a people counting system that gives a returning shopper a new ID counts that shopper twice.

  • Facial recognition: Names a person by matching their face embedding against a gallery of known people, using the same kind of embedding that identity-preserving generators take as conditioning.
  • Data privacy: Redaction and anonymization deliberately remove identity, the opposite goal.
  • Deepfakes: Face swaps use identity-preserving generation without the subject's consent.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision 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
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision 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
Computer vision in agriculture

Computer vision 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