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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Model card: SolarMap.PH clf_v5 (cross-domain, region-stratified)
|
| 2 |
+
|
| 3 |
+
| Field | Value |
|
| 4 |
+
|---|---|
|
| 5 |
+
| Model name | `clf_v5` (+ `clf_v5_calibrated` per-domain bundle) |
|
| 6 |
+
| Released | 2026-05-15 (v1.2.0) |
|
| 7 |
+
| Supersedes | `clf_v4_calibrated` (v1.0/v1.1, NCR-only calibration) |
|
| 8 |
+
| License | MIT |
|
| 9 |
+
| Reproducibility | Bit-exact, sha256 prefix `5cc0a093c5279fd9` |
|
| 10 |
+
| Encoder | `openai/clip-vit-large-patch14` (frozen, 768-dim image embeddings) |
|
| 11 |
+
| Classifier head | `sklearn.linear_model.LogisticRegression(C=1.0, class_weight="balanced", max_iter=2000, random_state=42)` |
|
| 12 |
+
| Training | Region-stratified (folds split by region, not NCR-pooled); step-3 per-region holdout + hard-negative pool excluded |
|
| 13 |
+
| Calibrator | Per-domain Platt sigmoid on a scan-realistic holdout; only where estimable (see Performance) |
|
| 14 |
+
| Decision threshold | 0.85 |
|
| 15 |
+
|
| 16 |
+
## What changed in v1.2 and why
|
| 17 |
+
|
| 18 |
+
v1.1 shipped seven cross-domain franchises by applying the NCR-trained
|
| 19 |
+
`clf_v4` with no retraining and no per-region calibration. The headline NCR
|
| 20 |
+
F1 (0.870) was measured on a curated OSM holdout. The v1.2 round began with a
|
| 21 |
+
domain-shift measurement (`docs/research/v12-domain-shift.md`) that found two
|
| 22 |
+
things:
|
| 23 |
+
|
| 24 |
+
1. **Geographic shift is within-envelope.** The pure geographic centroid
|
| 25 |
+
cosine (NCR scan vs each region scan) is 0.038–0.052 for all seven regions,
|
| 26 |
+
at or below the in-domain anchor floor of 0.0547 (NCR's own curated-train
|
| 27 |
+
vs natural-scan gap). No region is out-of-distribution enough to exclude or
|
| 28 |
+
to need a region-specific model. (The domain-classifier AUC saturates near
|
| 29 |
+
1.0 in 768-d with n=400 and is reported only as an ordinal diagnostic, not
|
| 30 |
+
an absolute OOD measure.)
|
| 31 |
+
2. **A calibration gap dominates.** A linear probe separates the curated
|
| 32 |
+
`dataset_v4` from the natural scan distribution at AUC≈0.88 *even within
|
| 33 |
+
NCR, same city*. So `clf_v4`'s published precision was measured on a
|
| 34 |
+
distribution ~0.88-separable from what the model actually sees in the
|
| 35 |
+
field. The cross-region precision implied on the live site was an
|
| 36 |
+
overestimate everywhere, not only in the new franchises.
|
| 37 |
+
|
| 38 |
+
`clf_v5` is the response: region-stratified retraining that adds the
|
| 39 |
+
cross-domain positives and the observed false-positive classes, plus
|
| 40 |
+
per-domain recalibration fit on the operating (scan) distribution rather than
|
| 41 |
+
the curated OSM set.
|
| 42 |
+
|
| 43 |
+
## Training data
|
| 44 |
+
|
| 45 |
+
- Inherited `dataset_v4`: 3,795 embedding rows (2,775 pos / 1,020 neg),
|
| 46 |
+
NCR OSM positives + ground-truth + random/hard negatives.
|
| 47 |
+
- **+210 region positives**: spot-check-confirmed cross-domain rooftops +
|
| 48 |
+
OSM `location=roof` solar tags in the seven region bboxes.
|
| 49 |
+
- **+4 region false-positive hard negatives**: the spot-check-confirmed
|
| 50 |
+
ground-mount + blue-roof FPs (the dominant cross-domain failure classes:
|
| 51 |
+
NCR Valenzuela, Cebu Naga, CDO ×2, Legazpi stadium).
|
| 52 |
+
- **+3 OSM ground-mount hard negatives** (`location=ground` / `power=plant`).
|
| 53 |
+
|
| 54 |
+
Total `dataset_v5`: 4,012 rows. Training excludes the step-3 per-region
|
| 55 |
+
holdout tiles and the shared hard-negative pool (56 rows) so the holdout
|
| 56 |
+
calibration is honest. `clf_v5` is fit on 3,956 rows.
|
| 57 |
+
|
| 58 |
+
## Performance
|
| 59 |
+
|
| 60 |
+
### Honest per-region calibration (scan-realistic holdout)
|
| 61 |
+
|
| 62 |
+
Per-domain Platt is fit on each region's held-out positives (OSM-roof +
|
| 63 |
+
spot-check) against a uniform random sample of that region's scan tiles
|
| 64 |
+
(the operating distribution is ~97–99% non-solar, so this is a high-purity
|
| 65 |
+
negative proxy; ~1–3% PU contamination biases precision *conservatively*).
|
| 66 |
+
A degeneracy guard rejects any non-discriminative fit.
|
| 67 |
+
|
| 68 |
+
| Region | Calibration | Platt | P@0.85 | R@0.85 | n_pos / n_neg |
|
| 69 |
+
|---|---|---|---|---|---|
|
| 70 |
+
| cebu | calibrated | A=1.24 B=−2.49 | 1.00 | 0.29 | 21 / 300 |
|
| 71 |
+
| iloilo | calibrated | A=1.50 B=−2.43 | 0.80 | 0.27 | 15 / 300 |
|
| 72 |
+
| calabarzon | calibrated | A=1.21 B=−2.09 | 0.67 | 0.13 | 16 / 300 |
|
| 73 |
+
| davao | uncalibrated (low n) | — | — | — | candidate inventory |
|
| 74 |
+
| cdo | uncalibrated (low n) | — | — | — | candidate inventory |
|
| 75 |
+
| bacolod | uncalibrated (low n) | — | — | — | candidate inventory |
|
| 76 |
+
| legazpi | uncalibrated (low n) | — | — | — | candidate inventory |
|
| 77 |
+
|
| 78 |
+
These precision figures are conservative lower bounds, not exact CIs: the
|
| 79 |
+
holdouts are small (15–21 positives) and the negative class carries bounded
|
| 80 |
+
PU noise. They are the first honest per-domain numbers the project has had;
|
| 81 |
+
they replace the implied transfer of NCR's 0.959 precision. Recall at the
|
| 82 |
+
calibrated 0.85 threshold is deliberately low — the calibrated high-confidence
|
| 83 |
+
tier favours precision, the correct bias for a civic tool (fewer false
|
| 84 |
+
attributions). The four low-n regions ship as **candidate inventory** with no
|
| 85 |
+
precision claim; an honest "uncalibrated" beats a fabricated CI.
|
| 86 |
+
|
| 87 |
+
### Leave-one-region-out (LORO)
|
| 88 |
+
|
| 89 |
+
`clf_v5_metrics.json` reports leave-one-region-out recall at the raw 0.85
|
| 90 |
+
threshold: 0.13–0.63 across regions. The low raw recall is the calibration
|
| 91 |
+
gap made visible (NCR-trained raw scores under-score cross-region rooftops);
|
| 92 |
+
it is what per-domain recalibration corrects. LORO precision is not estimable
|
| 93 |
+
(the labeled negative pool per held region is <3) and is reported as such,
|
| 94 |
+
never as a fabricated 1.0.
|
| 95 |
+
|
| 96 |
+
### NCR reference (unchanged, clf_v4)
|
| 97 |
+
|
| 98 |
+
NCR's published detections remain `clf_v4`-scored; v1.2 does not re-scan NCR.
|
| 99 |
+
`clf_v4`'s honest 20%-holdout numbers (P=0.959, R=0.797, F1=0.870 at t=0.85)
|
| 100 |
+
stand for NCR, now with the documented caveat that this holdout is the
|
| 101 |
+
curated OSM split, not the field scan distribution.
|
| 102 |
+
|
| 103 |
+
## Intended use / out-of-scope
|
| 104 |
+
|
| 105 |
+
Unchanged from v1.1. Aggregate, city/regional analysis of rooftop solar
|
| 106 |
+
adoption from public imagery. **Not** for permit, tax, enforcement, or any
|
| 107 |
+
decision adversely affecting an individual building owner. **Not** a
|
| 108 |
+
structural/electrical survey. **Not** address-level for residential roofs
|
| 109 |
+
(suppressed). The seven cross-domain franchises ship as a candidate inventory;
|
| 110 |
+
only cebu/iloilo/calabarzon carry a (conservative) per-domain precision.
|
| 111 |
+
|
| 112 |
+
## kWp estimates (v1.2)
|
| 113 |
+
|
| 114 |
+
Per-detection capacity is estimated with SAM (vit_b) panel-mask area within
|
| 115 |
+
the detection tile, converted via a deliberately conservative
|
| 116 |
+
`KWP_PER_M2 = 0.15` (~6.7 m²/kWp crystalline-Si). It is attached as the
|
| 117 |
+
scalar `kwp_estimate` / `panel_area_m2` properties on the existing
|
| 118 |
+
point-tile feature — no building polygons, so the privacy boundary and
|
| 119 |
+
`scripts/check_region_no_pii.py` are unchanged. Each candidate mask is
|
| 120 |
+
verified by the same two-stage filter as the NCR per-building pipeline
|
| 121 |
+
(area + colour gate, then a CLIP + clf_v5 semantic check at combined ≥ 0.70)
|
| 122 |
+
before its area is counted, so whole dark roofs are not mistaken for panels.
|
| 123 |
+
Aggregate across the seven cross-domain regions: **~174 MWp** (Calabarzon
|
| 124 |
+
~92, Cebu ~49, Davao ~24, plus Iloilo/CDO/Bacolod ~3–4 each). Legazpi's lone
|
| 125 |
+
detection — a known blue-stadium-roof false positive — correctly estimates
|
| 126 |
+
**0 kWp** after verification, a sanity check on the method. kWp is a rough
|
| 127 |
+
planning estimate, not a metered figure; a civic tool should under- not
|
| 128 |
+
over-state.
|
| 129 |
+
|
| 130 |
+
## Known biases
|
| 131 |
+
|
| 132 |
+
All v1.1 biases carry over (commercial/warehouse skew, urban-NCR training
|
| 133 |
+
skew, imagery vintage, solar-water-heater confound, ~5–10% OSM label noise).
|
| 134 |
+
New in v1.2: per-region precision is calibrated for only three of seven
|
| 135 |
+
franchises and is a conservative lower bound there; the ground-mount FP class
|
| 136 |
+
is in training but not separately reported (a rooftop-vs-ground-mount head
|
| 137 |
+
remains the highest-value future addition).
|
| 138 |
+
|
| 139 |
+
## Ethics and privacy
|
| 140 |
+
|
| 141 |
+
Unchanged. Residential roofs suppressed. Region GeoJSONs are point-tile only.
|
| 142 |
+
Conservative civic language; analytics surfaces carry the standard
|
| 143 |
+
disclaimer. The project is not affiliated with any named utility.
|
| 144 |
+
|
| 145 |
+
## How to load
|
| 146 |
+
|
| 147 |
+
```python
|
| 148 |
+
import joblib, numpy as np
|
| 149 |
+
|
| 150 |
+
bundle = joblib.load("detection/train/v5_region_holdout/clf_v5_calibrated.joblib")
|
| 151 |
+
base = bundle["base_clf"]
|
| 152 |
+
platt = bundle["per_region_platt"] # {region: {"A":..., "B":...}}; may be empty
|
| 153 |
+
|
| 154 |
+
def calibrated_probability(features_768d, region):
|
| 155 |
+
raw = base.decision_function(features_768d)
|
| 156 |
+
if region in platt:
|
| 157 |
+
A, B = platt[region]["A"], platt[region]["B"]
|
| 158 |
+
return 1.0 / (1.0 + np.exp(-(A * raw + B)))
|
| 159 |
+
return base.predict_proba(features_768d)[:, 1] # uncalibrated; candidate only
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
## Reproducibility
|
| 163 |
+
|
| 164 |
+
```bash
|
| 165 |
+
pip install -r requirements.txt
|
| 166 |
+
make train # build_dataset_v5 -> train_v5 (deterministic)
|
| 167 |
+
make hash-verify # asserts sha256 5cc0a093c5279fd9
|
| 168 |
+
make calibrate # per-domain Platt on the scan-realistic holdout
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
Pinned deps (`scikit-learn==1.7.2`, `joblib==1.5.2`, `numpy==1.26.4`) make the
|
| 172 |
+
joblib bytes deterministic. Update `EXPECTED_HASH` in the `Makefile` when
|
| 173 |
+
intentionally upgrading dependencies.
|
| 174 |
+
|
| 175 |
+
## Citation
|
| 176 |
+
|
| 177 |
+
```bibtex
|
| 178 |
+
@software{puspus_solar_map_ph_2026,
|
| 179 |
+
author = {Puspus, Xavier},
|
| 180 |
+
title = {SolarMap.PH: open-source rooftop solar detection from satellite imagery},
|
| 181 |
+
year = 2026,
|
| 182 |
+
url = {https://github.com/xmpuspus/solar-map-ph},
|
| 183 |
+
}
|
| 184 |
+
```
|