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

Transfer Learning

Transfer learning reuses a model trained on one task as the starting point for another, so a new task needs far less labeled data and training time.

Transfer learning is a machine learning technique that reuses a model trained on one task as the starting point for a related task. Training a neural network from random weights takes large labeled datasets and substantial compute, while a model pretrained on millions of images has already learned visual features that most new tasks need. Starting from those learned model weights, a new model reaches high accuracy from far fewer labeled images and in a fraction of the training time, which is why transfer learning is the default way to build computer vision models for custom tasks.

How Transfer Learning Works#

Transfer learning works because deep networks learn features in a hierarchy. The first layers of a backbone respond to edges, colors, and textures that appear in almost any image, while deeper layers combine them into object parts and task-specific concepts. A study by Yosinski et al. measured this progression in convolutional networks, finding that first-layer features are general, that transferability falls in higher layers as features specialize to the original task, and that transferred features improve generalization even after fine-tuning on the new dataset.

The process has two phases:

  1. Pretraining: A model learns general representations on a large benchmark dataset such as ImageNet, COCO, or Objects365, producing a set of pretrained weights.
  2. Adaptation: The output layers, such as a classifier or detection head, are replaced or resized for the new classes and trained on the target dataset. In feature extraction, the pretrained layers stay frozen and only the new layers learn. In fine-tuning, some or all pretrained layers also update, usually at a lower learning rate.

How much of the network to retrain depends on two questions: how much labeled data the new task has, and how closely it resembles the pretraining data. Stanford's CS231n notes lay out the four resulting cases:

Transfer Learning for Object Detection#

Detection models are almost always trained by transfer: the official YOLO26 checkpoints were pretrained on Objects365 for 150 epochs before fine-tuning on COCO, as the YOLO26 training recipe documents. Calling train() on a loaded checkpoint with a new dataset transfers every compatible weight, resets the class-specific output rows when the number of classes changes while keeping rows whose class names match, and accepts a freeze argument that holds early layers fixed, which helps most on small datasets.

from ultralytics import YOLO

# Load YOLO26n weights pretrained on COCO's 80 classes
model = YOLO("yolo26n.pt")

# Adapt to a new single-class dataset; freeze=10 keeps the first 10 layers fixed
results = model.train(data="medical-pills.yaml", epochs=20, freeze=10)

The pretrained backbone already detects shapes, edges, and textures, so training only has to learn what a pill looks like from the 92 labeled training images in the Medical Pills dataset.

  • Fine-tuning: One way to carry out transfer learning, in which pretrained weights keep updating on the new data. Feature extraction with a frozen backbone is the other main way.
  • Domain adaptation: A form of transfer learning where the task stays the same but the data distribution shifts, such as from daytime to nighttime images, often with few or no target labels.
  • Zero-shot learning and few-shot learning: Handle new classes with no labeled examples or only a handful, relying on a pretrained model's general knowledge instead of a full adaptation phase.
  • Parameter-efficient fine-tuning (PEFT): Adapts very large pretrained models by training a small set of added or selected parameters, such as LoRA matrices, while the original weights stay frozen.
  • Catastrophic forgetting: The loss of the original task's skills when a model is fine-tuned on new data. Mixing some original-class images into the new training set, or freezing more layers, limits it.

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