This repository contains code for the paper "Disentangling Label Distribution for Long-tailed Visual Recognition", published at CVPR' 2021

Related tags

Deep Learning LADE
Overview

Disentangling Label Distribution for Long-tailed Visual Recognition (CVPR 2021)

Install

conda create -n longtail pip python=3.7 -y
source activate longtail
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
pip install pyyaml tqdm matplotlib sklearn h5py tensorboard

Training

Preliminaries

  • Download pretrained caffe resnet152 model for Places-LT: please refer to link.

  • Prepare dataset: CIFAR-100, Places-LT, ImageNet-LT, iNaturalist 2018

    • Please download those datasets following Decoupling.

CIFAR-100 training

For CIFAR-100 with imbalance ratio 0.01, using LADE:

python main.py --seed 1 --cfg config/CIFAR100_LT/lade.yaml --exp_name lade2021/cifar100_imb0.01_lade --cifar_imb_ratio 0.01 --remine_lambda 0.01 --alpha 0.1 --gpu 0

Places-LT training

For PC Softmax:

python main.py --seed 1 --cfg config/Places_LT/ce.yaml --exp_name lade2021/places_pc_softmax --lr 0.05 --gpu 0,1,2,3

For LADE:

python main.py --seed 1 --cfg config/Places_LT/lade.yaml --exp_name lade2021/places_lade --lr 0.05 --remine_lambda 0.1 --alpha 0.005 --gpu 0,1,2,3

ImageNet-LT training

For LADE:

python main.py --seed 1 --cfg config/ImageNet_LT/lade.yaml  --exp_name lade2021/imagenet_lade --lr 0.05 --remine_lambda 0.5 --alpha 0.05 --gpu 0,1,2,3

iNaturalist18 training

For LADE:

python main.py --seed 1 --cfg ./config/iNaturalist18/lade.yaml --exp_name lade2021/inat_lade --lr 0.1 --alpha 0.05 --gpu 0,1,2,3

Evaluate on shifted test set & Confidence calibration

For Imagenet (Section 4.3, 4.4):

./notebooks/imagenet-shift-calib.ipynb

For CIFAR-100 (Supplementary material):

./notebooks/cifar100-shift-calib.ipynb

License

The use of this software is released under BSD-3.

Citation

If you find our paper or this project helps your research, please kindly consider citing our paper in your publications.

@article{hong2020disentangling,
  title={Disentangling Label Distribution for Long-tailed Visual Recognition},
  author={Hong, Youngkyu and Han, Seungju and Choi, Kwanghee and Seo, Seokjun and Kim, Beomsu and Chang, Buru},
  journal={arXiv preprint arXiv:2012.00321},
  year={2020}
}
Comments
  • About setting of batch size and learning rate

    About setting of batch size and learning rate

    Excuse me, do you test the PC Softmax on the same experiment setting of LADE about batch size and learning rate? I find that PC Softmax even get higher accuracy in some datasets such as ImageNet-LT, Places-LT and iNaturalist 2018. image inital learning rate is 0.05

    opened by mingliangzhang2018 6
  • About the implementation of Post-Compensation Strategy

    About the implementation of Post-Compensation Strategy

    Hi, I'm very interested in your paper.

    As seen from the paper, PC Softmax seems to be a strong baseline.

    Can you provide the implementation of the PC softmax (mainly about how to calculate the p_{s}(y) and p_{t}(y) )?

    opened by jiequancui 6
  • a small question about PC-Softmax.

    a small question about PC-Softmax.

    Hi, thanks for your inspiring work. I have a small question about the PC Softmax after reading the paper. image

    In this paper, the logits of PC softmax is logit - logS + logT (Eq.4, was writen a bit casual, hope you can understand it). Thus it should be trained with standard CE, and add -logS + logT during inference. For the proposed LADE (or balanced softmax when alpha=0), the model was trained like: CrossEntropy(logit + logS).

    I compared balanced softmax bellow. taken the class-balanced test set as example (where logT = const):

    | method | train logits | test logits | train - test offset | | ---------------- | ------------ | ------------------- | --| | balanced softmax | logit + logS | logit + logT | - logS + logT | | PC softmax | logit | logit - logS + logT | -logS + logT |

    In this table, Balanced-Softmax and PC-Softmax should be equivallent. In my opinion, Balanced Softmax learns logit + logS and PC-Softmax learns logit, and they should equal. The logS in Balanced Softmax seems like a "residual connection".

    However, there is some performance difference between them as shown in paper. My experiments on CIFAR100-LT and ImageNet-LT (ResNet50) also shows the difference. Balanced Softmax is 0.9% higher on ImageNet-LT but PC Softmax is 1.3% higher on CIFAR100-LT. That confused me... Could you please share some opinion on the difference of the two kind of Softmax? Looking forward to your reply~

    opened by seekingup 4
  • Compatible with margin loss and label smoothing

    Compatible with margin loss and label smoothing

    Thanks for the impressive work! I'd like to know whether the proposed method is compatible with margin loss (e.g. arc margin, cos margin, etc) and label smoothing? If yes, in which stage can we insert these techniques?

    opened by milliema 3
  • Some questions about reproducing the results of PC softmax

    Some questions about reproducing the results of PC softmax

    Hi, thanks for sharing the code of your great work. I am interested in your work and inspired a lot by it. When reproducing the PC softmax result on Cifar100-LT with imbalance factor 100, a gap appeared between result I reproduced and those reported in your paper.

    I implemented PC softmax by using the PriorCEloss.py for training and it got an acc of 41.80. Then I changed to train by CE loss and directly add -log p_s(y) to the logits when predicting, and the acc got better to 42.3 but still lower than the result of 45.3 in the paper. I want to ask if you used other methods together with PC softmax or if I misunderstood the PC softmax to implement it wrongly.Or is there other reasons to the gap?

    I will appreciate it getting some advice or hints from you. Thanks for sharing your awesome work again.

    opened by likanchuan 2
  • PC softmax implementation process

    PC softmax implementation process

    Thanks for your research, I got a lot of inspiration from yours. I'm trying to adapt the PC softmax strategy at the different domains (1d signal), but it's not working well as I thought.

    My question is, I'm not sure my implementation of the PC softmax you suggested in the paper well.

    For example, suppose that there is a model that gives the logit result value. During the training phase, we just use vanilla softmax. And on the inference phase, we will post-compensate (in other words, fix the logit value or something?) the logit value. For this, first, apply softmax on the model logit value and minus the log value of source data prior and plus the target data prior.

    Describe it with the pseudo-code, (on the inference phase) output = argmax( softmax(logit) - logS + logT )

    Now I'm implementing it with this code, and strangely, other losses work well (even LADE), but only PC softmax does not seem to work well.

    If you check this implementation, it will be of great help to me.

    opened by aiexperience 2
  • Question about PC softmax implementation

    Question about PC softmax implementation

    Hi, I was really impressed with your research. Your code really helped my toy problem experiment and it works well. But I'm a bit confused about matching your paper and code.

    I understood that PC softmax term (LADE-CE loss) is implemented in "loss/PriorCELoss.py". In the paper, equation 4 said that PC Strategy considers source and target probability. ( -log p_s(y) + log p_t(y) ) But in the "loss/PriorCELoss.py", it only considers prior (source probability) implemented with the function "calculate_prior".

    If I misunderstood, it would be of great help to me if you let me know what was wrong.

    Thank you!

    opened by aiexperience 2
  • How to use your classifier for Causal-Norm??

    How to use your classifier for Causal-Norm??

    Hello Sir,

    I could solve my issues for LADE and balanced-softmax at your previous response.

    But, I couldn't solve my issues completely.

    I can understand your comment for LADE and balanced-softmax. (Just replacing loss function, I can try it. I can understand) Thanks...

    But, still I didn't solve Causal-Norm in your code. Should I do create new network using feature-extraction layers and your classifier for other networks ??

    Thanks, Edward Cho.

    opened by edwardcho 2
  • How to use classifier..

    How to use classifier..

    Hello Sir,

    I checked DotProductClassifier.py and CausualNormClassifier.py in "models" folder of your source code.

    If I use in other networks (ex: Inception_v1), for LADE or Balanced softmax or Causal Norm, How to use this function in other networks?? (Should I do create new network using feature-extraction layers and your classifiers? ) (at Training and at Inference)

    Thanks, Edward Cho

    opened by edwardcho 2
  • The setting of random seeds

    The setting of random seeds

    Hi, thanks for your great work. I have a question related to random seeds. First, I tried the seed=1 and default hyperparameters, and the result of LADE is 52.2, which is actually lower than 53 in the original paper. I have no idea what is the difference. Then, I tried the seed=2 and default hyperparameters, and the result of LADE is 48.9. Does that mean this method is unstable? Thanks very much if you can reply.

    opened by Vanint 2
  • Specific version of pytorch to reproduce the results in paper

    Specific version of pytorch to reproduce the results in paper

    Interesting and impressive work. Recently i am trying to reproduce the results given in the paper. However, i find different versions of pytorch would produce different results on several data sets. Could you give the specific versions of pytorch. Thank you

    opened by abababa-ai 2
Owner
Hyperconnect
Hyperconnect Inc
Hyperconnect
This repository contains the code for the CVPR 2021 paper "GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields"

GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields Project Page | Paper | Supplementary | Video | Slides | Blog | Talk If

null 1.1k Dec 30, 2022
Provided is code that demonstrates the training and evaluation of the work presented in the paper: "On the Detection of Digital Face Manipulation" published in CVPR 2020.

FFD Source Code Provided is code that demonstrates the training and evaluation of the work presented in the paper: "On the Detection of Digital Face M

null 88 Nov 22, 2022
This repository contains the code for the CVPR 2020 paper "Differentiable Volumetric Rendering: Learning Implicit 3D Representations without 3D Supervision"

Differentiable Volumetric Rendering Paper | Supplementary | Spotlight Video | Blog Entry | Presentation | Interactive Slides | Project Page This repos

null 697 Jan 6, 2023
This repository contains the official implementation code of the paper Improving Multimodal Fusion with Hierarchical Mutual Information Maximization for Multimodal Sentiment Analysis, accepted at EMNLP 2021.

MultiModal-InfoMax This repository contains the official implementation code of the paper Improving Multimodal Fusion with Hierarchical Mutual Informa

Deep Cognition and Language Research (DeCLaRe) Lab 89 Dec 26, 2022
This GitHub repository contains code used for plots in NeurIPS 2021 paper 'Stochastic Multi-Armed Bandits with Control Variates.'

About Repository This repository contains code used for plots in NeurIPS 2021 paper 'Stochastic Multi-Armed Bandits with Control Variates.' About Code

Arun Verma 1 Nov 9, 2021
Tensorflow 2 implementation of the paper: Learning and Evaluating Representations for Deep One-class Classification published at ICLR 2021

Deep Representation One-class Classification (DROC). This is not an officially supported Google product. Tensorflow 2 implementation of the paper: Lea

Google Research 137 Dec 23, 2022
This repo contains the official code of our work SAM-SLR which won the CVPR 2021 Challenge on Large Scale Signer Independent Isolated Sign Language Recognition.

Skeleton Aware Multi-modal Sign Language Recognition By Songyao Jiang, Bin Sun, Lichen Wang, Yue Bai, Kunpeng Li and Yun Fu. Smile Lab @ Northeastern

Isen (Songyao Jiang) 128 Dec 8, 2022
CVPR 2021 - Official code repository for the paper: On Self-Contact and Human Pose.

selfcontact This repo is part of our project: On Self-Contact and Human Pose. [Project Page] [Paper] [MPI Project Page] It includes the main function

Lea Müller 68 Dec 6, 2022
CVPR 2021 - Official code repository for the paper: On Self-Contact and Human Pose.

SMPLify-XMC This repo is part of our project: On Self-Contact and Human Pose. [Project Page] [Paper] [MPI Project Page] License Software Copyright Lic

Lea Müller 83 Dec 14, 2022
CVPR 2021 - Official code repository for the paper: On Self-Contact and Human Pose.

TUCH This repo is part of our project: On Self-Contact and Human Pose. [Project Page] [Paper] [MPI Project Page] License Software Copyright License fo

Lea Müller 45 Jan 7, 2023
git git《Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking》(CVPR 2021) GitHub:git2] 《Masksembles for Uncertainty Estimation》(CVPR 2021) GitHub:git3]

Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking Ning Wang, Wengang Zhou, Jie Wang, and Houqiang Li Accepted by CVPR

NingWang 236 Dec 22, 2022
Code to reproduce the results for Statistically Robust Neural Network Classification, published in UAI 2021

Code to reproduce the results for Statistically Robust Neural Network Classification, published in UAI 2021

null 1 Jun 2, 2022
This repository contains a pytorch implementation of "HeadNeRF: A Real-time NeRF-based Parametric Head Model (CVPR 2022)".

HeadNeRF: A Real-time NeRF-based Parametric Head Model This repository contains a pytorch implementation of "HeadNeRF: A Real-time NeRF-based Parametr

null 294 Jan 1, 2023
This repository contains the PyTorch implementation of the paper STaCK: Sentence Ordering with Temporal Commonsense Knowledge appearing at EMNLP 2021.

STaCK: Sentence Ordering with Temporal Commonsense Knowledge This repository contains the pytorch implementation of the paper STaCK: Sentence Ordering

Deep Cognition and Language Research (DeCLaRe) Lab 23 Dec 16, 2022
RGBD-Net - This repository contains a pytorch lightning implementation for the 3DV 2021 RGBD-Net paper.

[3DV 2021] We propose a new cascaded architecture for novel view synthesis, called RGBD-Net, which consists of two core components: a hierarchical depth regression network and a depth-aware generator network.

Phong Nguyen Ha 4 May 26, 2022
BMW TechOffice MUNICH 148 Dec 21, 2022
Repository for "Improving evidential deep learning via multi-task learning," published in AAAI2022

Improving evidential deep learning via multi task learning It is a repository of AAAI2022 paper, “Improving evidential deep learning via multi-task le

deargen 11 Nov 19, 2022
[CVPR 2022] CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation

CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation Prerequisite Please create and activate the following conda envrionment. To r

Qin Wang 87 Jan 8, 2023
This repository contains all the code and materials distributed in the 2021 Q-Programming Summer of Qode.

Q-Programming Summer of Qode This repository contains all the code and materials distributed in the Q-Programming Summer of Qode. If you want to creat

Sammarth Kumar 11 Jun 11, 2021