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

IndexError: tuple index out of range in convert_to #17

Closed
hajbabaeim opened this issue Apr 24, 2017 · 1 comment
Closed

IndexError: tuple index out of range in convert_to #17

hajbabaeim opened this issue Apr 24, 2017 · 1 comment

Comments

@hajbabaeim
Copy link

Dear @HamedMP ,
I use files in example folder for reading and convert images to tfrecords file. but, I have some errors:
I using grayscale transform, so my images are 2D array.
first, I had a "too many indices" error in line: validation_images = train_images[:FLAGS.validation_size, :, :, :]
and with changing [:FLAGS.validation_size, :, :, :] to [:FLAGS.validation_size] this worked well.
besides that, my other issue is "IndexError: tuple index out of range" in convert_to function( in line "rows = images.shape[1]").
I don't understand, why we are using "rows = images.shape[1]" whereas our images have different size and even more, they have no depth in grayscale version.

best,
MRHajbabaei.

@hajbabaeim
Copy link
Author

hajbabaeim commented Jun 4, 2017

I hope this gonna be useful for everyone who encounter with this problem:
if you use GrayScale images try to use : im = im[..., None] after : im = np.asarray(im, np.uint8)
for compatibility with RGB mode (channel=3).
and then u can change these lines to your code to get pic size:
rows = im_shape[0]
cols = im_shape[1]
depth = im_shape[2]

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

No branches or pull requests

2 participants