kkirchheim/pytorch-ood
👽 Out-of-Distribution Detection with PyTorch
What it solves
Deep learning models often fail silently when presented with data that is significantly different from their training set (Out-of-Distribution or OOD data). This library provides a standardized toolkit to detect when a model is encountering such "unknown" inputs, helping to prevent unreliable predictions in production environments.
How it works
The library implements a wide range of academic OOD detection algorithms that analyze a model's internal states—such as softmax probabilities, energy scores, or feature activations—to determine if an input is likely an outlier. It provides a consistent interface for these detectors, allowing users to swap between different methods, evaluate them against standard benchmarks, and integrate them into existing PyTorch workflows.
Who it’s for
This project is designed for machine learning researchers and engineers who need to evaluate model robustness, implement uncertainty estimation, or build systems that can safely reject inputs that fall outside the model's training distribution.
Highlights
- Extensive collection of state-of-the-art OOD detection algorithms (e.g., Energy-Based, ODIN, Mahalanobis, ReAct, ViM).
- Built-in support for common OOD benchmarks like OpenOOD.
- Compatible with popular frameworks like PyTorch Lightning and segmentation-models-pytorch.
- Includes pre-trained model weights and utilities for data augmentation and custom loss functions.
- Standardized API for evaluating and comparing different detection strategies.
Related
- Project
facebookresearch/pytorchvideoPyTorchVideo is a PyTorch‑based library that supplies video‑focused data loaders, transforms, and a zoo of pretrained models (e.g., SlowFast, X3D, MViT) for research and development of video understanding AI. It streamlines training and fast inference, supports mobile deployment, and is open‑source under Apache 2.0.
- Project
yzhao062/pyodPyOD is a comprehensive Python library for anomaly/outlier detection across tabular, time‑series, graph, text, image, and audio data. Version 3 adds an agent‑ready orchestration core (ADEngine) and a natural‑language skill so LLM agents can run detection workflows automatically. The classic `fit`/`predict` API remains, and the package ships with 61 detectors, benchmark‑backed model routing, and optional MCP/Claude‑Code integration.
- Project
marcellodebernardi/loss-landscapes`loss‑landscapes` is a PyTorch library that samples scalar metrics (loss, gradient norm, curvature, expected return, etc.) on low‑dimensional slices of a model’s parameter space, enabling easy creation of loss‑landscape visualisations. It provides a flexible `Metric` abstraction, sub‑space generators (lines, planes, etc.), and a `ModelWrapper` to work with both standard models and RL agents. The original 2019 release is broken; a rewrite is underway, so the API may change.
- Project
pytorch/benchmarkPyTorch Benchmarks is a collection of standardized, lightweight versions of popular deep‑learning models (BERT, ResNet, Stable Diffusion, etc.) that can be run to measure the performance of different PyTorch builds, CUDA versions, and back‑ends. It offers a uniform API, install scripts, and multiple runners (simple test, pytest‑benchmark, custom userbenchmark) plus utilities for low‑noise tuning on AWS g4dn.metal instances.
- Project
meta-pytorch/captumCaptum is a PyTorch library that provides a suite of model‑interpretability algorithms (Integrated Gradients, DeepLift, Gradient Shap, SmoothGrad, TCAV, TracIn, neuron/layer conductance, etc.) to help developers and researchers understand which inputs, neurons, or training examples drive a model’s predictions. It installs via pip/conda and works with any PyTorch model.