diff --git a/deploy/hubserving/readme.md b/deploy/hubserving/readme.md index 28dde43124dab3a0403623f5a4795826627a37b7..c37485843421239b9999641b6da30803ae0faf8c 100644 --- a/deploy/hubserving/readme.md +++ b/deploy/hubserving/readme.md @@ -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个分类结果,以及对应的得分,还有此图片预测耗时,具体如下: diff --git a/deploy/hubserving/readme_en.md b/deploy/hubserving/readme_en.md index 5be4fe6b003d40e70dd3cdc233d94236f45185ed..0f34fd347f879d98fd7ed16d5dafdf7544cda10b 100644 --- a/deploy/hubserving/readme_en.md +++ b/deploy/hubserving/readme_en.md @@ -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 diff --git a/tools/test_hubserving.py b/tools/test_hubserving.py index 5c2820df29014f32b0a50c1884f06fee1afe6547..41f1287c7407d57bed0a37d8e3cae62437a7a5f7 100644 --- a/tools/test_hubserving.py +++ b/tools/test_hubserving.py @@ -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))