Test time augmentation
# inspecting a sample tta configuration
import mml.configs
from pathlib import Path
from omegaconf import OmegaConf
path = Path(mml.configs.__file__).parent / "tta" / "rotate.yaml"
cfg = OmegaConf.load(path)
print(OmegaConf.to_yaml(cfg))
mode: mean
variations:
identity:
- name: RandomHorizontalFlip
p: 0.0
rot90:
- name: RandomRotation
degrees:
- 90
- 90
p: 1.0
rot270:
- name: RandomRotation
degrees:
- 270
- 270
p: 1.0
hflip:
- name: RandomHorizontalFlip
p: 1.0
mode determines the merging strategy, currently only mean is supported but other strategies might be implemented later (majority vote, etc.). variations lists all kornia augmentations that shall be performed - ideally they are deterministic. mml will apply each transform to each image and merge the predictions of the model according to the mode. Note that tta is only active during testing and predicting with models - not during training nor validation.