ACCESS_READ error during numpy.load using mmap
我正试图加载一个相当大的numpy数组(大约75k个图像),但由于整个数据集都被加载到内存中,所以我不断地出现内存错误。我想使用numpy-mmap,但我一直收到访问读取错误。当我尝试使用mmap加载numpy数组时,我总是得到错误:
Traceback (most recent call last):
File"mmap.py", line 29, in
training_images = np.load('data_small/training_images.npy', mmap_mode='r', encoding = 'latin1')File"/usr/local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 416, in load
return format.open_memmap(file, mode=mmap_mode)File"/usr/local/lib/python2.7/site-packages/numpy/lib/format.py", line 792, in open_memmap
mode=mode, offset=offset)File"/usr/local/lib/python2.7/site-packages/numpy/core/memmap.py", line 205, in new
import mmapFile"/Users/Bjarnason/Desktop/AVEC/mmap.py", line 29, in
training_images = np.load('data_small/training_images.npy', mmap_mode='r', encoding = 'latin1')File"/usr/local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 416, in load
return format.open_memmap(file, mode=mmap_mode)
File"/usr/local/lib/python2.7/site-packages/numpy/lib/format.py", line 792, in open_memmap
mode=mode, offset=offset)File"/usr/local/lib/python2.7/site-packages/numpy/core/memmap.py", line 257, in new
acc = mmap.ACCESS_READAttributeError: 'module' object has no attribute 'ACCESS_READ'
号
下面是我要运行的代码:
import numpy as np training_images =
np.load('data_small/training_images.npy', mmap_mode='r')
号
不要调用你的文件
numpy库中的文件