karvo / ouc-cogsys-custom-structured-attention-graphs

Source code for the paper "Structured Attention Graphs for Understanding Deep Image Classifications"

Home Page:https://arxiv.org/pdf/2011.06733

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

structured-attention-graphs

Abstract

Attention maps are popular tools of explaining the decisions of convolutional networks for image classification. Typically for each image of interest, a single attention map is produced, which assigns weights to pixels based on their importance to the classification. We argue that a single attention map provides an incomplete understanding since there are often many other maps that explain a classification equally well. In this paper, we introduce structured attention graphs (SAGs), which compactly represent sets of attention maps for an image by capturing how different combinations of image regions impact the confidence of a classifier. We propose an approach to compute SAGs and a visualization for SAGs so that deeper insight can be gained into a classifier’s decisions.

[arxiv][https://arxiv.org/pdf/2011.06733]

Demo

Example: Peacock

Original Image Grad-CAM I-GOS Ours
SAG

Example: School bus

Original Image Grad-CAM I-GOS Ours
SAG

Installing dependencies:

bash requirements_install.sh

To run:

python main_generate_sag.py

Directory description:

  • search.py -- functions to perform search (beam search or combinatorial search) on a perturbation mask
  • diverse_subset_selection.py -- functions to obtain a diverse subset from a set of candidate masks
  • get_perturbation_mask.py -- functions to obtain a perturbation mask
  • patch_deletion_tree.py -- functions to build a tree by deleting one patch at a time
  • utils.py -- helper functions
  • main_generate_sag.py -- main file to generate SAG
  • Images -- folder consisting of input images for which we build SAGs
  • Results -- all results are populated here
  • GroundTruth1000.txt -- IMAGENET groundtruth labels
  • requirements_conda.txt -- lists all conda libraries dependencies
  • requirements_pip.txt -- lists all pip libraries dependencies

About

Source code for the paper "Structured Attention Graphs for Understanding Deep Image Classifications"

https://arxiv.org/pdf/2011.06733

License:MIT License


Languages

Language:Python 99.6%Language:Shell 0.4%