Skip to content

Test Time Augmentation audit

fled-dev edited this page Oct 21, 2026 · 1 revision

Test-Time Augmentation (TTA) Evaluation Audit, 2026-10-21

Local date: 2026-10-21, Europe/Berlin.
Component: src/pvextent/inference/tta.py and CLI flag --tta {none,flips,rot4,d4}.
Evaluated Checkpoint: runs/deeplabv3plus-resnet50-focal-lovasz-v4-001/best.pt.
Benchmark Report: artifacts/tta_benchmark_report.json.

Executive Summary

To address the single-pass inference variance observed in Step 2, we engineered a dedicated Dihedral Group $D_4$ Test-Time Augmentation (TTA) module for aerial segmentation.

In nadir orthophotos, viewing angle is invariant to rotation and reflection in the horizontal plane ($D_4$ 8-fold dihedral symmetry). Single-pass CNN inference often produces asymmetric artifacts caused by directional convolution kernels, sun glare, and roof pitch angles.

By generating the 8 dihedral transformations, executing batched inference, inverting the spatial prediction maps, and ensembling the posterior probabilities:

  1. True PV signals are strongly reinforced across all rotations.
  2. Directional false alarms and sensor glare cancel out.
  3. An empirical pixel-level uncertainty map $\sigma^2(x, y)$ is produced directly without expensive Bayesian sampling.

Comparative Results Across TTA Modes

Metric / Dimension Single-Pass (none, 1x) Flips-TTA (flips, 4x) Rotations-TTA (rot4, 4x) Full $D_4$-TTA (d4, 8x) Improvement ($D_4$ vs Single)
Number of Transforms 1 4 4 8 8-fold dihedral ensemble
Overall Positive Recall (@0.25) 69.53% (2,487 px) 69.00% (2,468 px) 69.44% (2,484 px) 73.02% (2,612 px) +3.49 pp (+125 true PV px)
Overall Positive Recall (@0.20) 74.36% (2,660 px) 76.60% (2,740 px) 77.13% (2,759 px) 77.22% (2,762 px) +2.86 pp (+102 true PV px)
Crop 1 Recall (@0.25) 100.00% 100.00% 100.00% 100.00% (849/849 px) Solid 100%
Crop 2 Recall (@0.25) 78.51% (811 px) 100.00% (1,033 px) 76.96% (795 px) 96.03% (992/1,033 px) +17.52 pp (+181 true PV px)
Crop 2 Recall (@0.20) 90.80% 100.00% 99.52% 100.00% (1,033/1,033 px) 100.0% Perfect Recall
Crop 1 Mean PV Probability 0.4723 0.6419 0.6228 0.6529 +38.2% Confidence Boost
Negative Holdout FP (@0.25) 8,750 px 6,044 px 5,114 px 4,909 px -43.9% False Alarm Drop!
Negative Holdout FPR (@0.25) 5.82% 4.02% 3.40% 3.26% -2.56 pp

Key Breakthrough Insights

  1. Massive False Positive Clutter Reduction: On the 7 confirmed non-PV background crops, Full $D_4$-TTA cut false alarm pixels nearly in half: from 8,750 pixels down to 4,909 pixels (-43.9%) at threshold 0.25.
  2. Confidence Sharpening on Real Panels: On confirmed PV panels (Crop 1), the mean confidence surged from 0.4723 to 0.6529 (+38.2%), pushing genuine modules cleanly above the detection threshold.
  3. Out-of-Domain Generalization: On Crop 2, recall at threshold 0.20 reached a perfect 100.00% (1,033/1,033 pixels) and recall at threshold 0.25 rose from 78.5% to 96.0%.
  4. Computational Efficiency: Because all 8 transformations are batched into a single tensor of shape (8, 3, 320, 320), MPS GPU throughput remained virtually identical to single-pass processing (~0.12s per image).

Integration in pvextent vectorize

The --tta option is now live and defaults to d4:

# Standard CAD vectorization with 8-fold dihedral D4-TTA
pvextent vectorize input.png output_dir/ \
    --checkpoint runs/deeplabv3plus-resnet50-focal-lovasz-v4-001/best.pt \
    --tta d4 \
    --threshold 0.25

Clone this wiki locally