Semi-Supervised Learning using Siamese Networks

Attaullah Sahito, Eibe Frank, Bernhard Pfahringer · DOI

Introduction

Deep learning has revolutionized fields like computer vision and natural language processing, but its success is often predicated on the availability of massive labeled datasets. In many real-world scenarios, we face a "labeling bottleneck": while raw data is abundant, human-verified labels are expensive and time-consuming to obtain. Standard neural networks typically rely on cross-entropy loss for classification, which does not inherently exploit the underlying geometric structure of unlabeled data.

This paper addresses this challenge by proposing a semi-supervised learning (SSL) framework that shifts the paradigm from direct classification to similarity learning. Instead of teaching a model to assign absolute labels, the authors focus on learning a robust similarity function—teaching the model to recognize when two images belong to the same category based on their proximity in a learned embedding space.

Methodology

The core of the proposed method is an iterative self-training approach that leverages Siamese networks and triplet loss to organize data into a discriminative manifold.

Siamese Networks and Triplet Loss

The framework utilizes a Siamese architecture where the network learns to map input images into a high-dimensional Euclidean space. The training objective is defined by a triplet loss function. In this setup, the model is presented with three inputs: an "anchor" image, a "positive" image (from the same class as the anchor), and a "negative" image (from a different class). The loss function encourages the network to minimize the distance between the anchor and the positive sample while maximizing the distance between the anchor and the negative sample, subject to a predefined margin.

Visualization of triplet loss and negative mining categories.

Iterative Self-Training Algorithm

To incorporate unlabeled data, the authors employ a multi-step iterative process:

  1. Initial Supervision: The Siamese network is initially trained on the small available set of labeled data.
  2. Embedding and Labeling: The trained model generates embeddings for the unlabeled dataset. A $k$-Nearest Neighbor ($k$-NN) classifier then assigns pseudo-labels to these unlabeled instances based on their proximity to labeled points in the embedding space.
  3. Confidence-Based Selection: Only the most "confident" predictions—defined as the top p% of samples—are promoted to the labeled training set.
  4. Refinement: The model is retrained on the expanded dataset, and the process repeats. This iterative loop allows the model to progressively refine its embedding space and improve the quality of its pseudo-labels.

The researchers also experimented with Local Learning with Global Consistency (LLGC), a graph-based method that propagates labels through the data manifold, to evaluate if more sophisticated label propagation could further enhance performance.

Experimental Results

The effectiveness of the Siamese self-training approach was evaluated on four standard image classification benchmarks: MNIST, Fashion MNIST, SVHN, and CIFAR-10. In each case, the model was provided with a very limited number of labeled samples (e.g., only 100 for MNIST).

The results demonstrate significant improvements over supervised-only baselines. For the MNIST dataset, the error rate was reduced from 9.73% to 3.24% through Siamese self-training.

Comparison of error rates on MNIST with 100 labeled samples.

Similar trends were observed across other datasets. On SVHN, the error dropped from 30.33% to 20.09%. For Fashion MNIST, the LLGC-based variant achieved the best performance, reducing the error from 26.72% to 23.23%. While the gains on CIFAR-10 were more modest (40.87% to 36.56%), the method still outperformed the baseline, indicating its generalizability to more complex, high-variance images.

Qualitative analysis using t-SNE visualizations further supported these findings, showing that even with minimal supervision, the network successfully forced thousands of test examples into distinct, class-based clusters.

Discussion and Conclusion

The primary takeaway from this research is that learning semantic relationships between data points is often more effective than learning absolute decision boundaries when labeled data is scarce. By focusing on the manifold structure of the data, the Siamese network creates clusters that make simple $k$-NN classification highly effective.

Interestingly, the study found that the added complexity of LLGC label propagation did not consistently outperform simple $k$-NN. This suggests that the quality of the learned embedding space is the dominant factor in performance. Future research could explore applying this similarity-learning framework to deeper architectures like ResNets or Transformers and investigating more sophisticated sample selection strategies, such as threshold-based confidence filtering, to further push the boundaries of semi-supervised learning.

Summary updated

BibTeX
@inproceedings{sahito2019semi,
  author = {Attaullah Sahito and Eibe Frank and Bernhard Pfahringer},
  title = {{Semi-Supervised Learning using Siamese Networks}},
  booktitle = {Australasian Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1007/978-3-030-35288-2\_47},
}
Figure