Home

Awesome

ECA-Net: Efficient Channel Attention

ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks

This is an implementation of ECA-Net(CVPR2020,paper), created by Banggu Wu.

Poster

Introduction

Recently, channel attention mechanism has demonstrated to offer great potential in improving the performance of deep convolutional neuralnetworks (CNNs). However, most existing methods dedicate to developing more sophisticated attention modules for achieving better performance,which inevitably increase model complexity. To overcome the paradox of performance and complexity trade-off, this paper proposes an EfficientChannel Attention (ECA) module, which only involves a handful of parameters while bringing clear performance gain. By dissecting the channelattention module in SENet, we empirically show avoiding dimensionality reduction is important for learning channel attention, and appropriatecross-channel interaction can preserve performance while significantly decreasing model complexity. Therefore, we propose a localcross-channel interaction strategy without dimensionality reduction, which can be efficiently implemented via 1D convolution. Furthermore,we develop a method to adaptively select kernel size of 1D convolution, determining coverage of local cross-channel interaction. Theproposed ECA module is efficient yet effective, e.g., the parameters and computations of our modules against backbone of ResNet50 are 80 vs.24.37M and 4.7e-4 GFLOPs vs. 3.86 GFLOPs, respectively, and the performance boost is more than 2% in terms of Top-1 accuracy. We extensivelyevaluate our ECA module on image classification, object detection and instance segmentation with backbones of ResNets and MobileNetV2. Theexperimental results show our module is more efficient while performing favorably against its counterparts.

Citation

@InProceedings{wang2020eca,
   title={ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks},
   author={Qilong Wang, Banggu Wu, Pengfei Zhu, Peihua Li, Wangmeng Zuo and Qinghua Hu},
   booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
   year={2020}
 }

Changelog

2020/02/26 Upload ECA-Resnet34 model.

2020/03/05 Upload RetinaNet-ecanet50 and RetinaNet-ecanet101 model.

2020/03/24 Update the Introduction and Citation.

2020/03/30 Upload ECA-Resnet18 model.

2020/05/06 Update the poster.

ECA module

ECA_module

Comparison of (a) SE block and (b) our efficient channel attention (ECA) module. Given the aggregated feature using global average pooling (GAP), SE block computes weights using two FC layers. Differently, ECA generates channel weights by performing a fast 1D convolution of size k, where k is adaptively determined via a function of channel dimension C.

Installation

Requirements

Our environments

Start Up

Train with ResNet

You can run the main.py to train or evaluate as follow:

CUDA_VISIBLE_DEVICES={device_ids} python main -a {model_name} --ksize {eca_kernel_size} {the path of you datasets}

For example:

CUDA_VISIBLE_DEVICES=0,1,2,3 python main -a eca_resnet50 --ksize 3557 ./datasets/ILSVRC2012/images

Train with MobileNet_v2

It is same with above ResNet replace main.py by light_main.py.

Compute the parameters and FLOPs

If you have install thop, you can paras_flosp.py to compute the parameters and FLOPs of our models. The usage is below:

python paras_flops.py -a {model_name}

Experiments

ImageNet

ModelParam.FLOPsTop-1(%)Top-5(%)BaiduDrive(models)Extract codeGoogleDrive
ECA-Net1811.15M1.70G70.9289.93eca_resnet18_k3577utsyeca_resnet18_k3577
ECA-Net3420.79M3.43G74.2191.83eca_resnet34_k3357o4dheca_resnet34_k3357
ECA-Net5024.37M3.86G77.4293.62eca_resnet50_k3557no6ueca_resnet50_k3557
ECA-Net10142.49M7.35G78.6594.34eca_resnet101_k3357iov1eca_resnet101_k3357
ECA-Net15257.41M10.83G78.9294.55eca_resnet152_k3357xafteca_resnet152_k3357
ECA-MobileNet_v23.34M319.9M72.5690.81eca_mobilenetv2_k13atpteca_mobilenetv2_k13

COCO 2017

Detection with Faster R-CNN and Mask R-CNN

ModelParam.FLOPsAPAP_50AP_75Pre trained modelsExtract codeGoogleDrive
Fast_R-CNN_ecanet5041.53M207.18G38.060.640.9faster_rcnn_ecanet50_k5_bs8_lr0.01divffaster_rcnn_ecanet50_k5_bs8_lr0.01
Fast_R-CNN_ecanet10160.52M283.32G40.362.944.0faster_rcnn_ecanet101_3357_bs8_lr0.01d3kdfaster_rcnn_ecanet101_3357_bs8_lr0.01
Mask_R-CNN_ecanet5044.18M275.69G39.061.342.1mask_rcnn_ecanet50_k3377_bs8_lr0.01xe19mask_rcnn_ecanet50_k3377_bs8_lr0.01
Mask_R-CNN_ecanet10163.17M351.83G41.363.144.8mask_rcnn_ecanet101_k3357_bs8_lr0.01y5e9mask_rcnn_ecanet101_k3357_bs8_lr0.01
RetinaNet_ecanet5037.74M239.43G37.357.739.6RetinaNet_ecanet50_k3377_bs8_lr0.01my44RetinaNet_ecanet50_k3377_bs8_lr0.01
RetinaNet_ecanet10156.74M315.57G39.159.941.8RetinaNet_ecanet101_k3357_bs8_lr0.012eu5RetinaNet_ecanet101_k3357_bs8_lr0.01

Instance segmentation with Mask R-CNN

ModelParam.FLOPsAPAP_50AP_75Pre trained modelsExtract codeGoogleDrive
Mask_R-CNN_ecanet5044.18M275.69G35.658.137.7mask_rcnn_ecanet50_k3377_bs8_lr0.01xe19mask_rcnn_ecanet50_k3377_bs8_lr0.01
Mask_R-CNN_ecanet10163.17M351.83G37.459.939.8mask_rcnn_ecanet101_k3357_bs8_lr0.01y5e9mask_rcnn_ecanet101_k3357_bs8_lr0.01
RetinaNet_ecanet5037.74M239.43G35.658.137.7RetinaNet_ecanet50_k3377_bs8_lr0.01my44RetinaNet_ecanet50_k3377_bs8_lr0.01
RetinaNet_ecanet10156.74M315.57G37.459.939.8RetinaNet_ecanet101_k3357_bs8_lr0.012eu5RetinaNet_ecanet101_k3357_bs8_lr0.01

Contact Information

If you have any suggestion or question, you can leave a message here or contact us directly: wubanggu@tju.edu.cn . Thanks for your attention!