ocr识别模型部署时遇到Error: The width of each timestep in Input(Label) should be 1.
Created by: yanmeizhao
具体错误信息如下:
--- Running analysis [ir_graph_build_pass] --- Running analysis [ir_graph_clean_pass] --- Running analysis [ir_analysis_pass] --- Running IR pass [is_test_pass] --- Running IR pass [simplify_with_basic_ops_pass] --- Running IR pass [conv_affine_channel_fuse_pass] --- Running IR pass [conv_eltwiseadd_affine_channel_fuse_pass] --- Running IR pass [conv_bn_fuse_pass] --- Running IR pass [conv_eltwiseadd_bn_fuse_pass] I0218 13:31:01.658505 36056 graph_pattern_detector.cc:96] --- detected 8 subgraphs --- Running IR pass [multihead_matmul_fuse_pass] --- Running IR pass [fc_fuse_pass] I0218 13:31:01.665282 36056 graph_pattern_detector.cc:96] --- detected 2 subgraphs --- Running IR pass [fc_elementwise_layernorm_fuse_pass] --- Running IR pass [conv_elementwise_add_act_fuse_pass] I0218 13:31:01.667009 36056 graph_pattern_detector.cc:96] --- detected 8 subgraphs --- Running IR pass [conv_elementwise_add2_act_fuse_pass] --- Running IR pass [conv_elementwise_add_fuse_pass] --- Running IR pass [transpose_flatten_concat_fuse_pass] --- Running IR pass [runtime_context_cache_pass] --- Running analysis [ir_params_sync_among_devices_pass] I0218 13:31:01.671290 36056 ir_params_sync_among_devices_pass.cc:41] Sync params from CPU to GPU --- Running analysis [adjust_cudnn_workspace_size_pass] --- Running analysis [inference_op_replace_pass] --- Running analysis [memory_optimize_pass] I0218 13:31:01.678493 36056 memory_optimize_pass.cc:223] Cluster name : gru_0.tmp_0 size: 800 I0218 13:31:01.678519 36056 memory_optimize_pass.cc:223] Cluster name : gru_0.tmp_2 size: 800 I0218 13:31:01.678534 36056 memory_optimize_pass.cc:223] Cluster name : batch_norm_3.tmp_3 size: 3072 I0218 13:31:01.678550 36056 memory_optimize_pass.cc:223] Cluster name : batch_norm_1.tmp_3 size: 3072 I0218 13:31:01.678565 36056 memory_optimize_pass.cc:223] Cluster name : pixel size: 192 I0218 13:31:01.678618 36056 memory_optimize_pass.cc:223] Cluster name : fc_0.tmp_1 size: 2400 I0218 13:31:01.678634 36056 memory_optimize_pass.cc:223] Cluster name : gru_0.tmp_3 size: 800 --- Running analysis [ir_graph_to_program_pass] I0218 13:31:01.685699 36056 analysis_predictor.cc:470] ======= optimize end ======= I0218 13:31:01.685760 36056 naive_executor.cc:105] --- skip [feed], feed -> pixel I0218 13:31:01.686285 36056 naive_executor.cc:105] --- skip [gru_0.tmp_2], fetch -> fetch I0218 13:31:01.686311 36056 naive_executor.cc:105] --- skip [fc_0.tmp_1], fetch -> fetch I0218 13:31:01.686329 36056 naive_executor.cc:105] --- skip [batch_norm_1.tmp_3], fetch -> fetch W0218 13:31:01.996632 36056 device_context.cc:236] Please NOTE: device: 1, CUDA Capability: 61, Driver API Version: 10.0, Runtime API Version: 9.0 W0218 13:31:02.002913 36056 device_context.cc:244] device: 1, cuDNN Version: 7.6. terminate called after throwing an instance of 'paddle::platform::EnforceNotMet' what():
C++ Call Stacks (More useful to developers):
0 std::__cxx11::basic_string<char, std::char_traits, std::allocator > paddle::platform::GetTraceBackString<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&&, char const*, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, char const*, int) 2 paddle::operators::WarpCTCKernel<paddle::platform::CUDADeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const 3 std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CUDAPlace, false, 0ul, paddle::operators::WarpCTCKernel<paddle::platform::CUDADeviceContext, float> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1 (closed)}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) 4 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const 5 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const 6 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&) 7 paddle::framework::NaiveExecutor::Run() 8 paddle::AnalysisPredictor::ZeroCopyRun()
Python Call Stacks (More useful to users):
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2459, in append_op attrs=kwargs.get("attrs", None)) File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/layers/nn.py", line 7526, in warpctc 'norm_by_times': norm_by_times, File "/data/xxx/projects/models-1.6/models/PaddleCV/ocr_recognition/crnn_ctc_model.py", line 202, in ctc_train_net input=fc_out, label=label, blank=num_classes, norm_by_times=True) File "train.py", line 84, in train args, data_shape, num_classes) File "train.py", line 254, in main train(args) File "train.py", line 258, in main()
Error Message Summary:
Error: The width of each timestep in Input(Label) should be 1. [Hint: Expected label_dims[0] == label->numel(), but received label_dims[0]:48 != label->numel():9600.] at (/home/install/Paddle/paddle/fluid/operators/warpctc_op.h:170) [operator < warpctc > error] run_impl.sh: line 28: 36056 Aborted (core dumped) ./${DEMO_NAME}