提交 bdf6e568 编写于 作者: M MRXLT

fix imagenet demo

上级 f5a809b5
......@@ -31,14 +31,14 @@ class ImageService(WebService):
sample = base64.b64decode(image)
img = reader.process_image(sample)
res_feed = {}
res_feed["image"] = img.reshape(-1)
res_feed["image"] = img
feed_batch.append(res_feed)
return feed_batch, fetch
else:
sample = base64.b64decode(feed["image"])
img = reader.process_image(sample)
res_feed = {}
res_feed["image"] = img.reshape(-1)
res_feed["image"] = img
return res_feed, fetch
......
......@@ -32,14 +32,14 @@ class ImageService(WebService):
sample = base64.b64decode(image)
img = reader.process_image(sample)
res_feed = {}
res_feed["image"] = img.reshape(-1)
res_feed["image"] = img
feed_batch.append(res_feed)
return feed_batch, fetch
else:
sample = base64.b64decode(feed["image"])
img = reader.process_image(sample)
res_feed = {}
res_feed["image"] = img.reshape(-1)
res_feed["image"] = img
return res_feed, fetch
......
......@@ -31,7 +31,7 @@ def predict(image_path, server):
r = requests.post(
server, data=req, headers={"Content-Type": "application/json"})
try:
print(r.json()["score"][0])
print(r.json()["result"]["score"])
except ValueError:
print(r.text)
return r
......
......@@ -26,7 +26,7 @@ start = time.time()
for i in range(1000):
with open("./data/n01440764_10026.JPEG", "rb") as f:
img = f.read()
img = reader.process_image(img).reshape(-1)
img = reader.process_image(img)
fetch_map = client.predict(feed={"image": img}, fetch=["score"])
end = time.time()
print(end - start)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册