Beta value in test time augmentation

Hi guys,
I’m trying to understand how TTA is calculated. I managed to implement a version of it for a specific problem and the results are essentially the same when using beta = 0.5. But what is this beta value?

I realized that beta = 0.5 is basically the same as taking the mean of the sum of raw and augmented predicitions, but I don’t know if this is applicable to other problems.

Here’s what I did so far:

  1. Each data point was replicated once, so I’m taking two rows of the predictions at a time and taking the mean of the activations.
# Gather aug predictions
aug_preds = [test_preds[i: i + 2].mean(0).unsqueeze(0) for i in range(0, test_preds.size(0), 2)]
  1. Stack the predictions

aug_preds = torch.cat(aug_preds)

  1. Calculate the mean of the sum between raw and augmented predictions

tta_preds = sum([aug_preds, test_preds_raw])/len([aug_preds, test_preds_raw])

Output:
tensor([[0.0025, 0.2091, 0.2511, …, 0.4357, 0.5650, 0.4612],
[0.2782, 0.9257, 0.0545, …, 0.8945, 0.5938, 0.6545],
[0.7445, 0.8402, 0.4103, …, 0.7193, 0.7759, 0.4584],
…,
[0.5572, 0.5441, 0.2103, …, 0.6965, 0.5492, 0.4015],
[0.4518, 0.3415, 0.4009, …, 0.5429, 0.6775, 0.3065],
[0.6138, 0.4065, 0.3223, …, 0.3311, 0.8964, 0.7895]])

The output is the same if I use fastai implementation instead:

fastai_tta = torch.lerp(aug_preds, test_preds_canonical, 0.5)

Output:
tensor([[0.0025, 0.2091, 0.2511, …, 0.4357, 0.5650, 0.4612],
[0.2782, 0.9257, 0.0545, …, 0.8945, 0.5938, 0.6545],
[0.7445, 0.8402, 0.4103, …, 0.7193, 0.7759, 0.4584],
…,
[0.5572, 0.5441, 0.2103, …, 0.6965, 0.5492, 0.4015],
[0.4518, 0.3415, 0.4009, …, 0.5429, 0.6775, 0.3065],
[0.6138, 0.4065, 0.3223, …, 0.3311, 0.8964, 0.7895]])