All Projects → HolmesShuan → Compact-Global-Descriptor

HolmesShuan / Compact-Global-Descriptor

Licence: BSD-2-Clause license
Pytorch implementation of "Compact Global Descriptor for Neural Networks" (CGD).

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Compact-Global-Descriptor

Sockeye
Sequence-to-sequence framework with a focus on Neural Machine Translation based on Apache MXNet
Stars: ✭ 990 (+4400%)
Mutual labels:  attention-mechanism, attention-model
Nmt Keras
Neural Machine Translation with Keras
Stars: ✭ 501 (+2177.27%)
Mutual labels:  attention-mechanism, attention-model
attention-mechanism-keras
attention mechanism in keras, like Dense and RNN...
Stars: ✭ 19 (-13.64%)
Mutual labels:  attention-mechanism, attention-model
Keras Attention Mechanism
Attention mechanism Implementation for Keras.
Stars: ✭ 2,504 (+11281.82%)
Mutual labels:  attention-mechanism, attention-model
Linear Attention Recurrent Neural Network
A recurrent attention module consisting of an LSTM cell which can query its own past cell states by the means of windowed multi-head attention. The formulas are derived from the BN-LSTM and the Transformer Network. The LARNN cell with attention can be easily used inside a loop on the cell state, just like any other RNN. (LARNN)
Stars: ✭ 119 (+440.91%)
Mutual labels:  attention-mechanism, attention-model
Deepattention
Deep Visual Attention Prediction (TIP18)
Stars: ✭ 65 (+195.45%)
Mutual labels:  attention-mechanism, attention-model
Structured Self Attention
A Structured Self-attentive Sentence Embedding
Stars: ✭ 459 (+1986.36%)
Mutual labels:  attention-mechanism, attention-model
Pytorch Attention Guided Cyclegan
Pytorch implementation of Unsupervised Attention-guided Image-to-Image Translation.
Stars: ✭ 67 (+204.55%)
Mutual labels:  attention-mechanism, attention-model
Image Caption Generator
A neural network to generate captions for an image using CNN and RNN with BEAM Search.
Stars: ✭ 126 (+472.73%)
Mutual labels:  attention-mechanism, attention-model
Attentionalpoolingaction
Code/Model release for NIPS 2017 paper "Attentional Pooling for Action Recognition"
Stars: ✭ 248 (+1027.27%)
Mutual labels:  attention-mechanism, attention-model
S2VT-seq2seq-video-captioning-attention
S2VT (seq2seq) video captioning with bahdanau & luong attention implementation in Tensorflow
Stars: ✭ 18 (-18.18%)
Mutual labels:  attention-mechanism
TS3000 TheChatBOT
Its a social networking chat-bot trained on Reddit dataset . It supports open bounded queries developed on the concept of Neural Machine Translation. Beware of its being sarcastic just like its creator 😝 BDW it uses Pytorch framework and Python3.
Stars: ✭ 20 (-9.09%)
Mutual labels:  attention-mechanism
efficient-attention
An implementation of the efficient attention module.
Stars: ✭ 191 (+768.18%)
Mutual labels:  attention-mechanism
learningspoons
nlp lecture-notes and source code
Stars: ✭ 29 (+31.82%)
Mutual labels:  attention-model
LanguageModel-using-Attention
Pytorch implementation of a basic language model using Attention in LSTM network
Stars: ✭ 27 (+22.73%)
Mutual labels:  attention-mechanism
DCAN
[AAAI 2020] Code release for "Domain Conditioned Adaptation Network" https://arxiv.org/abs/2005.06717
Stars: ✭ 27 (+22.73%)
Mutual labels:  attention-mechanism
SANET
"Arbitrary Style Transfer with Style-Attentional Networks" (CVPR 2019)
Stars: ✭ 21 (-4.55%)
Mutual labels:  attention-model
En-transformer
Implementation of E(n)-Transformer, which extends the ideas of Welling's E(n)-Equivariant Graph Neural Network to attention
Stars: ✭ 131 (+495.45%)
Mutual labels:  attention-mechanism
CIAN
Implementation of the Character-level Intra Attention Network (CIAN) for Natural Language Inference (NLI) upon SNLI and MultiNLI corpus
Stars: ✭ 17 (-22.73%)
Mutual labels:  attention-mechanism
Brain-Tumor-Segmentation
Attention-Guided Version of 2D UNet for Automatic Brain Tumor Segmentation
Stars: ✭ 125 (+468.18%)
Mutual labels:  attention-mechanism

Compact-Global-Descriptor

The Pytorch implementation of "Compact Global Descriptor for Neural Networks" (CGD). arXiv

Toy illustration :

CGD is a simple yet effective way to capture the correlations between each position and all positions across channels.

equation and equation correspond to the global average pooling which maps features across spatial dimensions into a response vector.

equation

Final scheme :

The cascaded scheme utlizes both max pooling and ave pooling:

equation

equation

equation

See attention_best.py for detail.

How to use ?

Add an attention layer (CGD) right after the first convolution layer in each block. Set the weight decay of CGD to 4e-5.

Init :

# __init__(self, in_channels, out_channels, bias=True, nonlinear=True):
self.attention = AttentionLayer(planes, planes, True, True)

ResNet / MobileNet

out = self.conv1(x)
out = self.attention(out)
out = self.bn1(out)
out = self.relu(out)

PreResNet

residual = x

out = self.bn1(x)
out = self.relu(out)
out = self.conv1(out)

out = self.attention(out)

out = self.bn2(out)
out = self.relu(out)
out = self.conv2(out)

SqueezeNet

x = self.squeeze_activation(self.bn(self.attention(self.squeeze(x))))

WRN

if not self.equalInOut:
    x = self.relu1(self.bn1(x))
else:
    out = self.relu1(self.bn1(x))
out = self.relu2(self.bn2(self.attention(self.conv1(out if self.equalInOut else x))))

Results :

ImageNet Acc

COCO mAP

Saliency Map:

We visualize the feature map of res5b branch2a after ReLU. Second row is the original ResNet50 results. Third row illustrates the results with CGD. CGD deactivates neurons corresponding to backgrounds, which reduces the background noise and helps CNN focus more on objects.

Cite

@article{CGD,
  author    = {Xiangyu He and 
               Ke Cheng and 
               Qiang Chen and
               Qinghao Hu and
               Peisong Wang and
               Jian Cheng},
  title     = {Compact Global Descriptor for Neural Networks},
  journal   = {arXiv},
  volume    = {abs/1907.09665},
  year      = {2019},
  url       = {http://arxiv.org/abs/1907.09665}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].