clovaai / deep-text-recognition-benchmark

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

ValueError: num_samples should be a positive integer value, but got num_samples=0 #176

Open Amithvassit opened 4 years ago

Amithvassit commented 4 years ago

train.py --train_data lmdb_dataset/training --valid_data lmdb_dataset/valid --Transformation TPS --FeatureExtraction ResNet --SequenceModeling BiLSTM --Prediction Attn Filtering the images containing characters which are not in opt.character Filtering the images whose label is longer than opt.batch_max_length

dataset_root: lmdb_dataset/training opt.select_data: / opt.batch_ratio: 1

dataset_root: lmdb_dataset/training dataset: / Namespace(FT=False, FeatureExtraction='ResNet', PAD=False, Prediction='Attn', SequenceModeling='BiLSTM', Transformation='TPS', adam=False, batch_max_length=25, batch_ratio='1', batch_size=192, beta1=0.9, character='0123456789abcdefghijklmnopqrstuvwxyz', data_filtering_off=False, eps=1e-08, experiment_name='TPS-ResNet-BiLSTM-Attn-Seed1111', grad_clip=5, hidden_size=256, imgH=32, imgW=100, input_channel=1, lr=1, manualSeed=1111, num_fiducial=20, num_gpu=0, num_iter=300000, output_channel=512, rgb=False, rho=0.95, saved_model='', select_data='/', sensitive=False, total_data_usage_ratio='1.0', train_data='lmdb_dataset/training', valInterval=2000, valid_data='lmdb_dataset/valid', workers=4) sub-directory: /train num samples: 0 num total samples of /: 0 x 1.0 (total_data_usage_ratio) = 0 num samples of / per batch: 192 x 1.0 (batch_ratio) = 192 Traceback (most recent call last): File "C:\Users\amith\Desktop\Train\deep-text-recognition-benchmark-master\train.py", line 316, in train(opt) File "C:\Users\amith\Desktop\Train\deep-text-recognition-benchmark-master\train.py", line 32, in train train_dataset = Batch_Balanced_Dataset(opt) File "C:\Users\amith\Desktop\Train\deep-text-recognition-benchmark-master\dataset.py", line 67, in init collate_fn=_AlignCollate, pin_memory=True) File "C:\Users\amith\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 213, in init sampler = RandomSampler(dataset) File "C:\Users\amith\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\sampler.py", line 94, in init "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integer value, but got num_samples=0

Amithvassit commented 4 years ago

Please help me

2113vm commented 4 years ago

It can be helpful https://github.com/clovaai/deep-text-recognition-benchmark/issues/186

projectz-ali commented 2 years ago

In that case, you need to adjust your characters. If you have an unused character in your character args, it will simply throw this error. Make sure that you put only the characters in opt.characters string that are being used in your dataset. For example if your characters are 'abcde' and there are no samples in ground truth that has 'e' in the dataset it will throw this error. In that case change your opt.character string to 'abcd'. Good Luck...!