PyTorch implementation of the paper: Long-tail Learning via Logit Adjustment

Overview

logit-adj-pytorch

PyTorch implementation of the paper: Long-tail Learning via Logit Adjustment

This code implements the paper: Long-tail Learning via Logit Adjustment : Aditya Krishna Menon, Sadeep Jayasumana, Ankit Singh Rawat, Himanshu Jain, Andreas Veit, Sanjiv Kumar. ICLR 2021.

Running the code

# To produce baseline (ERM) results:
python main.py --dataset cifar10-lt

# To produce posthoc logit-adjustment results:
python main.py --dataset cifar10-lt  --logit_adj_post 1

# To produce logit-adjustment loss results:
python main.py --dataset cifar10-lt  --logit_adj_train 0

# To monitor the training progress using Tensorboard:
tensorboard --logdir logs

Replace cifar10-lt above with cifar100-lt to obtain results for the CIFAR-100 long-tail dataset.

Results

Baseline Post-hoc logit adjustment Logit-adjusted loss
CIFAR10LT 0.7127 0.7816 0.7857
CIFAR100LT 0.3985 0.4404 0.4402
Comments
  • hello,there is some wrong with the  compute_adjustment

    hello,there is some wrong with the compute_adjustment

    image

    There is no problem with 10 classification, when 100 classification, the order is wrong I modified it:

    label_freq = dict(sorted(label_freq.items()))
    label_freq = sorted(label_freq.items(), key=lambda e: e[1], reverse=True)
    label_freq_array = np.array([x[1] for x in label_freq])
    label_freq_array = label_freq_array / label_freq_array.sum()
    
    opened by limengyang1992 4
  • transforms.py need modification?

    transforms.py need modification?

    When I run your code without any changes, it raises errors "TypeError: img should be PIL Image. Got <class 'torch.Tensor'>". So I think the code in "dataset/transforms.py", line 21 "cifar10-lt": transforms.Compose([ transforms.RandomHorizontalFlip(), transforms.RandomCrop(32, 4), normalize]) may need some modifications, like: "cifar10-lt": transforms.Compose([ transforms.ToPILImage(), transforms.RandomHorizontalFlip(), transforms.RandomCrop(32, 4), transforms.ToTensor(), normalize ]), So is this a bug or my version problems?

    opened by Tao-Han 1
  • why we cannot reproduce the result of logit-adjusted loss

    why we cannot reproduce the result of logit-adjusted loss

    In the README.md, the result of logit-adjusted loss is 0.7857, but the result of our reproduction with the same code and data is 0.7421. Do we miss anything? On the other hand, the reproduction result of post-hoc logit-adjustment is 0.8062, which looks pretty good.

    opened by zhuhongtiandi 0
  • Logit adjustment loss

    Logit adjustment loss

    For the way 2 using logit adjustment loss, the output logits for inference accuracy in the validation don't perform the logits adjustment, but the validation loss use the logits adjustment. As shown in the snippet below:

    elif args.logit_adj_train:
         loss = criterion(output + args.logit_adjustments, target_var)
    acc = utils.accuracy(output.data, target)
    
    opened by caide199212 0
  • Why we need

    Why we need

    Hi @sadeepj , Thanks for your amazing work, I noticed that there is another weight decay term:

    loss = loss + args.weight_decay * loss_r
    

    Why do we need this line? The weight decay has been set in optimizer init

    Besides, I did not found any weight decay in the official TensorFlow code. Could you please explain it?

    opened by mitming 1
Owner
Chamuditha Jayanga
Electronics and Telecommunication Engineering Undergraduate at University of Moratuwa, Sri Lanka
Chamuditha Jayanga
Implementation of DropLoss for Long-Tail Instance Segmentation in Pytorch

[AAAI 2021]DropLoss for Long-Tail Instance Segmentation [AAAI 2021] DropLoss for Long-Tail Instance Segmentation Ting-I Hsieh*, Esther Robb*, Hwann-Tz

Tim 37 Dec 2, 2022
Implementation of "Distribution Alignment: A Unified Framework for Long-tail Visual Recognition"(CVPR 2021)

Implementation of "Distribution Alignment: A Unified Framework for Long-tail Visual Recognition"(CVPR 2021)

null 105 Nov 7, 2022
A scientific and useful toolbox, which contains practical and effective long-tail related tricks with extensive experimental results

Bag of tricks for long-tailed visual recognition with deep convolutional neural networks This repository is the official PyTorch implementation of AAA

Yong-Shun Zhang 181 Dec 28, 2022
OpenLT: An open-source project for long-tail classification

OpenLT: An open-source project for long-tail classification Supported Methods for Long-tailed Recognition: Cross-Entropy Loss Focal Loss (ICCV'17) Cla

Ming Li 37 Sep 15, 2022
Poplar implementation of "Bundle Adjustment on a Graph Processor" (CVPR 2020)

Poplar Implementation of Bundle Adjustment using Gaussian Belief Propagation on Graphcore's IPU Implementation of CVPR 2020 paper: Bundle Adjustment o

Joe Ortiz 34 Dec 5, 2022
This codebase is the official implementation of Test-Time Classifier Adjustment Module for Model-Agnostic Domain Generalization (NeurIPS2021, Spotlight)

Test-Time Classifier Adjustment Module for Model-Agnostic Domain Generalization This codebase is the official implementation of Test-Time Classifier A

null 47 Dec 28, 2022
Rotation-Only Bundle Adjustment

ROBA: Rotation-Only Bundle Adjustment Paper, Video, Poster, Presentation, Supplementary Material In this repository, we provide the implementation of

Seong 51 Nov 29, 2022
Square Root Bundle Adjustment for Large-Scale Reconstruction

RootBA: Square Root Bundle Adjustment Project Page | Paper | Poster | Video | Code Table of Contents Citation Dependencies Installing dependencies on

Nikolaus Demmel 205 Dec 20, 2022
Deep Unsupervised 3D SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment.

(ACMMM 2021 Oral) SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment This repository shows two tasks: Face landmark detection and Fac

BoomStar 51 Dec 13, 2022
Deep Unsupervised 3D SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment.

(ACMMM 2021 Oral) SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment This repository shows two tasks: Face landmark detection and Fac

BoomStar 51 Dec 13, 2022
A coin flip game in which you can put the amount of money below or equal to 1000 and then choose heads or tail

COIN_FLIPPY ##This is a simple example package. You can use Github-flavored Markdown to write your content. Coinflippy A coin flip game in which you c

null 2 Dec 26, 2021
A face dataset generator with out-of-focus blur detection and dynamic interval adjustment.

A face dataset generator with out-of-focus blur detection and dynamic interval adjustment.

Yutian Liu 2 Jan 29, 2022
Forecasting for knowable future events using Bayesian informative priors (forecasting with judgmental-adjustment).

What is judgyprophet? judgyprophet is a Bayesian forecasting algorithm based on Prophet, that enables forecasting while using information known by the

AstraZeneca 56 Oct 26, 2022
PyTorch implementation for our NeurIPS 2021 Spotlight paper "Long Short-Term Transformer for Online Action Detection".

Long Short-Term Transformer for Online Action Detection Introduction This is a PyTorch implementation for our NeurIPS 2021 Spotlight paper "Long Short

null 77 Dec 16, 2022
Pytorch implementation of the AAAI 2022 paper "Cross-Domain Empirical Risk Minimization for Unbiased Long-tailed Classification"

[AAAI22] Cross-Domain Empirical Risk Minimization for Unbiased Long-tailed Classification We point out the overlooked unbiasedness in long-tailed clas

PatatiPatata 28 Oct 18, 2022
[ECCVW2020] Robust Long-Term Object Tracking via Improved Discriminative Model Prediction (RLT-DiMP)

Feel free to visit my homepage Robust Long-Term Object Tracking via Improved Discriminative Model Prediction (RLT-DIMP) [ECCVW2020 paper] Presentation

Seokeon Choi 35 Oct 26, 2022
A Simple Long-Tailed Rocognition Baseline via Vision-Language Model

BALLAD This is the official code repository for A Simple Long-Tailed Rocognition Baseline via Vision-Language Model. Requirements Python3 Pytorch(1.7.

Teli Ma 4 Jan 20, 2022
This is the official code repository for A Simple Long-Tailed Rocognition Baseline via Vision-Language Model.

BALLAD This is the official code repository for A Simple Long-Tailed Rocognition Baseline via Vision-Language Model. Requirements Python3 Pytorch(1.7.

peng gao 11 Dec 1, 2021
Implementation for our ICCV2021 paper: Internal Video Inpainting by Implicit Long-range Propagation

Implicit Internal Video Inpainting Implementation for our ICCV2021 paper: Internal Video Inpainting by Implicit Long-range Propagation paper | project

null 202 Dec 30, 2022