{"id":17665480,"url":"https://github.com/maclong01/DeBiFormer","last_synced_at":"2025-03-11T15:32:40.591Z","repository":{"id":226288441,"uuid":"768282784","full_name":"maclong01/DeBiFormer","owner":"maclong01","description":" [ACCV 2024 ] Official code for \"DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention\"","archived":false,"fork":false,"pushed_at":"2025-01-08T11:01:05.000Z","size":2974,"stargazers_count":22,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-08T11:39:54.210Z","etag":null,"topics":["attention-mechanism","deep-learning","detection","image","image-classification","semantic-segmentation"],"latest_commit_sha":null,"homepage":"https://arxiv.org/pdf/2410.08582","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maclong01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-06T19:57:09.000Z","updated_at":"2025-01-08T11:24:03.000Z","dependencies_parsed_at":"2025-01-08T11:41:24.630Z","dependency_job_id":null,"html_url":"https://github.com/maclong01/DeBiFormer","commit_stats":null,"previous_names":["maclong01/debiformer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclong01%2FDeBiFormer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclong01%2FDeBiFormer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclong01%2FDeBiFormer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclong01%2FDeBiFormer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maclong01","download_url":"https://codeload.github.com/maclong01/DeBiFormer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243059826,"owners_count":20229642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attention-mechanism","deep-learning","detection","image","image-classification","semantic-segmentation"],"created_at":"2024-10-23T21:01:29.090Z","updated_at":"2025-03-11T15:32:40.549Z","avatar_url":"https://github.com/maclong01.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# [DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention](https://arxiv.org/pdf/2410.08582)\n\nOfficial PyTorch implementation of **DeBiFormer**, from the following paper:\n\n[DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention](https://arxiv.org/pdf/2410.08582). ACCV 2024.\\\n[Nguyen Huu Bao Long](https://github.com/maclong01), [Chenyu Zhang](https://github.com/il1um), Yuzhi Shi, [Tsubasa Hirakawa](https://thirakawa.github.io/), [Takayoshi Yamashita](https://scholar.google.co.jp/citations?user=hkguTPgAAAAJ\u0026hl=en), [Hironobu Fujiyoshi](https://scholar.google.com/citations?user=CIHKZpEAAAAJ\u0026hl=en), and [Tohgoroh Matsui](https://xn--p8ja5bwe1i.jp/profile.html)\n\n\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/debiformer-vision-transformer-with-deformable/object-detection-on-coco-2017)](https://paperswithcode.com/sota/object-detection-on-coco-2017?p=debiformer-vision-transformer-with-deformable)\n\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/debiformer-vision-transformer-with-deformable/semantic-segmentation-on-ade20k)](https://paperswithcode.com/sota/semantic-segmentation-on-ade20k?p=debiformer-vision-transformer-with-deformable)\n\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/debiformer-vision-transformer-with-deformable/image-classification-on-imagenet)](https://paperswithcode.com/sota/image-classification-on-imagenet?p=debiformer-vision-transformer-with-deformable)\n\n\n--- \n\u003cp align=\"left\"\u003e\n\u003cimg src=\"assets/all_attention_3_1_v2-1.png\" width=60% height=60% \nclass=\"center\"\u003e\n\u003c/p\u003e\n\n\n\u003c!-- ✅ ⬜️  --\u003e\n\n## News\n\n* 2024-09-21: The paper has been accepted at ACCV 2024 !!!\n\n## Results and Pre-trained Models\n\n### ImageNet-1K trained models\n\n| name | resolution |acc@1 | #params | FLOPs | model | log |\n|:---:|:---:|:---:|:---:| :---:|:---:|:---:|\n| DeBiFormer-T | 224x224 | 81.9 | 21.4 M | 2.6 G | [model](https://drive.google.com/drive/folders/1K_Zk5Etx2oh3yVccr71m1R3bTqWAI2bg) | [log](https://drive.google.com/drive/folders/1K_Zk5Etx2oh3yVccr71m1R3bTqWAI2bg) |\n| DeBiFormer-S | 224x224 | 83.9 | 44 M | 5.4 G | [model](https://drive.google.com/drive/folders/1OmWKob1ECHgVMs5wSvZs3XF665zFJdHg) | [log](https://drive.google.com/drive/folders/1OmWKob1ECHgVMs5wSvZs3XF665zFJdHg) |\n| DeBiFormer-B | 224x224 | 84.4 | 77 M | 11.8 G | [model](https://drive.google.com/drive/folders/1Ae3l2Q9nPbpOgSiTtX_HWyvSXIPQ9jce) | [log](https://drive.google.com/drive/folders/1Ae3l2Q9nPbpOgSiTtX_HWyvSXIPQ9jce) | \n\n\n\n# Usage\n\nFirst, clone the repository locally:\n```\ngit clone https://github.com/maclong01/DeBiFormer.git\npip3 install -r requirements.txt\n```\n## Data preparation\n\nDownload and extract ImageNet train and val images from http://image-net.org/.\nThe directory structure is the standard layout for the torchvision [`datasets.ImageFolder`](https://pytorch.org/docs/stable/torchvision/datasets.html#imagefolder), and the training and validation data is expected to be in the `train/` folder and `val/` folder respectively:\n\n```\n/path/to/imagenet/\n  train/\n    class1/\n      img1.jpeg\n    class2/\n      img2.jpeg\n  val/\n    class1/\n      img3.jpeg\n    class/2\n      img4.jpeg\n```\n\n\n#### Training\n\nTo train DeBiFormer-S on ImageNet  using 8 gpus for 300 epochs, run:\n\n```shell\ncd classification/\nbash train.sh 8 --model debiformer_small --batch-size 256 --lr 5e-4 --warmup-epochs 20 --weight-decay 0.1 --data-path your_imagenet_path\n```\n\n#### Evaluation \n\nTo evaluate the performance of DeBiFormer-S on ImageNet using 8 gpus, run:\n```shell\ncd classification/\nbash 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\n```\n\n\n\n\n## Acknowledgement\nThis repository is built using the [timm](https://github.com/rwightman/pytorch-image-models) library, [DAT](https://github.com/LeapLabTHU/DAT), and [BiFormer](https://github.com/rayleizhu/BiFormer) repositories.\n\n## License\nThis project is released under the MIT license. Please see the [LICENSE](LICENSE) file for more information.\n\n## Citation\nIf you find this repository helpful, please consider citing:\n```bibtex\n@InProceedings{BaoLong_2024_ACCV,\n    author    = {BaoLong, NguyenHuu and Zhang, Chenyu and Shi, Yuzhi and Hirakawa, Tsubasa and Yamashita, Takayoshi and Matsui, Tohgoroh and Fujiyoshi, Hironobu},\n    title     = {DeBiFormer: Vision Transformer with Deformable Agent Bi-level Routing Attention},\n    booktitle = {Proceedings of the Asian Conference on Computer Vision (ACCV)},\n    month     = {December},\n    year      = {2024},\n    pages     = {4455-4472}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaclong01%2FDeBiFormer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaclong01%2FDeBiFormer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaclong01%2FDeBiFormer/lists"}