Home

Awesome

DLSA

This is the code accompanying our ECCV'22 papers: Constructing Balance from Imbalance for Long-tailed Image Recognition

Overview

Prerequisites

Packages: Install using pip install -r requirements.txt

Features: Train backbone models with Decouple<sup>[2]</sup>, and PaCo<sup>[3]</sup> and extract features for train and test sets. The features should be stored as features_train.h5 or features_test.h5 with structure:

{
    "features": numpy.ndarray, shape = (num_sample, feature_dim),
    "labels": numpy.ndarray, shape = (num_sample, ),
}

Please put the pretrained models and files in folder features and organize it as:

features
├── imagenet
│   ├── ce
│   │   ├── feature_test.h5
│   │   ├── feature_train.h5
│   │   └── final_model_checkpoint.pth
│   ├── cbs/...
│   └── paco/...
├── places
│   ├── ce/...
│   └── paco/...
└── inat
    └── paco/...

The pretrained feature and models will be released later.

Training

For example, to train a DLSA on PaCo+BSM model on ImageNet-LT, run:

python train_dlsa.py --cfg config/cls/ImgNet_PaCo_R50_bsm.yaml

Acknowledgement

The code, data and pretrianed models are partly based on OLTR<sup>[1]</sup>, Decouple<sup>[2]</sup>, PaCo<sup>[3]</sup> and normalizing_flows.

Reference

[1] Large-Scale Long-Tailed Recognition in an Open World

[2] Decoupling Representation and Classifier for Long-Tailed Recognition

[3] Parametric Contrastive Learning