BADBADBADBOY / pytorchOCR

基于pytorch的ocr算法库,包括 psenet, pan, dbnet, sast , crnn
671 stars 132 forks source link

IndexError: list index out of range #1

Closed kszqq closed 4 years ago

kszqq commented 4 years ago

When I train, there is an error in the code:

Traceback (most recent call last): File "det_train.py", line 259, in TrainValProgram(config) File "det_train.py", line 145, in TrainValProgram train_dataset = create_module(config['trainload']['function'])(config) File "/home/z/liao/pytorchOCR-master/ptocr/dataloader/DetLoad/PANProcess.py", line 23, in init img_list, label_list = self.get_base_information(config['trainload']['train_file']) File "/home/z/liao/pytorchOCR-master/ptocr/dataloader/DetLoad/PANProcess.py", line 63, in get_base_information result = self.get_bboxes(line[1]) IndexError: list index out of range

What is the reason? Could the author please answer it?

kszqq commented 4 years ago

thank you very much

---Original--- From: "BADBADBADBOY"<notifications@github.com> Date: Thu, Sep 17, 2020 19:22 PM To: "BADBADBADBOY/pytorchOCR"<pytorchOCR@noreply.github.com>; Cc: "Author"<author@noreply.github.com>;"kszqq"<731891448@qq.com>; Subject: Re: [BADBADBADBOY/pytorchOCR] IndexError: list index out of range (#1)

https://github.com/BADBADBADBOY/pytorchOCR/blob/master/data/example/train_list.txt , Is your train_list.txt the same as this one, separated by \t in the middle

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

BADBADBADBOY commented 4 years ago

When I train, there is an error in the code:

Traceback (most recent call last): File "det_train.py", line 259, in TrainValProgram(config) File "det_train.py", line 145, in TrainValProgram train_dataset = create_module(config['trainload']['function'])(config) File "/home/z/liao/pytorchOCR-master/ptocr/dataloader/DetLoad/PANProcess.py", line 23, in init img_list, label_list = self.get_base_information(config['trainload']['train_file']) File "/home/z/liao/pytorchOCR-master/ptocr/dataloader/DetLoad/PANProcess.py", line 63, in get_base_information result = self.get_bboxes(line[1]) IndexError: list index out of range

What is the reason? Could the author please answer it?

https://github.com/BADBADBADBOY/pytorchOCR/blob/master/data/example/train_list.txt , Is your train_list.txt the same as this one, separated by \t in the middle

BADBADBADBOY commented 4 years ago

After that, I will update some more detailed training documents

kszqq commented 4 years ago

@BADBADBADBOY What is train_list.txt in your CRNN training? Can you give me an example?

BADBADBADBOY commented 4 years ago

example:img_path+label, such as /src/notebooks/train/1,jpg hello , separated by \t in the middle

kszqq commented 4 years ago

thank you very much!

kszqq commented 4 years ago

@BADBADBADBOY When running rec_train.py, does the author have the following errors: Training from scratch.

Traceback (most recent call last): File "rec_train.py", line 219, in TrainValProgram(config) File "rec_train.py", line 186, in TrainValProgram loss_write = ModelTrain(train_data_loader,LabelConverter, model, criterion, optimizer, loss_bin, config, epoch) File "rec_train.py", line 51, in ModelTrain loss = criterion(pre_batch, gt_batch) File "/home/z/anaconda3/envs/chinese-ocr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, kwargs) File "/home/z/liao/pytorchOCR-master/ptocr/model/architectures/rec_model.py", line 42, in forward return self.loss(pre_batch, gt_batch) File "/home/z/anaconda3/envs/chinese-ocr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, *kwargs) File "/home/z/liao/pytorchOCR-master/ptocr/model/loss/ctc_loss.py", line 12, in forward loss = self.criterion(preds, labels, preds_size, labels_len) File "/home/z/anaconda3/envs/chinese-ocr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(input, kwargs) File "/home/z/anaconda3/envs/chinese-ocr/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 1295, in forward self.zero_infinity) File "/home/z/anaconda3/envs/chinese-ocr/lib/python3.6/site-packages/torch/nn/functional.py", line 1767, in ctc_loss zero_infinity)

RuntimeError: Tensor for argument #2'targets' is on CPU, but expected it to be on GPU (while checking arguments for ctc_loss_gpu)