Skip to main content

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

  1. Create a new fodler
  2. Create a new virtual environment
  3. Update your pip
  4. Install the package (pip install pip install visualfailureanalysis)
  5. Setup your folder in the form "../experiemnt_group_name/experiment_name/test_results"
  6. In this folder place your data as raw_outputs.npz
  7. 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.
  8. In this folder place your latent space as encoded_output.npz
  9. 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.
  10. In this folder place your data as attribution.csv
  11. 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",..
  12. All three data files need the rows to be in the same order!
  13. In python: from visualfailureanalysis import analyser
  14. Initalize the main class: my_data_visulizer = analyser.Analyser(path=path,class2name=class2name,class2plot=class2plot,ls_testsets=ls_testsets,test_datasets=test_datasets)
  15. path ="../experiemnt_group_name/experiment_name"
  16. class2plot = dict({0:"myclassname0",...}) conatianing a mapping of integer classes to real names
  17. ls_testsets = ["nameoftestset",...] a list with names of all testsets
  18. class2plot and test_datasets are two lists with a subset of classes/ testset names for which to generate outputs. (output can be quite large)
  19. run my_data_visulizer.setup() to link the create the lower dimensional representation needed
  20. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

visualfailureanalysis-0.1.1.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

visualfailureanalysis-0.1.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file visualfailureanalysis-0.1.1.tar.gz.

File metadata

  • Download URL: visualfailureanalysis-0.1.1.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.7 Linux/5.15.0-52-generic

File hashes

Hashes for visualfailureanalysis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8604edd8aaa38a75e98196f04eae0edc56260e1c6e0e6f199433a6a779cefd77
MD5 d007b33cb0d6c648e7e3b6bd2896aac2
BLAKE2b-256 9d6a21464a39325bd3cb753b87b396ebb1193538e31b5edb12603540049374b6

See more details on using hashes here.

File details

Details for the file visualfailureanalysis-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for visualfailureanalysis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f61ca06613839bb3c87a6426b51020045421850076f042de4274d6e1812ed7a8
MD5 600a9b3dcc59c8efa4570fcd1e01be1b
BLAKE2b-256 5ec3dc869456a2cf580b6668fb4ef0cf8641174c4457b93d446526bf09010102

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page