Practical overview
When it fits
Use Ttach when an existing PyTorch image-inference pipeline should evaluate transformed versions of inputs and combine the corresponding predictions.
Who it is for
- PyTorch developers adding augmented views to image-model inference
- Computer-vision practitioners working with classification, segmentation, or keypoint models
- Developers implementing custom multi-input or multi-output augmentation processing
Documented uses
- Wrap a classification model with crop-based test-time augmentation.
- Apply transforms to segmentation inputs and merge deaugmented predictions.
- Use flip-based augmentation with keypoint models that return coordinates in the specified tensor format.
- Compose transforms such as flips, rotations, scaling, and intensity changes.
- Build custom processing that augments inputs, deaugments selected outputs, and reduces results.
Requirements & limits
The repository identifies the project as open source under the MIT license. The README documents installation through PyPI or directly from GitHub.
- The library requires an existing PyTorch model and inference workflow.
- The number and type of transforms determine how many augmented inputs are processed; the README's custom example combines four transform groups into 36 augmentations.
- Merge options include mean, geometric mean, sum, max, min, and temperature sharpening.
- Keypoint models must return coordinates in the documented
torch([x1, y1, ..., xn, yn])format.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Wrap a segmentation model with D4 test-time transforms
Configure a segmentation model wrapper using D4 transforms and mean prediction merging.
Before you start
- Python environment with PyTorch and Ttach installed
- An existing segmentation model
Steps
Install Ttach from PyPI with the command below.
pip install ttachImport the library as
tta.Create a
SegmentationTTAWrapperaround the model usingtta.aliases.d4_transform()andmerge_mode='mean'.
Expected outcome
A segmentation model wrapped to apply D4 transformations and merge predictions by mean.
Guide limitations
- The documented example configures the wrapper but does not describe a complete input or inference invocation.
- The example assumes an existing model.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- qubvel/ttach · Official homepage title · retained in its source language

