skillfed

ttach

Images test time augmentation with PyTorch.

ttach v0.0.3 140.3K downloads/30d#11,274 on PyPI1,030
Permissive license MIT Abandoned released

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 ttach

uv

uv add ttach

poetry

poetry add ttach

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

test time augmentation pytorchtta image segmentationmodel prediction averagingaugmented inference pytorchensemble predictions imagestta classification wrapperimage augmentation at inference
test-time-augmentationmodel-inferencecomputer-vision

More Artificial Intelligence packages

Further reading