Skip to content

guolz-ml/SimCLR-Pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimCLR-Pytorch.

An Pytorch implementation of SimCLR. SimCLR: A Simple Framework for Contrastive Learning of Visual Representations

Introduction to SimCLR

SimCLR is a framework for contrastive learning of visual representations, it includes three main modules:

  1. Generate two different data augmentations. (Implementated in "simclr/augmentation_simclr.py"
  2. A deep model to output learned representations of the two augmentations. (Implemented in "models/simclr_backbone.py")
  3. Maximize the aggrement of learned representations. (Implemented in "simclr/contrastive_loss.py")

Pre-Training

Simply run the following code to pre-train an encoder using SimCLR:

python train_simclr.py --dataset cifar10 --backbone resnet18 --projection_size 128 

Fine-Tuning

Simply run the following code to train a Logistic Regression classifier using the features generated by the pre-trained model

python train_linear_model.py --dataset cifar10 --backbone resnet18 --projection_size 128 --resume ./pretrain_results/resnet18_cifar10_model.pth.tar

Dependencies

python = 3.7.6
pytorch = 1.4.0
torchvision

About

A Pytorch Implementation of SimCLR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages