All Projects → PistonY → ResidualAttentionNetwork

PistonY / ResidualAttentionNetwork

Licence: MIT license
A Gluon implement of Residual Attention Network. Best acc on cifar10-97.78%.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ResidualAttentionNetwork

gluon-faster-rcnn
Faster R-CNN implementation with MXNet Gluon API
Stars: ✭ 31 (-70.19%)
Mutual labels:  mxnet, gluon
Gluon2pytorch
Gluon to PyTorch deep neural network model converter
Stars: ✭ 70 (-32.69%)
Mutual labels:  mxnet, gluon
Aws Machine Learning University Accelerated Cv
Machine Learning University: Accelerated Computer Vision Class
Stars: ✭ 1,068 (+926.92%)
Mutual labels:  mxnet, gluon
Gluon Nlp
NLP made easy
Stars: ✭ 2,344 (+2153.85%)
Mutual labels:  mxnet, gluon
Aws Machine Learning University Accelerated Nlp
Machine Learning University: Accelerated Natural Language Processing Class
Stars: ✭ 1,695 (+1529.81%)
Mutual labels:  mxnet, gluon
Gluonrank
Ranking made easy
Stars: ✭ 39 (-62.5%)
Mutual labels:  mxnet, gluon
Imgclsmob
Sandbox for training deep learning networks
Stars: ✭ 2,405 (+2212.5%)
Mutual labels:  mxnet, gluon
Aws Machine Learning University Accelerated Tab
Machine Learning University: Accelerated Tabular Data Class
Stars: ✭ 718 (+590.38%)
Mutual labels:  mxnet, gluon
Mxnet Gluon Style Transfer
Neural Style and MSG-Net
Stars: ✭ 105 (+0.96%)
Mutual labels:  mxnet, gluon
Mxnet Im2rec tutorial
this simple tutorial will introduce how to use im2rec for mx.image.ImageIter , ImageDetIter and how to use im2rec for COCO DataSet
Stars: ✭ 97 (-6.73%)
Mutual labels:  mxnet, gluon
Sockeye
Sequence-to-sequence framework with a focus on Neural Machine Translation based on Apache MXNet
Stars: ✭ 990 (+851.92%)
Mutual labels:  mxnet, gluon
Mxnet.sharp
.NET Standard bindings for Apache MxNet with Imperative, Symbolic and Gluon Interface for developing, training and deploying Machine Learning models in C#. https://mxnet.tech-quantum.com/
Stars: ✭ 134 (+28.85%)
Mutual labels:  mxnet, gluon
Efficientnet
Gluon implementation of EfficientNet and EfficientNet-lite
Stars: ✭ 30 (-71.15%)
Mutual labels:  mxnet, gluon
Quantization.mxnet
Simulate quantization and quantization aware training for MXNet-Gluon models.
Stars: ✭ 42 (-59.62%)
Mutual labels:  mxnet, gluon
Mxnet Centernet
Gluon implementation of "Objects as Points", aka "CenterNet"
Stars: ✭ 29 (-72.12%)
Mutual labels:  mxnet, gluon
Ko en neural machine translation
Korean English NMT(Neural Machine Translation) with Gluon
Stars: ✭ 55 (-47.12%)
Mutual labels:  mxnet, gluon
Autogluon
AutoGluon: AutoML for Text, Image, and Tabular Data
Stars: ✭ 3,920 (+3669.23%)
Mutual labels:  mxnet, gluon
Gluon Cv
Gluon CV Toolkit
Stars: ✭ 5,001 (+4708.65%)
Mutual labels:  mxnet, gluon
Mxnet Gluon Syncbn
MXNet Gluon Synchronized Batch Normalization Preview
Stars: ✭ 78 (-25%)
Mutual labels:  mxnet, gluon
Aognet
Code for CVPR 2019 paper: " Learning Deep Compositional Grammatical Architectures for Visual Recognition"
Stars: ✭ 132 (+26.92%)
Mutual labels:  mxnet, cifar10

Residual Attention Network

GitHub Status 996.icu ToDo

A Gluon implement of Residual Attention Network

This code is refered to this project

https://github.com/tengshaofeng/ResidualAttentionNetwork-pytorch

Cifar-10 Kaggle

4

GluonCV

Project site: https://github.com/dmlc/gluon-cv

I have contribute this project to GluonCV.Now you can easily use pre-trained model in few days.

Usage:

from gluoncv.model_zoo.residual_attentionnet import *

Include which you can use:

__all__ = ['ResidualAttentionModel', 'cifar_ResidualAttentionModel',
           'residualattentionnet56', 'cifar_residualattentionnet56',
           'residualattentionnet92', 'cifar_residualattentionnet92',
           'residualattentionnet128', 'cifar_residualattentionnet452',
           'residualattentionnet164', 'residualattentionnet200',
           'residualattentionnet236', 'residualattentionnet452']

Prerequisites

Python3.6, Numpy, mxnet

  • I use maxnet-cu90 --pre but if not is just ok
  • If you want to train you need a recent NVIDIA GPU

Results

  • cifar-10: Acc-95.41(Top-1 err 4.59) with Attention-92(higher than paper top-1 err 4.99)
  • cifar-10: Acc-95.68(Top-1 err 4.32) with Attention-92(use MSRAPrelu init)
  • cifar-10: Acc-97.14(Top-1 err 2.86) with Attention-92, using gluoncv-tricks.
    • BS 256,
    • +mixup,
    • +LR warmup,
    • +No bias decay.
    • +Cosine decay.
    • +Cutout
  • cifar-10: Acc-97.57(Top-1 err 2.43) with Attention-452, using gluoncv-tricks.
    • BS 128,
    • +mixup,
    • +LR warmup,
    • +No bias decay.
    • +Cosine decay.
    • +Cutout
  • Network scale control: I add 'p,t,r,m' to control network scale.(Gluon-CV)
    • I add 'p,t,r,m.' control which origin paper proposed.Now you can use Attentnon 56/92/128/164/200/236/452 in Gluon-cv.But I won't update to this project.Because I can't train them and if I add, the paprm I have trained won't use any more.
  • ImageNet: Attention56 achieves (21.03 5.47) top1/top5 error on ImageNet.Better than paper.(21.76 5.9).(Gluon-cv)

How to train & test

For training cifar10, just run train_cifar.py

For only testing cifar10, you can simply run below script.

import mxnet as mx
from mxnet import gluon, image
from train_cifar import test
from model.residual_attention_network import ResidualAttentionModel_92_32input_update

def trans_test(data, label):
    im = data.astype(np.float32) / 255.
    auglist = image.CreateAugmenter(data_shape=(3, 32, 32),
                                    mean=mx.nd.array([0.485, 0.456, 0.406]),
                                    std=mx.nd.array([0.229, 0.224, 0.225]))
    for aug in auglist:
        im = aug(im)

    im = nd.transpose(im, (2, 0, 1))
    return im, label

ctx = mx.gpu()
val_data = gluon.data.DataLoader(
    gluon.data.vision.CIFAR10(train=False, transform=trans_test),
    batch_size=64)

net = ResidualAttentionModel_92_32input_update()
net.hybridize()
net.load_parameters('cifar_param/test_iter225999_0.95410.param')
test(net, ctx, val_data, 0)

Paper referenced

Residual Attention Network for Image Classification (CVPR-2017 Spotlight) By Fei Wang, Mengqing Jiang, Chen Qian, Shuo Yang, Chen Li, Honggang Zhang, Xiaogang Wang, Xiaoou Tang(https://arxiv.org/pdf/1704.06904.pdf)

1 Left: an example shows the interaction between features and attention masks. Right: example images illustrating that different features have different corresponding attention masks in our network. The sky mask diminishes low-level background blue color features. The balloon instance mask highlights high-level balloon bottom part features.

2 Attention Network architecture.

3

The Attention-56 network outperforms ResNet-152 by a large margin with a 0.4% reduction on top-1 error and a 0.26% reduction on top-5 error. More importantly Attention-56 network achieves better performance with only 52% parameters and 56% FLOPs compared with ResNet-152, which suggests that the proposed attention mechanism can significantly improve network performance while reducing the model complexity.

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].