Home

Awesome

Coordinate Attention for Efficient Mobile Network Design (preprint)

This repository is a PyTorch implementation of our coordinate attention (will appear in CVPR2021).

Our coordinate attention can be easily plugged into any classic building blocks as a feature representation augmentation tool. Here (pytorch-image-models) is a code base that you might want to train a classification model on ImageNet.

Note that the results reported in the paper are based on regular training setting (200 training epochs, random crop, and cosine learning schedule) without using extra label smoothing, random augmentation, random erasing, mixup. For specific numbers in ImageNet classification, COCO object detection, and semantic segmentation, please refer to our paper.

Updates


Comparison to Squeeze-and-Excitation block and CBAM

diagram

(a) Squeeze-and-Excitation block (b) CBAM (C) Coordinate attention block

How to plug the proposed CA block in the inverted residual block and the sandglass block

wheretoplug

(a) MobileNetV2 (b) MobileNeXt

Numerical results on ImageNet

MethodParamsM-AddsTop 1Model
MobileNetV2-1.03.5M300M72.3
MobileNetV2 + SE3.89M300M73.5
MobileNetV2 + CBAM3.89M300M73.6
MobileNetV2 + CA3.95M310M74.3link
MethodParamsM-AddsTop 1
MobileNeXt-1.03.5M300M74.0
MobileNeXt + SE3.89M300M74.7
MobileNeXt + CA4.09M330M75.2

Pretrained model (MobileNetV2 with CA) and model file are both available.

Some tips for designing lightweight attention blocks

Object detection

We use this repo (ssdlite-pytorch-mobilenext).

Results on COCO val

ModelMethodParamsAP
MobileNetV1SSDLite3205.1M22.2
MobileNetV2SSDLite3204.3M22.3
MobileNetV2SSDLite3205.0M22.0
MnasNet-A1SSDLite3204.9M23.0
MobileNeXtSSDLite3204.4M23.3
MobileNetV2 + SESSDLite3204.7M23.7
MobileNetV2 + CBAMSSDLite3204.7M23.0
MobileNetV2 + CASSDLite3204.8M24.5

Results on Pascal VOC 2007 test

ModelMethodParamsmAP
MobileNetV2SSDLite3204.3M71.7
MobileNetV2 + SESSDLite3204.7M71.7
MobileNetV2 + CBAMSSDLite3204.7M71.7
MobileNetV2 + CASSDLite3204.8M73.1

Semantic segmentation

We use this repo. You can also refer to mmsegmentation alternatively.

Results on Pascal VOC 2012 val

ModelMethodStrideParamsmIoU
MobileNetV2DeepLabV3164.570.84
MobileNetV2 + SEDeepLabV3164.971.69
MobileNetV2 + CBAMDeepLabV3164.971.28
MobileNetV2 + CADeepLabV3165.073.32
MobileNetV2DeepLabV384.571.82
MobileNetV2 + SEDeepLabV384.972.52
MobileNetV2 + CBAMDeepLabV384.971.67
MobileNetV2 + CADeepLabV385.073.96

Results on Cityscapes val

ModelMethodStrideParamsmIoU
MobileNetV2DeepLabV384.571.4
MobileNetV2 + SEDeepLabV384.972.2
MobileNetV2 + CBAMDeepLabV384.971.4
MobileNetV2 + CADeepLabV385.074.0

We observe that our coordinate attention yields larger improvement on semantic segmentation than ImageNet classification and object detection. We argue that this is because our coordinate attention is able to capture long-range dependencies with precise postional information, which is more beneficial to vision tasks with dense predictions, such as semantic segmentation.

Citation

You may want to cite:

@inproceedings{hou2021coordinate,
  title={Coordinate Attention for Efficient Mobile Network Design},
  author={Hou, Qibin and Zhou, Daquan and Feng, Jiashi},
  booktitle={CVPR},
  year={2021}
}

@inproceedings{sandler2018mobilenetv2,
  title={Mobilenetv2: Inverted residuals and linear bottlenecks},
  author={Sandler, Mark and Howard, Andrew and Zhu, Menglong and Zhmoginov, Andrey and Chen, Liang-Chieh},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  pages={4510--4520},
  year={2018}
}

@inproceedings{zhou2020rethinking,
  title={Rethinking bottleneck structure for efficient mobile network design},
  author={Zhou, Daquan and Hou, Qibin and Chen, Yunpeng and Feng, Jiashi and Yan, Shuicheng}
  booktitle={ECCV},
  year={2020}
}

@inproceedings{hu2018squeeze,
  title={Squeeze-and-excitation networks},
  author={Hu, Jie and Shen, Li and Sun, Gang},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  pages={7132--7141},
  year={2018}
}

@inproceedings{woo2018cbam,
  title={Cbam: Convolutional block attention module},
  author={Woo, Sanghyun and Park, Jongchan and Lee, Joon-Young and Kweon, In So},
  booktitle={Proceedings of the European conference on computer vision (ECCV)},
  pages={3--19},
  year={2018}
}