Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gsunner committed Feb 12, 2019
2 parents 59d0ead + 4a73b85 commit 95fad65
Show file tree
Hide file tree
Showing 7 changed files with 553 additions and 507 deletions.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 7 additions & 15 deletions examples/models/openvino_imagenet_ensemble/seldon_grpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import argparse


API_AMBASSADOR="localhost:8080"


def grpc_request_ambassador_bindata(deploymentName,namespace,endpoint="localhost:8080",data=None):
request = prediction_pb2.SeldonMessage(binData = data)
channel = grpc.insecure_channel(endpoint)
Expand All @@ -20,23 +17,18 @@ def grpc_request_ambassador_bindata(deploymentName,namespace,endpoint="localhost
return response


def getImage(path):
img = image.load_img(path, target_size=(227, 227))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
return x

def getImageBytes(path):
with open(path, mode='rb') as file:
fileContent = file.read()
return fileContent


def main():
parser = argparse.ArgumentParser()
parser.add_argument("--repeats", default=1, type=int)
parser.add_argument('--debug', action='store_true')
parser.add_argument('--test-input', default='input_images.txt')
parser.add_argument('--test-input', default='input_images.txt')
parser.add_argument('--ambassador',default='localhost:8080')

args = parser.parse_args()

Expand All @@ -56,18 +48,18 @@ def main():
path, label = line.strip().split(" ")
X = getImageBytes(path)
start_time = datetime.datetime.now()
response = grpc_request_ambassador_bindata("openvino-model","seldon",endpoint=API_AMBASSADOR,data=X)
response = grpc_request_ambassador_bindata("openvino-model","seldon",endpoint=args.ambassador,data=X)
if args.debug:
print(response)
end_time = datetime.datetime.now()
duration = (end_time - start_time).total_seconds() * 1000
durations.append(duration)
print("Duration",duration)
print("Duration",duration,"ms")
i += 1
if response.strData == cnames[int(label)]:
matched += 1
print("average duration:",sum(durations)/float(len(durations)))
print("average accuracy:",matched/float(len(durations))*100)
print("average duration:", sum(durations)/float(len(durations)), "ms")
print("average accuracy:", matched/float(len(durations))*100)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
{
"name": "JAEGER_AGENT_HOST",
"value": "jaeger-agent"
},
{
"name": "DTYPE",
"value": "float32"
}
]
},
Expand Down Expand Up @@ -60,14 +64,6 @@
{
"name": "prediction1",
"image": "seldonio/openvino-demo-prediction:0.1",
"resources": {
"requests": {
"cpu": "1"
},
"limits": {
"cpu": "32"
}
},
"env": [
{
"name": "XML_PATH",
Expand All @@ -77,22 +73,6 @@
"name": "BIN_PATH",
"value": "gs://intelai_public_models/densenet_169/1/densenet_169_i8.bin"
},
{
"name": "KMP_SETTINGS",
"value": "1"
},
{
"name": "KMP_AFFINITY",
"value": "granularity=fine,verbose,compact,1,0"
},
{
"name": "KMP_BLOCKTIME",
"value": "1"
},
{
"name": "OMP_NUM_THREADS",
"value": "16"
},
{
"name": "http_proxy",
"value": ""
Expand All @@ -114,56 +94,32 @@
{
"name": "prediction2",
"image": "seldonio/openvino-demo-prediction:0.1",
"resources": {
"requests": {
"cpu": "1"
},
"limits": {
"cpu": "32"
}
},
"env": [
{
"name": "XML_PATH",
"value": "gs://intelai_public_models/resnet_50_i8/1/resnet_50_i8.xml"
},
{
"env": [
{
"name": "XML_PATH",
"value": "gs://intelai_public_models/resnet_50_i8/1/resnet_50_i8.xml"
},
{
"name": "BIN_PATH",
"value": "gs://intelai_public_models/resnet_50_i8/1/resnet_50_i8.bin"
},
{
"name": "KMP_SETTINGS",
"value": "1"
},
{
"name": "KMP_AFFINITY",
"value": "granularity=fine,verbose,compact,1,0"
},
{
"name": "KMP_BLOCKTIME",
"value": "1"
},
{
"name": "OMP_NUM_THREADS",
"value": "16"
},
{
"name": "http_proxy",
"value": ""
},
{
"name": "https_proxy",
},
{
"name": "http_proxy",
"value": ""
},
{
},
{
"name": "https_proxy",
"value": ""
},
{
"name": "TRACING",
"value": "1"
},
{
"name": "JAEGER_AGENT_HOST",
"value": "jaeger-agent"
}
]
"value": "1"
},
{
"name": "JAEGER_AGENT_HOST",
"value": "jaeger-agent"
}
]
}
],
"terminationGracePeriodSeconds": 1
Expand Down
Loading

0 comments on commit 95fad65

Please sign in to comment.