This is the implementation of Learning to Impute: A General Framework for Semi-supervised introduced by Wei-Hong Li, Chuan-Sheng Foo, and Hakan Bilen. We provide code for our method (L2I) that performs Image Classification on CIFAR-10 and Facial Landmark Regression on AFLW. The repository also contains code for baselines which are compared in our paper. All methods are implemented in Pytorch
Figure 1. Computation graph of (a) consistency based semi-supervised learning and (b) our algorithm on imputing unlabeled samples in a deep neural network. Note that the illustration shows three instances of the same network and our method uses a single neural network.
Recent semi-supervised learning methods have shown to achieve comparable results to their supervised counterparts while using only a small portion of labels in image classification tasks thanks to their regularization strategies. In this paper, we take a more direct approach for semi-supervised learning and propose learning to impute the labels of unlabeled samples such that a network achieves better generalization when it is trained on these labels. We pose the problem in a learning-to-learn formulation which can easily be incorporated to the state-of-the-art semi-supervised techniques and boost their performance especially when the labels are limited. We demonstrate that our method is applicable to both classification and regression problems including image classification and facial landmark detection tasks.
- Python 3.6+
- PyTorch 1.0 (or newer version)
- torchvision 0.2.2 (or newer version)
- tensorboardX
- progress
- matplotlib
- numpy
Train the MT by 250 labeled data of CIFAR-10 dataset:
python train-MT.py --gpu <gpu_id> --n-labeled 250 --out cifar10MT@250
Train the MM by 250 labeled data of CIFAR-10 dataset:
python train-MM.py --gpu <gpu_id> --n-labeled 250 --out cifar10MM@250
We provide code for L2I-O (modeling missing labels as the Output of the model) and L2I-L (modeling missing labels as Learnable parameters) built on MT.
Train our L2I-O built on MT by 250 labeled data of CIFAR-10 dataset:
python train-L2I-O.py --gpu <gpu_id> --n-labeled 250 --out cifar10L2IO@250
Train our L2I-L built on MT by 250 labeled data of CIFAR-10 dataset:
python train-L2I-L.py --gpu <gpu_id> --n-labeled 250 --out cifar10L2IL@250
tensorboard --port 6006 --logdir cifar10L2IO@250
Download the dataset from https://github.com/tomasjakab/imm/. Unzip and place the whole dataset folder in ./data/
Train SL by full training data on AFLW dataset:
python train-SL.py --gpu <gpu_id> --n-labeled -1 --out aflwSL@-1
Train SL by 1% of labeled data on AFLW dataset:
python train-SL.py --gpu <gpu_id> --n-labeled 0.01 --out [email protected]
Train PL by 1% of labeled data on AFLW dataset:
python train-PL.py --gpu <gpu_id> --n-labeled 0.01 --out [email protected]
Train MT by 1% of labeled data on AFLW dataset:
python train-MT.py --gpu <gpu_id> --n-labeled 0.01 --out [email protected]
We provide code for L2I-O (modeling missing labels as the Output of the model) and L2I-L (modeling missing labels as Learnable parameters) built on MT.
Train our L2I-O built on MT by 1% labeled data on AFLW dataset:
python train-L2I-O.py --gpu <gpu_id> --n-labeled 0.01 --out [email protected]
Train our L2I-L built on MT by 1% labeled data on AFLW dataset:
python train-L2I-L.py --gpu <gpu_id> --n-labeled 0.01 --out [email protected]
tensorboard --port 6006 --logdir [email protected]
For any question, you can contact Wei-Hong Li.
If you find this code to be useful in your work and use it for a publication, please kindly cite:
@article{li2019learning,
title={Learning to impute: A general framework for semi-supervised learning},
author={Li, Wei-Hong and Foo, Chuan-Sheng and Bilen, Hakan},
journal={arXiv preprint arXiv:1912.10364},
year={2019}
}