rayleizhu / BiFormer

[CVPR 2023] Official code release of our paper "BiFormer: Vision Transformer with Bi-Level Routing Attention"
https://arxiv.org/abs/2303.08810
MIT License
499 stars 40 forks source link

Can Biformer run in the current MMDet? And can this model utilize any of the detection heads in MMdet? #35

Closed MaiZiPiaoPiao closed 1 year ago

MaiZiPiaoPiao commented 1 year ago

Can Biformer run in the current MMDet? And can this model utilize any of the detection heads in MMdet?

rayleizhu commented 1 year ago

See https://github.com/rayleizhu/BiFormer/tree/public_release/object_detection

MaiZiPiaoPiao commented 1 year ago

谢谢您的解答,我看了您的代码,发现您是基于mmdet写出来的代码,对吧? 我的问题是,能否直接将您所写的关于biformer的代码放入mmdet当中直接运行,而不需要进行修改?

rayleizhu commented 1 year ago

谢谢您的解答,我看了您的代码,发现您是基于mmdet写出来的代码,对吧? 我的问题是,能否直接将您所写的关于biformer的代码放入mmdet当中直接运行,而不需要进行修改?

我不理解什么叫做”直接“,”不需要进行修改“。你似乎对mmdet有什么误解。实际上,按照我的理解,任何pytorch模型都可以直接放入mmdet运行,需要做的仅仅是

(1) 保证接口一致(i.e. forward输出一个list, 包含4个level的feature map) https://github.com/rayleizhu/BiFormer/blob/1697bbbeafb8680524898f1dcaac10defd0604be/object_detection/models_mm/biformer_mm.py#L56

(2) 加入mmdet的registry https://github.com/rayleizhu/BiFormer/blob/1697bbbeafb8680524898f1dcaac10defd0604be/object_detection/models_mm/biformer_mm.py#L11

可能特别一点的是,我的代码里使用了继承来消除冗余代码,突出对mmdet做的适配,懂python的话应该容易理解的: https://github.com/rayleizhu/BiFormer/blob/1697bbbeafb8680524898f1dcaac10defd0604be/object_detection/models_mm/biformer_mm.py#L12