{"id":22482,"library":"ttach","title":"ttach","description":"Image test time augmentation for PyTorch. Wraps models to apply TTA transforms (flips, rotations, scaling) and aggregate predictions. Current version 0.0.3, last release April 2021. No recent updates; library is in maintenance mode.","status":"maintenance","version":"0.0.3","language":"python","source_language":"en","source_url":"https://github.com/qubvel/ttach","tags":["test-time augmentation","TTA","PyTorch","image segmentation","classification"],"install":[{"cmd":"pip install ttach","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for PyTorch tensors and models.","package":"torch","optional":false}],"imports":[{"note":"Import top-level functions directly; don't rely on module attributes.","wrong":"import ttach","symbol":"Compose","correct":"from ttach import Compose"},{"note":"","wrong":null,"symbol":"SegmentationTTAWrapper","correct":"from ttach import SegmentationTTAWrapper"}],"quickstart":{"code":"import torch\nimport ttach as tta\n\nmodel = torch.nn.Linear(10, 2)  # dummy model\nmodel.eval()\n\ntransforms = tta.Compose([\n    tta.HorizontalFlip(),\n    tta.Rotate90(angles=[0, 90]),\n    tta.Scale(scales=[1.0, 1.5]),\n])\n\ntta_model = tta.SegmentationTTAWrapper(model, transforms, merge_mode='mean')\n\ninput_tensor = torch.randn(1, 10)\noutput = tta_model(input_tensor)\nprint(output.shape)","lang":"python","description":"Basic TTA example: wrap a model with horizontal flip, 90° rotation, and scaling. Merge predictions by mean."},"warnings":[{"fix":"Consider alternatives like kornia's kornia.augmentation.TTA or torchvision's test-time augmentation utilities.","message":"The library has not been updated since April 2021. It may not work with newer PyTorch versions without issues.","severity":"deprecated","affected_versions":">=0.0.3"},{"fix":"Upgrade to >=0.0.2 or manually define the D4 transform using Compose.","message":"The 'd4' transform alias was fixed in v0.0.2 to remove duplicated augmentations. If using older version, you might get unintended duplicates.","severity":"gotcha","affected_versions":"<0.0.2"},{"fix":"Upgrade to 0.0.3 or handle keypoints manually.","message":"Keypoints support was added in v0.0.3. If you rely on keypoints, ensure version >=0.0.3 or use a workaround.","severity":"breaking","affected_versions":"<0.0.3"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from ttach import Compose' or 'import ttach' then 'tta = ttach; tta.Compose' (but direct import is recommended).","cause":"Importing the module incorrectly (e.g., 'import ttach') and then using 'ttach.Compose' without importing Compose directly.","error":"AttributeError: module 'ttach' has no attribute 'Compose'"},{"fix":"Ensure input is a torch.Tensor of appropriate shape (e.g., (batch, channels, height, width) for images).","cause":"Running TTA on a model that expects different input shapes or on non-tensor data.","error":"module 'torch' has no attribute 'Tensor'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}