mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-14 20:55:57 +08:00
[Bug Fix] fixed paddlex ppseg pp-trt infer error (#2049)
* [benchmark] fixed paddlex benchmark for picodet 320 * [Bug Fix] fixed paddlex ppseg pp-trt infer error
This commit is contained in:
@@ -21,13 +21,14 @@ fi
|
||||
./benchmark_ppdet --model PP-YOLOE+_crn_l_80e --image ppdet_det_img.jpg --config_path $CONFIG_PATH
|
||||
./benchmark_ppdet --model rt_detr_hgnetv2_l --image ppdet_det_img.jpg --config_path $CONFIG_PATH
|
||||
./benchmark_ppdet --model PP-PicoDet_s_320_lcnet --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,320,320:1,3,320,320:1,3,320,320
|
||||
./benchmark_ppdet --model dino_r50_4scale --image ppdet_det_img.jpg --config_path $CONFIG_PATH
|
||||
./benchmark_ppdet --model dino_r50_4scale --image ppdet_det_img.jpg --config_path $CONFIG_PATH --trt_shape 1,3,800,800:1,3,800,800:1,3,800,800
|
||||
|
||||
|
||||
# PaddleSeg
|
||||
./benchmark_ppseg --model OCRNet_HRNetW48 --image ppseg_cityscapes_demo.png --config_path $CONFIG_PATH
|
||||
./benchmark_ppseg --model PP-LiteSeg-STDC1 --image ppseg_cityscapes_demo.png --config_path $CONFIG_PATH
|
||||
./benchmark_ppseg --model PP-MobileSeg-Base --image ppseg_ade_val_512x512.png --config_path $CONFIG_PATH
|
||||
./benchmark_ppseg --model SegFormer-B0 --image ppseg_cityscapes_demo.png --config_path $CONFIG_PATH
|
||||
./benchmark_ppseg --model OCRNet_HRNetW48 --image ppseg_cityscapes_demo_512x512.png --config_path $CONFIG_PATH --trt_shape 1,3,512,512:1,3,512,512:1,3,512,512
|
||||
./benchmark_ppseg --model PP-LiteSeg-STDC1 --image ppseg_cityscapes_demo_512x512.png --config_path $CONFIG_PATH --trt_shape 1,3,512,512:1,3,512,512:1,3,512,512
|
||||
./benchmark_ppseg --model SegFormer-B0 --image ppseg_cityscapes_demo_512x512.png --config_path $CONFIG_PATH --trt_shape 1,3,512,512:1,3,512,512:1,3,512,512
|
||||
./benchmark_ppseg --model PP-MobileSeg-Base --image ppseg_ade_val_512x512.png --config_path $CONFIG_PATH --trt_shape 1,3,512,2048:1,3,512,2048:1,3,512,2048
|
||||
|
||||
# PaddleOCR
|
||||
./benchmark_ppocr_rec --model PP-OCRv4-mobile-rec --image ppocrv4_word_1.jpg --rec_label_file ppocr_keys_v1.txt --config_path $CONFIG_PATH
|
||||
|
@@ -19,9 +19,9 @@
|
||||
namespace vision = fastdeploy::vision;
|
||||
namespace benchmark = fastdeploy::benchmark;
|
||||
|
||||
DEFINE_string(trt_shape, "1,3,256,256:1,3,1024,1024:1,3,2048,2048",
|
||||
DEFINE_string(trt_shape, "1,3,512,512:1,3,512,512:1,3,512,512",
|
||||
"Set min/opt/max shape for trt/paddle_trt backend."
|
||||
"eg:--trt_shape 1,3,256,256:1,3,1024,1024:1,3,2048,2048");
|
||||
"eg:--trt_shape 1,3,512,512:1,3,512,512:1,3,512,512");
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
#if defined(ENABLE_BENCHMARK) && defined(ENABLE_VISION)
|
||||
@@ -52,6 +52,12 @@ int main(int argc, char* argv[]) {
|
||||
benchmark::ResultManager::GetInputShapes(FLAGS_trt_shape);
|
||||
option.trt_option.SetShape("x", trt_shapes[0], trt_shapes[1],
|
||||
trt_shapes[2]);
|
||||
// option.paddle_infer_option.delete_pass_names = {
|
||||
// "add_support_int8_pass",
|
||||
// "conv_elementwise_add_fuse_pass",
|
||||
// "conv_bn_fuse_pass",
|
||||
// // "tensorrt_subgraph_pass",
|
||||
// };
|
||||
}
|
||||
auto model_ppseg = vision::segmentation::PaddleSegModel(
|
||||
model_file, params_file, config_file, option, model_format);
|
||||
|
@@ -70,6 +70,7 @@ wget https://bj.bcebos.com/paddlehub/fastdeploy_paddlex_2_0/ppdet_det_img.jpg
|
||||
|
||||
# PaddleSeg
|
||||
wget https://bj.bcebos.com/paddlehub/fastdeploy_paddlex_2_0/ppseg_cityscapes_demo.png
|
||||
wget https://bj.bcebos.com/paddlehub/fastdeploy_paddlex_2_0/ppseg_cityscapes_demo_512x512.png
|
||||
wget https://bj.bcebos.com/paddlehub/fastdeploy_paddlex_2_0/ppseg_ade_val_512x512.png
|
||||
|
||||
# PaddleOCR
|
||||
|
@@ -24,22 +24,22 @@ void PaddleBackend::BuildOption(const PaddleBackendOption& option) {
|
||||
option_ = option;
|
||||
if (option.device == Device::GPU) {
|
||||
|
||||
|
||||
auto inference_precision = paddle_infer::PrecisionType::kFloat32;
|
||||
if (option_.inference_precision == "float32"){
|
||||
FDINFO<<"Will inference_precision float32"<<std::endl;
|
||||
FDINFO << "Will inference_precision float32" << std::endl;
|
||||
inference_precision = paddle_infer::PrecisionType::kFloat32;
|
||||
} else if (option_.inference_precision == "float16"){
|
||||
FDINFO<<"Will inference_precision float16"<<std::endl;
|
||||
FDINFO << "Will inference_precision float16" <<std::endl;
|
||||
inference_precision = paddle_infer::PrecisionType::kHalf;
|
||||
} else if (option_.inference_precision == "bfloat16"){
|
||||
FDINFO<<"Will inference_precision bfloat16"<<std::endl;
|
||||
FDINFO << "Will inference_precision bfloat16" << std::endl;
|
||||
inference_precision = paddle_infer::PrecisionType::kBf16;
|
||||
} else if (option_.inference_precision == "int8"){
|
||||
FDINFO<<"Will inference_precision int8"<<std::endl;
|
||||
FDINFO << "Will inference_precision int8" << std::endl;
|
||||
inference_precision = paddle_infer::PrecisionType::kInt8;
|
||||
} else {
|
||||
FDERROR<<"paddle inference only support precision in float32, float16, bfloat16 and int8"<<std::endl;
|
||||
FDERROR << "paddle inference only support precision in float32,"
|
||||
<< " float16, bfloat16 and int8" << std::endl;
|
||||
}
|
||||
config_.Exp_DisableMixedPrecisionOps({"feed","fetch"});
|
||||
config_.EnableUseGpu(option.gpu_mem_init_size, option.device_id, inference_precision);
|
||||
@@ -49,7 +49,7 @@ void PaddleBackend::BuildOption(const PaddleBackendOption& option) {
|
||||
config_.SwitchIrDebug();
|
||||
}
|
||||
if (option_.enable_inference_cutlass){
|
||||
FDINFO<<"Will enable_inference_cutlass"<<std::endl;
|
||||
FDINFO << "Will enable_inference_cutlass" << std::endl;
|
||||
config_.Exp_EnableUseCutlass();
|
||||
}
|
||||
if (option_.external_stream_) {
|
||||
@@ -284,7 +284,8 @@ bool PaddleBackend::InitFromPaddle(const std::string& model,
|
||||
}
|
||||
}
|
||||
if (option.enable_log_info){
|
||||
FDINFO<<"Finish paddle inference config with summary as: "<<std::endl<<config_.Summary()<<std::endl;
|
||||
FDINFO << "Finish paddle inference config with summary as: "
|
||||
<< std::endl << config_.Summary() <<std::endl;
|
||||
}
|
||||
predictor_ = paddle_infer::CreatePredictor(config_);
|
||||
auto input_names = predictor_->GetInputNames();
|
||||
|
Reference in New Issue
Block a user