So I'm trying to serve COCO via tensorflow serving, if I inspect the model I get the following:
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
My test code is as follows:
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)
Which yields:
[massive long base64 string]}\n} Type: Object is not of expected type: uint8" }
Also tried(same result):
body = {
"signature_name": "serving_default",
"instances": [{"inputs": {"b64":image_content}}]
}
And finally(Same result):
body = {
"signature_name": "serving_default",
"inputs": {"b64":image_content}
}
I also double checked before the file is base64 encoded by doing:
print(image.dtype)
Output is uint8!
I've also tried tinkering with the object, ie remove image and just having the array with "b64" "..." - no joy.
What am I missing?
from Tensorflow Serving Type: Object is not of expected type: uint8
No comments:
Post a Comment