deep-text-recognition-benchmark icon indicating copy to clipboard operation
deep-text-recognition-benchmark copied to clipboard

please help my code {ValueError: num_samples should be a positive integer value, but got num_samples=0}

Open Doracoon opened this issue 4 years ago • 4 comments

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: data_lmdb/training opt.select_data: ['/'] opt.batch_ratio: ['1']

dataset_root: data_lmdb/training dataset: / sub-directory: /. 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 "train.py", line 317, in train(opt) File "train.py", line 31, in train train_dataset = Batch_Balanced_Dataset(opt) File "/content/drive/My Drive/deep-text-recognition-benchmark/dataset.py", line 67, in init collate_fn=_AlignCollate, pin_memory=True) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 224, in init sampler = RandomSampler(dataset, generator=generator) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/sampler.py", line 96, 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

i dont know why... i changed batch_raio, select_data, character default in train.py

Doracoon avatar Aug 11 '20 13:08 Doracoon

Maybe you should check the your data path, and make sure the data in a right way. By the way, do you have any interest to take a look at our STR toolbox vedastr?

ChaseMonsterAway avatar Aug 14 '20 06:08 ChaseMonsterAway

Did you solve this problem? I have the same question, if you have solved this, could you tell me how to solve it? Thanks!

youngsirsk avatar Jun 22 '21 09:06 youngsirsk

It is a filtering issue. Just turn it off by --data_filtering_off when training

ceyxasm avatar Sep 21 '22 09:09 ceyxasm

add " --data_filtering_off --workers 0", it will solve your problem.

Chen-chang-yu avatar Jan 22 '24 01:01 Chen-chang-yu