I'm working on some imaging-related ML tasks, and as a result of the preprocessing required, I'm creating objects of a class that contains important metadata attributes, along with a 3d numpy array of image data. I'd like to reduce the size of these objects, and increase the speed that they're written and read.
As it stands, the object is saved as a file using pickle, however this does not seem like the most efficient method. The dill library is supposed to be better at saving numpy items, however as I need to process many files, and overall performance is slower, this seems unhelpful.
I also heard of the numpy.save method, but I wasn't sure how to implement this as part of my pickling process. I pickle items using pickle.dump and pickle.load.
picklewill usenp.saveunderneath the hood, I'm pretty sure.picklesaving your class isn't your bottleneck