Home

Awesome

STREAK Example Code

Interpreting neural networks via the STREAK algorithm (streaming weak submodular maximization).

Example

(original)(segmented)(interpretation)
Original Image (top label: daisy)Segmented ImageInterpretation for daisy
(original)(segmented)(interpretation)
Original Image (top label: daisy)Segmented ImageInterpretation for daisy

Given a black-box neural network and a test image, the algorithm finds a sparse explaination for the network's prediction. First, segment the image into regions. Then rerun the network with most of the image regions replaced by a gray reference image, and record the output. The algorithm returns a sparse set of regions that collectively still activate the network's top label. These examples use InceptionV3 with the last layer retrained to classify different types of flowers.

Requirements

Usage

The main scripts are streakInterpretationExample.py and streakRegressionExample.py. The Jupyter notebook StreakImageRetraining.ipynb is also available as a convenient walkthrough of streakIntrepretationExample. tf_predict.py can also be used from the command line to load the tensorflow model and predict labels for a list of images.

python streakInterpretationExample.py image1.jpg image2.jpg
python streakRegressionExample.py
python tf_predict.py image1.jpg image2.jpg

A modified LimeImageExplainer class supports 2 new feature selection methods: