GMM-CNN
This code package implements the modeling of CNN layers activity with Gaussian mixture model and Inference Graphs visualization technique from the paper "Inference graphs for CNN Interpretation".
Requirements:
- Graphvis V 0.10.1
- Tensorflow 1.11.0
- Keras 2.2.5
Instructions - Work Flow
GMM-CNN model training (main.py):
- Specify the directory for saving the model and configuration
- Specify the layers names as used in the CNN you wish to model.
- Specify the number of Gaussian (clusters) for each layer (as the same order you did in 2.).
- Choose between discriminative/generative for training method (as explained in the paper).
- Run main.py.
Gathering clusters statistics (gather_clusters_stats.py):
- Specify the directory you gave in 1. above.
- Run gather_clusters_stats.py script.
Creating clusters images (draw_clusters.py):
- Specify the directory you gave in 1. above.
- Insert the cluster visualiztion technique (rectangle/patches).
- Run draw_clusters.py.
Creating class infernce graphs (draw_class_inference_graph.py):
- Specify the directory you gave in 1. above.
- Specify the CNN layers name to visualize in the graph and the clusters visualiztion technique for each layer.
- Specify the class name you want to build the graph for.
- Run draw_class_inference_graph.py.
Creating image infernce graphs (draw_image_inference_graph.py):
- Specify the directory you gave in 1. above.
- Specify the CNN layers name to visualize in the graph and the clusters visualiztion technique for each layer.
- Specify whther you want to analyze a well-classified images or wrongly-classified images.
- Specify the number of images/graphs you want to build.
- Run draw_image_inference_graph.py.