SRN推理错误
Created by: YasinZhao
python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words_en/word_336.png" --rec_model_dir="./inference/srn/" --rec_image_shape="3, 32, 100" --rec_char_type="en" --rec_algorithm="SRN"
C++ Call Stacks (More useful to developers):
0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const*, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const*, int) 2 paddle::operators::ReshapeOp::ValidateShape(std::vector<int, std::allocator >, paddle::framework::DDim const&) 3 paddle::operators::ReshapeOp::InferShape(paddle::framework::InferShapeContext*) const 4 paddle::operators::Reshape2Op::InferShape(paddle::framework::InferShapeContext*) const 5 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const 6 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const 7 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&) 8 paddle::framework::NaiveExecutor::Run() 9 paddle::AnalysisPredictor::Run(std::vector<paddle::PaddleTensor, std::allocatorpaddle::PaddleTensor > const&, std::vector<paddle::PaddleTensor, std::allocatorpaddle::PaddleTensor >*, int)
Python Call Stacks (More useful to users):
File "/root/miniconda3/envs/face_detect/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2610, in append_op attrs=kwargs.get("attrs", None)) File "/root/miniconda3/envs/face_detect/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/envs/face_detect/lib/python3.6/site-packages/paddle/fluid/layers/nn.py", line 7440, in reshape "XShape": x_shape}) File "/app/ocr/PaddleOCR-0918/ppocr/modeling/heads/rec_srn_all_head.py", line 44, in pvam conv_features = fluid.layers.reshape(x=inputs, shape=[-1, c, h * w]) File "/app/ocr/PaddleOCR-0918/ppocr/modeling/heads/rec_srn_all_head.py", line 218, in call pvam_features = self.pvam(inputs, others) File "/app/ocr/PaddleOCR-0918/ppocr/modeling/architectures/rec_model.py", line 193, in call predicts = self.head(conv_feas, labels, mode) File "/app/ocr/PaddleOCR-0918/tools/program.py", line 214, in build_export image, others, outputs = model(mode='export') File "tools/export_model.py", line 51, in main config, eval_program, startup_prog) File "tools/export_model.py", line 75, in main()
Error Message Summary:
InvalidArgumentError: The 'shape' attribute in ReshapeOp is invalid. The input tensor X'size must be divisible by known capacity of 'shape'. But received X's shape = [1, 512, 4, 13], X's size = 26624, 'shape' is [-1, 512, 256], known capacity of 'shape' is -131072. [Hint: Expected output_shape[unk_dim_idx] * capacity == -in_size, but received output_shape[unk_dim_idx] * capacity:0 != -in_size:-26624.] at (/paddle/paddle/fluid/operators/reshape_op.cc:192) [operator < reshape2 > error] 2020-09-18 16:58:06,739-INFO: ERROR!!!! Please read the FAQ:https://github.com/PaddlePaddle/PaddleOCR#faq If your model has tps module: TPS does not support variable shape. Please set --rec_image_shape='3,32,100' and --rec_char_type='en'
老师,你好,我在测试SRN的推理模型时,报上述错误,请问这是什么原因呢?推理模型就是你们发布的预训练模型转换过来的。