In this blog post, I present how to use multi-dimensional index arrays for indexing tensors.
First, I will show multi-dimensional array indexing with numpy. Then I will show two approaches in tensorflow:
- tf.while_loop
- tf.gather_nd
I will conclude that tf.gather_nd is much more effective than tf.while_loop.
Reference¶
Classification with Mahalanobis distance + full covariance using tensorflow
This blog discusses how to calculate Mahalanobis distance using tensorflow. I will consider full variance approach, i.e., each cluster has its own general covariance matrix, so I do not assume common variance accross clusters unlike the previous post. Calculation of Mahalanobis distance is important for classification when each cluster has different covariance structure. Let's take a lookt at this situation using toy data.
Calculate Mahalanobis distance with tensorflow 2.0
I noticed that tensorflow does not have functions to compute Mahalanobis distance between two groups of samples. So here I go and provide the code with explanation. The blog is organized and explain the following topics
- Euclidean distance with Scipy
- Euclidean distance with Tensorflow v2
- Mahalanobis distance with Scipy
- Mahalanobis distance with Tensorflow v2
Learn the Carlini and Wagner's adversarial attack - MNIST
Deep neural networks (DNN) have become increasingly effective at many difficult machine-learning tasks. However, DNNs are vulnerable to adversarial examples that are maliciously made to misguide the DNN's performance. The vulnerability may make it difficult to apply the DNNs to security sensitive usecases. In this blog, we learn one of the most successful adversarial attack proposed in the paper "Toward Evaluating the Robustness of Neural Network".
Grad-CAM with keras-vis
Gradient Class Activation Map (Grad-CAM) for a particular category indicates the discriminative image regions used by the CNN to identify that category.
The goal of this blog is to:
- understand concept of Grad-CAM
- understand Grad-CAM is generalization of CAM
- understand how to use it using keras-vis
- implement it using Keras's backend functions.
Reference¶
Saliency Map with keras-vis
Image Specific Class Saliency Visualization allows better understanding of why a model makes a classification decision. The goal of this blog is to understand its concept and how to interpret the Saliency Map.
Reference¶
- Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps
- keras-vis
Reference in this blog¶
Visualization of deep learning classification model using keras-vis
In the next few blog posts, I will review visualization techiniques.
Image Specific Visualization¶
Create condo environment¶
conda create -n explainableAI python=3.5
source activate explainableAI
conda install tensorflow
conda install keras
conda install jupyter
pip install git+https://github.com/raghakot/keras-vis.git --upgrade --no-deps
pip install opencv-python==3.3.0.10
$CONDA_PREFIX/bin/jupyter notebook --no-browser
Download a json file containing ImageNet class names.¶
Part 7 Object Detection with YOLOv2 using VOC 2012 data - inference on video
This is the seventh and final blog post of Object Detection with YOLO blog series. This blog performs inference using the model in trained in Part 5 Object Detection with Yolo using VOC 2012 data - training. I will use PASCAL VOC2012 data. This blog assumes that the readers have read the previous blog posts - Part 1
Part 6 Object Detection with YOLOv2 using VOC 2012 data - inference on image
This is the sixth blog post of Object Detection with YOLO blog series. This blog performs inference using the model in trained in Part 5 Object Detection with Yolo using VOC 2012 data - training. I will use PASCAL VOC2012 data. This blog assumes that the readers have read the previous blog posts - Part 1
Part 5 Object Detection using YOLOv2 on Pascal VOC2012 - training
This is the fifth blog post of Object Detection with YOLO blog series. This blog finally train the model using the scripts that are developed in the previous blog posts. I will use PASCAL VOC2012 data. This blog assumes that the readers have read the previous blog posts - Part 1