繁体   English   中英

MemoryError: 无法分配形状为 (200, 20, 244, 244, 3) 和数据类型为 float64 的数组

[英]MemoryError: Unable to allocate array with shape (200, 20, 244, 244, 3) and data type float64

我试图从位于HERE的 Github 存储库运行培训模块。 我在云服务器上运行它,但我不知道为什么经过几轮后,我收到此错误:

Traceback (most recent call last):
  File "run.py", line 229, in <module>
    classes=classes, use_augs=use_augs, fix_lens=fix_lens)
  File "run.py", line 165, in hyper_tune_network
    classes=classes)
  File "run.py", line 111, in get_generators
    classes=classes)
  File "/home/code/DatasetBuilder.py", line 221, in get_sequences
    X = pad_sequences(X, maxlen=seq_length, padding='pre', truncating='pre')
  File "/usr/local/lib/python3.5/dist-packages/keras/preprocessing/sequence.py", line 61, in pad_sequences
    x = (np.ones((num_samples, maxlen) + sample_shape) * value).astype(dtype)
  File "/root/.local/lib/python3.5/site-packages/numpy/core/numeric.py", line 214, in ones
    a = empty(shape, dtype, order)

    MemoryError: Unable to allocate array with shape (200, 20, 244, 244, 3) and data type float64

第一,是什么意思? 有什么办法可以解决吗? 解决办法是什么?

它与 linux 如何处理 RAM 过量使用有关(我假设您正在运行 linux)。 如果您请求太多,您的进程将被终止,或者您会收到您描述的错误。 作为root ,您可以尝试:

echo 1 > /proc/sys/vm/overcommit_memory

这将让您尽可能多地请求。 如果您请求太多,您仍然会遇到内存不足错误,但这会让您使用更大的数组。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM