Closed xiegegege closed 5 years ago
能问下,你的ctc模型能训练吗,或者在哪里修改了,我用attention训练后预测也是出现的一模一样的错误,paddle我用的1.4.1,python3.7
@L-lei https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/ocr_recognition/infer.py#L3 这一行需要加上get_ctc_feeder_for_infer
第2个错是因为beam size == 2的情况,网络配置有问题。建议先设置beam size为1.
非常感谢,attention错误成功解决了,
用ctc网络训练出现下面的错误,请问您有遇到吗
Python Callstacks:
File "D:\develop\Python\Python37\lib\site-packages\paddle\fluid\framework.py", line 1654, in append_op
attrs=kwargs.get("attrs", None))
File "D:\develop\Python\Python37\lib\site-packages\paddle\fluid\layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "D:\develop\Python\Python37\lib\site-packages\paddle\fluid\layers\nn.py", line 5230, in warpctc
'use_cudnn': use_cudnn
File "G:\project\paddlepaddle\test\ocr_lpr\crnn_ctc_model.py", line 188, in ctc_train_net
input=fc_out, label=label, blank=num_classes, norm_by_times=True)
File "G:/project/paddlepaddle/test/ocr_lpr/train.py", line 80, in train
args, data_shape, num_classes)
File "G:/project/paddlepaddle/test/ocr_lpr/train.py", line 236, in main
train(args)
File "G:/project/paddlepaddle/test/ocr_lpr/train.py", line 240, in
用ctc网络训练出现下面的错误,请问您有遇到吗 Python Callstacks: File "D:\develop\Python\Python37\lib\site-packages\paddle\fluid\framework.py", line 1654, in append_op attrs=kwargs.get("attrs", None)) File "D:\develop\Python\Python37\lib\site-packages\paddle\fluid\layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "D:\develop\Python\Python37\lib\site-packages\paddle\fluid\layers\nn.py", line 5230, in warpctc 'use_cudnn': use_cudnn File "G:\project\paddlepaddle\test\ocr_lpr\crnn_ctc_model.py", line 188, in ctc_train_net input=fc_out, label=label, blank=num_classes, norm_by_times=True) File "G:/project/paddlepaddle/test/ocr_lpr/train.py", line 80, in train args, data_shape, num_classes) File "G:/project/paddlepaddle/test/ocr_lpr/train.py", line 236, in main train(args) File "G:/project/paddlepaddle/test/ocr_lpr/train.py", line 240, in main() File "D:\develop\IntelliJ IDEA 2018.2\myplugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:\develop\IntelliJ IDEA 2018.2\myplugins\python\helpers\pydev\pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "D:\develop\IntelliJ IDEA 2018.2\myplugins\python\helpers\pydev\pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "D:\develop\IntelliJ IDEA 2018.2\myplugins\python\helpers\pydev\pydevd.py", line 1664, in main() C++ Callstacks: Tensor holds the wrong type, it holds 3 at [D:\1.4.1\paddle\paddle/fluid/framework/tensor_impl.h:42] PaddlePaddle Call Stacks:
warpctc op的某个输入类型不对
我感觉很疑惑,一般来说,错误类型是这样的,向Tensor holds the wrong type, it holds int at,但是这里是‘3’,完全不能理解,输入数据reader中是正常的,所以就是crnn_ctc_model网络哪里出的问题
你确认下你的label的类型?是int64,还是 int32?
1.ctc模型预测报错: Traceback (most recent call last): File "infer.py", line 153, in
main()
File "infer.py", line 149, in main
inference(args)
File "infer.py", line 34, in inference
get_feeder_data = get_ctc_feeder_for_infer
NameError: name 'get_ctc_feeder_for_infer' is not defined
2.attention模型预测报错:
Traceback (most recent call last):
File "infer.py", line 153, in
main()
File "infer.py", line 149, in main
inference(args)
File "infer.py", line 93, in inference
return_numpy=False)
File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/executor.py", line 565, in run
use_program_cache=use_program_cache)
File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/executor.py", line 642, in _run
exe.run(program.desc, scope, 0, True, True, fetch_var_name)
paddle.fluid.core.EnforceNotMet: Invoke operator sequence_expand error.
Python Callstacks:
File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/framework.py", line 1654, in append_op
attrs=kwargs.get("attrs", None))
File "/opt/_internal/cpython-3.6.0/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 "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/layers/nn.py", line 3940, in sequence_expand
attrs={'ref_level': ref_level})
File "/ssd1/xiege/model/models-develop/PaddleCV/ocr_recognition/attention_model.py", line 218, in simple_attention
x=decoder_state_proj, y=encoder_proj)
File "/ssd1/xiege/model/models-develop/PaddleCV/ocr_recognition/attention_model.py", line 279, in attention_infer
decoder_size)
File "infer.py", line 44, in inference
ids = infer(images, num_classes, use_cudnn=True if args.use_gpu else False)
File "infer.py", line 149, in main
inference(args)
File "infer.py", line 153, in
main()
C++ Callstacks:
Enforce failed. Expected x_dims[0] == static_cast(y_lod[ref_level].size()) - 1, but received x_dims[0]:2 != static_cast(y_lod[ref_level].size()) - 1:1.
When Input(X)'s lod is null, the dims[0] of Input(X) should match the size of Input(Y)'s referred level lod. at [/paddle/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc:76]