All Projects → salesforce → Pcl

salesforce / Pcl

Licence: mit
PyTorch code for "Prototypical Contrastive Learning of Unsupervised Representations"

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pcl

Gat2vec
representation learning on attributed graphs
Stars: ✭ 48 (-61.29%)
Mutual labels:  representation-learning
Asne
A sparsity aware and memory efficient implementation of "Attributed Social Network Embedding" (TKDE 2018).
Stars: ✭ 73 (-41.13%)
Mutual labels:  representation-learning
Codesearchnet
Datasets, tools, and benchmarks for representation learning of code.
Stars: ✭ 1,378 (+1011.29%)
Mutual labels:  representation-learning
Codeslam
Implementation of CodeSLAM — Learning a Compact, Optimisable Representation for Dense Visual SLAM paper (https://arxiv.org/pdf/1804.00874.pdf)
Stars: ✭ 64 (-48.39%)
Mutual labels:  representation-learning
Graph 2d cnn
Code and data for the paper 'Classifying Graphs as Images with Convolutional Neural Networks' (new title: 'Graph Classification with 2D Convolutional Neural Networks')
Stars: ✭ 67 (-45.97%)
Mutual labels:  representation-learning
Ice
ICE: Item Concept Embedding
Stars: ✭ 83 (-33.06%)
Mutual labels:  representation-learning
Word2vec Win32
A word2vec port for Windows.
Stars: ✭ 41 (-66.94%)
Mutual labels:  representation-learning
Declutr
The corresponding code from our paper "DeCLUTR: Deep Contrastive Learning for Unsupervised Textual Representations". Do not hesitate to open an issue if you run into any trouble!
Stars: ✭ 111 (-10.48%)
Mutual labels:  representation-learning
Self Supervised Learning Overview
📜 Self-Supervised Learning from Images: Up-to-date reading list.
Stars: ✭ 73 (-41.13%)
Mutual labels:  representation-learning
Sert
Semantic Entity Retrieval Toolkit
Stars: ✭ 100 (-19.35%)
Mutual labels:  representation-learning
Dna Gan
DNA-GAN: Learning Disentangled Representations from Multi-Attribute Images
Stars: ✭ 65 (-47.58%)
Mutual labels:  representation-learning
Evalne
Source code for EvalNE, a Python library for evaluating Network Embedding methods.
Stars: ✭ 67 (-45.97%)
Mutual labels:  representation-learning
Conmask
ConMask model described in paper Open-world Knowledge Graph Completion.
Stars: ✭ 84 (-32.26%)
Mutual labels:  representation-learning
Usss iccv19
Code for Universal Semi-Supervised Semantic Segmentation models paper accepted in ICCV 2019
Stars: ✭ 57 (-54.03%)
Mutual labels:  representation-learning
Ampligraph
Python library for Representation Learning on Knowledge Graphs https://docs.ampligraph.org
Stars: ✭ 1,662 (+1240.32%)
Mutual labels:  representation-learning
Compress
Compressing Representations for Self-Supervised Learning
Stars: ✭ 43 (-65.32%)
Mutual labels:  representation-learning
Mklpy
A package for Multiple Kernel Learning in Python
Stars: ✭ 81 (-34.68%)
Mutual labels:  representation-learning
Multi object datasets
Multi-object image datasets with ground-truth segmentation masks and generative factors.
Stars: ✭ 121 (-2.42%)
Mutual labels:  representation-learning
Sigver wiwd
Learned representation for Offline Handwritten Signature Verification. Models and code to extract features from signature images.
Stars: ✭ 112 (-9.68%)
Mutual labels:  representation-learning
Pointglr
Global-Local Bidirectional Reasoning for Unsupervised Representation Learning of 3D Point Clouds (CVPR 2020)
Stars: ✭ 86 (-30.65%)
Mutual labels:  representation-learning

Prototypical Contrastive Learning of Unsupervised Representations (Salesforce Research)

This is a PyTorch implementation of the PCL paper:

@article{PCL,
	title={Prototypical Contrastive Learning of Unsupervised Representations},
	author={Junnan Li and Pan Zhou and Caiming Xiong and Steven C.H. Hoi},
	journal={ICLR},
	year={2021}
}

Requirements:

  • ImageNet dataset
  • Python ≥ 3.6
  • PyTorch ≥ 1.4
  • faiss-gpu: pip install faiss-gpu
  • pip install tqdm

Unsupervised Training:

This implementation only supports multi-gpu, DistributedDataParallel training, which is faster and simpler; single-gpu or DataParallel training is not supported.

To perform unsupervised training of a ResNet-50 model on ImageNet using a 4-gpu or 8-gpu machine, run:

python main_pcl.py \ 
  -a resnet50 \ 
  --lr 0.03 \
  --batch-size 256 \
  --temperature 0.2 \
  --mlp --aug-plus --cos (only activated for PCL v2) \	
  --dist-url 'tcp://localhost:10001' --multiprocessing-distributed --world-size 1 --rank 0 \
  --exp-dir experiment_pcl
  [Imagenet dataset folder]

Download Pre-trained Models

PCL v1 PCL v2

Linear SVM Evaluation on VOC

To train a linear SVM classifier on VOC dataset, using frozen representations from a pre-trained model, run:

python eval_svm_voc.py --pretrained [your pretrained model] \
  -a resnet50 \ 
  --low-shot (only for low-shot evaluation, otherwise the entire dataset is used) \
  [VOC2007 dataset folder]

Linear SVM classification result on VOC, using ResNet-50 pretrained with PCL for 200 epochs:

Model k=1 k=2 k=4 k=8 k=16 Full
PCL v1 46.9 56.4 62.8 70.2 74.3 82.3
PCL v2 47.9 59.6 66.2 74.5 78.3 85.4

k is the number of training samples per class.

Linear Classifier Evaluation on ImageNet

Requirement: pip install tensorboard_logger
To train a logistic regression classifier on ImageNet, using frozen representations from a pre-trained model, run:

python eval_cls_imagenet.py --pretrained [your pretrained model] \
  -a resnet50 \ 
  --lr 5 \
  --batch-size 256 \
  --id ImageNet_linear \ 
  --dist-url 'tcp://localhost:10001' --multiprocessing-distributed --world-size 1 --rank 0 \
  [Imagenet dataset folder]

Linear classification result on ImageNet, using ResNet-50 pretrained with PCL for 200 epochs: PCL v1 | PCL v2 ------ | ------ 61.5 | 67.6

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].