A global dataset of 3D building information from Sentinel imagery
Here we implement a GBuildingMap
function to streamline the process of building height and footprint prediction via Google Cloud Service (GCS) so that 3D building information can be directly retrieved from the execution of a single function without downloading Sentinel-1/2 images locally and then applying CNN models for inference.
However, it requires some additional configuration of GCS before inference. The following part will give a brief introduction of the GBuildingMap
function's usage.
The following steps are required for setting up a Goolge Earth Engine enabled Cloud Project:
-
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 are required by the execution of
GBuildingMap
function. An example of the structure of the GCS's bucket can be given as follows:
bucket-name/
|-- dataset/
| |-- 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 is required by the execution of
GBuildingMap
function. -
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 is required by the execution of
GBuildingMap
function.
from inference_ee import GBuildingMap
# ---Path to the folder which contains pretrained MTL models based on Tensorflow
pretrained_weight = "./DL_run/height/check_pt_senet_100m_MTL_TF_gpu"
# ---Google Cloud Service configuration
GCS_config = {
"SERVICE_ACCOUNT": "e-mail name of the GCS account",
"GS_ACCOUNT_JSON": "path to the JSON key for the GCS service account",
"BUCKET": "name of the Google Cloud Storage bucket",
"DATA_FOLDER": "name of the folder under the Google Cloud Storage bucket prepared for storing intermediate datasets",
}
GBuildingMap(lon_min=-0.50, lat_min=51.00, lon_max=0.4, lat_max=51.90, year=2020, dx=0.09, dy=0.09, precision=3, batch_size=512,
pretrained_model=pretrained_weight, GCS_config=GCS_config,
target_resolution=100, num_task_queue=30, num_queue_min=2,
file_prefix="_", padding=0.01, patch_size_ratio=1, s2_cloud_prob_threshold=20, s2_cloud_prob_max=80, MTL=True,
removed=True, output_folder="./results")