City-scale solar PV potential estimation on 3D buildings using multi-source RS data: A case study in Wuhan, China
This is the PyTorch implementation about building information extraction of the following publication:
City-scale solar PV potential estimation on 3D buildings using multi-source RS data: A case study in Wuhan, China
Zhe Chen, Bisheng Yang, Rui Zhu, Zhen Dong
Paper Applied Energy 2024
The part on building extraction using unsupervised domain adapation based on our another work:
Joint alignment of the distribution in input and feature space for cross-domain aerial image semantic segmentation
Zhe Chen, Bisheng Yang, Ailong Ma, Mingjun Peng, Haiting Li, Tao Chen, Chi Chen, Zhen Dong
Paper JAG 2022
City-scale solar PV potential estimation on 3D buildings using multi-source RS data:
A case study in Wuhan, China
Abstract: Assessing the solar photovoltaic (PV) potential on buildings is essential for environmental protection and sustainable development. However, currently, the high costs of data acquisition and labor required to obtain 3D building models limit the scalability of such estimations extending to a large scale. To overcome the limitations, this study proposes a method of using freely available multi-source Remote Sensing (RS) data to estimate the solar PV potential on buildings at the city scale without any labeling. Firstly, Unsupervised Domain Adaptation (UDA) is introduced to transfer the building extraction knowledge learned by Deep Semantic Segmentation Networks (DSSN) from public datasets to available satellite images in a label-free manner. In addition, the coarse-grained land cover product is utilized to provide prior knowledge for reducing negative transfer. Secondly, the building heights are derived from the global open Digital Surface Model (DSM) using morphological operations. The building information obtained from the above two aspects supports the subsequent estimation. In the case study of Wuhan, China, the solar PV potential on all buildings throughout the city is estimated without any data acquisition cost or human labeling cost through the proposed method. In 2021, the estimated solar irradiation received by buildings in Wuhan is 289737.58 GWh. Taking into account the current technical conditions, the corresponding solar PV potential is 43460.64 GWh, which can meet the electricity demands of residents.
- 2024-01-21: Accepted by Applied Energy! 🎉🎉🎉
- 2023-12-15: Code is aviliable! 🎉
The code has been tested on:
- Ubuntu 20.04
- CUDA 11.3
- Python 3.8.0
- Pytorch 1.12.1
- GeForce RTX 3070 * 2.
You can create an environment directy using the provided environment.yaml
cd UDA-Seg
conda env create -f environment.yaml
conda activate fgdal
Our method has been experimented in both the benchmark and practical applications.
- ISPRS 2D cross-domain semantic segmentation benchmark
Provided by Te Shi, the ISRPS image dataset for cross-domain semantic segmentation can be downloaded via Google Drive or BaiduDisk (Acess Code: vaam).- Pratical applications: SpaceNet-Shanghai to GES-Wuhan
The SpaceNet-Shanghai dataset and GES image dataset ( Wuchang District, Wuhan ) can be downloaded via Google Drive or BaiduDist (Acess Code: 9527)
Once the datasets are downloaded and decompressed, change the folder path of the dataset according to the actual path in file UDA-Seg/core/datasets/dataset_path_catalog.py
(line 33-36) for training and testing purposes.
We provide the training script for source domain training and domain adaptation training.
cd UDA-Seg
bash train_with_sd.sh
Specially, supervised training on labeled source domain data is needed to initialize the network parameters firstly.
# Set the num of GPUs, for example, 2 GPUs
export NGPUS=2
# train on source data
python -m torch.distributed.launch --nproc_per_node=$NGPUS train_src.py -cfg configs/rs_deeplabv2_r101_src.yaml OUTPUT_DIR results/src_r101_try/
Then, we conduct the unlabeled target domain data and labeled source domain data for adversarial training to carry out domain adaptation.
# train with FGDAL-MSF-DNT
python -m torch.distributed.launch --nproc_per_node=$NGPUS train_SEmsf_dnt_adv_BD+FD_FreezeBackbone.py -cfg configs/rs_deeplabv2_r101_adv.yaml OUTPUT_DIR results/adv_test resume results/src_r101_try/model_iter030000.pth
Note that our framework does not use self distill. However, you can slightly modify the code (network) in train_self_distill.py
to conduct self distill and further improve the performance.
# generate pseudo labels for self distillation
python test.py -cfg configs/rs_deeplabv2_r101_tgt_self_distill.yaml --saveres resume results/adv_test/model_iter080000.pth OUTPUT_DIR datasets/rs/soft_labels DATASETS.TEST rs_train
# train with self distillation
python -m torch.distributed.launch --nproc_per_node=$NGPUS train_self_distill.py -cfg configs/rs_r101_tgt_self_distill.yaml OUTPUT_DIR results/sd_test
# Test the performance of a specific ckpt
python test_SEmsf_dnt.py -cfg configs/configs/rs_deeplabv2_r101_adv.yaml --saveres resume results/adv_test/model_iter080000.pth OUTPUT_DIR datasets/rs/pred
# Test the performance of all ckpt in a folder
python test_SEmsf_dnt.py -cfg configs/configs/rs_deeplabv2_r101_adv.yaml --saveres resume results/adv_test OUTPUT_DIR datasets/rs/pred
Additionaly, for predicting a RS image with large range, we provide a predition code based on sliding window.
python predcit_dnt_SEmsf_large_image.py -cfg configs/configs/rs_deeplabv2_r101_adv.yaml --img_path test_img/Wuchang_GES_Image.tif
The code has been tested on:
- Ubuntu 20.04
- Python 3.8.0
Fewer packages are required for building height extraction:
conda create -n BHD python==3.8
conda activate BHD
pip install matplotlib tqdm gdal argparse opencv-python
The DSM with global coverage of 30m resolution is accessible in Japan Aerospace Exploration Agency Earth Observation Research Center.
To derive the building height from global DSM, you can use the following commands:
python BH_ExtractionFromAW3D30.py --input_path AW3D30_WH.tif --output_path BH_WH.tif
If you find this repo helpful, please give us a 😍 star 😍. Please consider citing our works if this program benefits your project.
@article{CHEN2024122720,
title = {City-Scale Solar {{PV}} Potential Estimation on {{3D}} Buildings Using Multi-Source {{RS}} Data: {{A}} Case Study in {{Wuhan}}, {{China}}},
author = {Chen, Zhe and Yang, Bisheng and Zhu, Rui and Dong, Zhen},
year = {2024},
journal = {Applied Energy},
volume = {359},
pages = {122720},
issn = {0306-2619},
doi = {10.1016/j.apenergy.2024.122720}
}
@article{chenJointAlignmentDistribution2022,
title = {Joint Alignment of the Distribution in Input and Feature Space for Cross-Domain Aerial Image Semantic Segmentation},
author = {Chen, Zhe and Yang, Bisheng and Ma, Ailong and Peng, Mingjun and Li, Haiting and Chen, Tao and Chen, Chi and Dong, Zhen},
year = {2022},
month = dec,
journal = {International Journal of Applied Earth Observation and Geoinformation},
volume = {115},
pages = {103107},
issn = {1569-8432},
doi = {10.1016/j.jag.2022.103107},
urldate = {2022-12-02},
langid = {english}
}
We sincerely thank the excellent project: