Coder Social home page Coder Social logo

dreadlord1984 / guided-attention-inference-network Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alokwhitewolf/guided-attention-inference-network

0.0 3.0 0.0 5.21 MB

Contains implementation of Guided Attention Inference Network (GAIN) presented in Tell Me Where to Look(CVPR 2018). This repository aims to apply GAIN on fcn8 architecture used for segmentation.

License: MIT License

Python 100.00%

guided-attention-inference-network's Introduction

Guided Attention for FCN

About

Chainer implementation of Tell Me Where To Look. This is an experiment to apply Guided Attention Inference Network(GAIN) as presented in the paper to Fully Convolutional Networks(FCN) used for segmentation purposes. The trained FCN8s model is fine tuned using guided attention.

GAIN

GAIN is based on supervising the attention maps that is produced when we train the network for the task of interest.

Image

FCN

Fully Convolutional Networks is a network architecture that consists of convolution layers followed by deconvolutions to give the segmentation output

Image

Approach

  • We take the fully trained FCN8 network and add a average pooling and fully connected layers after its convolutional layers. We freeze the convolutional layers and train the fully connected networks to classify for the objects. We do this in order to get GradCAMs for a particular class to be later used during GAIN

Image

  • Next we train the network as per the GAIN update rule. However in this implementation I have also considered the segmentation loss along with the GAIN updates/loss. This is because, I found using only the GAIN updates though did lead to convergence of losses, but also resulted in quite a significant dip in segmentation accuracies. In this step, the fully connected ayers are freezed and are not updated.

Loss Curves

For classification training

Image

Segmentation Loss during GAIN updates

Image

Qualitative Results

Original Image PreTrained GCAMs Post GAIN GCAMs
Image

Image

Image

Image

Quantitative Results

For FCN8s

Implementation Accuracy Accuracy Class Mean IU FWAVACC Model File
Original 91.2212 77.6146 65.5126 84.5445 fcn8s_from_caffe.npz
Experimental 90.5962 80.4099 64.6869 83.9952 model.npz

How to use

pip install chainer
pip install chainercv
pip install cupy
pip install fcn

Training

For training the classifier, download. the pretrained FCN8s chainer model

train_classifier.py --modelfile <path to the downloaded pre trained model>

For GAIN updates,

train_GAIN.py --mmodelfile <path to the trained model with trained classifier>

The accuracy of original implementation is computed with (evaluate.py)

To Do

[x] Finetune hyperparameters

[x] Push Visualization Code

Credits

The original FCN module and the fcn package is courtesy of wkentaro

guided-attention-inference-network's People

Contributors

alokwhitewolf avatar

Watchers

James Cloos avatar DL avatar  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.