Jyouhou / ICDAR2019-ArT-Recognition-Alchemy

PKU Team Zero's code for participation in ICDAR2019 ArT Recognition track (Champion)
MIT License
220 stars 67 forks source link

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

Closed 13438960761 closed 2 years ago

13438960761 commented 5 years ago

Have the below error when i use the Rectotal data set to train , could you please give me advice to fix it ? thanks very much.

[2019-09-16 03:31:53]   Evaluation: [1091/1101] Time 0.030 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:53]   Evaluation: [1092/1101] Time 0.027 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:53]   Evaluation: [1093/1101] Time 0.026 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:54]   Evaluation: [1094/1101] Time 0.026 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:54]   Evaluation: [1095/1101] Time 0.027 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:54]   Evaluation: [1096/1101] Time 0.026 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:54]   Evaluation: [1097/1101] Time 0.025 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:54]   Evaluation: [1098/1101] Time 0.026 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:54]   Evaluation: [1099/1101] Time 0.026 (0.029)  Data 0.000 (0.000)  
[2019-09-16 03:31:54]   Evaluation: [1100/1101] Time 0.026 (0.029)  Data 0.000 (0.000)  
Traceback (most recent call last):
  File "/home/kv/workspace/ICDAR2019-ArT-Recognition-Alchemy-master/examples/main.py", line 271, in <module>
    main(args)
  File "/home/kv/workspace/ICDAR2019-ArT-Recognition-Alchemy-master/examples/main.py", line 244, in main
    dataset=test_dataset)
  File "/home/kv/workspace/ICDAR2019-ArT-Recognition-Alchemy-master/Source/evaluators.py", line 61, in evaluate
    output_dict = self._forward(input_dict)
  File "/home/kv/workspace/ICDAR2019-ArT-Recognition-Alchemy-master/Source/evaluators.py", line 189, in _forward
    output_dict = self.model(input_dict)
  File "/home/kv/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/kv/anaconda3/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 141, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/home/kv/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/kv/workspace/ICDAR2019-ArT-Recognition-Alchemy-master/Source/models/RectificationBaseline.py", line 107, in forward
    [rectified_feat, rec_targets, rec_lengths])
  File "/home/kv/workspace/ICDAR2019-ArT-Recognition-Alchemy-master/Source/models/attention_recognition_head.py", line 61, in sample
    encoder_feats = self.encoder(x)
  File "/home/kv/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/kv/workspace/ICDAR2019-ArT-Recognition-Alchemy-master/Source/models/recognition_subnet.py", line 112, in forward
    cnn_feat = cnn_feat.transpose(2, 1)
RuntimeError: Dimension out of range (expected to be in range of [-2, 1], but got 2)
13438960761 commented 5 years ago

HI author: i fix the above error and can run, but the accuracy always 0.0, could you please advise how to change the situation? thanks.

[2019-09-16 10:02:46]   Evaluation: [130/138]   Time 0.042 (0.048)  Data 0.000 (0.003)  
[2019-09-16 10:02:46]   Evaluation: [131/138]   Time 0.042 (0.047)  Data 0.000 (0.002)  
[2019-09-16 10:02:46]   Evaluation: [132/138]   Time 0.042 (0.047)  Data 0.000 (0.002)  
[2019-09-16 10:02:47]   Evaluation: [133/138]   Time 0.041 (0.047)  Data 0.000 (0.002)  
[2019-09-16 10:02:47]   Evaluation: [134/138]   Time 0.043 (0.047)  Data 0.000 (0.002)  
[2019-09-16 10:02:47]   Evaluation: [135/138]   Time 0.042 (0.047)  Data 0.000 (0.002)  
[2019-09-16 10:02:47]   Evaluation: [136/138]   Time 0.043 (0.047)  Data 0.000 (0.002)  
[2019-09-16 10:02:47]   Evaluation: [137/138]   Time 0.045 (0.047)  Data 0.000 (0.002)  
[2019-09-16 10:02:47]   Evaluation: [138/138]   Time 0.035 (0.047)  Data 0.000 (0.002)  
lexicon0: accuracy: 0.000

 * Finished iters 10000  accuracy:  0.0%  **best:  0.1%**
PkuDavidGuan commented 5 years ago

Do you use RecTotal only or RecTotal&SynthText as the training set?

13438960761 commented 5 years ago

yes, no synth text,only rectotal data. I am confused for the problem.------------------ 原始邮件 ------------------ 发件人: "Yushuo Guan"notifications@github.com 发送时间: 2019年9月17日(星期二) 上午10:38 收件人: "Jyouhou/ICDAR2019-ArT-Recognition-Alchemy"ICDAR2019-ArT-Recognition-Alchemy@noreply.github.com; 抄送: "13438960761"404262186@qq.com;"Author"author@noreply.github.com; 主题: Re: [Jyouhou/ICDAR2019-ArT-Recognition-Alchemy] RuntimeError:Dimension out of range (expected to be in range of [-2, 1], but got 2) (#8)

Do you use RecTotal only or RecTotal&SynthText as the training set?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

13438960761 commented 5 years ago

yes, no synth text,only rectotal data. I am confused for the problem

PkuDavidGuan commented 5 years ago

You need to use synthetic data to pretrain the model. RecTotal only is not enough to train a recognition model.

Jyouhou commented 5 years ago

It is weird that it printed something like "Evaluation: [1095/1101]". Did you change the batch size?

@PkuDavidGuan is right. Training on such a small dataset may give unstable and unreliable results.

May I know your training setting?