Reputation: 89
I am working on an image classification task. I use opencv to load the images. Most of them are very huge in size so I resize them as well.
I wanted to know if there is a way to save the loaded images e.g (1000, 227,227,3) as a csv or something else?
So that I don’t have to load all the images on every run of my python code.
Thanks
Upvotes: 1
Views: 208
Reputation: 478
You could use "pickle" to save a list-object of image objects.
import pickle
# to safe
myImagesList = [...]
with open("myImages.pickle", "wb") as file:
pickle.dump(myImagesList, file)
# to load it again
with open("myImages.pickle", "rb") as file:
mySavedImagesList = pickle.load(file)
Upvotes: 2