[AAAI-2022] Official implementations of MCL: Mutual Contrastive Learning for Visual Representation Learning

Related tags

Deep LearningMCL
Overview

Mutual Contrastive Learning for Visual Representation Learning

This project provides source code for our Mutual Contrastive Learning for Visual Representation Learning (MCL).

Installation

Requirements

Ubuntu 18.04 LTS

Python 3.8 (Anaconda is recommended)

CUDA 11.1

PyTorch 1.7.0

NCCL for CUDA 11.1

Supervised Learning on CIFAR-100 dataset

Dataset

CIFAR-100 : download

unzip to the ./data folder

Training two baseline networks

python main_cifar.py --arch resnet32 --number-net 2

More commands for training various architectures can be found in scripts/train_cifar_baseline.sh

Training two networks by MCL

python main_cifar.py --arch resnet32  --number-net 2 \
    --alpha 0.1 --gamma 1. --beta 0.1 --lam 1. 

More commands for training various architectures can be found in scripts/train_cifar_mcl.sh

Results of MCL on CIFAR-100

We perform all experiments on a single NVIDIA RTX 3090 GPU (24GB) with three runs.

Network Baseline MCL(×2) MCL(×4)
ResNet-32 70.91±0.14 72.96±0.28 74.04±0.07
ResNet-56 73.15±0.23 74.48±0.23 75.74±0.16
ResNet-110 75.29±0.16 77.12±0.20 78.82±0.14
WRN-16-2 72.55±0.24 74.56±0.11 75.79±0.07
WRN-40-2 76.89±0.29 77.51±0.42 78.84±0.22
HCGNet-A1 77.42±0.16 78.62±0.26 79.50±0.15
ShuffleNetV2 0.5× 67.39±0.35 69.55±0.22 70.92±0.28
ShuffleNetV2 1× 70.93±0.24 73.26±0.18 75.18±0.25

Training multiple networks by MCL combined with Logit distillation

python main_cifar.py --arch WRN_16_2  --number-net 4 \
    --alpha 0.1 --gamma 1. --beta 0.1 --lam 1. \
    --logit-distill

More commands for training various architectures can be found in scripts/train_cifar_mcl_logit.sh

Results of MCL combined with logit distillation on CIFAR-100

We perform all experiments on a single NVIDIA RTX 3090 GPU (24GB) with three runs.

Network Baseline MCL(×4)+Logit KD
WRN-16-2 72.55±0.24 76.34±0.22
WRN-40-2 76.89±0.29 80.02±0.45
WRN-28-4 79.17±0.29 81.68±0.31
ShuffleNetV2 1× 70.93±0.24 77.02±0.32
HCGNet-A2 79.00±0.41 82.47±0.20

Supervised Learning on ImageNet dataset

Dataset preparation

  • Download the ImageNet dataset to YOUR_IMAGENET_PATH and move validation images to labeled subfolders

  • Create a datasets subfolder and a symlink to the ImageNet dataset

$ ln -s PATH_TO_YOUR_IMAGENET ./data/

Folder of ImageNet Dataset:

data/ImageNet
├── train
├── val

Training two networks by MCL

python main_cifar.py --arch resnet18  --number-net 2 \
    --alpha 0.1 --gamma 1. --beta 0.1 --lam 1. 

More commands for training various architectures can be found in scripts/train_imagenet_mcl.sh

Results of MCL on ImageNet

We perform all experiments on a single NVIDIA Tesla V100 GPU (32GB) with three runs.

Network Baseline MCL(×2) MCL(×4)
ResNet-18 69.76 70.32 70.77
ResNet-34 73.30 74.13 74.34

Training two networks by MCL combined with logit distillation

python main_cifar.py --arch resnet18  --number-net 2 \
    --alpha 0.1 --gamma 1. --beta 0.1 --lam 1. 

More commands for training various architectures can be found in scripts/train_imagenet_mcl.sh

Results of MCL combined with logit distillation on ImageNet

We perform all experiments on a single NVIDIA Tesla V100 GPU (32GB) with three runs.

Network Baseline MCL(×4)+Logit KD
ResNet-18 69.76 70.82

Self-Supervised Learning on ImageNet dataset

Apply MCL(×2) to MoCo

python main_moco_mcl.py \
  -a resnet18 \
  --lr 0.03 \
  --batch-size 256 \
  --number-net 2 \
  --dist-url 'tcp://localhost:10001' \
  --multiprocessing-distributed \
  --world-size 1 \
  --rank 0 \
  --gpu-ids 0,1,2,3,4,5,6,7 

Linear Classification

python main_lincls.py \
  -a resnet18 \
  --lr 30.0 \
  --batch-size 256 \
  --pretrained [your checkpoint path]/checkpoint_0199.pth.tar \
  --dist-url 'tcp://localhost:10001' \
  --multiprocessing-distributed \
  --world-size 1 \
  --rank 0 \
  --gpu-ids 0,1,2,3,4,5,6,7 

Results of applying MCL to MoCo on ImageNet

We perform all experiments on 8 NVIDIA RTX 3090 GPUs with three runs.

Network Baseline MCL(×2)
ResNet-18 47.45±0.11 48.04±0.13

Citation

@inproceedings{yang2022mcl,
  title={Mutual Contrastive Learning for Visual Representation Learning},
  author={Chuanguang Yang, Zhulin An, Linhang Cai, Yongjun Xu},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  year={2022}
}
Owner
winycg
winycg
Transfer SemanticKITTI labeles into other dataset/sensor formats.

LiDAR-Transfer Transfer SemanticKITTI labeles into other dataset/sensor formats. Content Convert datasets (NUSCENES, FORD, NCLT) to KITTI format Minim

Photogrammetry & Robotics Bonn 64 Nov 21, 2022
基于DouZero定制AI实战欢乐斗地主

DouZero_For_Happy_DouDiZhu: 将DouZero用于欢乐斗地主实战 本项目基于DouZero 环境配置请移步项目DouZero 模型默认为WP,更换模型请修改start.py中的模型路径 运行main.py即可 SL (baselines/sl/): 基于人类数据进行深度学习

1.5k Jan 08, 2023
The hippynn python package - a modular library for atomistic machine learning with pytorch.

The hippynn python package - a modular library for atomistic machine learning with pytorch. We aim to provide a powerful library for the training of a

Los Alamos National Laboratory 37 Dec 29, 2022
On the Analysis of French Phonetic Idiosyncrasies for Accent Recognition

On the Analysis of French Phonetic Idiosyncrasies for Accent Recognition With the spirit of reproducible research, this repository contains codes requ

0 Feb 24, 2022
Turning SymPy expressions into JAX functions

sympy2jax Turn SymPy expressions into parametrized, differentiable, vectorizable, JAX functions. All SymPy floats become trainable input parameters. S

Miles Cranmer 38 Dec 11, 2022
Dense Gaussian Processes for Few-Shot Segmentation

DGPNet - Dense Gaussian Processes for Few-Shot Segmentation Welcome to the public repository for DGPNet. The paper is available at arxiv: https://arxi

37 Jan 07, 2023
DI-smartcross - Decision Intelligence Platform for Traffic Crossing Signal Control

DI-smartcross DI-smartcross - Decision Intelligence Platform for Traffic Crossin

OpenDILab 213 Jan 02, 2023
TDN: Temporal Difference Networks for Efficient Action Recognition

TDN: Temporal Difference Networks for Efficient Action Recognition Overview We release the PyTorch code of the TDN(Temporal Difference Networks).

Multimedia Computing Group, Nanjing University 326 Dec 13, 2022
The pytorch implementation of DG-Font: Deformable Generative Networks for Unsupervised Font Generation

DG-Font: Deformable Generative Networks for Unsupervised Font Generation The source code for 'DG-Font: Deformable Generative Networks for Unsupervised

130 Dec 05, 2022
这个开源项目主要是对经典的时间序列预测算法论文进行复现,模型主要参考自GluonTS,框架主要参考自Informer

Time Series Research with Torch 这个开源项目主要是对经典的时间序列预测算法论文进行复现,模型主要参考自GluonTS,框架主要参考自Informer。 建立原因 相较于mxnet和TF,Torch框架中的神经网络层需要提前指定输入维度: # 建立线性层 TensorF

Chi Zhang 85 Dec 29, 2022
U-Net: Convolutional Networks for Biomedical Image Segmentation

Deep Learning Tutorial for Kaggle Ultrasound Nerve Segmentation competition, using Keras This tutorial shows how to use Keras library to build deep ne

Yihui He 401 Nov 21, 2022
Compare neural networks by their feature similarity

PyTorch Model Compare A tiny package to compare two neural networks in PyTorch. There are many ways to compare two neural networks, but one robust and

Anand Krishnamoorthy 181 Jan 04, 2023
Rule Based Classification Project

Kural Tabanlı Sınıflandırma ile Potansiyel Müşteri Getirisi Hesaplama İş Problemi: Bir oyun şirketi müşterilerinin bazı özelliklerini kullanaraknseviy

Şafak 1 Jan 12, 2022
Codes accompanying the paper "Believe What You See: Implicit Constraint Approach for Offline Multi-Agent Reinforcement Learning" (NeurIPS 2021 Spotlight

Implicit Constraint Q-Learning This is a pytorch implementation of ICQ on Datasets for Deep Data-Driven Reinforcement Learning (D4RL) and ICQ-MA on SM

42 Dec 23, 2022
This repo in the implementation of EMNLP'21 paper "SPARQLing Database Queries from Intermediate Question Decompositions" by Irina Saparina, Anton Osokin

SPARQLing Database Queries from Intermediate Question Decompositions This repo is the implementation of the following paper: SPARQLing Database Querie

Yandex Research 20 Dec 19, 2022
Python scripts to detect faces in Python with the BlazeFace Tensorflow Lite models

Python scripts to detect faces using Python with the BlazeFace Tensorflow Lite models. Tested on Windows 10, Tensorflow 2.4.0 (Python 3.8).

Ibai Gorordo 46 Nov 17, 2022
LeViT a Vision Transformer in ConvNet's Clothing for Faster Inference

LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference This repository contains PyTorch evaluation code, training code and pretrained

Facebook Research 504 Jan 02, 2023
Improved Fitness Optimization Landscapes for Sequence Design

ReLSO Improved Fitness Optimization Landscapes for Sequence Design Description Citation How to run Training models Original data source Description In

Krishnaswamy Lab 44 Dec 20, 2022
A fast MoE impl for PyTorch

An easy-to-use and efficient system to support the Mixture of Experts (MoE) model for PyTorch.

Rick Ho 873 Jan 09, 2023
Baseline for the Spoofing-aware Speaker Verification Challenge 2022

Introduction This repository contains several materials that supplements the Spoofing-Aware Speaker Verification (SASV) Challenge 2022 including: calc

40 Dec 28, 2022