skills/cv/test-time-augmentation/SKILL.md
Applies geometric and color augmentations at inference time and averages predictions to reduce variance.
npx skillsauth add wenmin-wu/ds-skills cv-test-time-augmentationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate multiple augmented copies of each input image at inference (flips, 90-degree rotations, brightness/contrast jitter), run the model on all copies, then average the predictions. Reduces prediction variance and improves robustness without retraining.
import numpy as np
def tta_predict(model, image, n_augments=8):
preds = []
for _ in range(n_augments):
aug = apply_random_augment(image) # flip, rotate, color jitter
preds.append(model.predict(aug[np.newaxis]))
return np.mean(preds, axis=0)
def apply_random_augment(img):
if np.random.rand() > 0.5:
img = np.fliplr(img)
if np.random.rand() > 0.5:
img = np.flipud(img)
k = np.random.randint(0, 4)
img = np.rot90(img, k)
return img
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF