Skip to content

bourcierj/rdfia-tme9-visu-nn

Repository files navigation

#rdfia #tme9 #cnn-visualization #imagenet #pytorch

Visualization of Neural Networks

In this practical work, we experiment with diverse techniques with the goal to study the behavior of convolutional neural networks.

The techniques we study are:

  • Saliency maps: visualization of the importance of each pixel in the image to the classification score of the true class. (Simonyan et al. (2014))
  • Adversarial examples / fooling examples: adding minor modifications to an image, imperceptible to a human, which lead to a wrong classification of the image. (Szegedy et al. (2014), Goodfellow et al. (2015))
  • Class visualization (DeepDream-like): "generation" of an image corresponding to a category, in order to visualize the type of patterns detected by the network. (Simonyan et al. (2014), Yosinski et al. (2015))

The common principle of these approaches is to use the gradient of the input image with respect to an output class.

Therefore, the goal is not to modify/train the network but instead take a trained network, freeze its weights and backpropagates gradient of the input image, in order to study indirectly the behavior of the network.

We use the SqueezeNet network (from Iandola et al. (2016)), trained on ImageNet, designed to be very compact and eficient while allowing good results.

Saliency Maps

saliency-maps_1

Fig. 1: Images sampled from ImageNet with the saliency maps associated to their respective label.

Adversarial Examples

fooling-examples_sports-car fooling-examples_space-shuttle fooling-examples_bee-eater fooling-examples_daisy

Fig. 2: Images sampled from ImageNet and an adversarial example generated from each image, with target class "stingray", along with the difference between those images. For the original images, "confidence" is the probability of the image label; for the adversarial images, it is the probability of the target class.

Class Visualizations

class-visualizations_2

Fig. 6: "DeepDream-like" images generated from natural images, with target class set to the respective images labels.