Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substring not found / Index out of bounds #13

Open
moermann opened this issue Mar 16, 2018 · 3 comments
Open

Substring not found / Index out of bounds #13

moermann opened this issue Mar 16, 2018 · 3 comments

Comments

@moermann
Copy link

moermann commented Mar 16, 2018

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 moermann changed the title ValueError: substring not found Index out of bounds Mar 16, 2018
@moermann moermann changed the title Index out of bounds Substring not found / Index out of bounds Mar 16, 2018
@EzequielAdrianM
Copy link

EzequielAdrianM commented Mar 18, 2018

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
Copy link
Author

@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
Copy link

T-Evan commented Mar 27, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants