1

I want to host a DNN-model on the Google AI-platform and use this model in the Google Earth for prediction.

However, I can not seem to configure the input-output definition properly. There is an example here, but without any further explanation.

from tensorflow.python.tools import saved_model_utils

meta_graph_def = saved_model_utils.get_meta_graph_def(config.MODEL_DIR, 'serve')
inputs = meta_graph_def.signature_def['serving_default'].inputs
outputs = meta_graph_def.signature_def['serving_default'].outputs

# Just get the first thing(s) from the serving signature def.  i.e. this
# model only has a single input and a single output.
input_name = None
for k,v in inputs.items():
  input_name = v.name
  break

output_name = None
for k,v in outputs.items():
  output_name = v.name
  break

# Make a dictionary that maps Earth Engine outputs and inputs to 
# AI Platform inputs and outputs, respectively.
import json
input_dict = "'" + json.dumps({input_name: "array"}) + "'"
output_dict = "'" + json.dumps({output_name: "impervious"}) + "'"

# You need to set the project before using the model prepare command.
!earthengine set_project {PROJECT}
!earthengine model prepare --source_dir {config.MODEL_DIR} --dest_dir {config.EEIFIED_DIR} --input {input_dict} --output {output_dict}

Is there any mapping/explanation available how the input_dict relates to the access in the Earth Engine?

var model = ee.Model.fromAiPlatformPredictor({
    projectName: PROJECT,
    modelName: MODEL_NAME,
    version: VERSION_NAME,
    inputTileSize: [pixel_size, pixel_size],
    proj: ee.Projection('EPSG:4326').atScale(SCALE),
    fixInputProj: true,
    outputBands: {'land_classes': {
        type: ee.PixelType.float(),
        dimensions: 1
      }
    }
});

I fail to understand the mapping and can therefore not use a model of my own.

1 Answer 1

0

you should change the "'land_classes':" in outputBands, cause the "output_name" as impervious

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.