ttach
Images test time augmentation with PyTorch.
What it is and what it does
TTAch is a PyTorch wrapper library that implements test-time augmentation (TTA)—a technique where multiple augmented versions of an input image are passed through a trained model, and the resulting predictions are merged (averaged, max-pooled, etc.) to produce a final output. Instead of showing a model one clean image, TTA shows it many transformed versions and combines their predictions, often improving accuracy and robustness at the cost of inference time.
The library provides pre-built wrappers for segmentation, classification, and keypoint detection models, along with a composable transform system (flips, rotations, scaling, crops, etc.) and multiple merge strategies (mean, geometric mean, max, min, temperature sharpening). You can wrap an existing model in one line and immediately use TTA, or build custom augmentation pipelines for specialized workflows.
Use it for:
- Improve segmentation model accuracy on medical images by averaging predictions across rotations and flips.
- Boost classification confidence on edge cases by merging predictions from multiple scaled and cropped versions of the input.
- Refine keypoint detection by applying TTA with geometric transformations and reversing them before merging.
- Ensemble inference without training multiple models—apply TTA to a single model for a quick accuracy boost.
- Benchmark model robustness by testing how predictions vary across different augmentations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps PyTorch models to apply test-time augmentation—running augmented versions of input images through a model and merging predictions to improve robustness.
No—the package is abandoned (last release 2020-07-09, last commit 2023-07-28) with no maintenance or compatibility updates. While it has low install friction and permissive licensing, the lack of active maintenance poses a significant risk for compatibility with current PyTorch and Python versions. For active TTA support, consider maintained alternatives or implementing TTA directly in your training framework.
Install
ttach on PyPI
pip
pip install ttachuv
uv add ttachpoetry
poetry add ttachInstalling ttach
Before you install
Low friction install with no runtime dependencies. However, the package is abandoned—last release was 2020-07-09 and last commit 2023-07-28—so expect no maintenance, bug fixes, or compatibility updates for newer PyTorch or Python versions.
License in practice
MIT license is permissive and places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install ttach
import ttach as tta
model = ... # your trained PyTorch model
tta_model = tta.SegmentationTTAWrapper(model, tta.aliases.d4_transform(), merge_mode='mean')
predictions = tta_model(images)
Requires PyTorch to be installed separately; the package itself has no runtime dependencies but will not function without a PyTorch model to wrap.
Verify before relying
- Compatibility with current PyTorch versions (package last updated 2020-07-09).
- Whether the package works with modern Python versions beyond 3.0 despite the broad classifier.
- Performance impact of test-time augmentation on inference latency for typical model sizes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.0.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,227 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 140,340/month — #11,274 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ttach-0.0.3-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
batchgeneratorsv2Reimplemented data augmentation transforms for…
permissive · top 15,000 on PyPI
imgaugAugments images and related data (heatmaps,…
permissive · top 5,000 on PyPI
torch-audiomentationsProvides PyTorch-native audio data augmentation…
permissive · top 5,000 on PyPI
batchgeneratorsbatchgenerators provides data augmentation…
permissive · top 15,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
augmaxAugmax is a JAX-based image data augmentation…
permissive · top 15,000 on PyPI
pytorch_revgradImplements a gradient reversal layer for…
permissive · top 15,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
nlpaugnlpaug generates synthetic augmented text and…
permissive · top 15,000 on PyPI
imgvizimgviz provides image visualization utilities…
permissive · top 15,000 on PyPI