All Projects → UMBCvision → Compress

UMBCvision / Compress

Licence: mit
Compressing Representations for Self-Supervised Learning

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Compress

Revisiting-Contrastive-SSL
Revisiting Contrastive Methods for Unsupervised Learning of Visual Representations. [NeurIPS 2021]
Stars: ✭ 81 (+88.37%)
Mutual labels:  clustering, representation-learning
Self Supervised Learning Overview
📜 Self-Supervised Learning from Images: Up-to-date reading list.
Stars: ✭ 73 (+69.77%)
Mutual labels:  representation-learning, clustering
Unsupervised Classification
SCAN: Learning to Classify Images without Labels (ECCV 2020), incl. SimCLR.
Stars: ✭ 605 (+1306.98%)
Mutual labels:  representation-learning, clustering
DESOM
🌐 Deep Embedded Self-Organizing Map: Joint Representation Learning and Self-Organization
Stars: ✭ 76 (+76.74%)
Mutual labels:  clustering, representation-learning
M-NMF
An implementation of "Community Preserving Network Embedding" (AAAI 2017)
Stars: ✭ 119 (+176.74%)
Mutual labels:  clustering, representation-learning
Self Label
Self-labelling via simultaneous clustering and representation learning. (ICLR 2020)
Stars: ✭ 324 (+653.49%)
Mutual labels:  representation-learning, clustering
Bagofconcepts
Python implementation of bag-of-concepts
Stars: ✭ 18 (-58.14%)
Mutual labels:  representation-learning, clustering
Kitti Track Collection
Data and devtools for the "Large-Scale Object Discovery and Detector Adaptation from Unlabeled Video" paper.
Stars: ✭ 20 (-53.49%)
Mutual labels:  clustering
Channel Pruning
Channel Pruning for Accelerating Very Deep Neural Networks (ICCV'17)
Stars: ✭ 979 (+2176.74%)
Mutual labels:  model-compression
Tribuo
Tribuo - A Java machine learning library
Stars: ✭ 882 (+1951.16%)
Mutual labels:  clustering
Graphvite
GraphVite: A General and High-performance Graph Embedding System
Stars: ✭ 865 (+1911.63%)
Mutual labels:  representation-learning
Densitycluster
Machine learning. Clustering by fast search and find of density peaks.
Stars: ✭ 27 (-37.21%)
Mutual labels:  clustering
Mlj.jl
A Julia machine learning framework
Stars: ✭ 982 (+2183.72%)
Mutual labels:  clustering
Events
Repository for *SEM Paper on Event Coreference Resolution in ECB+
Stars: ✭ 20 (-53.49%)
Mutual labels:  clustering
Model Optimization
A toolkit to optimize ML models for deployment for Keras and TensorFlow, including quantization and pruning.
Stars: ✭ 992 (+2206.98%)
Mutual labels:  model-compression
Clustering
fast clustering algorithms
Stars: ✭ 14 (-67.44%)
Mutual labels:  clustering
Swarm
Easy clustering, registration, and distribution of worker processes for Erlang/Elixir
Stars: ✭ 1,004 (+2234.88%)
Mutual labels:  clustering
Knowledge Distillation Pytorch
A PyTorch implementation for exploring deep and shallow knowledge distillation (KD) experiments with flexibility
Stars: ✭ 986 (+2193.02%)
Mutual labels:  model-compression
K Means Constrained
K-Means clustering - constrained with minimum and maximum cluster size
Stars: ✭ 33 (-23.26%)
Mutual labels:  clustering
Mob Suite
MOB-suite: Software tools for clustering, reconstruction and typing of plasmids from draft assemblies
Stars: ✭ 32 (-25.58%)
Mutual labels:  clustering

CompRess: Self-Supervised Learning by Compressing Representations

This repository is the official implementation of CompRess: Self-Supervised Learning by Compressing Representations

Project webpage. https://umbcvision.github.io/CompRess/

@Article{abbasi2020compress,
  author  = {Koohpayegani, Soroush Abbasi and Tejankar, Ajinkya and Pirsiavash, Hamed},
  title   = {CompRess: Self-Supervised Learning by Compressing Representations},
  journal = {Advances in neural information processing systems},
  year    = {2020},
}

[comment]: <> (📋Optional: include a graphic explaining your approach/main result, bibtex entry, link to demos, blog posts and tutorials)

Requirements

Install PyTorch and ImageNet dataset following the official PyTorch ImageNet training code. We used Python 3.7 for our experiments.

To run NN and Cluster Alignment, you require to install FAISS.

FAISS:

[comment]: <> (📋Describe how to set up the environment, e.g. pip/conda/docker commands, download datasets, etc...)

Training

Our code is based on unofficial implementation of MoCo from https://github.com/HobbitLong/CMC.

To train the student(s) using pretrained teachers in the paper :

Download pretrained official MoCo ResNet50 model from https://github.com/facebookresearch/moco.

Then train the student using pretrained model:

python train_student.py \
    --teacher_arch resnet50 \ 
    --teacher <path_to_pretrained_model or cached_features> \
    --student_arch mobilenet \
    --checkpoint_path <path_to_checkpoint_folder> \
    <path_to_imagenet_data>

To train the student(s) using cached teachers in the paper :

We converted TensorFlow SimCLRv1 ResNet50x4(https://github.com/google-research/simclr) to PyTorch. Optionally, you can download pretrained SimCLR ResNet50x4 PyTorch model from here.

First, run this command to calculate and store cached features.

python cache_feats.py \ 
    --weight <path_to_pretrained_model> \
    --save <path_to_save_folder> \
    --arch resnet50x4 \ 
    --data_pre_processing SimCLR \ 
    <path_to_imagenet_data>

Then train the student using cached features:

python train_student.py \
    --cache_teacher \ 
    --teacher <path_to_pretrained_model or cached_features> \
    --student_arch mobilenet \
    --checkpoint_path <path_to_checkpoint_folder> \
    <path_to_imagenet_data>

To train the student(s) without Momentum framework execute train_student_without_momentum.py instead of train_student.py

[comment]: <> (📋Describe how to train the models, with example commands on how to train the models in your paper, including the full training procedure and appropriate hyperparameters.)

Evaluation

To run Nearest Neighbor evaluation on ImageNet, run:

python eval_knn.py \
    --arch alexnet \
    --weights <path_to_pretrained_model> \
    --save <path_to_save_folder> \
    <path_to_imagenet_data>

Note that above execution will cache features too. After first execution, you can add "--load_cache" flag to load cached features from a file.

To run Cluster Alignment evaluation on ImageNet, run:

python eval_cluster_alignment.py  \
    --weights <path_to_pretrained_model> \
    --arch resnet18  \
    --save <path_to_save_folder> \ 
    --visualization \ 
    --confusion_matrix \ 
    <path_to_imagenet_data> 

To run Linear Classifier evaluation on ImageNet, run:


python eval_linear.py \
    --arch alexnet \
    --weights <path_to_pretrained_model> \
    --save <path_to_save_folder> \
    <path_to_imagenet_data>

Results

"SOTA Self-Supervised" refers to SimCLR for RexNet50x4 and MoCo for all other architectures.

Our model achieves the following performance on ImageNet:

Model name Teacher Top-1 Linear Classifier Accuracy Top-1 Nearest Neighbor Accuracy Top-1 Cluster Alignment Accuracy Pre-trained
CompRess(Resnet50) SimCLR ResNet50x4(cached) 71.6% 63.4% 42.0% Pre-trained Resnet50
CompRess(Mobilenet) MoCoV2 ResNet50 63.0% 54.4% 35.5% Pre-trained Mobilenet
CompRess(Resnet18) MoCoV2 ResNet50 61.7% 53.4% 34.7% Pre-trained Resnet18
CompRess(Resnet18) SwAV ResNet50 65.6% 56.0% 26.3% Pre-trained Resnet18
CompRess(Alexnet) SimCLR ResNet50x4(cached) 57.6% 52.3% 33.3% Pre-trained Alexnet

License

This project is under the MIT license.

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