Science Score: 33.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.2%) to scientific vocabulary
Repository
simultaneous extraction of building height and footprint
Basic Info
- Host: GitHub
- Owner: LllC-mmd
- Language: Python
- Default Branch: main
- Size: 460 MB
Statistics
- Stars: 60
- Watchers: 2
- Forks: 9
- Open Issues: 3
- Releases: 1
Metadata Files
README.md
SHAFTS
SHAFTS is a deep-learning-based Python package for Simultaneous extraction of building Height And FootprinT from Sentinel Imagery
Citation
More details can be found in the model description paper.
Please cite the paper if you use SHAFTS in your research.
bibtex
@Article{gmd-16-751-2023,
AUTHOR = {Li, R. and Sun, T. and Tian, F. and Ni, G.-H.},
TITLE = {SHAFTS (v2022.3): a deep-learning-based Python package for simultaneous extraction of building height and footprint from sentinel imagery},
JOURNAL = {Geoscientific Model Development},
VOLUME = {16},
YEAR = {2023},
NUMBER = {2},
PAGES = {751--778},
URL = {https://gmd.copernicus.org/articles/16/751/2023/},
DOI = {10.5194/gmd-16-751-2023}
}
Installation
System Requirements
SHAFTS is developed and tested on Linux and macOS.
It should also work on Windows, but we have not tested it yet; but you may consider using Windows Subsystem for Linux to run SHAFTS.
To use SHAFTS, you need to install the following packages, which can be installed via mamba with the provided env.yml file:
shell
mamba env create -f env.yml
Once the environment is created, activate it via:
shell
mamba activate shafts-dev
Install SHAFTS
You can install SHAFTS from PyPI or from source.
Please activate the environment created by mamba before installing SHAFTS.
Install from PyPI
shell
pip install shafts
Install from source
- Clone the repository:
shell
git clone https://github.com/LllC-mmd/SHAFTS.git
- Install the package:
Change your current directory to the root of the repository and run:
shell
make test
This will install the package in editable mode and run the tests.
Data Download
The input data of SHAFTS may include:
Sentinel-1: VH band, VV band.
Sentinel-2: RGB band, NIR band.
SRTM: DEM (optional).
SHAFTS contains some functions which can download above data directly from Google Earth Engine.
Note that according to the guidance for exporting data from Google Earth Engine, we can not export data to any local devices directly. Thus, Google Drive is recommended as a destination where data are export and then we can download exported data to our local devices.
An example for downloading Sentinel-2's image via sentinel2_download_by_extent is given as follows:
```python {cmd} from shafts.utils.GEEops import sentinel2downloadbyextent
---specify the spatial extent and year for Sentinel-2's images
lonmin = -87.740 latmin = 41.733 lonmax = -87.545 latmax = 41.996 year = 2018
---define the output settings
dst = "Drive" dstdir = "Sentinel-2export" filename = "Chicago2018sentinel2.tif"
---start data downloading
sentinel2downloadbyextent(lonmin=lonmin, latmin=latmin, lonmax=lonmax, latmax=latmax, year=year, dstdir=dstdir, filename=file_name, dst=dst) ```
Also, SHAFTS gives functions such as sentinel1_download, sentinel2_download and srtm_download to download images in a batch way by a .csv file.
Building Height and Footprint prediction
After preparing above necessary images, building height and footprint information can be predicted by:
pred_height_from_tiff_DL_patch: using deep-learning-based (DL) models trained by Single-Task-Learning (STL).pred_height_from_tiff_DL_patch_MTL: using deep-learning-based (DL) models trained by Multi-Task-Learning (MTL).
Since the total amount of relevant parameter settings are relatively more than data downloading, potential users can ref to the sample script for prediction named minimum_case_run.py under the example directory.
If batch processing is desired, users can ref to the sample script for prediction named case_run.py under the example directory.
Here, we offer pretrained DL models (based on PyTorch) for building height and footprint prediction via the link on Google Drive. All of pretrained DL models are stored as checkpoint.pth.tar.
Note that for each target resolution, we can use STL/MTL models with(out) SRTM data to make predictions:
For STL models, models with SRTM data are stored under
experiment_1and models without SRTM data are stored underexperiment_2.For MTL models, models with SRTM data are stored under
experiment_1and models without SRTM data are stored underexperiment_2. Since MTL models can give both building height and footprint predictions, we only offer full sets of MTL models under the directory of models for building height prediction namedheight.
Note that all of models offered in the above link requires SRTM images as one of input variables, though more pretrained DL models during package development are collected for performance comparison.
Integration with Google Cloud Ecosystem
If users want to generate building height and footprint maps without downloading Sentinel data to a local machine, SHAFTS offers the function named GBuildingMap which streamlines the workflow of satellite image preprocessing, TFRecord-based dataset management and DL model inference.
An example usage can be given as follows:
```python {cmd} from shafts.inference_gcloud import GBuildingMap
---specify the mapping extent by the minimum/maximum of longitude and latitude
lonmin = -0.50 latmin = 51.00 lonmax = 0.4 latmax = 51.90
---specify the year (ranging between 2018 and 2022)
year = 2020
---specify a local path to the pretrained SHAFTS's Tensorflow-based models
pretrainedweight = './dl-models/height/checkptsenet100mMTLTF_gpu'
---specify a local output folder for storing building height and footprint maps
output_folder = './results'
---specify the Google Cloud Service configuration
GCSconfig = {
'SERVICEACCOUNT': '***** Google Cloud Service Account Name **',
'GSACCOUNTJSON': '** Parh to Google Cloud Service Account Credential **',
'BUCKET': '** name of the bucket set for dataset exporting in Google Cloud Storage **',
'DATA_FOLDER': '** name of the folder which stores the exported dataset under the BUCKET *****',
}
---launch building height and footprint mapping
GBuildingMap( lonmin, latmin, lonmax, latmax, year, dx=0.09, dy=0.09, precision=3, batchsize=256, pretrainedmodel=pretrainedweight, GCSconfig=GCSconfig, targetresolution=100, numtaskqueue=30, numqueuemin=2, fileprefix='', padding=0.01, patchsizeratio=1, s2cloudprobthreshold=20, s2cloudprobmax=80, MTL=True, removed=True, outputfolder=outputfolder, ) ```
The execution of this function requires following pre-steps:
Install and initialize the
gcloudcommand-line interface. Users can ref to this link for details.Create a Google Cloud Project in the Google Cloud console for building height and footprint prediction.
Enable the Earth Engine API for the project.
Set up a bucket in the Google Cloud Storage (GCS) prepared for the storage of some intermediate exported datasets from Google Earth Engine. Please note that the names of the created bucket, its folder for storing intermediate datasets correspond to the
BUCKETandDATA_FOLDERin theGCS_configrequired by theGBuildingMapfunction. An example of the structure of the GCS's bucket can be given as follows:
bash
BUCKET/
|-- DATA_FOLDER/
| |-- tmp-exported-dataset.tfrecord.gz
| |-- ...
Create a Google Cloud Service's account for the project. If there is already an account, you can keep it without creating an additional one. Please note that the e-mail name of the service account corresponds to the
SERVICE_ACCOUNTin theGCS_configrequired by theGBuildingMapfunction.Create a private key in the format of JSON for the service account by clicking the menu for that account via : > key > JSON. Please download the JSON key file locally and the path to the JSON key for the service account corresponds to the
GS_ACCOUNT_JSONin theGCS_configrequired by theGBuildingMapfunction.
Here we should note that
The pretrained models should be based on Tensorflow's implementation. And we offer pretrained MTDL models for building height and footprint mapping at the resolution of 100 m via the link on Google Drive. If your system has CUDA-supported GPUs, please download
check_pt_senet_100m_MTL_TF_gpu. Otherwise, please downloadcheck_pt_senet_100m_MTL_TF.Based on preliminary tests, building height and footprint mapping for a area of $0.9^\circ\times 0.9^\circ$ might take 20-40 minutes where the majority of time is spent on exporting satellite images. So please control the size of target areas when you are using a laptop for this functionality.
Owner
- Login: LllC-mmd
- Kind: user
- Location: Beijing
- Company: Tsinghua University
- Repositories: 1
- Profile: https://github.com/LllC-mmd
GitHub Events
Total
- Watch event: 7
Last Year
- Watch event: 7
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| LllC-mmd | 9****5@q****m | 108 |
| lyy | l****9@m****n | 35 |
| Ting Sun | s****5@g****m | 19 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 9
- Total pull requests: 2
- Average time to close issues: about 1 year
- Average time to close pull requests: about 4 hours
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 2.44
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- sunt05 (6)
- rochanofa (1)
- liuqiqi546 (1)
- JonasZero (1)
Pull Request Authors
- sunt05 (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 33 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 6
- Total maintainers: 1
pypi.org: shafts
Simultaneous building Height And FootprinT extraction from Sentinel Imagery
- Homepage: https://github.com/LllC-mmd/SHAFTS
- Documentation: https://shafts.readthedocs.io/
- License: GPL-V3.0
-
Latest release: 2022.1.28
published over 4 years ago
Rankings
Maintainers (1)
Dependencies
- albumentations *
- earthengine-api *
- gdal *
- geopandas *
- h5py *
- kneed *
- lmdb *
- matplotlib *
- numpy *
- opencv-python *
- pandas *
- pyarrow *
- scikit-image *
- scikit-learn *
- scipy *
- shapely *
- torch *
- torchvision *
- xgboost *
- actions/checkout v2 composite
- actions/download-artifact v2 composite
- actions/upload-artifact v2 composite
- conda-incubator/setup-miniconda v2 composite
- pypa/gh-action-pypi-publish master composite
- actions/checkout v2 composite
- actions/download-artifact v2 composite
- actions/upload-artifact v2 composite
- mamba-org/setup-micromamba v1 composite
- pypa/gh-action-pypi-publish master composite