PaddlePaddle / PaddleSeg

Easy-to-use image segmentation library with awesome pre-trained model zoo, supporting wide-range of practical tasks in Semantic Segmentation, Interactive Segmentation, Panoptic Segmentation, Image Matting, 3D Segmentation, etc.
https://arxiv.org/abs/2101.06175
Apache License 2.0
8.69k stars 1.68k forks source link

python部署后使用tensorrt报错 #1670

Closed huilin16 closed 2 years ago

huilin16 commented 2 years ago

环境:aistudio, paddle2.1.2 运行命令: !python /home/aistudio/PaddleSeg/deploy/python/infer.py \ --config /home/aistudio/output/deploy.yaml \ --image_path /home/aistudio/infer/images \ --save_dir /home/aistudio/infer/preds \ --batch_size 8\ --use_trt True 错误日志: ['/home/aistudio/infer/images/zh12.tif', '/home/aistudio/infer/images/zh2-Copy1.tif', '/home/aistudio/infer/images/zh10.tif', '/home/aistudio/infer/images/zh4-Copy1.tif', '/home/aistudio/infer/images/zh8.tif', '/home/aistudio/infer/images/zh8-Copy1.tif', '/home/aistudio/infer/images/zh12-Copy1.tif', '/home/aistudio/infer/images/zh5.tif', '/home/aistudio/infer/images/zh1.tif', '/home/aistudio/infer/images/zh5-Copy1.tif', '/home/aistudio/infer/images/zh10-Copy1.tif', '/home/aistudio/infer/images/zh4.tif', '/home/aistudio/infer/images/zh3.tif', '/home/aistudio/infer/images/zh6-Copy1.tif', '/home/aistudio/infer/images/zh11.tif', '/home/aistudio/infer/images/zh6.tif', '/home/aistudio/infer/images/zh2.tif', '/home/aistudio/infer/images/zh3-Copy1.tif', '/home/aistudio/infer/images/zh1-Copy1.tif', '/home/aistudio/infer/images/zh9-Copy1.tif', '/home/aistudio/infer/images/zh11-Copy1.tif', '/home/aistudio/infer/images/zh9.tif'] {'Deploy': {'model': 'model.pdmodel', 'params': 'model.pdiparams', 'transforms': [{'type': 'Normalize', 'mean': [0.264, 0.209, 0.398], 'std': [0.037, 0.042, 0.06]}, {'type': 'Resize', 'target_size': [512, 512]}]}} [{'type': 'Normalize', 'mean': [0.264, 0.209, 0.398], 'std': [0.037, 0.042, 0.06]}, {'type': 'Resize', 'target_size': [512, 512]}] t_list [{'type': 'Normalize', 'mean': [0.264, 0.209, 0.398], 'std': [0.037, 0.042, 0.06]}, {'type': 'Resize', 'target_size': [512, 512]}] t_list [{'mean': [0.264, 0.209, 0.398], 'std': [0.037, 0.042, 0.06]}, {'type': 'Resize', 'target_size': [512, 512]}] <paddleseg.transforms.transforms.Compose object at 0x7f7d15b356d0> 2021-12-29 12:31:34 [INFO] Use GPU 2021-12-29 12:31:34 [INFO] Use TRT 2021-12-29 12:31:34 [INFO] Use manual set dynamic shape Traceback (most recent call last): File "/home/aistudio/PaddleSeg/deploy/python/infer.py", line 410, in main(args) File "/home/aistudio/PaddleSeg/deploy/python/infer.py", line 397, in main predictor = Predictor(args) File "/home/aistudio/PaddleSeg/deploy/python/infer.py", line 140, in init self.predictor = create_predictor(self.pred_cfg) ValueError: (InvalidArgument) Pass tensorrt_subgraph_pass has not been registered. Please use the paddle inference library compiled with tensorrt or disable the tensorrt engine in inference configuration! [Hint: Expected Has(pass_type) == true, but received Has(pass_type):0 != true:1.] (at /paddle/paddle/fluid/framework/ir/pass.h:216)

juncaipeng commented 2 years ago

hi,你安装的paddlepaddle版本不支持tensorrt,需要参考文档重新安装:https://paddleinference.paddlepaddle.org.cn/user_guides/download_lib.html#python