rlronan / cnn_vis_demo

Demo of our EasyVIZ package capabilities. EasyVIZ is a package for easy CNN visualizations, and metrics for those visualizations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EasyVIZ Demo:

A demonstration of two potential use cases for our EasyVIZ package.

For the package implementation please see: EasyVIZ

Use During Training

demo.py showcases using our Tensorflow Callbacks to create and save our layer visualizations, maximum mean filter activation visualizations, and our 2D-Entropy calculations. It also demonstrates how users can display the visualizations during traing, save them to disk, or log them to Tensorboard. We've chosen a very small model and dataset for this demo, so results can be seen instantly. Given the size of the model and dataset, however, the results may not appear very impressive.

Use On Pretrained Models

demo2.py showcases how one could use EasyVIZ to explore pretrained models by visualizing maximum mean filter activations and computing the 2D-Entropy of these features. The demo uses a pretrained VGG16 model, but it is compatible with any Tensorflow model with accessible layers. Pretrained models from Tensorflow's tf.keras.applications section should work as long as the preprocessing function is provided, but models from Tensorflow's Model Zoo, for example, will not work because they are repacked as one-layer models.

2D-Entropy Examples With VGG16

Filters from Block 2, Conv 1. They appear to be looking for pixel gradients in a constrained range.

Filters from Block 2, Conv 1. We observe two edge detection filters, and note the histogram of gradients are entirely different from the first two examples.

Filters from Block 3, Conv 1. While they both appear to be detecting edges in the direction from top left to bottom right, the second filter also shows detections in the orthogonal direction.

Filters from Block 3, Conv 1.

Filters from Block 3, Conv 4 and Conv 1.

Requirements:

tensorflow 2.x

tensorflow_addons compatible with the installed tensorflow version

scipy

pathlib

imageio

matplotlib

numpy

About

Demo of our EasyVIZ package capabilities. EasyVIZ is a package for easy CNN visualizations, and metrics for those visualizations.


Languages

Language:Python 100.0%