TypeError: object of type 'numpy.int32' has no len()
vinayakarannil opened this issue · comments
When i run testing i get the below error
(vinayak) C:\Users\vinayak\Documents\github\CRNN-1\CRNN>python run.py -ex ../sam
ples --test --restore
Restoring
Checkpoint is valid
0
Loading data
examples 10
Traceback (most recent call last):
File "run.py", line 118, in
main()
File "run.py", line 111, in main
args.restore
File "C:\Users\vinayak\Documents\github\CRNN-1\CRNN\crnn.py", line 53, in in
it
self.__data_manager = DataManager(batch_size, model_path, examples_path, max
_image_width, train_test_ratio, self.__max_char_count)
File "C:\Users\vinayak\Documents\github\CRNN-1\CRNN\data_manager.py", line 26,
in init
self.test_batches = self.__generate_all_test_batches()
File "C:\Users\vinayak\Documents\github\CRNN-1\CRNN\data_manager.py", line 108
, in __generate_all_test_batches
(-1)
File "C:\Users\vinayak\Documents\github\CRNN-1\CRNN\utils.py", line 17, in spa
rse_tuple_from
indices.extend(zip([n]*len(seq), [i for i in range(len(seq))]))
TypeError: object of type 'numpy.int32' has no len()
The images in the samples/ folder are the images displayed in the README.md, not valid testing examples as they do not have a ground truth in the filename.
You can use this dataset to test https://node1.belval.org/test_dataset.zip or generate a new one using https://github.com/Belval/TextRecognitionDataGenerator.
i found a workaround. I commented sparse_tuple_from call from __generate_all_test_batches and used only batch_x and batch_y to run test. Anyways we just need batch_x only to do the prediction.
And yes, i had modified the filenames in the samples folder
Thanks