AstarLight / Lets_OCR

A repository for OCR, which inlcudes some classical OCR algorithms Pytorch implementation such as CTPN, EAST and CRNN.
MIT License
656 stars 327 forks source link

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

Open ZhangZoffy opened 5 years ago

ZhangZoffy commented 5 years ago

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

ShangLe0607 commented 5 years ago

大神你好,能不能指教一下请问我训练的时候出现这问题是咋回事啊, [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 commented 5 years ago

大神你好,能不能指教一下请问我训练的时候出现这问题是咋回事啊, [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 commented 5 years ago

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

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

ZhangZoffy commented 5 years ago

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

ShangLe0607 commented 5 years ago

@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 commented 5 years ago

@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在编码上的区别