GithubHelp home page GithubHelp logo

cbam.pytorch's Introduction

CBAM.PyTorch

Non-official implement of Paper:CBAM: Convolutional Block Attention Module

Introduction

The codes are PyTorch re-implement version for paper: CBAM: Convolutional Block Attention Module

Woo S, Park J, Lee J Y, et al. CBAM: Convolutional Block Attention Module[J]. 2018. ECCV2018

Structure

The overview of CBAM. The module has two sequential sub-modules: channel and spatial. The intermediate feature map is adaptively refined through our module (CBAM) at every convolutional block of deep networks.

1

Requirements

  • Python3
  • PyTorch 0.4.1
  • tensorboardX (optional)
  • torchnet
  • pretrainedmodels (optional)

Results

We just test four models in ImageNet-1K, both train set and val set are scaled to 256(minimal side), only use Mirror and RandomResizeCrop as training data augmentation, during validation, we use center crop to get 224x224 patch.

ImageNet-1K

Models validation(Top-1) validation(Top-5)
ResNet50 74.26 91.91
ResNet50-CBAM 75.45 92.55

cbam.pytorch's People

Contributors

developer0hye avatar ice-tong avatar luuuyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cbam.pytorch's Issues

Error in testing

hi I ma getting this error while testing
Traceback (most recent call last):
File "test.py", line 213, in
test_and_generate_result_round2('2','resnet50',416, True)
File "test.py", line 133, in test_and_generate_result_round2
my_model = resnet50.MyResNet50(model_ft)
NameError: name 'resnet50' is not defined

I think there are some mistakes

After applying Channel Attention Module, maybe it would be better to apply a convolution layer in order to modify the channels to the original value (usually 3 channels), instead of applying Spatial Attention Module instantly. Or Spatial Attention Module can't make sense.

fc or conv in file resnet_cbam.py, line 31 and line 33?

For the file resnet_cbam.py, I think line31 and line 33 are not consistent with the paper. fc1 and fc2 should be nn.Linear because the paper said:

Both descriptors are then forwarded to a shared network
to produce our channel attention map Mc 2 RC�1�1. The shared network is
composed of multi-layer perceptron (MLP) with one hidden layer. To reduce
parameter overhead, the hidden activation size is set to RC=r�1�1, where r is
the reduction ratio.

May I know why you use conv instead of Linear ?

Questions about ChannelAttention

Thank you very much! In the paper, this block meant to be the same as SE block (except for the MaxPool addition). Is there any reason why you used nn.Conv2d rather than nn.Linear in the original SE block? I am working with time series, would you recommend me to use Conv1d or keep using Linear? Finally, is there any reason why bias = False? I obtained better results with bias = True with SE block in my case.

Lastly, have you done any comparison with Gather & Excite? https://github.com/hujie-frank/GENet

怎么运行

博主大大 能给出运行的步骤吗 刚接触python和pytorch ,真的是一脸懵

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.