Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
/ directclr Public archive

Code used in "Understanding Dimensional Collapse in Contrastive Self-supervised Learning" paper.

License

Notifications You must be signed in to change notification settings

facebookresearch/directclr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Understanding Dimensional Collapse in Contrastive Self-supervised Learning

This repo contains the code used in paper Understanding Dimensional Collapse in Contrastive Self-supervised Learning.

complete-collapse idea dim-collapse

@article{Jing2021UnderstandingDC,
  title={Understanding Dimensional Collapse in Contrastive Self-supervised Learning},
  author={Li Jing and Pascal Vincent and Yann LeCun and Yuandong Tian},
  journal={arXiv preprint arXiv:2110.09348},
  year={2021}
}

Part 1: Visualize SimCLR's embedding Spectrum

We viaulize the embedding space spectrum of a pretrained SimCLR model.

spectrum

The spectrum is generated by spectrum.py.

How to use:

python spectrum.py --data <path-to-imagenet-data> --checkpoint <path-to-checkpoint> --projector

Part 2: Toy Tasks

We show that 2 reasons (strong augmentaiton and implicit regularization) cause dimensional collapse in contrastive learning via toy tasks. Please see toy_tasks.

Part 3: DirectCLR

DirectCLR is a simple contrastive learning model for visual representation learning. It does not require a trainable projector as SimCLR. It is able to prevent dimensional collapse and outperform SimCLR with a linear projector.

DirectCLR

For training / evaluation detail, please see diretclr.

License

This project is under the CC-BY-NC 4.0 license. See LICENSE for details.

About

Code used in "Understanding Dimensional Collapse in Contrastive Self-supervised Learning" paper.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages