Repository navigation
Probability calibration audit
Project: valeford-de/spacement-pvextent
Model Architecture: DeepLabV3+ ResNet-50 ASPP Photometric Invariance V5
Checkpoint: runs/deeplabv3plus-resnet50-v5-photometric-001/best.pt
Checkpoint SHA-256: 9380f5b7ebf5af23aeb445832402714865e387db5ce496d070575aada6e351a6
Dataset Split: Strictly isolated in-domain validation split (data/pvextent-training-v4, split="val", 278 crops, 28,467,200 valid pixels)
Hardware Accelerator: Apple M2 Silicon MPS
Standard deep learning segmentation models trained with loss functions like Focal Loss and Lovász Hinge surrogate frequently suffer from probability miscalibration. While they excel at ranking and separating hard boundaries, their unscaled sigmoid probabilities do not represent true Bayesian posterior probabilities
In defense- and intelligence-grade geospatial analysis ("Palantir-Niveau"), calibrated probabilities are strictly mandatory:
- When a model predicts
$p = 0.90$ , exactly 90 out of 100 pixels must empirically contain photovoltaic modules. - Downstream physical solvers (shadow simulation, CAD vectorization, financial yield projection, grid feeder sizing) rely on calibrated confidence thresholds to prevent false capital expenditure allocations.
This audit establishes:
- Validation calibration across 28,467,200 supervised validation pixels (6,099,607 PV-positive pixels).
- Optimal scalar Temperature Scaling ($T^ = 0.4068$)* and Platt Scaling ($a^ = 2.3983, b^ = -0.1618$)** parameters fitted via L-BFGS.
- Expected Calibration Error (ECE) dropped from 8.75% down to 0.47% (-94.59% error reduction).
- Negative Log-Likelihood (NLL / Log Loss) dropped from 0.13374 down to 0.05858 (-56.19% reduction).
-
Bayes-Optimal Decision Thresholds
$\tau^*_{\text{IoU}} = 0.505$ (Max IoU = 91.22%, Dice = 95.41%), eliminating ad-hoc threshold guessing.
Let predicted probability
For each bin
-
Confidence:
$\text{conf}(B_m) = \frac{1}{|B_m|} \sum_{i \in B_m} p_i$ -
Accuracy (Empirical Precision):
$\text{acc}(B_m) = \frac{1}{|B_m|} \sum_{i \in B_m} y_i$
The Expected Calibration Error (ECE) is the bin-count-weighted difference between empirical accuracy and predicted confidence:
The Maximum Calibration Error (MCE) captures worst-case bin deviation:
Given raw unnormalized network logits
The parameter $T^$ is learned by minimizing the Negative Log-Likelihood (Binary Cross-Entropy) over all valid pixels: $$T^ = \arg\min_{T > 0} \left[ - \frac{1}{N} \sum_{i=1}^N \left( y_i \log \sigma\left(\frac{z_i}{T}\right) + (1 - y_i) \log \left(1 - \sigma\left(\frac{z_i}{T}\right)\right) \right) \right]$$
Crucially, because temperature scaling is a strictly monotonic transformation of
Unlike Cross-Entropy models which are notoriously overconfident (
| Calibration Method | Temperature |
ECE | MCE | Negative Log-Likelihood (NLL) | Brier Score | ECE Reduction |
|---|---|---|---|---|---|---|
| Raw Uncalibrated | 8.75% | 15.83% | 0.13374 | 0.02494 | Baseline | |
| Temperature Scaled | $T^ = 0.4068$* | 0.47% | 9.44% | 0.05858 | 0.01537 | -94.59% |
| Affine Platt Scaled | 0.39% | 7.26% | 0.05841 | 0.01532 | -95.53% |
Both Temperature Scaling and Platt Scaling achieve near-identical reductions, dropping ECE below 0.5%. Temperature scaling is selected as the production standard because it preserves the zero-crossing decision boundary (
Evaluating decision thresholds
| Threshold |
Validation IoU | Validation F1 / Dice | Precision | Recall | Note |
|---|---|---|---|---|---|
| 0.250 | 0.8924 | 0.9431 | 0.9080 | 0.9811 | High Recall Sensitivity Mode |
| 0.350 | 0.9048 | 0.9500 | 0.9304 | 0.9705 | Balanced Conservative |
| 0.455 | 0.9118 | 0.9539 | 0.9483 | 0.9596 | Near-optimal trade-off |
| 0.485 | 0.9122 | 0.9541 | 0.9530 | 0.9551 | Balanced Precision / Recall Point |
| 0.505 | 0.9122 | 0.9541 | 0.9557 | 0.9525 | Bayes-Optimal Global Max IoU |
| 0.604 | 0.9116 | 0.9538 | 0.9620 | 0.9457 | High Precision Mode |
| 0.703 | 0.9086 | 0.9521 | 0.9682 | 0.9365 | Clutter Rejection Mode |
Because the model is calibrated, the optimal decision threshold naturally converges to $\tau^ = 0.505$* (essentially
To run calibration across the validation split and output full JSON diagnostics:
pvextent evaluate calibrate data/pvextent-training-v4 runs/deeplabv3plus-resnet50-v5-photometric-001/best.pt runs/calibration/ --device mpsTo apply temperature scaling and optimal thresholding automatically during CAD vectorization:
pvextent vectorize input.png output_dir/ \
--checkpoint runs/deeplabv3plus-resnet50-v5-photometric-001/best.pt \
--calibrate \
--tta d4 \
--gsd 0.10This automatically applies
Developed and maintained by Valeford under the Spacement brand. Original project code: Apache-2.0. See the repository NOTICE for attribution.
Spacement PVExtent
- Home
- PVExtent Vidda vs. Tinden (v1.0 Releases)
- Getting started
- Dataset format
- Annotation guide
- PV4GER-SEG import
- Import audit
- Geographic splits
- Split audit
- Label review
- NRW candidates
- Bulk NRW training imagery
- Bulk mask curation
- Live training monitor
- Training quality exclusions
- Final bulk mask audit
- Experimental negative curation
- Negative curation audit
- Exploratory negative holdout
- Negative holdout audit
- Exploratory positive holdout
- Positive holdout audit
- Training smoke test
- Smoke audit
- Pretrained baseline training
- Baseline comparison
- Baseline comparison audit
- Six-epoch continuation audit
- V4 bulk training audit
- Domain-balanced training audit
- DeepLabV3+ ASPP architecture audit
- DeepLabV3+ Focal + Lovász loss audit
- DeepLabV3+ V5 Photometric Invariance audit
- CAD vectorization & rectilinear audit
- Test-Time Augmentation (TTA) audit
- Probability calibration & temperature scaling audit
- Seamless overlapping tiled inference & Hann blending audit
- Heterogeneous ensemble & quality triage audit
- Sealed 421 test benchmark audit
- 3D elevation & solar yield audit
- Multi-temporal 4D change detection audit
- Multispectral NIR & spectral signature audit
- Encoder weights and licenses
- Baseline audit
- Frozen validation errors
- Validation error audit
- Candidate predictions
- Research roadmap
Project