未验证 提交 c9c7c18c 编写于 作者: T Tingquan Gao 提交者: GitHub

Fix HubServing demo (#709)

上级 7a96b6d1
......@@ -118,7 +118,7 @@ hub serving start -c deploy/hubserving/clas/config.json
- **top_k**:[**可选**] 返回前 `top_k` 个 `score` ,默认为 `1`。
访问示例:
```python tools/test_hubserving.py http://127.0.0.1:8866/predict/clas_system ./deploy/hubserving/ILSVRC2012_val_00006666.JPEG 5```
```python tools/test_hubserving.py --server_url http://127.0.0.1:8866/predict/clas_system --image_file ./deploy/hubserving/ILSVRC2012_val_00006666.JPEG 5```
### 返回结果格式说明
返回结果为列表(list),包含top-k个分类结果,以及对应的得分,还有此图片预测耗时,具体如下:
......
......@@ -121,7 +121,7 @@ Two parameters need to be passed to the script:
**Eg.**
```shell
python tools/test_hubserving.py http://127.0.0.1:8866/predict/clas_system ./deploy/hubserving/ILSVRC2012_val_00006666.JPEG 5
python tools/test_hubserving.py --server_url http://127.0.0.1:8866/predict/clas_system --image_file ./deploy/hubserving/ILSVRC2012_val_00006666.JPEG 5
```
### Returned result format
......
......@@ -87,11 +87,12 @@ def main(args):
predict_time += elapse
for number, result_list in enumerate(batch_result_list):
all_score += result_list[0]["score"]
result_str = ", ".join([
"{}: {:.2f}".format(r["cls_id"], r["score"])
for r in result_list
])
all_score += result_list["scores"][0]
result_str = ""
for i in range(len(result_list["clas_ids"])):
result_str += "{}: {:.2f}\t".format(
result_list["clas_ids"][i],
result_list["scores"][i])
logger.info("File:{}, The top-{} result(s): {}".format(
img_name_list[number], args.top_k, result_str))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册