I need to store a ton of information in a numpy array. It needs to be of the following shape:
facefeature1s = np.empty([2000,64,64,64,32])
When I run this, i get a memory error. What can I do about this?
Error is:
MemoryError Traceback (most recent call last)
<ipython-input-271-2c56a37b4a7c> in <module>()
----> 1 facefeature1s = np.empty([2000,64,64,64,32])
As @Jaime says in the comments, your array is too big. IF you really need such a huge array, you can use numpy.memmap() to work on the array using the hard drive:
a = np.memmap('filename.myarray', dtype=np.float64, mode='w+',
shape=(2000, 64, 64, 64, 32))
The next time you open the array, use mode='r', or mode='r+'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With