sunt05 / Global3DBuildingInfo

A global dataset of 3D building information from Sentinel imagery

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Global3DBuildingInfo

A global dataset of 3D building information from Sentinel imagery

Building Height and Footprint Prediction using Google Cloud Service

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.

Configuration for Google Cloud Service

The following steps are required for setting up a Goolge Earth Engine enabled Cloud Project:

  1. Create a Google Cloud Project in the Google Cloud console for building height and footprint prediction.

  2. Enable the Earth Engine API for the project.

  3. 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
    |   |-- ...
  1. 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.

  2. 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.

Building Height and Footprint Prediction

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")

About

A global dataset of 3D building information from Sentinel imagery


Languages

Language:Python 48.0%Language:PureBasic 47.8%Language:JavaScript 4.2%Language:Shell 0.0%