Git Product home page Git Product logo

imbalanced-ssl's Introduction

Imbalanced-SSL

Code Release for "Self-supervised Learning is More Robust to Dataset Imbalance"

Requirement

  • pytorch>=1.6.0
  • torchvision
  • numpy
  • tqdm

Data

The CIFAR data is available in the google drive link.

The ImageNet textlists is available in the google drive link.

Usage

Train on Imbalanced CIFAR

Exponential weight

python main_sam_exp.py --data_root data/ --arch resnet18 \
       --learning_rate 0.06 --epochs 1600 --weight_decay 5e-4 --momentum 0.9 \
       --batch_size 512 --gpu 0 \
       --exp_dir <exp_dir> \
       --rho 7.0 --phi 1.6

KDE weight

python main_sam_weight.py --data_root data/ --arch resnet18 \
       --learning_rate 0.06 --epochs 1600 --weight_decay 5e-4 --momentum 0.9 \
       --batch_size 512 --gpu 0 \
       --weight_path <weight_path> \
       --exp_dir <exp_dir> \

No weight

python main.py --data_root data/ --arch resnet18 \
       --learning_rate 0.06 --epochs 1600 --weight_decay 5e-4 --momentum 0.9 \
       --batch_size 512 --gpu 0 \
       --exp_dir <exp_dir> \

Evaluation on Balanced CIFAR

python main_lincls.py --arch resnet18 --num_cls 10 \
       --batch_size 256 --lr 30.0 --weight_decay 0.0 \
       --pretrained <pretraining_checkpoint_path> --gpu 0 <cifar_data_path>

Train on ImageNet

python pretrain_moco_sam_rare.py --dataset imagenet --data data/imagenet \
       --epochs 300 --rho 2 --phi 1.005 \
       --root_path <root_path> --dist-url tcp://localhost:10001

Evaluate on Downstream Datasets

CUDA_VISIBLE_DEVICES=0 python ft_moco.py <dataset_path> \
       -d <dataset_name> -sr 100 --lr 0.1 -i 2000 \
       --lr-decay-epochs 5 10 15 --epochs 20  \
       --log <output_path> --pretrained <model_checkpoint_path>

Citation

@inproceedings{
liu2022selfsupervised,
title={Self-supervised Learning is More Robust to Dataset Imbalance},
author={Hong Liu and Jeff Z. HaoChen and Adrien Gaidon and Tengyu Ma},
booktitle={International Conference on Learning Representations},
year={2022},
url={https://openreview.net/forum?id=4AZz9osqrar}
}

imbalanced-ssl's People

Contributors

liuhong99 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.