# TTA wrapper
Test time augmnentation wrapper for keras image segmentation and classification models.
## Description
### How it works?
Wrapper add augmentation layers to your Keras model like this:
```
Input
| # input image; shape 1, H, W, C
/ / / \ \ \ # duplicate image for augmentation; shape N, H, W, C
| | | | | | # apply augmentations (flips, rotation, shifts)
your Keras model
| | | | | | # reverse transformations
\ \ \ / / / # merge predictions (mean, max, gmean)
| # output mask; shape 1, H, W, C
Output
```
### Arguments
- `h_flip` - bool, horizontal flip augmentation
- `v_flip` - bool, vertical flip augmentation
- `rotataion` - list, allowable angles - 90, 180, 270
- `h_shift` - list of int, horizontal shift augmentation in pixels
- `v_shift` - list of int, vertical shift augmentation in pixels
- `add` - list of int/float, additive factor (aug_image = image + factor)
- `mul` - list of int/float, additive factor (aug_image = image * factor)
- `contrast` - list of int/float, contrast adjustment factor (aug_image = (image - mean) * factor + mean)
- `merge` - one of 'mean', 'gmean' and 'max' - mode of merging augmented predictions together
### Constraints
1) model has to have 1 `input` and 1 `output`
2) inference `batch_size == 1`
3) image `height == width` if `rotation_angles` augmentation is used
## Example
```python
from keras.models import load_model
from tta_wrapper import tta_segmentation
model = load_model('path/to/model.h5')
tta_model = tta_segmentation(model, h_flip=True, rotation_angles=(90, 270),
h_shifts=(-5, 5), merge='mean')
y = tta_model.predict(x)
```
Metadata
Release files for tta-wrapper 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tta_wrapper-0.0.1.tar.gz | 5.3 kB | Without provenance | Details for tta_wrapper-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tta_wrapper-0.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for tta_wrapper-0.0.1-py2.py3-none-any.whl |
Total release size: 12.3 kB
Release files / tta_wrapper-0.0.1.tar.gz
| Download URL | tta_wrapper-0.0.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80595505d9c4cb8f0e555d9c23a3b0641685b75504a36d9fd9811d1e1b56f2f9
|
|
BLAKE2b-256 checksum How to use checksums |
8e5b5fe0b3611e16c6a46b09ea3bcda9194215429dba47b19a8fc0c74c46a2fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.19.9 CPython/3.6.3
|
Release files / tta_wrapper-0.0.1-py2.py3-none-any.whl
| Download URL | tta_wrapper-0.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
57d68d000fbcd15983cda83b6cc1673515d494cb4970d2e9c7c0e325e5d364fc
|
|
BLAKE2b-256 checksum How to use checksums |
e46a11cced7cc269dda46749763cb10c90e06d455ba4cc8a56d4a62f8abb0c08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.19.9 CPython/3.6.3
|
Security for tta-wrapper 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.