Invariance, Same-Equivariance and other measures for Neural Networks. Support for PyTorch (now) and TensorFlow (coming).
Project description
✴ Transformational Measures 📏
The Transformational Measures (tmeasures
) library allows neural network designers to evaluate the invariance, equivariance and other properties of their models with respect to a set of transformations. Support for Pytorch (current) and Tensorflow/Keras (coming).
🔎 Visualizations
tmeasures
allows computing invariance, same-equivariance and other transformational measures, and contains helpful functions to visualize these. The following are some examples of the results you can obtain with the library:
🔥 Invariance heatmap
Each column shows the invariance to rotation of a layer of a Neural Network. Each row/block inside each column indicates the invariance of a feature map or single neuron, depending on the layer.
📉 Average Invariance vs layer, same model
Plot the transformational and sample invariance to rotations of a simple neural network trained on MNIST, with and without data augmentation. The X axis indicates the layer, while the Y axis shows the average invariance of the layer.
📈 Average invariance by layer, different models:
Plot of the invariance to rotations of several well-known models trained on CIFAR10. The number of layers of each model is streched on a percentage scale, so that different models can be compared.
💻 PyTorch API
These notebooks contain step-by-step code and explanations to measure invariance in both custom and pretrained model, both using predefined and custom transformations. They can be executed in google colab directly. Alternatively, you can download them for local execution, but be aware you will have to provide your own virtualenv with torch
and torchvision
installed.
- Measuring invariance to brightness changes on a pretrained ResNet18 on TinyImageNet
- Measuring invariance to rotations on a custom CNN on MNIST
Other examples with multiple measures and pretrained models can be found in the doc folder of this repository.
💻 TensorFlow API
We are still developing the Tensorflow API.
📋 Examples
You can find many uses of this library in the repository with the code for the article Measuring (in)variances in Convolutional Networks, where this library was first presented. Also, in the code for the experiments of the PhD Thesis "Invariance and Same-Equivariance Measures for Convolutional Neural Networks" (spanish).
🤙🏽 Citing
If you use this library in your research, we kindly ask you to cite Invariance and Same-Equivariance Measures for Convolutional Neural Networks.
@article{quiroga20,
author = {Facundo Quiroga and
Laura Lanzarini},
title = {Invariance and Same-Equivariance Measures for Convolutional Neural Networks},
journal = {J. Comput. Sci. Technol.},
volume = {20},
number = {1},
pages = {06},
year = {2020},
url = {https://doi.org/10.24215/16666038.20.e06},
doi = {10.24215/16666038.20.e06},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tmeasures-1.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4386bc1be25315316dfc7625adab358cad654ac365ce5480d0df0cbe643d2600 |
|
MD5 | 857bc7d18364e9a7e99680e3deee8373 |
|
BLAKE2b-256 | 3f4494d7e18e318f9a868b2c4d5d940cf2d715e92e6b5e10ceba3586a8ff31a6 |