landskape-ai / triplet-attention

Official PyTorch Implementation for "Rotate to Attend: Convolutional Triplet Attention Module." [WACV 2021]
https://openaccess.thecvf.com/content/WACV2021/html/Misra_Rotate_to_Attend_Convolutional_Triplet_Attention_Module_WACV_2021_paper.html
MIT License
406 stars 49 forks source link

mmdetection_fasterrcnn #7

Closed ZJUTSong closed 4 years ago

ZJUTSong commented 4 years ago

hello, i applied triple_attention on fasterrcnn using mmdetection, the problem is inference speed becomes very slow , about twice slower,why this happens? And where is the code you applied trilet_attention on fasterrcnn using mmdetection?i‘d like to learn some. Thanks~

iyaja commented 4 years ago

Thanks for trying it out. It's expected that triplet attention would incur a performance cost, but could you share more info? What batch size, image size, CPU, accelerator, etc. are you using?

We're planning to release the mmdetection code soon, but the implementation is relatively straightforward. All we do is add triplet the usual way into a model definition identical to the default ResNet provided in mmdetection. The repo has a guide on how to do this: https://github.com/open-mmlab/mmdetection/blob/master/docs/tutorials/customize_models.md

ZJUTSong commented 4 years ago

Thans for yor patiently help ! batch_size=1, img_size=(1400, 840), GPU:nvidia1080ti.
The baseline inference speed about 13.8FPS, but decreased to 6.7FPS after i used triplet_attentation, i added the triplet block on the third conv in every Bottleneck of res2net_50. Also, i'd like to know if i have no pretrained backbone weights, the model will be bad? i have res2net pretrained model, but for triplet_block, i just iniltialized it.

digantamisra98 commented 4 years ago

@ZJUTSong yes we expect the introduction of triplet attention will cause a drop in inference speed. We are planning to optimize it further. Additionally, we wouldn't advise to use a pretrained backbone and initialize triplet within it. As per our understanding, training from scratch would be a much better route. Thanks!