title: Tensorflow Serving Type: Object is not of expected type: uint8
body: <p>So I'm trying to serve COCO via tensorflow serving, if I inspect the model I get the following:</p>
  
  <pre><code>signature_def['serving_default']:
    The given SavedModel SignatureDef contains the following input(s):
      inputs['inputs'] tensor_info:
          dtype: DT_UINT8
          shape: (-1, -1, -1, 3)
          name: image_tensor:0
    The given SavedModel SignatureDef contains the following output(s):
      outputs['detection_boxes'] tensor_info:
          dtype: DT_FLOAT
          shape: (-1, 100, 4)
          name: detection_boxes:0
      outputs['detection_classes'] tensor_info:
          dtype: DT_FLOAT
          shape: (-1, 100)
          name: detection_classes:0
      outputs['detection_masks'] tensor_info:
          dtype: DT_FLOAT
          shape: (-1, -1, -1, -1)
          name: detection_masks:0
      outputs['detection_scores'] tensor_info:
          dtype: DT_FLOAT
          shape: (-1, 100)
          name: detection_scores:0
      outputs['num_detections'] tensor_info:
          dtype: DT_FLOAT
          shape: (-1)
          name: num_detections:0
    Method name is: tensorflow/serving/predict
  </code></pre>
  
  <p>My test code is as follows:</p>
  
  <pre><code>import json
  import numpy as np
  import cv2
  import base64
  import requests
  import base64
  import json
  
  image = "./frames/IMG_0474.MOV/IMG_0474_100.jpg"
  URL = "http://localhost:8501/v1/models/saved_model/versions/1:predict" 
  headers = {"content-type": "application/json"}
  image_content = base64.b64encode(cv2.imread(image)).decode("utf-8")
  body = {
      "signature_name": "serving_default",
      "inputs": [{"image": {"b64":image_content}}]
      }
  r = requests.post(URL, data=json.dumps(body), headers = headers) 
  print(r.text)
  </code></pre>
  
  <p>Which yields:</p>
  
  <pre><code>"error": "JSON Value: {\n    \"b64\": [massive long base64 string]}\n} Type: Object is not of expected type: uint8" }
  </code></pre>
  
  <p>Also tried(same result):</p>
  
  <pre><code>body = {
      "signature_name": "serving_default",
      "instances": [{"inputs": {"b64":image_content}}]
      }
  </code></pre>
  
  <p>And finally(Same result):</p>
  
  <pre><code>body = {
      "signature_name": "serving_default",
      "inputs": {"b64":image_content}
      }
  </code></pre>
  
  <p>I also double checked before the file is base64 encoded by doing:</p>
  
  <pre><code>print(image.dtype)
  </code></pre>
  
  <p>Output is uint8!</p>
  
  <p>I've also tried tinkering with the object, ie remove image and just having the array with "b64" "..." - no joy.</p>
  
  <p>What am I missing?</p>