From e44ecc198700db9fda7449dcfab6bf363f73ad57 Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Thu, 22 Sep 2022 03:03:30 +0000 Subject: [PATCH] update PP-ShiTu inference doc --- deploy/cpp_shitu/src/main.cpp | 4 ++++ deploy/python/predict_system.py | 2 +- docs/zh_CN/deployment/PP-ShiTu/cpp.md | 20 ++++++++++++++++--- .../quick_start/quick_start_recognition.md | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/deploy/cpp_shitu/src/main.cpp b/deploy/cpp_shitu/src/main.cpp index 6bdbf657..b4c384d5 100644 --- a/deploy/cpp_shitu/src/main.cpp +++ b/deploy/cpp_shitu/src/main.cpp @@ -174,6 +174,10 @@ int main(int argc, char **argv) { .as() .empty()) { detector_ptr = new Detection::ObjectDetector(config.config_file); + } else { + std::cout << "Found 'Global.det_inference_model_dir' empty, so " + "det_predictor is disabled" + << std::endl; } // initialize feature_extractor diff --git a/deploy/python/predict_system.py b/deploy/python/predict_system.py index c029636b..19bf5c32 100644 --- a/deploy/python/predict_system.py +++ b/deploy/python/predict_system.py @@ -34,7 +34,7 @@ class SystemPredictor(object): if not config["Global"]["det_inference_model_dir"]: logger.info( - f"find 'Global.det_inference_model_dir' empty({config['Global']['det_inference_model_dir']}), so det_predictor is disabled" + f"Found 'Global.det_inference_model_dir' empty({config['Global']['det_inference_model_dir']}), so det_predictor is disabled" ) self.det_predictor = None else: diff --git a/docs/zh_CN/deployment/PP-ShiTu/cpp.md b/docs/zh_CN/deployment/PP-ShiTu/cpp.md index 3f45f503..6a802a61 100644 --- a/docs/zh_CN/deployment/PP-ShiTu/cpp.md +++ b/docs/zh_CN/deployment/PP-ShiTu/cpp.md @@ -348,11 +348,25 @@ cd .. ./build/pp_shitu -c inference_drink.yaml ``` - 以 `drink_dataset_v2.0/test_images/nongfu_spring.jpeg` 作为输入图像,则执行上述推理命令可以得到如下结果 + 默认以 `../drink_dataset_v2.0/test_images/100.jpeg` 作为输入图像,则执行上述推理命令可以得到如下结果 ```log - ../../deploy/drink_dataset_v2.0/test_images/nongfu_spring.jpeg: - result0: bbox[0, 0, 729, 1094], score: 0.688691, label: 农夫山泉-饮用天然水 + ../drink_dataset_v2.0/test_images/100.jpeg: + result0: bbox[437, 72, 660, 723], score: 0.769916, label: 元气森林 + result1: bbox[220, 71, 449, 685], score: 0.695485, label: 元气森林 + result2: bbox[795, 104, 979, 653], score: 0.626963, label: 元气森林 + ``` + + 识别流程支持灵活配置,用户可以选择不使用主体检测模型,而直接将单幅整图输入到特征提取模型,计算特征向量供后续检索使用,从而减少整体识别流程的耗时。只需将`Global.det_inference_model_dir`后的字段改为`null`或者`""`,再运行以下推理命令即可 + ```shell + ./build/pp_shitu -c inference_drink.yaml + ``` + + 最终输出结果如下 + ```log + Found 'Global.det_inference_model_dir' empty, so det_predictor is disabled + ../drink_dataset_v2.0/test_images/100.jpeg: + result0: bbox[0, 0, 1199, 801], score: 0.568903, label: 元气森林 ``` 由于python和C++的opencv实现存在部分不同,可能导致python推理和C++推理结果有微小差异。但基本不影响最终的检索结果。 diff --git a/docs/zh_CN/quick_start/quick_start_recognition.md b/docs/zh_CN/quick_start/quick_start_recognition.md index b8912daa..511a3c60 100644 --- a/docs/zh_CN/quick_start/quick_start_recognition.md +++ b/docs/zh_CN/quick_start/quick_start_recognition.md @@ -234,7 +234,7 @@ python3.7 python/predict_system.py -c configs/inference_general.yaml -o Global.u 最终输出结果如下 ```log -INFO: find 'Global.det_inference_model_dir' empty(), so det_predictor is disabled +INFO: Found 'Global.det_inference_model_dir' empty(), so det_predictor is disabled [{'bbox': [0, 0, 1200, 802], 'rec_docs': '元气森林', 'rec_scores': 0.5696486}] ``` -- GitLab