Catalogue of Tools & Metrics for Trustworthy AI

These tools and metrics are designed to help AI actors develop and use trustworthy AI systems and applications that respect human rights and are fair, transparent, explainable, robust, secure and safe.

Interpreting Convolutional Neural Network (CNN) Results



Interpreting Convolutional Neural Network (CNN) Results

This repo contains the code for our talk “Demystifying the neural network black box”. Slides are available on Speaker Deck.

Motivation

Convolutional Neural Networks (CNN) are state of the art when it comes to computer vision tasks such as image recognition and object detection. However, due to the high amount of architectural complexity, it is often difficult to interpret the decisions made by these networks. Luckily, there are several techniques available which can enhance our comprehension of CNN decisions. These techniques are generally divided into attribution and visualisation methods.

In one of our image classification projects at idealo, we wished to recognise the area of hotel property depicted in the images. There were several cases where images depicting a Swimming Pool area were misclassified as belonging to the Bathroom area. Some examples of such images are as below:

Misclassified Images

Using an attribution technique called Gradient Class Activation Maps (Grad-CAM), we were able to draw a heatmap that indicates the relative importance of different image areas in making the classification decision. Heatmaps for the above images are as below:

Heatmaps

This helped us discover a bias for using metallic rails as a means to misclassify images as belonging to Bathroom area.

On the other hand, visualization techniques helped us understand the patterns that neurons at different layers in the CNN might be learning. Some visualisations for a specific layer of MobileNet architecture fitted to our data are as below:

vis

These patterns usually get increasing complex as one progresses towards the output layer of a CNN.

Getting Started

In this repository, several interpretation techniques have been demonstrated with Google Colab notebooks. There is no need to clone this repository. Google Colab notebooks for attribution and visualisation methods can be launched in the browser by simply clicking the ‘Open in Colab’ icon in the respective sections below. Additionally, the ‘Hardware accelerator’ for Colab notebooks should be set to ‘GPU’ for a quicker run through the code. For a quick tutorial on Colab notebooks, check out this blog post.

Attribution techniques:

Open In Colab

Some of the attribution methods we have tried to explore are:

Visualization techniques

Open In Colab

Some of the visualization methods we have tried to explore are:

Acknowledgement

Several awesome Python packages have been used for this work:

LICENSE

See LICENSE for details.

About the tool


Developing organisation(s):


Tool type(s):




Country/Territory of origin:


Type of approach:





Programming languages:



Github stars:

  • 173

Github forks:

  • 30

Modify this tool

Use Cases

There is no use cases for this tool yet.

Would you like to submit a use case for this tool?

If you have used this tool, we would love to know more about your experience.

Add use case
Partnership on AI

Disclaimer: The tools and metrics featured herein are solely those of the originating authors and are not vetted or endorsed by the OECD or its member countries. The Organisation cannot be held responsible for possible issues resulting from the posting of links to third parties' tools and metrics on this catalogue. More on the methodology can be found at https://oecd.ai/catalogue/faq.