"We performed a filter-wise pruning sensitivity analysis on ResNet20-Cifar using the following command:\n",
"```\n",
"python3 compress_classifier.py -a resnet20_cifar ../../../data.cifar10/ -j 12 --resume=../cifar10/resnet20/checkpoint_trained_dense.pth.tar --sense=filter\n",
"python3 compress_classifier.py -a resnet20_cifar ../../../data.cifar10/ -j 12 --resume=../ssl/checkpoints/checkpoint_trained_dense.pth.tar --sense=filter\n",
"```\n"
]
},
...
...
%% Cell type:markdown id: tags:
# Sensitivity Analysis
Some pruning algorthims tune their hyperparameters based on the results of pruning sensitivity analysis. Distiller support L1-norm element-wise pruning sensitivity analysis, and filter-wise pruning sensitivity analysis based on the mean L1-norm ranking of filters.
## Table of Contents
1.[Load a pruning sensitivity analysis file](#Load-a-pruning-sensitivity-analysis-file)
You prepare a sensitivity analysis file by invoking ```distiller.perform_sensitivity_analysis()```. Checkout the documentation of ```distiller.perform_sensitivity_analysis()``` for more information.<br>
Alternatively, you can use the sample ```compress_classifier.py``` application to perform sensitivity analysis on one of the supported models. In the example below, we invoke sensitivity analysis on a pretrained Resnet18 from torchvision, using the ImageNet test dataset for evaluation.
```
$ python3 compress_classifier.py -a resnet18 ../../../data.imagenet -j 12 --pretrained --sense=element
```
The outputs of performing pruning sensitivity analysis on several different networks is available at ```../examples/sensitivity-analysis```
Just as we perform element-wise pruning sensitivity analysis, we can also analyze a model's filter-wise pruning sensitivity. Although the sparsity levels are reported in percentage steps, the actual pruning level might be somewhat lower, because when we prune filters the minimum granularity of pruning is ```1/numer_of_filters```.
We performed a filter-wise pruning sensitivity analysis on ResNet20-Cifar using the following command:
```
python3 compress_classifier.py -a resnet20_cifar ../../../data.cifar10/ -j 12 --resume=../cifar10/resnet20/checkpoint_trained_dense.pth.tar --sense=filter
python3 compress_classifier.py -a resnet20_cifar ../../../data.cifar10/ -j 12 --resume=../ssl/checkpoints/checkpoint_trained_dense.pth.tar --sense=filter