All Projects → joshr17 → IFM

joshr17 / IFM

Licence: MIT License
Code for paper "Can contrastive learning avoid shortcut solutions?" NeurIPS 2021.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to IFM

SelfSupervisedLearning-DSM
code for AAAI21 paper "Enhancing Unsupervised Video Representation Learning by Decoupling the Scene and the Motion“
Stars: ✭ 26 (-21.21%)
Mutual labels:  self-supervised-learning
SelfTask-GNN
Implementation of paper "Self-supervised Learning on Graphs:Deep Insights and New Directions"
Stars: ✭ 78 (+136.36%)
Mutual labels:  self-supervised-learning
video-clip-order-prediction
Self-supervised Spatiotemporal Learning via Video Clip Order Prediction
Stars: ✭ 85 (+157.58%)
Mutual labels:  self-supervised-learning
sc depth pl
Pytorch Lightning Implementation of SC-Depth (V1, V2...) for Unsupervised Monocular Depth Estimation.
Stars: ✭ 86 (+160.61%)
Mutual labels:  self-supervised-learning
AdCo
AdCo: Adversarial Contrast for Efficient Learning of Unsupervised Representations from Self-Trained Negative Adversaries
Stars: ✭ 148 (+348.48%)
Mutual labels:  self-supervised-learning
PASSL
PASSL包含 SimCLR,MoCo v1/v2,BYOL,CLIP,PixPro,BEiT,MAE等图像自监督算法以及 Vision Transformer,DEiT,Swin Transformer,CvT,T2T-ViT,MLP-Mixer,XCiT,ConvNeXt,PVTv2 等基础视觉算法
Stars: ✭ 134 (+306.06%)
Mutual labels:  self-supervised-learning
video repres mas
code for CVPR-2019 paper: Self-supervised Spatio-temporal Representation Learning for Videos by Predicting Motion and Appearance Statistics
Stars: ✭ 63 (+90.91%)
Mutual labels:  self-supervised-learning
Co-mining
Co-mining: Self-Supervised Learning for Sparsely Annotated Object Detection, AAAI 2021.
Stars: ✭ 16 (-51.52%)
Mutual labels:  self-supervised-learning
GCA
[WWW 2021] Source code for "Graph Contrastive Learning with Adaptive Augmentation"
Stars: ✭ 69 (+109.09%)
Mutual labels:  self-supervised-learning
DIG
A library for graph deep learning research
Stars: ✭ 1,078 (+3166.67%)
Mutual labels:  self-supervised-learning
improving segmentation with selfsupervised depth
[CVPR21] Implementation of our work "Three Ways to Improve Semantic Segmentation with Self-Supervised Depth Estimation"
Stars: ✭ 189 (+472.73%)
Mutual labels:  self-supervised-learning
point-cloud-prediction
Self-supervised Point Cloud Prediction Using 3D Spatio-temporal Convolutional Networks
Stars: ✭ 97 (+193.94%)
Mutual labels:  self-supervised-learning
awesome-contrastive-self-supervised-learning
A comprehensive list of awesome contrastive self-supervised learning papers.
Stars: ✭ 748 (+2166.67%)
Mutual labels:  self-supervised-learning
FisheyeDistanceNet
FisheyeDistanceNet
Stars: ✭ 33 (+0%)
Mutual labels:  self-supervised-learning
simclr-pytorch
PyTorch implementation of SimCLR: supports multi-GPU training and closely reproduces results
Stars: ✭ 89 (+169.7%)
Mutual labels:  self-supervised-learning
FKD
A Fast Knowledge Distillation Framework for Visual Recognition
Stars: ✭ 49 (+48.48%)
Mutual labels:  self-supervised-learning
CIKM2020-S3Rec
Code for CIKM2020 "S3-Rec: Self-Supervised Learning for Sequential Recommendation with Mutual Information Maximization"
Stars: ✭ 150 (+354.55%)
Mutual labels:  self-supervised-learning
self-supervised
Whitening for Self-Supervised Representation Learning | Official repository
Stars: ✭ 83 (+151.52%)
Mutual labels:  self-supervised-learning
al-fk-self-supervision
Official PyTorch code for CVPR 2020 paper "Deep Active Learning for Biased Datasets via Fisher Kernel Self-Supervision"
Stars: ✭ 28 (-15.15%)
Mutual labels:  self-supervised-learning
EgoNet
Official project website for the CVPR 2021 paper "Exploring intermediate representation for monocular vehicle pose estimation"
Stars: ✭ 111 (+236.36%)
Mutual labels:  self-supervised-learning

Can contrastive learning avoid shortcut solutions?

The generalization of representations learned via contrastive learning depends crucially on what features of the data are extracted. However, we observe that the contrastive loss does not always sufficiently guide which features are extracted, a behavior that can negatively impact the performance on downstream tasks via "shortcuts", i.e., by inadvertently suppressing important predictive features. We find that feature extraction is influenced by the difficulty of the so-called instance discrimination task (i.e., the task of discriminating pairs of similar points from pairs of dissimilar ones). Although harder pairs improve the representation of some features, the improvement comes at the cost of suppressing previously well represented features. In response, we propose implicit feature modification (IFM), a method for altering positive and negative samples in order to guide contrastive models towards capturing a wider variety of predictive features. Empirically, we observe that IFM reduces feature suppression, and as a result improves performance on vision and medical imaging tasks.

An ideal encoder would discriminate between instances using multiple distinguishing features instead of finding simple shortcuts that suppress features. We show that InfoNCE-trained encoders can suppress features (Sec. 2.2). However, making instance discrimination harder during training can trade off representation of different features (Sec. 2.3). To avoid the need for trade-offs we propose implicit feature modification (Sec. 3), which reduces suppression in general, and improves generalization (Sec. 4).

Can contrastive learning avoid shortcut solutions? [paper]
Joshua Robinson, Li Sun, Ke Yu, Kayhan Batmanghelich, Stefanie Jegelka, and Suvrit Sra

Implicit feature modification

In this paper we present implicit feature modification, a method for reducing shortcut learning in contorstive leanring while adding no computational overhead, and requiring only a couple of lines of code to implement. We also find that IFM improves downstream generalization. This repo contains a minimally modificed version of the official MoCo code to illustrate the simplicity of the implementation.

To reproduce our ImageNet100 results, first Install PyTorch and ImageNet dataset following the official PyTorch ImageNet training code, and select the 100 sublasses. To do 200 epochs of unsupervised pre-training using a ResNet-50 model using our method, run for example:

python main_moco.py \
  -a resnet50 \
  --lr 0.8 \
  --batch-size 512 \
  --moco-m 0.99 \
  --mlp --moco-t 0.2 --aug-plus --cos
  --dist-url 'tcp://localhost:10001' --multiprocessing-distributed --world-size 1 --rank 0 \
  --method ifm \
  --epsilon 0.1 \
  --dataset_root PATH/TO/DATA

To run standard MoCo-v2 simply remove the --method and --epsilon arguments. Training should fit on any 8-gpu machine, but also works on 4 Tesla V100s. For linear evaluation run,

python main_lincls.py \
--pretrained=model_best.pth.tar \
--lr 10.0  \ 
-b=128  \
--schedule 30 40 50 \
--epochs 60 \
--dist-url=tcp://localhost:10001 \
--dataset_root=PATH/TO/DATA

Checkpoints for models pre-trained on ImageNet100 can be downloaded here:

epochs epsilon top-1 acc. checkpoint
MoCo-v2 200 0 80.5 download
IFM-MoCo-v2 200 0.05 81.1 download
IFM-MoCo-v2 200 0.1 81.4 download
IFM-MoCo-v2 200 0.2 80.9 download

Citation

If you find this repo useful for your research, please consider citing the paper

@article{robinson2021shortcuts,
  title={Can contrastive learning avoid shortcut solutions?},
  author={Robinson, Joshua and Sun, Li and Yu, Ke and Batmanghelich, Kayhan and Jegelka, Stefanie and Sra, Suvrit},
  journal={NeurIPS},
  year={2021}
}

For any questions, please contact Josh Robinson ([email protected]).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].