wolfib / image-classification-CIFAR10-tf

Simple Image Classification Models for the CIFAR-10 dataset using TensorFlow
MIT License
156 stars 124 forks source link

python 3.5 compatebility issue #1

Closed ToxidoLiu closed 7 years ago

ToxidoLiu commented 7 years ago

if you run the _two_layerfc.py in python 3.5 it will throw an error as

Traceback (most recent call last):
  File "D:/workspace/python_dir/tf-image-recognition/run_fc_model.py", line 66, in 
    batch = next(batches)
  File "D:\workspace\python_dir\tf-image-recognition\data_helpers.py", line 71, in gen_batch
    index = len(data)
TypeError: len() of unsized object 

Please ignore the line number coz I've changed the code a little bit.

And the error says the object created by zip() will no longer be 'Sized' so len() could not read its actual length. So I modified a little at

batches = data_helpers.gen_batch(list(zipped_data), FLAGS.batch_size, FLAGS.max_steps)
That will do the trick. Really liked your blog, I've read about both of the _How to Build a Simple Image Recognition System with TensorFlow_ series, those have been of great help. Hope to see more. Thanks
wolfib commented 7 years ago

Thank you!

I've implemented your bugfix. Also modified a few other lines to make the code compatible with Python 3.5.

Thanks a lot for the feedback! Hearing that my stuff is useful to others makes me very happy.