clovaai / deep-text-recognition-benchmark

Text recognition (optical character recognition) with deep learning methods, ICCV 2019
Apache License 2.0
3.77k stars 1.11k forks source link

AttributeError: '_MultiProcessingDataLoaderIter' object has no attribute 'next' #355

Closed krammnic closed 1 year ago

krammnic commented 2 years ago

PyTorch version: 1.13.0.dev20220810+cu116 Train command: python train.py --train_data data_lmdb_release/training/MJ/MJ_train --valid_data data_lmdb_release/training/MJ/MJ_valid --select_data MJ-MJ --batch_ratio 0.5-0.5 --Transformation TPS --FeatureExtraction ResNet --SequenceModeling BiLSTM --Prediction Attn Full log:

Traceback (most recent call last):
  File "/home/krammnic/PycharmProjects/yolov6/deep-text-recognition-benchmark/train.py", line 318, in <module>
    train(opt)
  File "/home/krammnic/PycharmProjects/yolov6/deep-text-recognition-benchmark/train.py", line 147, in train
    image_tensors, labels = train_dataset.get_batch()
  File "/home/krammnic/PycharmProjects/yolov6/deep-text-recognition-benchmark/dataset.py", line 88, in get_batch
    image, text = data_loader_iter.next()  # .next()
AttributeError: '_MultiProcessingDataLoaderIter' object has no attribute 'next'
scuxxs commented 2 years ago

I have the same issue

scuxxs commented 2 years ago

have you solved it?

jkwhuer commented 2 years ago

I would appreciate it if you could tell me how to solve this problem

import-max commented 1 year ago

This error is an error of next() function of Python. You should edit the details of dataset.py imported in train.py

#  line87
#                image, text = data_loader_iter.next()
                image, text = next(data_loader_iter)

#  line92
#                image, text = self.dataloader_iter_list[i].next()
                image, text = next(self.dataloader_iter_list[i])

data_loader_iter.next() ---> next(data_loader_iter)
self.dataloader_iter_list[i].next() ---> next(self.dataloader_iter_list[i])
HkDzl commented 1 year ago

data_loader_iter.next()--->next(data_loader_iter)