Skip to main content

This package provides the implementation of GGA (https://arxiv.org/abs/2102.12196).

Project description

GGA-Identifying-Untrustworthy-Predictions

Code relative to "Identifying Untrustworthy Predictions in Neural Networks by Geometric Gradient Analysis" Leo Schwinn, An Nguyen, René Raab, Leon Bungert, Daniel Tenbrinck, Dario Zanca, Martin Burger, Bjoern Eskofier Paper: https://arxiv.org/abs/2102.12196 Accepted at UAI 2021

We propose a geometric gradient analysis (GGA) of the input gradients of neural networks to detect out-of-distribution data and adversarial attacks. GGA does not require retraining of a given model. Here, we analyze and interpret the gradient of a neural network w.r.t. its input (e.g., saliency map). More precisely, for a given input sample we inspect the geometric relation among all possible saliency maps, calculated for each output class of the model. This is achieved by a pairwise calculation of the cosine similarity between saliency maps. The cosine similarites for a given input can be summarizes with cosine similiarty maps (CSMs)

The following image exemplifies how GGA can be used to differentiate different data types for a MNIST model by calculating the respective CSM for every input.

Examples of CSMs for the "Standard" CIFAR10 model provided by RobustBench libary (https://github.com/RobustBench/robustbench) are given below:

How to use GGA

GGA can be installed with the following command:

Instalation

pip install gga-csm

To compute the cosine similarity map for a given input use the following code:

from gga.CSM import cosine_similarity_maps

csm = cosine_similarity_maps(model, x)

An example is also given in main.py

Citation

If you use our method in a publication please cite:

@article{schwinn2021identifying,
  author    = {Leo Schwinn and
               An Nguyen and
               Ren{\'{e}} Raab and
               Leon Bungert and
               Daniel Tenbrinck and
               Dario Zanca and
               Martin Burger and
               Bjoern Eskofier},
  title     = {Identifying Untrustworthy Predictions in Neural Networks by Geometric
               Gradient Analysis},
  journal   = {CoRR},
  volume    = {abs/2102.12196},
  year      = {2021},
}

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

gga-csm-0.0.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

gga_csm-0.0.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file gga-csm-0.0.3.tar.gz.

File metadata

  • Download URL: gga-csm-0.0.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for gga-csm-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3886d2d090ca17820713cbf37cd2e79f843d027871c2e0638cd4f2ee6eefa745
MD5 d8076eaabfa9bbf9166aabd2ff3a3843
BLAKE2b-256 3a121a805a156c2c495e814cf9f8d94564aa8a9d8c71f4766533e58449df6dab

See more details on using hashes here.

File details

Details for the file gga_csm-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: gga_csm-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for gga_csm-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3cce759b72f4ff4ba35eecdd4322679a15728979fc651abeb20a105a0b549852
MD5 736a8deb13ec3df7d14fdbbffef80a2f
BLAKE2b-256 3b564e7eafdd2a1826b0c85b7dbc1d12319c37065c9ae9b9eaa9fb88fe861bca

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