Giter VIP home page Giter VIP logo

wcdas_code's Introduction

WCDAS

The Pytorch implementation for the paper titled Wrapped Cauchy Distributed Angular Softmax for Long-Tailed Visual Recognition.

Abstract

Visual recognition is vital for various computer vision applications. However, imbalanced or long-tailed data pose significant challenges to the deep learning approaches due to the mismatch between training and testing distributions. Our paper presents a novel softmax function based on wrapped Cauchy distribution: Wrapped Cauchy Distributed Angular Softmax (WCDAS). WCDAS considers the data-wise Gaussian-based kernels in the angular representation between features and classifier weights, describing noise and sparse sampling-induced uncertainty. As the class-wise distribution of such angular representation follows the sum of the kernels, we prove theoretically that the wrapped Cauchy distribution can be a better approximation for such mixed distributions than the widely-used Gaussian distribution. We demonstrate that WCDAS can dynamically optimize the compactness/margin of each class via the corresponding trainable concentration parameters. The empirical study shows that such class-wise parameters of WCDAS exhibit label-aware behavior. WCDAS outperforms other state-of-the-art softmax-based methods in long-tailed visual recognition on several benchmark datasets.

Usage

Training

The algorithm is simply implemented in the class WCDAS at models/Loss.py.

To reproduce the results in the paper, the ResNet-10 equipped with the WCDAS is trained from scratch on ImageNet-LT dataset by

python main_train.py --dataset imagenetlt --net-config ResNet10Feature --workers 12 --seed 0 --loss-config WCDAS_ImageNetLT 
python main_finetune.py --dataset imagenetlt --net-config ResNet10Feature_finetune --loss-config WCDAS_ImageNetLT --model-file ./results/imagenetlt_loss_WCDAS_ImageNetLT_ResNet10Feature_lr_0.4_model/ --workers 12 --seed 0  

For iNaturalist-2018, the script to train from script is as follows:

python main_train.py --dataset 'inat2018' --net-config ResNet50Feature --workers 12 --seed 0 --loss-config WCDAS_iNaturalist2018
python main_finetune.py --dataset 'inat2018' --net-config ResNet50Feature_finetune --loss-config WCDAS_iNaturalist2018 --model-file ./results/inat2018_loss_WCDAS_iNaturalist2018_ResNet50Feature_lr_0.4_model/ --workers 12 --seed 0  

Results

ImageNet

Method ImageNet-LT iNaturalist-2018
WCDAS 44.5 71.8

Acknowledgement

The codes are modified based on tvMF, Classifier-Balancing and BalancedMetaSoftmax-Classification.

wcdas_code's People

Contributors

boranhan avatar

Stargazers

Jacky-Huang avatar Pengxiao Han avatar  avatar Tung avatar YubiaoYue avatar Alexandridis, Konstantinos Panagiotis avatar Erwin avatar

Watchers

 avatar

wcdas_code's Issues

Inquiry about Parameter Settings and Model Accuracy(CIFAR10 imbalance factor 0.01)

Hi, thank you for your excellent work. I am attempting to replicate your code, but I am unable to achieve the level of accuracy reported in your paper.

Here is my key parameter settings:

  1. DATASET: cifar10lt
  2. net-config: Resnet32Feature
  3. loss-config: WCDAS_CIFARLT
  4. imbalance-ratio: 100
  5. lrs: cos_lr(0.2,700)
  6. opt_params: {weight_decay:0.0001, momentum:0.9}
    For main_finetune.py, most parameters are same but lrs:cos_lr(0.005,30)

My final acuracy is always 2% lower than the report, what is your recommend parameters I need to set?

Cheers.

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.