5

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.

2 Answers 2

22

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.

Sign up to request clarification or add additional context in comments.

Comments

1

You can try using pickle to save the data. It is much more diverse and easy to handle compare to np.save.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.