Semi-supervised Convolutional Neural Network

Machine Learning
Introduced by
Lee, D.-H.; Tarvainen, A. & Valpola, H. (among others)
Year
2013–2017
Type
Semi-supervised deep learning
Family
Deep learning / NLP / CV

What does it do?

A semi-supervised CNN trains a convolutional network on a small labeled image set together with a larger pool of unlabeled images.

It uses pseudo-labeling and consistency regularization to extract a training signal from the unlabeled data. Whether it outperforms purely supervised training depends on the dataset, the ratio of labeled to unlabeled images, and how reliable the model's predictions on unlabeled images are.

The intuition behind the method

Labeling images is expensive, so a method that can use unlabeled images is attractive. A partly trained network already encodes some useful structure of the image data. It can assign its own predictions to unlabeled images as pseudo-labels and train on them alongside the true labels. It is also trained to give the same output for an image and a perturbed version of it, which requires no labels at all. When the pseudo-labels are reasonably accurate, these two signals can add useful training data. When they are not, the same mechanism can reinforce the network's own errors.

History

Lee (2013) proposed the pseudo-label method for deep neural networks, in which the network's own predictions on unlabeled data serve as training targets. Tarvainen and Valpola (2017) introduced Mean Teacher, which applies consistency regularization against a teacher whose weights are an exponential average of the student weights. Later methods, including MixMatch and FixMatch, extend these ideas; consult their original papers for their designs and reported results.

When to use it

Choose a semi-supervised CNN when you have many unlabeled images from the same distribution as a small labeled set, for example in medical imaging, remote sensing, or industrial inspection, where annotation is costly. Check that the unlabeled images truly resemble the labeled ones, because pseudo-labels inherit any systematic mismatch. Do not use it when labeled data are already plentiful, since the added training complexity then brings little benefit; a supervised baseline that already performs well on a validation set is a sign to stay with supervised training. It is also a poor choice when the unlabeled pool comes from a different domain than the labeled set, because the model's errors on that pool would be systematic and then reinforced. For object detection or multi-label tasks, the core idea applies, but the specific published methods differ from the classification setting described here.

Limitations and considerations

  • Errors in pseudo-labels feed back into training. A weak initial model, or pseudo-labels taken without a confidence filter, lets wrong labels reinforce themselves, and accuracy can fall.
  • The method assumes unlabeled images come from the same distribution as the labeled ones. The pseudo-label and consistency terms cannot correct a domain shift between the two sets.
  • The joint objective adds the weight lambda and augmentation settings to tune, and threshold-based variants add a confidence cut-off, so tuning is harder than for supervised training.
  • Each training step processes unlabeled batches alongside labeled ones, so training takes longer than a supervised run on the same labeled set.
  • The warm-start on labeled data needs enough examples for the first model to predict usefully. The minimum depends on the task and the number of classes, so run a pilot check on the task at hand before relying on the warm-start.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • When the unlabeled pool is large and the labeled set is small, the pseudo-label and consistency terms can add training signal that the supervised loss alone does not provide.
  • Pseudo-labels are the network's own predictions, so the method needs no additional annotation pass or external labeling model.
  • The consistency term uses only the network's outputs under perturbation and needs no labels on the unlabeled images.
  • A teacher built as an exponential average of the student weights, as in the Mean Teacher setting, is intended to give a steadier consistency target than the current student alone.
  • Unlabeled images are often cheap to collect, so the extra training data can be obtained at low cost.

Applications

  • Medical image analysis where expert annotation is scarce and expensive.
  • Remote sensing and satellite imagery classification with large unlabeled archives.
  • Industrial defect detection when defective samples are rare but normal ones plentiful.
  • Scene and object recognition when crowd-sourced labels cover only a fraction of collected images.
  • Wildlife and ecological monitoring using camera-trap images with partial species annotations.

How it works

How it works

1

The CNN is first trained, or warm-started, on the labeled images with a supervised cross-entropy loss. This is the supervised term of the joint objective. It gives the network a feature extractor good enough for its predictions on unlabeled images to be usable as pseudo-labels.

2

For each unlabeled image, the current model produces class probabilities, and the most probable class is taken as a hard pseudo-label, as in the formula. The rule above applies no confidence cut-off. Many practical variants keep a pseudo-label only when its top probability reaches a threshold tau, which yields fewer but cleaner pseudo-labels. Tau is chosen on a validation set by weighing pseudo-label accuracy against the share of unlabeled images retained, and any reported experiment should state whether such a filter was used. The pseudo-labels then serve as targets in later training iterations.

Formula
\hat{y}_u = \arg\max_c f_\theta(x_u)_c
3

The network is trained so that its output for an unlabeled image agrees with its output for a perturbed version of that image, perturbed by augmentation or noise. The formula measures the squared difference between the student output and the reference output. In the Mean Teacher setting, the reference network is a teacher whose weights are a slowly moving exponential average of the student weights, which is intended to give a steadier target than the current student alone.

Formula
\mathcal{L}_{\text{unsup}} = \|f_\theta(x_u) - f_{\theta'}(\tilde{x}_u)\|^2
4

The supervised loss on labeled data and the unsupervised loss on unlabeled data are summed, with the unsupervised term weighted by a coefficient lambda. Lambda is a tuned hyperparameter, and its value should be selected on validation data. Some training schedules increase lambda gradually, so that early and noisy pseudo-targets have limited influence. This ramp-up is a variant of the joint objective shown above.

Formula
\mathcal{L} = \mathcal{L}_{\text{sup}} + \lambda \mathcal{L}_{\text{unsup}}
5

Model performance is measured on a held-out labeled test set. Metrics are compared against a fully supervised CNN trained on the same labeled subset only, quantifying how much unlabeled data contributed. Class-level precision, recall, and F1 should accompany overall accuracy.

Common pitfalls

  • Using a low confidence cut-off in a threshold-based variant, so that many incorrect pseudo-labels enter training.
  • Applying semi-supervised training when labeled data are already sufficient, which adds complexity without a clear gain.
  • Ignoring distribution mismatch between the labeled and unlabeled sets, which produces systematic pseudo-label errors that the model then learns.
  • Evaluating on the unlabeled pool, or on data overlapping with the training set, rather than a separate held-out labeled test set, which inflates reported accuracy.
  • Not tracking pseudo-label accuracy during training. Pseudo-label error should fall as the model improves; if it does not, the unlabeled term may be hurting.

Frequently asked questions

How many labeled examples are needed to start semi-supervised CNN training?

There is no universal minimum. The number depends on task complexity, the number of classes and image diversity, so check it with a pilot run: confirm on a validation set that the model trained on the labeled images predicts usefully before adding unlabeled data. Reliability generally improves as labeled examples per class increase.

What is the difference between pseudo-labeling and consistency regularization?

Pseudo-labeling assigns a hard class label to an unlabeled image based on the model's highest-confidence prediction and treats it as ground truth. Consistency regularization instead penalizes differences in the model's output for perturbed versions of the same unlabeled image, without committing to a single label.

Can I apply semi-supervised CNN to multi-label or detection tasks?

Yes, in principle. Extensions to object detection and multi-label classification have been proposed, but they are more complex and differ from the single-label classification setting described here. The core idea, leveraging unlabeled data via consistency or pseudo-labels, generalizes beyond single-label classification; consult the original papers for specific methods.

What confidence threshold should I use for pseudo-labels?

No single threshold is correct across tasks. A higher threshold keeps pseudo-labels cleaner but labels fewer unlabeled images. The right value depends on class difficulty and model calibration, so set it on a validation set by measuring pseudo-label accuracy and the share of images retained, and raise it if label noise is high.

Should I use a pretrained backbone?

Pretrained weights are often a useful starting point when the target domain resembles the pretraining data, and they can improve early pseudo-label quality. For distant domains, such as medical or remote sensing images, check on a validation set whether they help before relying on them.

Related methods

Sources

  1. Lee, D.-H. (2013). Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. ICML Workshop on Challenges in Representation Learning.

    Open publication reference
  2. Tarvainen, A. & Valpola, H. (2017). Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. Advances in Neural Information Processing Systems (NeurIPS), 30.

    Open publication reference