Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pp_liteseg用paddle inference推理时,采用TensorRT加速,已开启use_trt_dynamic_shape #3360

Closed
1 task done
gitleej opened this issue Jul 10, 2023 · 8 comments
Closed
1 task done
Assignees
Labels
GoodFirstIssue question Further information is requested

Comments

@gitleej
Copy link

gitleej commented Jul 10, 2023

问题确认 Search before asking

  • 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

use_trt_dynamic_shape设置
if (FLAGS_dynamic_shape_path.empty()) {
std::map<std::string, std::vector> min_input_shape = {
{"x", {1, 3, 1, 1}},
{"image", {1, 3, 112, 112}},
{"bilinear_interp_v2_5.tmp_0", {1, 3, 1, 1}},
{"bilinear_interp_v2_0.tmp_0", {1, 3, 1, 1}},
{"bilinear_interp_v2_1.tmp_0", {1, 3, 1, 1}},
{"bilinear_interp_v2_2.tmp_0", {1, 3, 1, 1}},
{"max_4.tmp_0", {1, 3, 1, 1}},
{"max_5.tmp_0", {1, 3, 1, 1}},
{"mean_4.tmp_0", {1, 3, 1, 1}},
{"relu_36.tmp_0", {1, 3, 1, 1}},
{"bilinear_interp_v2_4.tmp_0", {1, 3, 1, 1}},
{"max_2.tmp_0", {1, 3, 1, 1}},
{"max_3.tmp_0", {1, 3, 1, 1}},
{"mean_2.tmp_0", {1, 3, 1, 1}},
{"relu_33.tmp_0", {1, 3, 1, 1}},
{"bilinear_interp_v2_3.tmp_0", {1, 3, 1, 1}},
{"max_0.tmp_0", {1, 3, 1, 1}},
{"max_1.tmp_0", {1, 3, 1, 1}},
{"mean_0.tmp_0", {1, 3, 1, 1}},
{"relu_30.tmp_0", {1, 3, 1, 1}}};
std::map<std::string, std::vector> max_input_shape = {
{"x", {1, 3, 1024, 2048}},
{"image", {1, 3, 1024, 2048}},
{"bilinear_interp_v2_5.tmp_0", {1, 3, 1024, 2048}},
{"bilinear_interp_v2_0.tmp_0", {1, 3, 1024, 2048}},
{"bilinear_interp_v2_1.tmp_0", {1, 3, 1024, 2048}},
{"bilinear_interp_v2_2.tmp_0", {1, 3, 1024, 2048}},
{"max_4.tmp_0", {1, 3, 1024, 2048}},
{"max_5.tmp_0", {1, 3, 1024, 2048}},
{"mean_4.tmp_0", {1, 3, 1024, 2048}},
{"relu_36.tmp_0", {1, 3, 1024, 2048}},
{"bilinear_interp_v2_4.tmp_0", {1, 3, 1024, 2048}},
{"max_2.tmp_0", {1, 3, 1024, 2048}},
{"max_3.tmp_0", {1, 3, 1024, 2048}},
{"mean_2.tmp_0", {1, 3, 1024, 2048}},
{"relu_33.tmp_0", {1, 3, 1024, 2048}},
{"bilinear_interp_v2_3.tmp_0", {1, 3, 1024, 2048}},
{"max_0.tmp_0", {1, 3, 1024, 2048}},
{"max_1.tmp_0", {1, 3, 1024, 2048}},
{"mean_0.tmp_0", {1, 3, 1024, 2048}},
{"relu_30.tmp_0", {1, 3, 1024, 2048}}};
std::map<std::string, std::vector> opt_input_shape = {
{"x", {1, 3, 512, 1024}},
{"image", {1, 3, 512, 1024}},
{"bilinear_interp_v2_5.tmp_0", {1, 3, 512, 1024}},
{"bilinear_interp_v2_0.tmp_0", {1, 3, 512, 1024}},
{"bilinear_interp_v2_1.tmp_0", {1, 3, 512, 1024}},
{"bilinear_interp_v2_2.tmp_0", {1, 3, 512, 1024}},
{"max_4.tmp_0", {1, 3, 512, 1024}},
{"max_5.tmp_0", {1, 3, 512, 1024}},
{"mean_4.tmp_0", {1, 3, 512, 1024}},
{"relu_36.tmp_0", {1, 3, 512, 1024}},
{"bilinear_interp_v2_4.tmp_0", {1, 3, 256, 512}},
{"max_2.tmp_0", {1, 3, 256, 512}},
{"max_3.tmp_0", {1, 3, 256, 512}},
{"mean_2.tmp_0", {1, 3, 256, 512}},
{"relu_33.tmp_0", {1, 3, 256, 512}},
{"bilinear_interp_v2_3.tmp_0", {1, 3, 256, 512}},
{"max_0.tmp_0", {1, 3, 256, 512}},
{"max_1.tmp_0", {1, 3, 256, 512}},
{"mean_0.tmp_0", {1, 3, 256, 512}},
{"relu_30.tmp_0", {1, 3, 256, 512}}};
infer_config.SetTRTDynamicShapeInfo(
min_input_shape, max_input_shape, opt_input_shape);

WARNING: Logging before InitGoogleLogging() is written to STDERR I0710 15:28:49.381031 18480 main.cpp:94] Use GPU I0710 15:28:49.383030 18480 main.cpp:99] Use TRT I0710 15:28:49.383030 18480 main.cpp:100] trt_precision:fp32 I0710 15:28:49.383030 18480 main.cpp:121] Enable TRT dynamic shape WARNING: Logging before InitGoogleLogging() is written to STDERR I0710 15:28:52.924093 18480 analysis_predictor.cc:1099] TensorRT subgraph engine is enabled e[1me[35m--- Running analysis [ir_graph_build_pass]e[0m e[1me[35m--- Running analysis [ir_analysis_pass]e[0m e[32m--- Running IR pass [adaptive_pool2d_convert_global_pass]e[0m I0710 15:28:52.953110 18480 fuse_pass_base.cc:59] --- detected 1 subgraphs e[32m--- Running IR pass [shuffle_channel_detect_pass]e[0m e[32m--- Running IR pass [quant_conv2d_dequant_fuse_pass]e[0m e[32m--- Running IR pass [delete_fill_constant_op_pass]e[0m e[32m--- Running IR pass [delete_quant_dequant_op_pass]e[0m e[32m--- Running IR pass [delete_quant_dequant_filter_op_pass]e[0m e[32m--- Running IR pass [delete_weight_dequant_linear_op_pass]e[0m e[32m--- Running IR pass [delete_quant_dequant_linear_op_pass]e[0m e[32m--- Running IR pass [identity_scale_op_clean_pass]e[0m e[32m--- Running IR pass [add_support_int8_pass]e[0m I0710 15:28:52.994058 18480 fuse_pass_base.cc:59] --- detected 200 subgraphs e[32m--- Running IR pass [simplify_with_basic_ops_pass]e[0m e[32m--- Running IR pass [trt_embedding_eltwise_layernorm_fuse_pass]e[0m e[32m--- Running IR pass [preln_embedding_eltwise_layernorm_fuse_pass]e[0m e[32m--- Running IR pass [delete_c_identity_op_pass]e[0m e[32m--- Running IR pass [trt_multihead_matmul_fuse_pass_v2]e[0m e[32m--- Running IR pass [trt_multihead_matmul_fuse_pass_v3]e[0m e[32m--- Running IR pass [vit_attention_fuse_pass]e[0m e[32m--- Running IR pass [trt_skip_layernorm_fuse_pass]e[0m e[32m--- Running IR pass [preln_skip_layernorm_fuse_pass]e[0m e[32m--- Running IR pass [preln_residual_bias_fuse_pass]e[0m e[32m--- Running IR pass [layernorm_shift_partition_fuse_pass]e[0m e[32m--- Running IR pass [conv_bn_fuse_pass]e[0m I0710 15:28:53.060089 18480 fuse_pass_base.cc:59] --- detected 39 subgraphs e[32m--- Running IR pass [unsqueeze2_eltwise_fuse_pass]e[0m e[32m--- Running IR pass [trt_squeeze2_matmul_fuse_pass]e[0m e[32m--- Running IR pass [trt_flatten2_matmul_fuse_pass]e[0m e[32m--- Running IR pass [trt_map_matmul_v2_to_mul_pass]e[0m e[32m--- Running IR pass [trt_map_matmul_v2_to_matmul_pass]e[0m e[32m--- Running IR pass [trt_map_matmul_to_mul_pass]e[0m e[32m--- Running IR pass [fc_fuse_pass]e[0m e[32m--- Running IR pass [conv_elementwise_add_fuse_pass]e[0m I0710 15:28:53.081130 18480 fuse_pass_base.cc:59] --- detected 43 subgraphs e[32m--- Running IR pass [remove_padding_recover_padding_pass]e[0m e[32m--- Running IR pass [delete_remove_padding_recover_padding_pass]e[0m e[32m--- Running IR pass [dense_fc_to_sparse_pass]e[0m e[32m--- Running IR pass [dense_multihead_matmul_to_sparse_pass]e[0m e[32m--- Running IR pass [constant_folding_pass]e[0m e[32m--- Running IR pass [tensorrt_subgraph_pass]e[0m I0710 15:28:55.416604 18480 tensorrt_subgraph_pass.cc:244] --- detect a sub-graph with 15 nodes I0710 15:28:55.767565 18480 tensorrt_subgraph_pass.cc:560] Prepare TRT engine (Optimize model structure, Select OP kernel etc). This process may cost a lot of time. W0710 15:28:56.290634 18480 helper.h:110] Tensor DataType is determined at build time for tensors not marked as input or output. E0710 15:28:56.291595 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.291595 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.291595 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.291595 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.291595 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.292604 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.292604 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.292604 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.292604 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.293560 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.293560 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.293560 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.293560 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.293560 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.294612 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.294612 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.294612 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.294612 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.294612 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.294612 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.294612 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.295616 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.295616 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.295616 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.295616 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.295616 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.295616 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.296615 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.296615 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.296615 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.296615 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.296615 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.296615 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.297618 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.297618 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.297618 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.297618 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.297618 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.297618 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.297618 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.298615 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.298615 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) I0710 15:28:56.298615 18480 engine.cc:199] Run Paddle-TRT Dynamic Shape mode. E0710 15:28:56.298615 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.298615 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.299623 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.299623 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.299623 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.299623 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.299623 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.299623 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.299623 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.300616 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.300616 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.300616 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.300616 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.300616 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.300616 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.300616 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.301623 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.301623 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.301623 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.301623 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.301623 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.301623 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.302615 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.302615 18480 helper.h:114] 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::28] Error Code 4: Internal Error (conv2d (Output: batch_norm_42.tmp_2759): number of kernel weights does not match tensor dimensions) E0710 15:28:56.302615 18480 helper.h:114] 3: conv2d (Output: batch_norm_42.tmp_2759):kernel weights has count 72 but 180 was expected E0710 15:28:56.302615 18480 helper.h:114] 4: conv2d (Output: batch_norm_42.tmp_2759): count of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1 = 180 E0710 15:28:56.302615 18480 helper.h:114] 4: [network.cpp::nvinfer1::Network::validate::2640] Error Code 4: Internal Error (Layer conv2d (Output: batch_norm_42.tmp_2759) failed validation) E0710 15:28:56.302615 18480 helper.h:114] 2: [builder.cpp::nvinfer1::builder::Builder::buildSerializedNetwork::417] Error Code 2: Internal Error (Assertion enginePtr != nullptr failed.)

@gitleej gitleej added the question Further information is requested label Jul 10, 2023
@Asthestarsfalll
Copy link
Contributor

能否有更清晰的报错提示和运行命令等?

@gitleej
Copy link
Author

gitleej commented Jul 11, 2023

能否有更清晰的报错提示和运行命令等?

上面就是所有报错信息了,程序源码就是PaddleSeg套件里的cpp推理源码,命令--use_trt --use_dynamic_shape

@Asthestarsfalll
Copy link
Contributor

number of kernel weights does not match tensor dimensionscount of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1,请检查一下通道数

@gitleej
Copy link
Author

gitleej commented Jul 12, 2023

number of kernel weights does not match tensor dimensionscount of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1,请检查一下通道数

是模型的通道数和trt 加速max shape、min shape、opt shape要统一吗?或者max、min、opt shape的参数应该怎么设置?

@Asthestarsfalll
Copy link
Contributor

number of kernel weights does not match tensor dimensionscount of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1,请检查一下通道数

是模型的通道数和trt 加速max shape、min shape、opt shape要统一吗?或者max、min、opt shape的参数应该怎么设置?

请给出复现步骤,包括但不限于paddleseg版本、使用模型、命令等,我来看一下

@gitleej
Copy link
Author

gitleej commented Jul 13, 2023

number of kernel weights does not match tensor dimensionscount of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1,请检查一下通道数

是模型的通道数和trt 加速max shape、min shape、opt shape要统一吗?或者max、min、opt shape的参数应该怎么设置?

请给出复现步骤,包括但不限于paddleseg版本、使用模型、命令等,我来看一下

  • paddleseg release/2.8
  • model:pp_liteseg
  • 命令:
    • 训练:
    python tools/train.py --config configs/pp_liteseg/pp_liteseg_stdc1_camvid_960x720_10k_for_test.yml --save_dir output/pp_liteseg_stdc1_camvid_960x720_10k_for_test --save_interval 1000 --num_workers 2 --do_eval --use_vdl
    • 导出模型
    python tools/export.py --config configs/pp_liteseg/pp_liteseg_stdc1_camvid_960x720_10k_for_test.yml --model_path output/pp_liteseg_stdc1_camvid_960x720_10k_for_test/best_model/model.pdparams --save_dir output/infer_model/pp_liteseg_stdc1_camvid_960x720_10k_for_test

@gitleej
Copy link
Author

gitleej commented Jul 13, 2023

number of kernel weights does not match tensor dimensionscount of 72 weights in kernel, but kernel dimensions (3,3) with 10 input channels, 2 output channels and 1 groups were specified. Expected Weights count is 10 * 3*3 * 2 / 1,请检查一下通道数

是模型的通道数和trt 加速max shape、min shape、opt shape要统一吗?或者max、min、opt shape的参数应该怎么设置?

请给出复现步骤,包括但不限于paddleseg版本、使用模型、命令等,我来看一下

  • paddleseg release/2.8

  • model:pp_liteseg

  • 命令:

    • 训练:
    python tools/train.py --config configs/pp_liteseg/pp_liteseg_stdc1_camvid_960x720_10k_for_test.yml --save_dir output/pp_liteseg_stdc1_camvid_960x720_10k_for_test --save_interval 1000 --num_workers 2 --do_eval --use_vdl
    • 导出模型
    python tools/export.py --config configs/pp_liteseg/pp_liteseg_stdc1_camvid_960x720_10k_for_test.yml --model_path output/pp_liteseg_stdc1_camvid_960x720_10k_for_test/best_model/model.pdparams --save_dir output/infer_model/pp_liteseg_stdc1_camvid_960x720_10k_for_test

问题解决了:
根据这里#2679 (comment) 导出dynamic_shape.pbtxt即可解决问题。

#导出模型
python tools/export.py --config configs/pp_liteseg/pp_liteseg_stdc1_medicine_board_840x450_10k_for_test.yml --model_path output/pp_liteseg_stdc1_medicine_board_840x450_10k_for_test_lr_01/best_model/model.pdparams --save_dir output/infer_model/pp_liteseg_stdc1_medicine_board_840x450_10k_for_test_lr_01
#导出dynamic_shape.pbtxt
python deploy/python/collect_dynamic_shape.py --config output/infer_model/pp_liteseg_stdc1_medicine_board_840x450_10k_for_test_lr_01/deploy.yaml --image_path data/02-Medicine_Board/JPEGImages/10.bmp --dynamic_shape_path output/infer_model/pp_liteseg_stdc1_medicine_board_840x450_10k_for_test_lr_01/dynamic_shape.pbtxt

C++推理时,命令行参数加上

--use_trt --use_dynamic_shape --dynamic_shape_path=path/to/dynamic_shape.pbtxt

@ToddBear
Copy link
Collaborator

以上回答已经充分解答了问题,如果有新的问题欢迎随时提交issue,或者在此条issue下继续回复~
我们开启了飞桨套件的ISSUE攻关活动,欢迎感兴趣的开发者参加:PaddlePaddle/PaddleOCR#10223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoodFirstIssue question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants