This is the repository for the WinsorCAM project, which is a tool for interprepting the results of a CNN model. The tool is designed to help users understand the model's predictions by providing visualizations of where a model is localizing feature that are indicative of a certain class. This repository contains Python code that implements the WinsorCAM algorithm for models like ResNet50, DenseNet121, VGG16, InceptionV3, and other models. The code is made in Pytorch. This is a very preliminary version and may be modified in the future and is not majorly optimized.
To acquire the project, you can clone the repository using Git:
git clone [email protected]:caseywall/Winsor-CAM.git
cd Winsor-CAMFor ease of use, we recommend using Conda to manage the Python environment for this project. Download and install Conda from the official website if you haven't already.
To recreate the Conda environment used for this project, run:
conda env create -f environment.ymlThe notebooks are currently location at the root of this repository. To run the notebooks, you can use your preferred Jupyter Notebook environment (if it is unclear how to do this, please refer to the Jupyter documentation). After setting up your environment (this found in the usage section above), you can select the created environment in Jupyter Notebook then begin running the notebooks.
There are currently two notebooks:
pascalvoc_example.ipynb: This notebook demonstrates how to use the WinsorCAM algorithm on the Pascal VOC dataset. It includes code for loading the dataset and visualization. This models for this dataset can be shared on request if desired. The model used in this found in ./model_files and will automatically be loaded.imagenet_example.ipynb: This notebook demonstrates how to use the WinsorCAM algorithm on the ImageNet dataset. It includes code for loading the dataset, and generating visualizations of the model's predictions. This notebook can be run in full without any needed models, but models will be downloaded from PyTorch. Also the data for this might be large so be aware of that.
Output from the example notebooks can be found in the outputs folder. This includes visualizations generated by the WinsorCAM algorithm for both the Pascal VOC and ImageNet datasets.