title: Deploying Image Segmentation Model to Production using AI Platform: HTTP request 500 Error
body: <p>I am trying to deploy a tensorflow image segmentation model to production using the AI Platform of Google Cloud. I have previously succesfully deployed a custom image classification model using the AI platform yet when I try to deploy a custom segmentation model using:</p>
  
  <p><code>gcloud ai-platform predict --model=%MODEL_NAME% --json-instances="C:\Users\umara\Desktop\DLOCTseg\Normal Image.json" --verbosity debug</code></p>
  
  <p>I run into the following Error</p>
  
  <pre><code>ERROR: (gcloud.ai-platform.predict) HTTP request failed. Response: {
    "error": {
      "code": 500,
      "message": "Internal error encountered.",
      "status": "INTERNAL"
    }
  }
  </code></pre>
  
  <p>A little bit of googling around (<a href="https://stackoverflow.com/questions/54287997/ml-engine-serving-seems-to-not-be-working-as-intended">ML engine serving seems to not be working as intended</a>) told me that the error could be due to the output size being too large. My output size is a 1 X 512 x 512 x 9 array for each image input.</p>
  
  <p>The saved-model-cli </p>
  
  <pre><code>saved_model_cli show --all --dir C:\Users\umara\Desktop\DLOCTseg\export\v1
  </code></pre>
  
  <p>gives:</p>
  
  <pre><code>MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:
  
  signature_def['serving_default']:
    The given SavedModel SignatureDef contains the following input(s):
      inputs['bytes'] tensor_info:
          dtype: DT_STRING
          shape: (-1)
          name: image_binary:0
    The given SavedModel SignatureDef contains the following output(s):
      outputs['conv2d_24'] tensor_info:
          dtype: DT_FLOAT
          shape: (-1, 512, 512, 9)
          name: conv2d_24/Sigmoid:0
    Method name is: tensorflow/serving/predict
  </code></pre>
  
  <p>How can I deploy such a model on google cloud using AI platform? Is there a manual way to deploy my large output image segmentation model using Docker/ Kubernetes (is there a tutorial for this)? Any help regarding deploying this custom model on a server on Google Cloud and accessing prediction remotely would be appreciated. Thanks</p>