← 开源
ZjjConan

SimAM

The official pytorch implemention of our ICML-2021 paper "SimAM: A Simple, Parameter-Free Attention Module for Convolutional Neural Networks".

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+124 小时新增 Star+0.2%
504
Star
43
Fork
+1
本周
1
贡献者
创建于 2021-05-08 · 更新于 2026-10-15 · 今日第 6877 名
主要开发者
ZjjConan

ZjjConan/SimAM 排名第 6,877,有 504 个星标。

同类别比较

ZjjConan/SimAM 排名第 6,877,此处有 8 个同类条目;uoftcprg/pokerkit 排名第 6,876。

同类别比较
名称排名指标
dougbrion/pytorch-classification-uncertainty6,839
语言:
Python
星标数:
521
分叉数:
70
简介:
This repo contains a PyTorch implementation of the paper: "Evidential Deep Learning to Quantify Classification Uncertainty"
emdgroup/baybe6,850
语言:
Python
星标数:
516
分叉数:
81
简介:
Bayesian Optimization and Design of Experiments
cair/TsetlinMachine6,868
语言:
Cython
星标数:
508
分叉数:
58
简介:
Code and datasets for the Tsetlin Machine
uoftcprg/pokerkit6,876
语言:
Python
星标数:
505
分叉数:
81
简介:
An open-source Python library for poker game simulations, hand evaluations, and statistical analysis
databrickslabs/dbldatagen6,884
语言:
Python
星标数:
503
分叉数:
105
简介:
Generate relevant synthetic data quickly for your projects. The Databricks Labs synthetic data generator (aka `dbldatagen`) may be used to generate large simulated / synthetic data sets for test, POCs, and other uses in Databricks environments including in Delta Live Tables pipelines
hpcaitech/ColossalAI6,890
语言:
Python
星标数:
41,430
分叉数:
4,485
简介:
Making large AI models cheaper, faster and more accessible
BVLC/caffe6,896
语言:
C++
星标数:
34,553
分叉数:
18,396
简介:
Caffe: a fast open framework for deep learning.
facebookresearch/fastText6,905
语言:
HTML
星标数:
26,523
分叉数:
4,827
简介:
Library for fast text representation and classification.
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
关键词Computer vision
星标数504
分叉数43
贡献者1
创建日期2021-05-08
更新日期2026-10-15
1 天星标数1
7 天星标数1
排名6,877
上次排名18,007
排名变化11,130
7 天星标排名11,606
上次 7 天星标排名16,574
7 天星标排名变化4,968
总星标排名19,231
上次总星标排名19,251
总星标排名变化20
国家China
README 摘录

In contrast to existing channel-wise and spatial-wise attention modules, our module instead infers 3-D attention weights for the feature map in a layer without adding parameters to the original networks. Specifically, we base on some well-known neuroscience theories and propose to optimize an energy function to find the importance of each neuron. We further derive a fast closed-form solution for the energy function, and show that the solution can be implemented in less than ten

lines of code. Another advantage of the module is that most of the operators are selected based on the solution to the defined energy function, avoiding too many efforts for structure tuning. Quantitative evaluations on various visual tasks demonstrate that the proposed module is flexible and effective to improve the representation ability of many ConvNets. **SimAM (A pytorch-like implementation). ** Detail of implementations, including the module and the network, can be found in networks in this repository. ImageNet All the

following models can be download from **BaiduYunPan** (extract code: **25tp**) and **Google Drive. 74 | COCO Evaluation We use mmdetection to train Faster RCNN and Mask RCNN for object detection and instance segmentation. If you want to run the following models, please firstly install with their guide. And then put all in mmdetection of this repository to the corresponding folders. All the following models can be download from **BaiduYunPan** (extract code: **ysrz**) and **Google Drive.

常见问题

记录了多少星标和分叉?

ZjjConan/SimAM 有 504 个星标和 43 个分叉。

仓库排名是多少?

ZjjConan/SimAM 排名第 6,877。

记录的语言和类别是什么?

ZjjConan/SimAM 有 504 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

ZjjConan/SimAM 与 uoftcprg/pokerkit 比较,后者排名第 6,876,有 505 个星标。

README

SimAM: A Simple, Parameter-Free Attention Module for Convolutional Neural Networks

Lingxiao Yang, Ru-Yuan Zhang, Lida Li, Xiaohua Xie

Abstract

In this paper, we propose a conceptually simple but very effective attention module for Convolutional Neural Networks (ConvNets). In contrast to existing channel-wise and spatial-wise attention modules, our module instead infers 3-D attention weights for the feature map in a layer without adding parameters to the original networks. Specifically, we base on some well-known neuroscience theories and propose to optimize an energy function to find the importance of each neuron. We further derive a fast closed-form solution for the energy function, and show that the solution can be implemented in less than ten lines of code. Another advantage of the module is that most of the operators are selected based on the solution to the defined energy function, avoiding too many efforts for structure tuning. Quantitative evaluations on various visual tasks demonstrate that the proposed module is flexible and effective to improve the representation ability of many ConvNets. Our code is available at Pytorch-SimAM.


Our environments and toolkits

  • OS: Ubuntu 18.04.5
  • CUDA: 11.0
  • Python: 3.8.3
  • Toolkit: PyTorch 1.8.0
  • GPU: Quadro RTX 8000 (4x)
  • thop

Module

Our goal is to infer a 3-D attention weights (Figure (c)) with a given feature map, which is very different to previous works as shown in Figure (a) and (b).

SimAM (A pytorch-like implementation). Detail of implementations, including the module and the network, can be found in networks in this repository.

    class SimAM(nn.Module):
        # X: input feature [N, C, H, W]
        # lambda: coefficient λ in Eqn (5)
        def forward (X, lambda):
            # spatial size
            n = X.shape[2] * X.shape[3] - 1
            # square of (t - u)
            d = (X - X.mean(dim=[2,3])).pow(2)
            # d.sum() / n is channel variance
            v = d.sum(dim=[2,3]) / n
            # E_inv groups all importance of X
            E_inv = d / (4 * (v + lambda)) + 0.5
            # return attended features
            return X * sigmoid(E_inv)

Training and Validation Curves

Experiments

Training and Evaluation

The following commands train models on ImageNet from scratch with 4 gpus.

# Training from scratch

python main_imagenet.py {the path of ImageNet} --gpu 0,1,2,3 --epochs 100 -j 20 -a resnet18 

python main_imagenet.py {the path of ImageNet} --gpu 0,1,2,3 --epochs 100 -j 20 -a resnet18 
--attention_type simam --attention_param 0.1

python main_imagenet.py {the path of ImageNet} --gpu 0,1,2,3 --epochs 150 -j 20 -a mobilenet_v2
--attention_type simam --attention_param 0.1 --lr .05 --cos_lr --wd 4e-5 
# Evaluating the trained model

python main_imagenet.py {the path of ImageNet} --gpu 0,1,2,3 -j 20 -a resnet18 -e
--resume {the path of pretrained .pth}

ImageNet

All the following models can be download from BaiduYunPan (extract code: 25tp) and Google Drive.

Model Parameters FLOPs Top-1(%) Top-5(%)
SimAM-R18 11.69 M 1.82 G 71.31 89.88
SimAM-R34 21.80 M 3.67 G 74.49 92.02
SimAM-R50 25.56 M 4.11 G 77.45 93.66
SimAM-R101 44.55 M 7.83 G 78.65 94.11
SimAM-RX50 (32x4d) 25.03 M 4.26 G 78.00 93.93
SimAM-MV2 3.50 M 0.31 G 72.36 90.74

COCO Evaluation

We use mmdetection to train Faster RCNN and Mask RCNN for object detection and instance segmentation. If you want to run the following models, please firstly install mmdetection with their guide. And then put all .py in mmdetection of this repository to the corresponding folders. All the following models can be download from BaiduYunPan (extract code: ysrz) and Google Drive.

Detection with Faster RCNN (FR for short) and Mask RCNN (MR for short)

Model AP AP_50 AP_75 AP_S AP_M AP_L
FR-SimAM-R50 39.2 60.7 40.8 22.8 43.0 50.6
FR-SimAM-R101 41.2 62.4 45.0 24.0 45.6 52.8
MR-SimAM-R50 39.8 61.0 43.4 23.1 43.7 51.4
MR-SimAM-R101 41.8 62.8 46.0 24.8 46.2 53.9

Instance Segmentation with Mask RCNN (MR for short)

Model AP AP_50 AP_75 AP_S AP_M AP_L
MR-SimAM-R50 36.0 57.9 38.2 19.1 39.7 48.6
MR-SimAM-R101 37.6 59.5 40.1 20.5 41.5 50.8

Citation

If you find SimAM useful in your research, please consider citing:

@InProceedings{pmlr-v139-yang21o,
    title = 	 {SimAM: A Simple, Parameter-Free Attention Module for Convolutional Neural Networks},
    author =       {Yang, Lingxiao and Zhang, Ru-Yuan and Li, Lida and Xie, Xiaohua},
    booktitle = 	 {Proceedings of the 38th International Conference on Machine Learning},
    pages = 	 {11863--11874},
    year = 	 {2021},
    editor = 	 {Meila, Marina and Zhang, Tong},
    volume = 	 {139},
    series = 	 {Proceedings of Machine Learning Research},
    month = 	 {18--24 Jul},
    publisher =    {PMLR},
    pdf = 	 {http://proceedings.mlr.press/v139/yang21o/yang21o.pdf},
    url = 	 {http://proceedings.mlr.press/v139/yang21o.html}
}

Contact Information

If you have any suggestion or question, you can contact us by: lingxiao.yang717@gmail.com. Thanks for your attention!

排名相邻
同类项目