Reputation: 203
I am trying to save a series of images to CSV file so they can be used as a training dataset for Alexnet Keras machine learning. The shape is (15,224,224,3).
So far I am having issue doing this. I have managed to put all data into a numpy array but now I cannot save it to a file.
Please help.
Upvotes: 5
Views: 13481
Reputation: 553
You can try using pickle to save the data. It is much more diverse and easy to handle compare to np.save.
Upvotes: 1
Reputation: 756
I don't think saving it to a csv file is the correct way to do this, it's used for 1d or 2d data to create a table-like structure, so I'm going to offer another solution. You can use np.save
to save any numpy array to a file;
np.save('file_name', your_array)
which can then be loaded using np.load
;
loaded_array = np.load('file_name.npy')
Hope that this works for you.
Upvotes: 22