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

我用自己的训练集转lmdb,CRNN训练时loss都是20多,不收敛。我只识别数字和字母 #74

Open
ZhangZoffy opened this issue Oct 23, 2019 · 7 comments

Comments

@ZhangZoffy
Copy link

No description provided.

@ZhangZoffy
Copy link
Author

image
image
这是数据集,自己造的

@ShangLe0607
Copy link

大神你好,能不能指教一下请问我训练的时候出现这问题是咋回事啊,
[root@localhost crnn]# python3 train.py
Traceback (most recent call last):
File "train.py", line 2, in
from torch.nn.modules.loss import CTCLoss
ImportError: cannot import name 'CTCLoss' from 'torch.nn.modules.loss' (/usr/local/lib/python3.7/site-packages/torch/nn/modules/loss.py)
[root@localhost crnn]#

@ZhangZoffy
Copy link
Author

大神你好,能不能指教一下请问我训练的时候出现这问题是咋回事啊,
[root@localhost crnn]# python3 train.py
Traceback (most recent call last):
File "train.py", line 2, in
from torch.nn.modules.loss import CTCLoss
ImportError: cannot import name 'CTCLoss' from 'torch.nn.modules.loss' (/usr/local/lib/python3.7/site-packages/torch/nn/modules/loss.py)
[root@localhost crnn]#

安装warpctc吧,先降一下torch版本,我被这个问题坑了2天,降版本搞定

@ShangLe0607
Copy link

@ZhangZoffy 装了warpctc,torch版本降到了1.3.0,但是还报错

段错误(吐核),该怎么办呢

@ZhangZoffy
Copy link
Author

@ZhangZoffy 装了warpctc,torch版本降到了1.3.0,但是还报错
段错误(吐核),该怎么办呢
必须安装torch0.4.0版本,超过1.0的都不行

@ShangLe0607
Copy link

@ZhangZoffy 谢谢你,都装好了,还是会报错,是咋回事啊[0/20][20/282] Loss: 42.145580
[0/20][40/282] Loss: 19.428555
[0/20][60/282] Loss: 17.523825
[0/20][80/282] Loss: 16.701580
[0/20][100/282] Loss: 16.425825
[0/20][120/282] Loss: 16.065802
[0/20][140/282] Loss: 15.806343
[0/20][160/282] Loss: 15.621722
[0/20][180/282] Loss: 15.718269
[0/20][200/282] Loss: 15.642500
[0/20][220/282] Loss: 15.453972
[0/20][240/282] Loss: 15.550603
[0/20][260/282] Loss: 15.239004
Traceback (most recent call last):
File "train.py", line 165, in
cost = trainBatch(net, criterion, optimizer, train_iter)
File "train.py", line 76, in trainBatch
t, l = converter.encode(cpu_texts)
File "/opt/crnn/lib/convert.py", line 47, in encode
index = self.dict[char]
KeyError: '\ufeff'

@ZhangZoffy
Copy link
Author

@ZhangZoffy 谢谢你,都装好了,还是会报错,是咋回事啊[0/20][20/282] Loss: 42.145580
[0/20][40/282] Loss: 19.428555
[0/20][60/282] Loss: 17.523825
[0/20][80/282] Loss: 16.701580
[0/20][100/282] Loss: 16.425825
[0/20][120/282] Loss: 16.065802
[0/20][140/282] Loss: 15.806343
[0/20][160/282] Loss: 15.621722
[0/20][180/282] Loss: 15.718269
[0/20][200/282] Loss: 15.642500
[0/20][220/282] Loss: 15.453972
[0/20][240/282] Loss: 15.550603
[0/20][260/282] Loss: 15.239004
Traceback (most recent call last):
File "train.py", line 165, in
cost = trainBatch(net, criterion, optimizer, train_iter)
File "train.py", line 76, in trainBatch
t, l = converter.encode(cpu_texts)
File "/opt/crnn/lib/convert.py", line 47, in encode
index = self.dict[char]
KeyError: '\ufeff'

你这个应该是编码问题,py2和py3在编码上的区别

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants