Open Lie-huo opened 3 years ago
CPU下运行出现上面的问题
试试这个https://blog.csdn.net/qq_35668469/article/details/108081044
试试这个https://blog.csdn.net/qq_35668469/article/details/108081044
大佬,您实现的模型目前只支持["其他", "代码", "号码", "车牌号", "日期", "上车", "下车", "单价", "里程", "金额"] 这几个吗,如果想要支持更多的话,是不是得自己再训练?还有一个问题是您在博客里的“数据增广”的小节的图,框中的数字是什么意思呢,这个图是怎么做出来的呢
我提供的是一个工具,根据自己业务场景改就行。你这个问题太多,可以加我微信聊13212101005
File "", line 1, in
text_hidden = processing_text(text_list[:max_len])
File "", line 103, in processing_text
out = rnn_infer.predict(label_list)
File "C:\Users\shiqiang42\Desktop\seq2seq-layout-analysis-main\seq2seq-layout-analysis-main\rnn_infer.py", line 46, in predict types, hidden = model(input_tensor)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, **kwargs)
File "C:\Users\shiqiang42\Desktop\seq2seq-layout-analysis-main\seq2seq-layout-analysis-main\models\TextRNN.py", line 44, in forward emb = self.embedding(x)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, **kwargs)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\modules\sparse.py", line 114, in forward self.norm_type, self.scale_grad_by_freq, self.sparse)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\functional.py", line 1724, in embedding return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.IntTensor instead (while checking arguments for embedding)
text_hidden = processing_text(int(text_list[:max_len])) Traceback (most recent call last):
File "", line 1, in
text_hidden = processing_text(int(text_list[:max_len]))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
text_hidden = processing_text(text_list[:max_len]) Traceback (most recent call last):
File "", line 1, in
text_hidden = processing_text(text_list[:max_len])
File "", line 103, in processing_text
out = rnn_infer.predict(label_list)
File "C:\Users\shiqiang42\Desktop\seq2seq-layout-analysis-main\seq2seq-layout-analysis-main\rnn_infer.py", line 46, in predict types, hidden = model(input_tensor)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, **kwargs)
File "C:\Users\shiqiang42\Desktop\seq2seq-layout-analysis-main\seq2seq-layout-analysis-main\models\TextRNN.py", line 44, in forward emb = self.embedding(x)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, **kwargs)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\modules\sparse.py", line 114, in forward self.norm_type, self.scale_grad_by_freq, self.sparse)
File "D:\software\anaconda3\envs\ocr\lib\site-packages\torch\nn\functional.py", line 1724, in embedding return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.IntTensor instead (while checking arguments for embedding)