DirMixE

April 28, 2026 ยท View on GitHub

This repository is the official code for the paper Harnessing Hierarchical Label Distribution Variations in Test Agnostic Long-tail Recognition (ICML 2024).

Paper Title: Harnessing Hierarchical Label Distribution Variations in Test Agnostic Long-tail Recognition.

Author: Zhiyong Yang, Qianqian Xu*, Zitai Wang, Sicong Li, Boyu Han, Shilong Bao, Xiaochun Cao, Qingming Huang*

key_idea

๐Ÿ”ฅ News

  • [2026] Our work has been further extended in a TPAMI version with improved methodology and more comprehensive experiments.
    ๐Ÿ‘‰ Please check the new repository: https://github.com/scongl/DirMixE_TPAMI

Installation

  • Clone the repository
git clone https://github.com/scongl/DirMixE.git
  • Install the required libraries
pip install -r requirements.txt

Datasets

Four bechmark datasets

  • Please download these datasets and put them to the /data file.
  • ImageNet-LT can be found at here.
  • iNaturalist data should be the 2018 version from here.
  • CIFAR-100 and CIFAR-10 will be downloaded automatically with the dataloader.
data
โ”œโ”€โ”€ CIFAR-10
โ”‚ย ย  โ””โ”€โ”€ cifar-10-batches-py
โ”œโ”€โ”€ CIFAR-100
โ”‚ย ย  โ””โ”€โ”€ cifar-100-python
โ”œโ”€โ”€ ImageNet_LT
โ”‚ย ย  โ”œโ”€โ”€ test
โ”‚ย ย  โ”œโ”€โ”€ train
โ”‚ย ย  โ””โ”€โ”€ val
โ””โ”€โ”€ iNaturalist
    โ”œโ”€โ”€ test2018
    โ””โ”€โ”€ train_val2018

Txt files

  • We provide txt files for test-agnostic long-tailed recognition for ImageNet-LT and iNaturalist 2018. CIFAR-100 and CIFAR-10 will be generated automatically with the code.
  • For iNaturalist 2018, please unzip the iNaturalist_train.zip.
data_txt
โ”œโ”€โ”€ ImageNet_LT
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_backward10.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_backward25.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_backward2.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_backward50.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_backward5.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_forward10.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_forward25.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_forward2.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_forward50.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_forward5.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_test.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_train.txt
โ”‚ย ย  โ”œโ”€โ”€ ImageNet_LT_uniform.txt
โ”‚ย ย  โ””โ”€โ”€ ImageNet_LT_val.txt
โ””โ”€โ”€ iNaturalist18
    โ”œโ”€โ”€ iNaturalist18_backward2.txt
    โ”œโ”€โ”€ iNaturalist18_backward3.txt
    โ”œโ”€โ”€ iNaturalist18_forward2.txt
    โ”œโ”€โ”€ iNaturalist18_forward3.txt
    โ”œโ”€โ”€ iNaturalist18_train.txt
    โ”œโ”€โ”€ iNaturalist18_uniform.txt
    โ””โ”€โ”€ iNaturalist18_val.txt

Script

CIFAR10-LT

Training

  • To train the DirMixE model, run this command:
python train.py -c configs/train/cifar10.json 

Evaluate

  • To evaluate DirMixE under ours setting, run this command:
python test_train_cifar_dirmixe.py -c configs/test/test_cifar10.json -r checkpoint_path
  • To evaluate DirMixE under sade's setting, run this command:
python test_train_cifar_sade.py -c configs/test/test_cifar10.json -r checkpoint_path

CIFAR100-LT

Training

  • To train the DirMixE model, run this command:
python train.py -c configs/train/cifar100.json 

Evaluate

  • To evaluate DirMixE under ours setting, run this command:
python test_train_cifar_dirmixe.py -c configs/test/test_cifar100.json -r checkpoint_path
  • To evaluate DirMixE under sade's setting, run this command:
python test_train_cifar_sade.py -c configs/test/test_cifar100.json -r checkpoint_path

ImageNet-LT

Training

  • To train the DirMixE model, run this command:
python train.py -c configs/train/imagenet.json 

Evaluate

  • To evaluate DirMixE under ours setting, run this command:
python test_train_cifar_dirmixe.py -c configs/test/test_imagenet.json -r checkpoint_path
  • To evaluate DirMixE under sade's setting, run this command:
python test_train_cifar_sade.py -c configs/test/test_imagenet.json -r checkpoint_path

iNaturalist

Training

  • To train the DirMixE model, run this command:
python train.py -c configs/train/inaturalist.json

Evaluate

  • To evaluate DirMixE under ours setting, run this command:
python test_train_cifar_dirmixe.py -c configs/test/test_inaturalist.json -r checkpoint_path
  • To evaluate DirMixE under sade's setting, run this command:
python test_train_cifar_sade.py -c configs/test/test_inaturalist.json -r checkpoint_path

Citation

If you find our work inspiring or use our codebase in your research, please cite our work.

@inproceedings{yang2024harnessing,
    title={Harnessing Hierarchical Label Distribution Variations in Test Agnostic Long-tail Recognition}, 
    author={Zhiyong Yang and Qianqian Xu and Zitai Wang and Sicong Li and Boyu Han and Shilong Bao and Xiaochun Cao and Qingming Huang},
    booktitle={International Conference on Machine Learning},
    year={2024}
}

@article{yang2026dirmixe,
    title = {DirMixE: Harnessing Test Agnostic Long-tail Recognition with Hierarchical Label Vartiations},
    author = {Zhiyong Yang and Qianqian Xu and Sicong Li and Zitai Wang and Xiaochun Cao and Qingming Huang},
    journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
    year = {2026},
}

Acknowledgements

Our codes are based on the repository SADE.