Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/titu1994/keras-attention-augmented-convs

Keras implementation of Attention Augmented Convolutional Neural Networks
https://github.com/titu1994/keras-attention-augmented-convs

attention-augmented-conv keras-tensorflow tensorflow

Last synced: 18 days ago
JSON representation

Keras implementation of Attention Augmented Convolutional Neural Networks

Awesome Lists containing this project

README

        

# Keras Attention Augmented Convolutions

A Keras (Tensorflow only) wrapper over the Attention Augmentation module from the paper [Attention Augmented Convolutional Networks](https://arxiv.org/abs/1904.09925).

Provides a Layer for Attention Augmentation as well as a callable function to build a augmented convolution block.

# Usage

It is advisable to use the `augmented_conv2d(...)` function directly to build an attention augmented convolution block.

```python
from attn_augconv import augmented_conv2d

ip = Input(...)
x = augmented_conv2d(ip, ...)
...
```

If you wish to add the attention module seperately, you can do so using the `AttentionAugmentation1D` layer as well.

```python
from attn_augconv import AttentionAugmentation1D

ip = Input(...)

# make sure that input to the AttentionAugmentation1D layer has (2 * depth_k + depth_v) filters.
x = Conv2D(2 * depth_k + depth_v, ...)(ip)
x = AttentionAugmentation1D(depth_k, depth_v, num_heads)(x)
...
```

# Requirements
- Tensorflow 2.0+