captcha_recognize icon indicating copy to clipboard operation
captcha_recognize copied to clipboard

TypeError: object of type 'zip' has no len()

Open sbshukla opened this issue 6 years ago • 4 comments

Copying the exact error while running captcha_records.py

(tensorenviron) C:\Work\captcha_recognize-master>python captcha_records.py Looking for images in './data/train_data'

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 "C:\Users\User\AppData\Local\Continuum\anaconda2\envs\tensorenviron\lib\site-packages\tensorflow\python\platform\app.py", line 125, 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 55, in conver_to_tfrecords num_examples = len(data_set) TypeError: object of type 'zip' has no len()

sbshukla avatar Dec 13 '18 07:12 sbshukla

you can rewrite it as: .................................................. #num_examples = len(data_set) for image,label in data_set: #image = data_set[index][0] height = image.shape[0] width = image.shape[1] image_raw = image.tostring() #label = data_set[index][1] ........................................................................

ireqhawk avatar Mar 05 '19 08:03 ireqhawk

I had met the same problem. I sovled it successfully by using the function: list(): ...... data_set = list(data_set) # just add this line num_examples = len(data_set) ......

tomorrow1pan avatar Mar 18 '19 07:03 tomorrow1pan

I tried to solve the error by these suggestion but it didnt work. Do you have any soloution?

thanks in advanced

mnwato avatar Oct 06 '20 13:10 mnwato

Hi @mnwato

check my fork. it works perfectly with Python 3.10, TF 2.10.0, NP 1.23.4

SecurityEnthusiast avatar Nov 07 '22 19:11 SecurityEnthusiast