提交 7ecb4eed 编写于 作者: H HexToString

fix examples

上级 b6d3a797
...@@ -62,10 +62,7 @@ for i in range(10): ...@@ -62,10 +62,7 @@ for i in range(10):
img = seq(image_file) img = seq(image_file)
fetch_map = client.predict( fetch_map = client.predict(
feed={"image": img}, fetch=["score"], batch=False) feed={"image": img}, fetch=["score"], batch=False)
prob = max(fetch_map["score"][0]) print(fetch_map)
label = label_dict[fetch_map["score"][0].tolist().index(prob)].strip(
).replace(",", "")
print("prediction: {}, probability: {}".format(label, prob))
end = time.time() end = time.time()
print(end - start) print(end - start)
...@@ -59,4 +59,4 @@ for line in sys.stdin: ...@@ -59,4 +59,4 @@ for line in sys.stdin:
#print(feed) #print(feed)
fetch = ["prediction"] fetch = ["prediction"]
fetch_map = client.predict(feed=feed, fetch=fetch, batch=True) fetch_map = client.predict(feed=feed, fetch=fetch, batch=True)
print("{} {}".format(fetch_map["prediction"][0], label[0])) print(fetch_map)
...@@ -65,7 +65,3 @@ for line in sys.stdin: ...@@ -65,7 +65,3 @@ for line in sys.stdin:
fetch=["crf_decode"], fetch=["crf_decode"],
batch=True) batch=True)
print(fetch_map) print(fetch_map)
begin = fetch_map['crf_decode.lod'][0]
end = fetch_map['crf_decode.lod'][1]
segs = reader.parse_result(line, fetch_map["crf_decode"][begin:end])
print("word_seg: " + "|".join(str(words) for words in segs))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册