For the paper "Group Visualization of Class-Discriminative Features"
A tensorflow
based implementation of the method of Group Visualization of Class-Discriminative Features.
You would better to install necessary libraries listed in the "requirement.txt" file at first.
-
Install all necessary library and clone/download this repository.
-
Run GroupClassDiscVis.py and the results of the 1st and 3rd experiments in the manuscript could be generated.
-
With the attribution computing method, you can test other layers, classes, and images. The grouping methods could be changed with the clustering methods provided by the library
sklearn
. We also provide two simple classes in the file ./utils/utils.py, it should be easy to extended for trying other grouping features methods like clustering and matrix decomposing. -
Some description for code in main dir.
- data is for placing testing images, for GoogleNet, input size is 224. The two
matlab
files are used for mosaic figures in the paper. - dog_cat224 is the dir named by the image name for saving generated visual results and computed attribution results (those .txt files).
- utils is for main codes to compute attribution, group features, loss function, and some activation maps handling operators.
- data is for placing testing images, for GoogleNet, input size is 224. The two
-
Run GroupKernelVisShapResNet.py to generate visualization results in ResNet-50.
-
The codes for generating adversarial samples will be uploaded later. We also plan to rearrange the structure of the codes for easier reading further.
-
When you try different networks that are provided in
TensorFlow-Slim
, the transform methods and some random image preconditioning settings should be changed accordingly for good visualization. We suggest to read more about activation maximization methods from the codes oflucid
. They have integrated many useful loss functions, regularizations, and preconditioning methods from a lot of literatures about activation maximization.
- It will be fun to visualize what features are extracted from different objects in the image.
- If you have any question, please contact with us by email or comment in Issues.
@article{shi2020group,
title={Group visualization of class-discriminative features},
author={Shi, Rui and Li, Tianxing and Yamaguchi, Yasushi},
journal={Neural Networks},
volume={129},
pages={75-90},
year={2020},
publisher={Elsevier}
}