Code release for "Self-Tuning for Data-Efficient Deep Learning" (ICML 2021)

Overview

Self-Tuning for Data-Efficient Deep Learning

This repository contains the implementation code for paper:
Self-Tuning for Data-Efficient Deep Learning
Ximei Wang, Jinghan Gao, Mingsheng Long, Jianmin Wang
38th International Conference on Machine Learning (ICML 2021)
[Project Page] [Paper] [Video] [Slide] [Poster] [Blog] [Zhihu] [SlidesLive]


Brief Introduction for Data-Efficient Deep Learning

Mitigating the requirement for labeled data is a vital issue in deep learning community. However, common practices of TL and SSL only focus on either the pre-trained model or unlabeled data. This paper unleashes the power of both worlds by proposing a new setup named data-efficient deep learning, aims to mitigate the requirement of labeled data by unifying the exploration of labeled and unlabeled data and the transfer of pre-trained model.

To address the challenge of confirmation bias in self-training, a general Pseudo Group Contrast mechanism is devised to mitigate the reliance on pseudo-labels and boost the tolerance to false labels. To tackle the model shift problem, we unify the exploration of labeled and unlabeled data and the transfer of a pre-trained model, with a shared key queue beyond just 'parallel training'. Comprehensive experiments demonstrate that Self-Tuning outperforms its SSL and TL counterparts on five tasks by sharp margins, e.g., it doubles the accuracy of fine-tuning on Stanford-Cars provided with 15% labels.

Dependencies

  • python3.6
  • torch == 1.3.1 (with suitable CUDA and CuDNN version)
  • torchvision == 0.4.2
  • tensorboardX
  • numpy
  • argparse

Datasets

Dataset Download Link
CUB-200-2011 http://www.vision.caltech.edu/visipedia/CUB-200-2011.html
Stanford Cars http://ai.stanford.edu/~jkrause/cars/car_dataset.html
FGVC Aircraft http://www.robots.ox.ac.uk/~vgg/data/fgvc-aircraft/
Cifar100 https://www.cs.toronto.edu/~kriz/cifar.html
  • You can either download datasets via the above links or directly run the commands shown below to automatically download datasets as well as data lists from Tsinghua Cloud.

Disclaimer on Datasets

This open-sourced code will download and prepare public datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have licenses to use the dataset. It is your responsibility to determine whether you have permission to use the dataset under the dataset's license.

If you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset to be included in this code, please get in touch with us through a GitHub issue. Thanks for your contribution to the ML community!

Quick Start

  • The running commands for several datasets are shown below. Please refer to run.sh for commands for datasets with other label ratios.
python src/main.py  --root ./StanfordCars --batch_size 24 --logdir vis/ --gpu_id 0 --queue_size 32 --projector_dim 1024 --backbone resnet50  --label_ratio 15 --pretrained
python src/main.py  --root ./CUB200 --batch_size 24 --logdir vis/ --gpu_id 1 --queue_size 32 --projector_dim 1024 --backbone resnet50 --label_ratio 15 --pretrained
python src/main.py  --root ./Aircraft --batch_size 24 --logdir vis/ --gpu_id 2 --queue_size 32 --projector_dim 1024 --backbone resnet50 --label_ratio 15 --pretrained
python src/main.py  --root ./cifar100 --batch_size 20 --logdir vis/ --gpu_id 3 --queue_size 32 --backbone efficientnet-b2 --num_labeled 10000 --expand_label --pretrained --projector_dim 1024

Tensorboard Log

Dataset Label Ratio 1 Label Ratio 2 Label Ratio 3
CUB-200-2011 15% 30% 50%
Stanford Cars 15% 30% 50%
FGVC Aircraft 15% 30% 50%
Cifar100 400 2500 10000
  • We achieved better results than that reported in the paper, after fixing some small bugs of the code.

Updates

  • [07/2021] We have created a Blog post in Chinese for this work. Check it out for more details!
  • [07/2021] We have released the code and models. You can find all reproduced checkpoints via this link.
  • [06/2021] A five minute video is released to briefly introduce the main idea of Self-Tuning.
  • [05/2021] Paper accepted to ICML 2021 as a Short Talk.
  • [02/2021] arXiv version posted. Please stay tuned for updates.

Citation

If you find this code or idea useful, please cite our work:

@inproceedings{wang2021selftuning,
  title={Self-Tuning for Data-Efficient Deep Learning},
  author={Wang, Ximei and Gao, Jinghan and Long, Mingsheng and Wang, Jianmin},
  booktitle={International Conference on Machine Learning (ICML)},
  year={2021}
}

Contact

If you have any questions, feel free to contact us through email ([email protected]) or Github issues. Enjoy!

Comments
  • PGC_labels is constants ?

    PGC_labels is constants ?

    code snippet of models.py( line 121-122): PGC_labels = torch.zeros([batch_size, 1 + self.queue_size*self.class_num]).cuda() PGC_labels[:,0:self.queue_size+1].fill_(1.0/(self.queue_size+1))

    opened by bifeng 5
  • Can you upload the video on bilibili?

    Can you upload the video on bilibili?

    The video in ICML 2021 website is not available for the non-registered users.

    So it will be very helpful if you can upload the video on bilibili, thanks!

    image

    opened by Muyun99 4
  • No module named 'efficientnet_pytorch'

    No module named 'efficientnet_pytorch'

    No module or files named 'efficientnet_pytorch' in the whole file holder. But 'from efficientnet_pytorch import EfficientNet' appears in the first line of efficientnet.py Is there any thing should be done before running main.py? Thanks for your reply!

    opened by Fanyan-0411 1
  • Can Cifar100 uses the imagenet-pretrained model(efficientnet)? The resolution differs a lot.

    Can Cifar100 uses the imagenet-pretrained model(efficientnet)? The resolution differs a lot.

    You mention that you use Efficientnet for cifar100 in your paper. image

    Your corresponding code is like image

    Can Cifar100 uses the imagenet-pretrained model(efficientnet)? The resolution differs a lot.

    I really appreciate it if you could answer my question!

    opened by shiyegao 1
  • Question about PGC loss.

    Question about PGC loss.

    Hi,

    After reading ur paper and code, I found the PGC loss u implemented is a little bit different from the Eq (4) in ur paper? (u use KLD in ur code but not mentioned in the paper) Am I right, or I missed something?

    opened by xiujiesong 0
  • Can't download the dataset from tsinghua cloud.

    Can't download the dataset from tsinghua cloud.

    Hi, I can't connect the "https://cloud.tsinghua.edu.cn/f/04356d49d0054092b07e/?dl=1" to download data of Aircraft. I wonder if there are some connection problems of tsinghua cloud.

    opened by woshiyanyan 0
  • huge performance gap between the reported number and reproduced one on Fine-Tuning method

    huge performance gap between the reported number and reproduced one on Fine-Tuning method

    Hi,

    Thanks for the interesting work and sharing the code.

    Recently, I reproduced the Fine-Tuning baseline method based on the released code for Self-Tuning method (directly delete the unlabeled and contrastive parts and use the same optim hyperparam and schedule), and the reproduced results are as follows (all experiments are conducted on 15% label proportion setting):

    | Dataset | FT-reported | FT-reproduced | | --------- | ---------- | ------------- | | CUB | 45.25 | 48.43 | | Standford Cars | 36.77 | 53.09 | | FGVC Aircraft| 39.57 | 53.65 |

    As the table shown, there is a huge performance gap between the reported numbers and the reporduced ones. Furthermore, I also found some reproduced numbers even much better than the reported numbers of SSL methods. As shown in the following table, the performance gap is quite unreasonable since large amount of unlabeled samples have been further utilized in these SSL methods.

    | Dataset | FT-reproduced | PI-model | pseudo-labeling | UDA | Fixmatch | | --------- | ---------- | ------------- | ------------- | ------------- | ------------- | | CUB | 48.43 | 45.20 | 45.33 | 46.90 | 44.06 | Standford Cars | 53.09 | 45.19 | 40.93 | 39.90 | 49.86 | FGVC Aircraft| 53.65 | 37.32 | 46.83 | 43.96 | 55.53

    So, I am really wondering how do you train the baseline methods to get the reported numbers?

    opened by HeimingX 2
  • release code and training hyperparams of compared baseline methods

    release code and training hyperparams of compared baseline methods

    Hi,

    Thanks for the awesome work and the public repo.

    I wonder if it is possible to release the codes and training hyperparams of compared baseline methods in the paper (e.g., Fine-tuning, pseudo-labeling, fixmatch, etc.). I believe the further open source codebase will help the community to do more explorations and bring your paper more citations and impacts.

    Cheers

    opened by HeimingX 0
Owner
THUML @ Tsinghua University
Machine Learning Group, School of Software, Tsinghua University
THUML @ Tsinghua University
Code for the ICML 2021 paper: "ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision"

ViLT Code for the paper: "ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision" Install pip install -r requirements.txt pip

Wonjae Kim 922 Jan 1, 2023
Code for the ICML 2021 paper: "ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision"

ViLT Code for the paper: "ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision" Install pip install -r requirements.txt pip

Wonjae Kim 922 Jan 1, 2023
Code for ICML 2021 paper: How could Neural Networks understand Programs?

OSCAR This repository contains the source code of our ICML 2021 paper How could Neural Networks understand Programs?. Environment Run following comman

Dinglan Peng 115 Dec 17, 2022
Official Code for ICML 2021 paper "Revisiting Point Cloud Shape Classification with a Simple and Effective Baseline"

Revisiting Point Cloud Shape Classification with a Simple and Effective Baseline Ankit Goyal, Hei Law, Bowei Liu, Alejandro Newell, Jia Deng Internati

Princeton Vision & Learning Lab 115 Jan 4, 2023
Code for Fold2Seq paper from ICML 2021

[ICML2021] Fold2Seq: A Joint Sequence(1D)-Fold(3D) Embedding-based Generative Model for Protein Design Environment file: environment.yml Data and Feat

International Business Machines 43 Dec 4, 2022
Official code for UnICORNN (ICML 2021)

UnICORNN (Undamped Independent Controlled Oscillatory RNN) [ICML 2021] This repository contains the implementation to reproduce the numerical experime

Konstantin Rusch 21 Dec 22, 2022
Code for the ICML 2021 paper "Bridging Multi-Task Learning and Meta-Learning: Towards Efficient Training and Effective Adaptation", Haoxiang Wang, Han Zhao, Bo Li.

Bridging Multi-Task Learning and Meta-Learning Code for the ICML 2021 paper "Bridging Multi-Task Learning and Meta-Learning: Towards Efficient Trainin

AI Secure 57 Dec 15, 2022
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)

SLM: Structural Language Models of Code This is an official implementation of the model described in: "Structural Language Models of Code" [PDF] To ap

null 73 Nov 6, 2022
[ICML 2021, Long Talk] Delving into Deep Imbalanced Regression

Delving into Deep Imbalanced Regression This repository contains the implementation code for paper: Delving into Deep Imbalanced Regression Yuzhe Yang

Yuzhe Yang 568 Dec 30, 2022
[ICML 2021] DouZero: Mastering DouDizhu with Self-Play Deep Reinforcement Learning | 斗地主AI

[ICML 2021] DouZero: Mastering DouDizhu with Self-Play Deep Reinforcement Learning DouZero is a reinforcement learning framework for DouDizhu (斗地主), t

Kwai Inc. 3.1k Jan 4, 2023
An interpreter for RASP as described in the ICML 2021 paper "Thinking Like Transformers"

RASP Setup Mac or Linux Run ./setup.sh . It will create a python3 virtual environment and install the dependencies for RASP. It will also try to insta

null 141 Jan 3, 2023
Official implementation of "SinIR: Efficient General Image Manipulation with Single Image Reconstruction" (ICML 2021)

SinIR (Official Implementation) Requirements To install requirements: pip install -r requirements.txt We used Python 3.7.4 and f-strings which are in

null 47 Oct 11, 2022
[ICML 2021] “ Self-Damaging Contrastive Learning”, Ziyu Jiang, Tianlong Chen, Bobak Mortazavi, Zhangyang Wang

Self-Damaging Contrastive Learning Introduction The recent breakthrough achieved by contrastive learning accelerates the pace for deploying unsupervis

VITA 51 Dec 29, 2022
[ICML 2021] "Graph Contrastive Learning Automated" by Yuning You, Tianlong Chen, Yang Shen, Zhangyang Wang

Graph Contrastive Learning Automated PyTorch implementation for Graph Contrastive Learning Automated [talk] [poster] [appendix] Yuning You, Tianlong C

Shen Lab at Texas A&M University 80 Nov 23, 2022
How Do Adam and Training Strategies Help BNNs Optimization? In ICML 2021.

AdamBNN This is the pytorch implementation of our paper "How Do Adam and Training Strategies Help BNNs Optimization?", published in ICML 2021. In this

Zechun Liu 47 Sep 20, 2022
[ICML 2021] Break-It-Fix-It: Learning to Repair Programs from Unlabeled Data

Break-It-Fix-It: Learning to Repair Programs from Unlabeled Data This repo provides the source code & data of our paper: Break-It-Fix-It: Unsupervised

Michihiro Yasunaga 86 Nov 30, 2022
Implementation of Learning Gradient Fields for Molecular Conformation Generation (ICML 2021).

[PDF] | [Slides] The official implementation of Learning Gradient Fields for Molecular Conformation Generation (ICML 2021 Long talk) Installation Inst

MilaGraph 117 Dec 9, 2022
Pytorch Implementation of Spiking Neural Networks Calibration, ICML 2021

SNN_Calibration Pytorch Implementation of Spiking Neural Networks Calibration, ICML 2021 Feature Comparison of SNN calibration: Features SNN Direct Tr

Yuhang Li 60 Dec 27, 2022