bear63 / sceneReco

ctpn+crnn Scene character recognition
943 stars 371 forks source link

RuntimeError: dimension out of range (expected to be in range of [-2, 1], but got 2) #24

Open ycp007 opened 7 years ago

ycp007 commented 7 years ago

When I input 21.bmp, I got an error: please input file name:21.bmp Traceback (most recent call last): File "demo.py", line 23, in crnnRec(model,converter,img,text_recs) File "/home/ycp/sceneReco-master/crnnport.py", line 78, in crnnRec preds = preds.squeeze(2) File "/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py", line 750, in squeeze return Squeeze.apply(self, dim) File "/usr/local/lib/python2.7/dist-packages/torch/autograd/_functions/tensor.py", line 378, in forward result = input.squeeze(dim) RuntimeError: dimension out of range (expected to be in range of [-2, 1], but got 2)

bear63 commented 7 years ago

preds = preds.squeeze(2)

delete preds = preds.squeeze(2) I also encountered this problem on different computers

liurongfang commented 6 years ago

@bear63 thank you,this is ok