CNN Attention layer to be used with tf or tf.keras
Project description
Visual_attention_tf
A set of image attention layers implemented as custom keras layers that can be imported dirctly into keras
Currently Implemented layers:
- Pixel Attention : Efficient Image Super-Resolution Using Pixel Attention(Hengyuan Zhao et al)
- Channel Attention : CBAM: Convolutional Block Attention Module(Sanghyun Woo et al)
Usage:
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D
from visual_attention import PixelAttention2D , ChannelAttention2D
inp = Input(shape=(1920,1080,3))
cnn_layer = Conv2D(32,3,,activation='relu', padding='same')(inp)
# Using the .shape[-1] to simplify network modifications. Can directly input number of channels as well
Pixel_attention_cnn = PixelAttention2D(cnn_layer.shape[-1])(cnn_layer)
Channel_attention_cnn = ChannelAttention2D(cnn_layer.shape[-1])(cnn_layer)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file visual-attention-tf-1.0.3.tar.gz
.
File metadata
- Download URL: visual-attention-tf-1.0.3.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75c0cd51a56610b8ecb23a805e7f1968aea13bf0fa9630ffc1bb941d01d57543 |
|
MD5 | bf15503bd5a03ac94b08271fe7a8921a |
|
BLAKE2b-256 | cd56d34e7fc0ef13b54fd6762e69400ecaeced0e0826809513a127abad80d0f8 |
File details
Details for the file visual_attention_tf-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: visual_attention_tf-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53fd96682b6d23a9434676b088461763850dc54955369bc44b0e76f457f7c819 |
|
MD5 | 89fb607e6cc05306bbfc12d656c374c2 |
|
BLAKE2b-256 | d95aa38d3099026436cab219715088c87e9a42756f69de7377219930b9e9ba01 |