Rooftop photovoltaic detection from high-resolution aerial imagery for South African cities. Mask R-CNN + SAM 2.1 refinement, V1.4 four-channel validation framework. Cape Town & Johannesburg covered.
# ZAsolar — Rooftop Solar Detection for South African Cities
简体中文
ZAsolar is a research codebase for detecting residential rooftop photovoltaic
installations from high-resolution aerial imagery, with the goal of building a
grid-aggregate panel data record of solar adoption across South Africa.
Cape Town and Johannesburg are currently covered.
The detection stack is **Mask R-CNN (ResNet-50 + FPN) + SAM 2.1 mask-prompt
refinement**. The V1.4 validation framework treats grid-aggregate installation
inventory as the primary success metric, with per-polygon F1 retained as a
diagnostic. Install-date back-dating is handled by a sibling repo,
`solar_backdating`.
## Headline results
Primary benchmark: **Johannesburg CBD, 25 grids, Vexcel 2024 aerial (~6.7 cm GSD)**,
detector = V3-C-HN, post-proc = SAM 2.1 mask+box refinement.
| Channel | Metric | Result | Sample |
|---|---|---|---|
| Ch1 — stratified precision | P (V3-C, hit-table) | 0.749 [0.71, 0.78] | 25 grids × stratified roof samples |
| Ch3 — inventory accuracy | area F1 | 0.821 | JHB CBD 25-grid Vexcel |
| Ch3 — inventory accuracy | aggregate \|A\|/\|B\| | 0.992 | JHB CBD 25-grid Vexcel |
See `docs/validation_strategy.md` for the full
four-channel framework, what each channel does and does not certify, and the
known confounders (e.g. SSEG building geocoding mismatch, vintage gaps).
## Repo layout
```
core/ shared modules (region_registry, postproc, models)
pipeline/ declarative dataset builder (V1.2 spec)
configs/ region / imagery / training / model registries
data/annotations/ Cape Town + Johannesburg ground truth (gitignored)
docs/ architecture.md, validation_strategy.md, workflows.md
scripts/
analysis/ benchmarks, audits, calibration sweeps
imagery/ tile download / preview / VRT
training/ COCO export, hard-negative export
annotations/ review GUI, SAM FN GUI, batch finalize
d …