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

Training with custom font #385

Open SiVy1 opened 1 year ago

SiVy1 commented 1 year ago

It's my first time with something like this and I don't know what am I doing wrong. I have data folder with gt.txt and inside it folder images with images my gt.txt looks like this:

./data/images/1.jpg\t(some text on image)\n ./data/images/2.jpg\t(some text on image)

So after run create_imbd it create this two files data.mdb and lock.mdb. Data.mdb have about 1GB so I dont think I do something wrong before. Now I think its time for training I create two dict val and train and they are empty. I run train.py by this command

python train.py --select_data .\result\data.mdb --train_data .\train --Transformat ion None --FeatureExtraction VGG --SequenceModeling BiLSTM --Prediction CTC --data_filtering_off --workers 0 --valid_data .\val

and in return i get error

'__SingleProcessDataLoaderIter' object has no attribute 'next'

What am I doing wrong. I read multiple times threade #174 and threads connected to it and still dont get answer.

SiVy1 commented 1 year ago

So I solved the problem, it was quite simple, but then I didn't think about it anymore, I spent some time with it and already you can say I gave up, but I looked at it after time and all I had to do was change in 87 line in dataset.py to image, text = next(data_loader_iter) and 91 line to image, text = next(self.dataloader_iter_list[i])

And if someone want to create custom font after you create lmdb, you have to create folders train/result and validation/result and copy there data.mdb and lock.mdb then run command python3 train.py --train_data train/result --valid_data valid/result --Transformation None --FeatureExtract ion VGG --SequenceModeling BiLSTM --Prediction CTC --workers 0 --data_filtering_off but before do things in this