Skip to content

Open-source framework for uncertainty and deep learning models in PyTorch 🌱

License

Notifications You must be signed in to change notification settings

ENSTA-U2IS-AI/torch-uncertainty

Repository files navigation

TorchUncertaintyLogo

pypi tests Docs PRWelcome Ruff Code Coverage Downloads Discord Badge

TorchUncertainty is a package designed to help you leverage uncertainty quantification techniques and make your deep neural networks more reliable. It aims at being collaborative and including as many methods as possible, so reach out to add yours!

🚧 TorchUncertainty is in early development 🚧 - expect changes, but reach out and contribute if you are interested in the project! Please raise an issue if you have any bugs or difficulties and join the discord server.

📚 Our webpage and documentation is available here: torch-uncertainty.github.io. 📚

TorchUncertainty contains the official implementations of multiple papers from major machine-learning and computer vision conferences and was/will be featured in tutorials at WACV 2024 and ECCV 2024.


This package provides a multi-level API, including:

  • easy-to-use ⚡️ lightning uncertainty-aware training & evaluation routines for 4 tasks: classification, probabilistic and pointwise regression, and segmentation.
  • ready-to-train baselines on research datasets, such as ImageNet and CIFAR
  • pretrained weights for these baselines on ImageNet and CIFAR (work in progress 🚧).
  • layers, models, metrics, & losses available for use in your networks
  • scikit-learn style post-processing methods such as Temperature Scaling.

Have a look at the Reference page or the API reference for a more exhaustive list of the implemented methods, datasets, metrics, etc.

⚙️ Installation

TorchUncertainty requires Python 3.10 or greater. Install the desired PyTorch version in your environment. Then, install the package from PyPI:

pip install torch-uncertainty

The installation procedure for contributors is different: have a look at the contribution page.

🐎 Quickstart

We make a quickstart available at torch-uncertainty.github.io/quickstart.

📚 Implemented methods

TorchUncertainty currently supports classification, probabilistic and pointwise regression, segmentation and pixelwise regression (such as monocular depth estimation). It includes the official codes of the following papers:

  • A Symmetry-Aware Exploration of Bayesian Neural Network Posteriors - ICLR 2024
  • LP-BNN: Encoding the latent posterior of Bayesian Neural Networks for uncertainty quantification - IEEE TPAMI
  • Packed-Ensembles for Efficient Uncertainty Estimation - ICLR 2023 - Tutorial
  • MUAD: Multiple Uncertainties for Autonomous Driving, a benchmark for multiple uncertainty types and tasks - BMVC 2022

We also provide the following methods:

Baselines

To date, the following deep learning baselines have been implemented:

  • Deep Ensembles
  • MC-Dropout - Tutorial
  • BatchEnsemble
  • Masksembles
  • MIMO
  • Packed-Ensembles (see Blog post) - Tutorial
  • Bayesian Neural Networks 🚧 Work in progress 🚧 - Tutorial
  • Regression with Beta Gaussian NLL Loss
  • Deep Evidential Classification & Regression - Tutorial

Augmentation methods

The following data augmentation methods have been implemented:

  • Mixup, MixupIO, RegMixup, WarpingMixup

Post-processing methods

To date, the following post-processing methods have been implemented:

  • Temperature, Vector, & Matrix scaling - Tutorial
  • Monte Carlo Batch Normalization - Tutorial

Tutorials

Our documentation contains the following tutorials: