Skip to content
/ xai Public

A repository containing a few experiments related to XAI

Notifications You must be signed in to change notification settings

NINAnor/xai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Explainable AI visualisation

All the XAI techniques in this repository are using a pretrained Residual Network 50 layers from torchvision.

How to use the folder

  • Install the dependancies and enter the virtual environment:
poetry install
poetry shell

User interface

We made a user interface available so you can seemlessly explain the pictures:

python gradio_app.py

Supported methods

So far we have few supported XAI methods.

  • Grad-CAM and HiResCAM:

The Grad-CAM technique consists of highlighting the pixels in the image that are important for the model to make its classification decision [1]. HiResCAM is a generalization of CAM that does not have the same drawbacks as Grad-CAM [2].

python src/xai_methods/cam.py --img ./assets/images/dog.png --output src/xai_methods/dog_hirescam.png --method hirescam

This will give you the following result:

Picture of a German shepherd classified by an AI model (labelled as dog) and explained using Grad-CAM technique. The HiResCAM technique consists of highlighting the pixels in the image that are important for the model to make its classification decision.

  • Deep Feature Factorization:

DFF is a technique that decomposes the image as a set of interpretable components as viewed by the AI algorithm. This allows the visualization and understanding of complex representations learned by the network [3].

python src/xai_methods/dff.py --img ./assets/images/dog.png --output src/xai_methods/dog_dff.png --n_components 2  

This will give you the following result:

Picture of a German shepherd explained using Deep Feature Factorization (DFF).

Reference:

[1] Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization [2] Use HiResCAM instead of Grad-CAM for faithful explanations of convolutional neural networks [3] Deep Feature Factorization For Concept Discovery

About

A repository containing a few experiments related to XAI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages