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

Error for running, list index out of range #2

Open
andresvivancov opened this issue Jun 11, 2017 · 4 comments
Open

Error for running, list index out of range #2

andresvivancov opened this issue Jun 11, 2017 · 4 comments

Comments

@andresvivancov
Copy link

Hello, sorry
Thanks for sharing!!
I was trying to use it but I had an error, could you help me, please?
I downloaded and I tested with the original mnist compressed and uncompressed and also with python 2 and python 3

python convert_mnist_to_png.py /home/andre/mnistX/in3/ /home/andresviv/mnistX/out/

Log:
andresviv@andresviv-ThinkPad-P50:/mnistX/ULTIMATE/01/mnist_png-master$ python convert_mnist_to_png.py /home/andresviv/mnistX/in3/ /home/andresviv/mnistX/out/
writing /home/andresviv/mnistX/out/training/0/0.png
writing /home/andresviv/mnistX/out/training/3/1.png
Traceback (most recent call last):
File "convert_mnist_to_png.py", line 68, in
path.join(output_path, dataset))
File "convert_mnist_to_png.py", line 47, in write_dataset
output_filename = path.join(output_dirs[label], str(i) + ".png")
IndexError: list index out of range
andresviv@andresviv-ThinkPad-P50:
/mnistX/ULTIMATE/01/mnist_png-master$

image

Thank you

@Allicnam
Copy link

Allicnam commented Dec 10, 2017

i have the same problem, would like to know how you figured it out!

Edit: i just solved it lol.

Solution (Windows 10):

  1. Extract the four .gz mnist packages into your desktop (or whichever directory you're using)
  2. In lines 15,16,18 and 19, change the second dash for a period in the path ( i.e. 'train-images.idx3-ubyte' instead of 'train-images-idx3-ubyte' )

Make sure you send the apropiate path in the arguments and don't change the file names

worked for me at least...

@Vi5HaL
Copy link

Vi5HaL commented Apr 10, 2018

My solution :
I convert EMNIST balanced by just increase range of for loop at line :35( in write_dataset() > output_dirs
for i in range(47))

here Images are rotated

so to get proper images replace this code at line around 50( i m not sure see code)
w.write(h, data_i ) with
w.write(h, np.rot90(np.fliplr(data_i)))

and add import numpy as np at begining

@ankurjha7
Copy link

Instead of hardcoding value in the range one can also use len(set(labels))) . This will handle all the cases with different labels

@Vi5HaL
Copy link

Vi5HaL commented Sep 2, 2018 via email

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

4 participants