Fix HubServing demo (#709)

pull/715/head
Tingquan Gao 2021-05-06 13:55:53 +08:00 committed by GitHub
parent 7a96b6d1bc
commit c9c7c18c72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -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个分类结果以及对应的得分还有此图片预测耗时具体如下

View File

@ -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

View File

@ -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))