Skip to content
PyTorch implementation of Semi-Supervised Learning with Scarce Annotations
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Semi-Supervised Learning with Scarce Annotations

Code to reproduce some of the main results in:

Sylvestre-Alvise Rebuffi, Sebastien Ehrhardt, Kai Han, Andrea Vedaldi, Andrew Zisserman, "Semi-Supervised Learning with Scarce Annotations", arXiv


Install requirements: the environement used to run this code is provided in environment.yml. It can be installed using conda with the following command (environment name will be salsa):

conda env create -f environment.yml

Train a RotNet

python --dataset mydataset --network mynetwork --save_dir myrotnetdir

Choose any network among: {ResNet-18, RevNet-18,TempEns} and dataset in {cifar10, cifar100, svhn}

Alternative training with semi-supervision

python --dataset mydataset --save_dir mydir --rotnet_dir myrotnetdir --nb_labels_per_class 10

Default parameters are for CIFAR10. For CIFAR100 use inner milestones [14,20], for SVHN use learning rate of 0.1 and outer milestones [120,150].

Training scripts

A sample training script to run the same experiments 10 time with different dataset splits is available in scripts/. You will have to specify (in the following order) dataset, number of labels per class, save_dir, and rotnet_dir.

For instance: sh ./scripts/ cifar10 10 mydir myrotnetdir

Train with full supervision

python --dataset mydataset --network mynetwork --save_dir mydir --rotnet_dir myrotnetdir

Available Datasets

This code supports CIFAR10, CIFAR100 and SVHN datasets.

Two moons figure

We also provide the script to generate the two moons figure of the paper (Fig 1.). To generate the pictures run python two_moons/, figures will be available in the folder render/.

Cite this work

If you use this code for your project please consider citing us:

  title={Semi-Supervised Learning with Scarce Annotations},
  author={Rebuffi, Sylvestre-Alvise and Ehrhardt, Sebastien and Han, Kai and Vedaldi, Andrea and Zisserman, Andrew},
  journal={Technical report},
You can’t perform that action at this time.