简体   繁体   English

MemoryError: 无法分配形状为 (2515, 406272) 且数据类型为 float32 的数组

[英]MemoryError: Unable to allocate array with shape (2515, 406272) and data type float32

I am trying to make a finger knuckle recognition using CNN on Spyder on Anaconda.我正在尝试使用 CNN 在 Anaconda 上的 Spyder 上进行指关节识别。 I have 2515 images that i am dealing with and it seems 8 GB is not enough to do this.我有 2515 张图像要处理,但 8 GB 似乎不足以执行此操作。 What can i do?我能做什么? Should i get another stick of RAM or making this project on Kaggle/Colab will be a better approach?我应该再买一块内存还是在 Kaggle/Colab 上做这个项目会是一个更好的方法?

arr = np.array(finger_dat)
arr = arr.reshape((2515, 406272))

arr = arr / 255

#############Making dataset####################

label = np.array(range(503))
label = np.repeat(label, 5)

dataset = pd.DataFrame(arr)
dataset['label'] = label

X = dataset.iloc[:, 0:406272]
y = dataset.iloc[:, -1]

from sklearn.tree import DecisionTreeClassifier
dtf = DecisionTreeClassifier()
dtf.fit(X, y)

dtf.score(X, y)

Try to process the data in batches.尝试批量处理数据。

Have a look in this doc.看看这个文档。 from sklearn: Strategies to scale computationally: bigger data来自 sklearn: 计算扩展策略:更大的数据

In your place I would try in this order:在你的地方,我会按这个顺序尝试:

colab, change code to load batches change code to use database to feed train buy more ram but you are probably going to need > 40Gb. colab,更改代码以加载批次更改代码以使用数据库为火车提供动力购买更多内存,但您可能需要> 40Gb。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 numpy.core._exceptions.MemoryError:无法为形状为 (1073741824, 0) 且数据类型为 float32 的数组分配 0 个字节 - numpy.core._exceptions.MemoryError: Unable to allocate 0 bytes for an array with shape (1073741824, 0) and data type float32 MemoryError:在python中使用word2vec时无法分配形状和数据类型为float32的数组 - MemoryError: unable to allocate array with shape and data type float32 while using word2vec in python MemoryError: Unable to allocate 137. MiB for an array with shape (3000, 4000, 3) and data type float32 - MemoryError: Unable to allocate 137. MiB for an array with shape (3000, 4000, 3) and data type float32 当显示带有 plt.show() 的图像时 -> MemoryError: Unable to allocate array with shape (3600, 7200, 4) and data type float32 - When showing an image with plt.show() -> MemoryError : Unable to allocate array with shape (3600, 7200, 4) and data type float32 MemoryError: Unable to allocate 5.62 GiB for an array with shape (16384, 30720, 3) and data type float32 when training StyleGan2 - MemoryError: Unable to allocate 5.62 GiB for an array with shape (16384, 30720, 3) and data type float32 When training StyleGan2 训练我的 model 时出现 Memory 错误:无法为形状为(3094、720、1280、3)和数据类型 float32 的数组分配 31.9 GiB - Memory error while training my model: Unable to allocate 31.9 GiB for an array with shape (3094, 720, 1280, 3) and data type float32 MemoryError: 无法分配形状为 (200, 20, 244, 244, 3) 和数据类型为 float64 的数组 - MemoryError: Unable to allocate array with shape (200, 20, 244, 244, 3) and data type float64 MemoryError:无法为形状为 (323313, 3435) 且数据类型为 float64 的数组分配 8.27 GiB - MemoryError: Unable to allocate 8.27 GiB for an array with shape (323313, 3435) and data type float64 MemoryError:无法为形状为 (28709, 224, 224, 3) 且数据类型为 float64 的数组分配 32.2 GiB - MemoryError: Unable to allocate 32.2 GiB for an array with shape (28709, 224, 224, 3) and data type float64 MemoryError: 无法分配形状 (118, 840983) 和数据类型 float64 的数组 - MemoryError: Unable to allocate array with shape (118, 840983) and data type float64
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM