Toolkit to visualize the reasoning of image classification networks.
Project description
Purpose
This toolkit is designed to analyse the underlying representation of a image classification network.
Instructions
- Create a new fodler
- Create a new virtual environment
- Update your pip
- Install the package (pip install pip install visualfailureanalysis)
- Setup your folder in the form "../experiemnt_group_name/experiment_name/test_results"
- In this folder place your data as raw_outputs.npz
- Format: Outputs of the softmax in the first columns followed by the label as an integer and dataset integer index in the last column. Each row is one data point. If you only have one data set the index is always 0.
- In this folder place your latent space as encoded_output.npz
- Format: Outputs of the penultimate layer (e.g. inputs to the final layer) in the first columns and dataset index in the last. Each row is one data point.
- In this folder place your data as attribution.csv
- attributions.csv needs to at least contain a column called "filepath" containing the absolute filepaths of your images. If you have multiple data sets attributions are renamed to "attributions0.csv","attributions1.csv",..
- All three data files need the rows to be in the same order!
- In python: from visualfailureanalysis import analyser
- Initalize the main class: my_data_visulizer = analyser.Analyser(path=path,class2name=class2name,class2plot=class2plot,ls_testsets=ls_testsets,test_datasets=test_datasets)
- path ="../experiemnt_group_name/experiment_name"
- class2plot = dict({0:"myclassname0",...}) conatianing a mapping of integer classes to real names
- ls_testsets = ["nameoftestset",...] a list with names of all testsets
- class2plot and test_datasets are two lists with a subset of classes/ testset names for which to generate outputs. (output can be quite large)
- run my_data_visulizer.setup() to link the create the lower dimensional representation needed
- generate outputs and statistics with the respective class methods.
Outputs
Generates outputs for representative images based on a k-means clustering of the latent space. Latennt space dimenstions are reduced to 50 by pca and 3 by T-SNE.
Generates the most overconfident as well as underconfident images based on the softmax response (could be adjusted to other confidence score).
The app.py file can be run by "python3 app.py" and starts an interactive dash app that allows the user to explore the latent space of his neural network and the images linked to each data point. The data necessary to run the app can be generated by the package. After initalizing the main analyser simply run analyzer.prepaire_dash() and the correct data frame is written.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for visualfailureanalysis-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8604edd8aaa38a75e98196f04eae0edc56260e1c6e0e6f199433a6a779cefd77 |
|
MD5 | d007b33cb0d6c648e7e3b6bd2896aac2 |
|
BLAKE2b-256 | 9d6a21464a39325bd3cb753b87b396ebb1193538e31b5edb12603540049374b6 |
Hashes for visualfailureanalysis-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f61ca06613839bb3c87a6426b51020045421850076f042de4274d6e1812ed7a8 |
|
MD5 | 600a9b3dcc59c8efa4570fcd1e01be1b |
|
BLAKE2b-256 | 5ec3dc869456a2cf580b6668fb4ef0cf8641174c4457b93d446526bf09010102 |