coolair
V2EX  ›  问与答

关于 numpy memory error 的问题

  •  
  •   coolair · Feb 23, 2019 · 1164 views
    This topic created in 2649 days ago, the information mentioned may be changed or developed.
    代码如下:
    x = numpy.asarray(image.convert('RGBA')).copy()
    x[:, :, 3] = (255 * (x[:, :, :3] != 255).any(axis=2)).astype(numpy.uint8)

    当 x 非常大时,小内存的机器上就会因为内存不足而 memory error,有什么好办法优化吗?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3653 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 04:44 · PVG 12:44 · LAX 21:44 · JFK 00:44
    ♥ Do have faith in what you're doing.