PatrickLib / captcha_recognize

Image Recognition captcha without image segmentation 无需图片分割的验证码识别
Apache License 2.0
554 stars 173 forks source link

Substring not found / Index out of bounds #13

Open moermann opened 6 years ago

moermann commented 6 years ago

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

EzequielAdrianM commented 6 years ago

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.

moermann commented 6 years ago

@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!

T-Evan commented 6 years ago

@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.