unet-solar-pv: solar PV panel segmentation
A U-Net that finds solar photovoltaic panels in RGB aerial and drone imagery. It labels every pixel of a 256 x 256 chip as panel or background, and the panel pixels are then traced into polygons. Built for fAIr, the AI-assisted mapping platform of the Humanitarian OpenStreetMap Team.
- Architecture: U-Net (
segmentation_models_pytorch0.5.0) with a ResNet-34 encoder initialised from ImageNet, 24.4 M parameters - File:
solar_pv_unet.onnx(ONNX opset 18, 98 MB) - Imagery: true-colour RGB at zoom 19-20, about 0.15 to 0.3 m per pixel; zoom 20 works best
- Author: Oluwasola Oyinloye (GitHub)
Inputs and outputs
| Name | Shape | Notes | |
|---|---|---|---|
| Input | image | [batch, 3, 256, 256] float32 | RGB values divided by 255 |
| Output | logits | [batch, 1, 256, 256] float32 | One panel logit per pixel |
ImageNet normalisation is built into the graph, so the input is plain RGB / 255. The panel probability is the sigmoid of the logit; 0.5 is the default threshold.
Quick start
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from PIL import Image
path = hf_hub_download("dexsholex/unet-solar-pv", "solar_pv_unet.onnx")
session = ort.InferenceSession(path)
chip = Image.open("tile.png").convert("RGB").resize((256, 256)) # a zoom 19-20 aerial tile
x = (np.asarray(chip, dtype=np.float32) / 255.0).transpose(2, 0, 1)[None]
logits = session.run(None, {"image": x})[0]
panel_mask = 1.0 / (1.0 + np.exp(-logits[0, 0])) >= 0.5
Training data
Jiang et al. (2021), a multi-resolution PV panel dataset from Jiangsu, China (Zenodo, CC-BY-4.0):
- PV01: 645 rooftop chips from UAV orthophotos at 0.1 m.
- PV03: 2,308 chips from aerial photography at 0.3 m, 236 of them rooftop.
Chips were mosaicked or cropped to 0.15-0.32 m per pixel, the range of OpenAerialMap tiles at zoom 19 and 20, and augmented with rotation, flips and changes in brightness, colour, haze, blur and JPEG quality. Train and validation sets are split by spatial blocks. Loss: binary cross-entropy plus Dice; 40 epochs on one T4 GPU, best epoch chosen by mean rooftop IoU.
Evaluation
Held-out spatial blocks of the training region, threshold 0.5:
| Source | Zoom 19 IoU | Zoom 19 F1 | Zoom 20 IoU | Zoom 20 F1 |
|---|---|---|---|---|
| PV01 rooftop | 0.797 | 0.887 | 0.870 | 0.930 |
| PV03 rooftop | 0.841 | 0.913 | 0.747 | 0.855 |
| PV03 ground | 0.912 | 0.954 |
Zero-shot test in Kaduna, Nigeria: 18 rooftop arrays (287 m2 of panels) outlined on 2025 OpenAerialMap imagery and checked at zoom 21, threshold 0.5:
| Zoom | IoU | Precision | Recall | Arrays found | False alarms |
|---|---|---|---|---|---|
| 19 | 0.179 | 0.599 | 0.204 | 7 of 18 | 5 |
| 20 | 0.307 | 0.787 | 0.335 | 10 of 18 | 0 |
An array counts as found when the model marks any of its pixels; a false alarm is a predicted shape of at least 1.5 m2 that touches no panel outline. The model has not seen African imagery yet: in Kaduna it outlines about a third of the panel area, and at zoom 19 it mistakes some grey-blue painted metal roofs for panels.

Top two rows: held-out validation chips from Jiangsu. Bottom two rows: Kaduna at zoom 20. On the first roof the model outlines most of the array; on the second it misses the top array and only partly outlines the bottom one. Label yellow, prediction blue, threshold 0.5. Imagery: Jiang et al. (2021), CC-BY-4.0, and OpenAerialMap (shamaki, 2025-05-29), CC-BY 4.0.
Limitations
- Trained only on imagery from eastern China; accuracy drops in African cities, most of all for small rooftop arrays.
- Corrugated or painted metal roofs and tents can be mistaken for panels.
- Needs true-colour RGB: thermal or false-colour imagery gives meaningless results.
- Fixed 256 x 256 input.
Licence
Weights and code: Apache-2.0. Training data: CC-BY-4.0, Jiang et al. (2021).
Citation
@misc{oyinloye2026unetsolarpv,
author = {Oyinloye, Oluwasola},
title = {unet-solar-pv: solar PV panel segmentation for fAIr},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/dexsholex/unet-solar-pv}
}
@article{jiang2021pvdataset,
author = {Jiang, H. and Yao, L. and Lu, N. and Qin, J. and Liu, T. and Liu, Y. and Zhou, C.},
title = {Multi-resolution dataset for photovoltaic panel segmentation from satellite and aerial imagery},
journal = {Earth System Science Data},
volume = {13},
number = {11},
pages = {5389--5401},
year = {2021},
doi = {10.5194/essd-13-5389-2021}
}