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

Semi-Supervised Learning

Semi-supervised learning trains on a few labeled examples plus many unlabeled ones to cut labeling costs. Covers pseudo-labeling, consistency, and code.

Semi-supervised learning trains a model on a small set of labeled examples together with a much larger set of unlabeled ones, using the unlabeled data to reach higher accuracy than the labels alone allow. It sits between supervised learning, where every training example has a label, and unsupervised learning, where none do. The approach suits computer vision because cameras collect images cheaply, while data labeling, such as drawing boxes or masks or recording a diagnosis, takes human time and often expert knowledge. FixMatch reached 88.61% accuracy on the CIFAR-10 image benchmark with only 4 labeled images per class, and Noisy Student raised ImageNet top-1 accuracy to 88.4% by adding pseudo-labels for 300 million unlabeled images.

How Semi-Supervised Learning Works#

Unlabeled data helps because it shows the shape of the data distribution. Methods assume that examples close together in a dense region share a label, so the decision boundary between classes should pass through sparse regions where few examples lie. Three families of methods put this into practice.

Pseudo-labeling, also called self-training, trains a model on the labeled data, runs it on the unlabeled data, and keeps predictions above a confidence threshold as extra training data. In teacher-student versions, the trained model becomes a teacher that labels the pool, and a student, often as large as or larger than the teacher, trains on the real and pseudo-labels and becomes the next teacher:

Consistency regularization requires a model to give the same prediction for different perturbations of the same unlabeled image, such as two different data augmentations. FixMatch combines the two ideas: it pseudo-labels a weakly augmented view, only when the model is confident, and trains the model to predict that label on a strongly augmented view of the same image. Graph-based methods connect similar examples into a graph and spread the known labels along its edges. The main risk throughout is confirmation bias, where wrong pseudo-labels are trained on and then predicted with even more confidence, which is why methods use high thresholds, strong augmentation, or a teacher whose weights are a slow moving average of the student's.

This scikit-learn example keeps the labels of only 2 images per digit and compares a supervised classifier trained on those 20 images with label spreading, a graph-based method that also uses the 1,237 unlabeled training images:

import numpy as np
from sklearn.datasets import load_digits
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.semi_supervised import LabelSpreading

X, y = load_digits(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X / 16, y, test_size=0.3, random_state=0, stratify=y)

# Keep the labels of only 2 training images per digit; -1 marks every other image as unlabeled
labeled = np.concatenate([np.flatnonzero(y_train == digit)[:2] for digit in range(10)])
y_partial = np.full_like(y_train, -1)
y_partial[labeled] = y_train[labeled]

# Supervised baseline trains on the 20 labeled images; label spreading also uses the unlabeled ones
supervised = LogisticRegression(max_iter=5000).fit(X_train[labeled], y_train[labeled])
semi_supervised = LabelSpreading(kernel="knn", n_neighbors=10).fit(X_train, y_partial)
print(f"Supervised, 20 labeled images: {supervised.score(X_test, y_test):.3f}")
print(f"Semi-supervised, 20 labeled + {(y_partial == -1).sum()} unlabeled: {semi_supervised.score(X_test, y_test):.3f}")

On 540 held-out digits, the supervised classifier scores 0.800 and label spreading scores 0.919 with the same 20 labels, because the unlabeled images connect each labeled example to the many similar images of the same digit.

Semi-Supervised Learning in Computer Vision#

Teacher-student pseudo-labeling scales to tasks whose labels are the most expensive to draw, such as boxes, instance segmentation masks, and depth maps. Semi-supervised object detection methods such as Unbiased Teacher keep confident pseudo-boxes from a teacher, and Depth Anything trained a monocular depth estimation model on about 62 million unlabeled images that a teacher model had labeled automatically. Ultralytics YOLO26 depth models were pretrained the same way: 1,281,167 ImageNet training images, which have no depth ground truth, received pseudo depth maps from Depth Anything 3 teacher models and made up about 58% of a 2.19-million-image mix that also includes real ground-truth depth datasets. Vision language models can also act as teachers, labeling objects from class names alone, and the VLM Leaderboard compares how accurately they annotate real-world detection datasets. For detection, a large YOLO26 model can play the teacher and write its confident predictions as YOLO-format label files, a simple form of auto-labeling:

from ultralytics import YOLO
from ultralytics.utils import ASSETS

# A large pretrained YOLO26 model acts as the teacher
teacher = YOLO("yolo26x.pt")

# Label a folder of unlabeled images; only detections with confidence above 0.5 become pseudo-labels
# save_txt=True writes one YOLO-format .txt label file per image, ready for training a student model
results = teacher.predict(source=ASSETS, conf=0.5, save_txt=True)
  • Active learning: Selects the most informative unlabeled images and sends them to a human annotator. Semi-supervised learning labels the pool automatically, and many labeling pipelines combine the two.
  • Self-supervised learning: Pretrains on unlabeled data alone, with targets derived from the data, and uses labels only afterward for fine-tuning. Semi-supervised learning uses labeled and unlabeled data in the same training run.
  • Transfer learning: Starts from a model pretrained on another dataset. It combines with semi-supervised learning, since a pretrained model makes a better first teacher.
  • Knowledge distillation: Trains a student to match a teacher's outputs, usually to compress the model. Pseudo-labeling uses the same teacher-student setup to add training data, and Noisy Student trained students as large as or larger than their teachers, with noise added during training, and beat the previous best ImageNet model, which had been pretrained on 3.5 billion weakly labeled Instagram images, by 2.0%.

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