未验证 提交 e3bcab92 编写于 作者: W wangguanzhong 提交者: GitHub

Refine cpp infer (#164)

* refine code & doc for cpp_infer

* add cython for pycocotools install
上级 759b2dfc
...@@ -18,9 +18,12 @@ python tools/cpp_infer.py --model_path=inference_model/faster_rcnn_r50_1x/ --con ...@@ -18,9 +18,12 @@ python tools/cpp_infer.py --model_path=inference_model/faster_rcnn_r50_1x/ --con
4. visualize: 是否保存可视化结果,默认保存路径为```output/``` 4. visualize: 是否保存可视化结果,默认保存路径为```output/```
更多参数可在```tools/cpp_demo.yml```中查看, **设置shape时必须保持与模型导出时shape大小一致** 更多参数可在```tools/cpp_demo.yml```中查看,
**注意**
1. 设置shape时必须保持与模型导出时shape大小一致
2. ```min_subgraph_size```的设置与模型arch相关,对部分arch需要调大该参数,一般设置为40适用于所有模型。适当的调小```min_subgraph_size```会对预测有小幅加速效果。例如YOLO中该参数可设置为3
## Paddle环境搭建 ## Paddle环境搭建
需要基于develop分支编译TensorRT版本Paddle, 在编译命令中指定TensorRT路径: 需要基于develop分支编译TensorRT版本Paddle, 在编译命令中指定TensorRT路径:
...@@ -38,5 +41,5 @@ cmake .. -DWITH_MKL=ON \ ...@@ -38,5 +41,5 @@ cmake .. -DWITH_MKL=ON \
make -j20 make -j20
make install make install
export LD_LIBRARY_PATH=${PATH_TO_TensorRT}:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${PATH_TO_TensorRT}/lib:$LD_LIBRARY_PATH
``` ```
...@@ -3,4 +3,5 @@ docstring_parser @ http://github.com/willthefrog/docstring_parser/tarball/master ...@@ -3,4 +3,5 @@ docstring_parser @ http://github.com/willthefrog/docstring_parser/tarball/master
typeguard ; python_version >= '3.4' typeguard ; python_version >= '3.4'
tb-paddle tb-paddle
tensorboard >= 1.15 tensorboard >= 1.15
cython
pycocotools pycocotools
...@@ -13,6 +13,7 @@ import ppdet.utils.voc_eval as voc_eval ...@@ -13,6 +13,7 @@ import ppdet.utils.voc_eval as voc_eval
import ppdet.utils.coco_eval as coco_eval import ppdet.utils.coco_eval as coco_eval
import cv2 import cv2
import yaml import yaml
import copy
import logging import logging
FORMAT = '%(asctime)s-%(levelname)s: %(message)s' FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
...@@ -170,7 +171,8 @@ def Preprocess(img_path, arch, config): ...@@ -170,7 +171,8 @@ def Preprocess(img_path, arch, config):
orig_shape = img.shape orig_shape = img.shape
scale = 1. scale = 1.
data = [] data = []
for data_aug_conf in config: data_config = copy.deepcopy(config)
for data_aug_conf in data_config:
obj = data_aug_conf.pop('type') obj = data_aug_conf.pop('type')
preprocess = eval(obj)(**data_aug_conf) preprocess = eval(obj)(**data_aug_conf)
if obj == 'Resize': if obj == 'Resize':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册