Giter Club home page Giter Club logo

attention_branch_network's Introduction

Attention Branch Network

Writer : Hiroshi Fukui

Abstract

This repository contains the source code of Attention Branch Network for image classification. The attention branch network is designed to extend the top-down visual explanation model by introducing a branch structure with an attention mechanism. ABN improves CNN’s performance and visual explanation at the same time by gnerating attention maps in the forward pass. This link is the arXiv paper.

Citation

@article{fukui2018,
author = {Hiroshi Fukui and Tsubasa Hirakawa and Takayoshi Yamashita and Hironobu Fujiyoshi},
title = {Attention Branch Network: Learning of Attention Mechanism for Visual Explanation},
journal = {arXiv preprint arXiv:1812.10025},
year = {2018}
}

Detail

Our source code is based on https://github.com/bearpaw/pytorch-classification/ with PyTorch. Requirements of PyTorch version is as follows, and we published the Docker file. If you need the Docker, please use our Dockerfile.

  • PyTorch : 0.4.0
  • PyTorch vision : 0.2.1

Example of run command is as follows, but if you try the other models or ImageNet, please refer the README at https://github.com/bearpaw/pytorch-classification/blob/master/TRAINING.md.

  • Training

python cifar.py -a resnet --dataset cifar100 --depth 110 --epochs 300 --schedule 150 225 --gamma 0.1 --wd 1e-4 --checkpoint checkpoints/cifar100/resnet-110 --gpu-id 0,1

python imagenet.py -a resnet152 --data ../../../../dataset/imagenet_data/ --epochs 90 --schedule 31 61 --gamma 0.1 -c checkpoints/imagenet/resnet152 --gpu-id 0,1,2,3 --test-batch 100

  • Evaluation

python cifar.py -a resnet --dataset cifar100 --depth 110 --epochs 300 --schedule 150 225 --gamma 0.1 --wd 1e-4 --checkpoint checkpoints/cifar100/resnet-110 --gpu-id 0,1 --evaluate --resume checkpoints/cifar100/resnet-110/model_best.pth.tar

python imagenet.py -a resnet152 --data ../../../../dataset/imagenet_data/ --epochs 90 --schedule 31 61 --gamma 0.1 -c checkpoints/imagenet/resnet152 --gpu-id 4,5,6 --test-batch 10 --evaluate --resume checkpoints/imagenet/resnet152/model_best.pth.tar

Additionally, we have published the model files of ABN, which are ResNet family models on CIFAR100 and ImageNet2012 dataset.

Models on CIFAR100 Dataset

Models on ImageNet2012 Dataset

Performance of the ABN on CIFAR100

top-1 error (ABN) top-1 error (original)
ResNet110 22.5 24.1
DenseNet 21.6 22.5
Wide ResNet 18.1 18.9
ResNeXt 17.7 18.3

Performance of the ABN on ImageNet2012

top-1 error (ABN) top-1 error (original)
ResNet50 23.1 24.1
ResNet101 21.8 22.5
ResNet152 21.4 22.2

Example of Attention map

overview image

attention_branch_network's People

Contributors

hiroshi-fukui avatar

Watchers

Shubham Pachori avatar paper2code - bot avatar

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.