V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
coolair
V2EX  ›  问与答

关于 numpy memory error 的问题

  •  
  •   coolair · 2019-02-23 13:45:20 +08:00 · 836 次点击
    这是一个创建于 1950 天前的主题,其中的信息可能已经有所发展或是发生改变。
    代码如下:
    x = numpy.asarray(image.convert('RGBA')).copy()
    x[:, :, 3] = (255 * (x[:, :, :3] != 255).any(axis=2)).astype(numpy.uint8)

    当 x 非常大时,小内存的机器上就会因为内存不足而 memory error,有什么好办法优化吗?
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5583 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 02:32 · PVG 10:32 · LAX 19:32 · JFK 22:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.