maclong01/DeBiFormer

[ACCV 2024 ] Official code for "DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention"

Python

34

53 commits

updated Jan 8, 2025

See the code

README

DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention

Official PyTorch implementation of DeBiFormer, from the following paper:

DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention. ACCV 2024.
Nguyen Huu Bao Long, Chenyu Zhang, Yuzhi Shi, Tsubasa Hirakawa, Takayoshi Yamashita, Hironobu Fujiyoshi, and Tohgoroh Matsui

PWC

PWC

PWC


News

  • 2024-09-21: The paper has been accepted at ACCV 2024 !!!

Results and Pre-trained Models

ImageNet-1K trained models

nameresolutionacc@1#paramsFLOPsmodellog
DeBiFormer-T224x22481.921.4 M2.6 Gmodellog
DeBiFormer-S224x22483.944 M5.4 Gmodellog
DeBiFormer-B224x22484.477 M11.8 Gmodellog

Usage

First, clone the repository locally:

git clone https://github.com/maclong01/DeBiFormer.git
pip3 install -r requirements.txt

Data preparation

Download and extract ImageNet train and val images from http://image-net.org/. The directory structure is the standard layout for the torchvision datasets.ImageFolder, and the training and validation data is expected to be in the train/ folder and val/ folder respectively:

/path/to/imagenet/
  train/
    class1/
      img1.jpeg
    class2/
      img2.jpeg
  val/
    class1/
      img3.jpeg
    class/2
      img4.jpeg

Training

To train DeBiFormer-S on ImageNet using 8 gpus for 300 epochs, run:

cd classification/
bash train.sh 8 --model debiformer_small --batch-size 256 --lr 5e-4 --warmup-epochs 20 --weight-decay 0.1 --data-path your_imagenet_path

Evaluation

To evaluate the performance of DeBiFormer-S on ImageNet using 8 gpus, run:

cd classification/
bash train.sh 8 --model debiformer_small --batch-size 256 --lr 5e-4 --warmup-epochs 20 --weight-decay 0.1 --data-path your_imagenet_path --resume ../checkpoints/debiformer_small_in1k_224.pth --eval

Acknowledgement

This repository is built using the timm library, DAT, and BiFormer repositories.

License

This project is released under the MIT license. Please see the LICENSE file for more information.

Citation

If you find this repository helpful, please consider citing:

@InProceedings{BaoLong_2024_ACCV,
    author    = {BaoLong, NguyenHuu and Zhang, Chenyu and Shi, Yuzhi and Hirakawa, Tsubasa and Yamashita, Takayoshi and Matsui, Tohgoroh and Fujiyoshi, Hironobu},
    title     = {DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention},
    booktitle = {Proceedings of the Asian Conference on Computer Vision (ACCV)},
    month     = {December},
    year      = {2024},
    pages     = {4455-4472}
}
attention-mechanism
deep-learning
detection
image
image-classification
semantic-segmentation

Significant stargazers

Marty Sullivan

25 followers · starred Oct 2024

maclong01/DeBiFormer

[ACCV 2024 ] Official code for "DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention"

Python

34

53 commits

updated Jan 8, 2025

See the code

README

DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention

Official PyTorch implementation of DeBiFormer, from the following paper:

DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention. ACCV 2024.
Nguyen Huu Bao Long, Chenyu Zhang, Yuzhi Shi, Tsubasa Hirakawa, Takayoshi Yamashita, Hironobu Fujiyoshi, and Tohgoroh Matsui

PWC

PWC

PWC


News

  • 2024-09-21: The paper has been accepted at ACCV 2024 !!!

Results and Pre-trained Models

ImageNet-1K trained models

nameresolutionacc@1#paramsFLOPsmodellog
DeBiFormer-T224x22481.921.4 M2.6 Gmodellog
DeBiFormer-S224x22483.944 M5.4 Gmodellog
DeBiFormer-B224x22484.477 M11.8 Gmodellog

Usage

First, clone the repository locally:

git clone https://github.com/maclong01/DeBiFormer.git
pip3 install -r requirements.txt

Data preparation

Download and extract ImageNet train and val images from http://image-net.org/. The directory structure is the standard layout for the torchvision datasets.ImageFolder, and the training and validation data is expected to be in the train/ folder and val/ folder respectively:

/path/to/imagenet/
  train/
    class1/
      img1.jpeg
    class2/
      img2.jpeg
  val/
    class1/
      img3.jpeg
    class/2
      img4.jpeg

Training

To train DeBiFormer-S on ImageNet using 8 gpus for 300 epochs, run:

cd classification/
bash train.sh 8 --model debiformer_small --batch-size 256 --lr 5e-4 --warmup-epochs 20 --weight-decay 0.1 --data-path your_imagenet_path

Evaluation

To evaluate the performance of DeBiFormer-S on ImageNet using 8 gpus, run:

cd classification/
bash train.sh 8 --model debiformer_small --batch-size 256 --lr 5e-4 --warmup-epochs 20 --weight-decay 0.1 --data-path your_imagenet_path --resume ../checkpoints/debiformer_small_in1k_224.pth --eval

Acknowledgement

This repository is built using the timm library, DAT, and BiFormer repositories.

License

This project is released under the MIT license. Please see the LICENSE file for more information.

Citation

If you find this repository helpful, please consider citing:

@InProceedings{BaoLong_2024_ACCV,
    author    = {BaoLong, NguyenHuu and Zhang, Chenyu and Shi, Yuzhi and Hirakawa, Tsubasa and Yamashita, Takayoshi and Matsui, Tohgoroh and Fujiyoshi, Hironobu},
    title     = {DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention},
    booktitle = {Proceedings of the Asian Conference on Computer Vision (ACCV)},
    month     = {December},
    year      = {2024},
    pages     = {4455-4472}
}
attention-mechanism
deep-learning
detection
image
image-classification
semantic-segmentation

Significant stargazers

Marty Sullivan

25 followers · starred Oct 2024