Skip to content

sadimanna/idx2numpy_array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

idx2numpy_array

To convert idx formatted files to numpy array ::

1. For the file idx2nparray_py3.py ::

Just run the code with the proper file path in the dictionary filename

This code is a mixture of the above two.

I have stacked blocks of 10000 images after reading the data of 10000X28X28 bytes = 7840000 bytes at once.

And the time taken for reading 7840000 bytes at once and stacking them all in 6 iterations in a single numpy array to form a 3D array was about 5 seconds on my laptop.

The numpy arrays can further be converted to images using other libraries like opencv, PIL or scipy.

But for using in a CNN, keeping in the np.ndarray format will be useful. I guess!!

To convert numpy array to image ::

Run the file ndarr2img.py

Takes about less than 20 seconds for the trainiing images and much less than that for the test images.

Just enter the right path

The iamges will be saved in '.jpg' format

And the labels will be saved in '.npy' format