captcha_recognize icon indicating copy to clipboard operation
captcha_recognize copied to clipboard

Substring not found / Index out of bounds

Open moermann opened this issue 7 years ago • 3 comments

Writing ./data/train.tfrecords Traceback (most recent call last): File "captcha_records.py", line 123, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "~/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "captcha_records.py", line 102, in main conver_to_tfrecords(training_data, TRAIN_FILE) File "captcha_records.py", line 62, in conver_to_tfrecords label_raw = label_to_one_hot(label).tostring() File "captcha_records.py", line 42, in label_to_one_hot index.append(CHAR_SETS.index(c)) ValueError: substring not found

Before adding _1 to all of my training captchas I've got this error:

Traceback (most recent call last): File "captcha_records.py", line 123, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "~/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "captcha_records.py", line 102, in main conver_to_tfrecords(training_data, TRAIN_FILE) File "captcha_records.py", line 62, in conver_to_tfrecords label_raw = label_to_one_hot(label).tostring() File "captcha_records.py", line 44, in label_to_one_hot one_hot_label[one_hot_index] = 1.0 IndexError: index 5 is out of bounds for axis 0 with size 5

moermann avatar Mar 16 '18 17:03 moermann

I had the same issue. Check config.py file and make sure that IMAGE_HEIGHT, IMAGE_WIDTH and CHAR_SETS fits your Dataset needs. Otherwise, It will crash trying to read your dataset images under an unexpected resolution.

EzequielAdrianM avatar Mar 18 '18 06:03 EzequielAdrianM

@EzequielAdrianM And how are your filenames like? Image width and height are correct, CHARS_NUM = 6, but the script just doesn't want to process 2BFG6C_1.jpg!

moermann avatar Mar 19 '18 11:03 moermann

@moermann Hi,I had the same issue. Maybe you can check CHAR_SETS in config.py and you'll find there is a O lost ,just add O here and try again.

T-Evan avatar Mar 27 '18 17:03 T-Evan