coolair
V2EX  ›  问与答

关于 numpy memory error 的问题

  •  
  •   coolair · Feb 23, 2019 · 1182 views
    This topic created in 2660 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   ·   1079 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:26 · PVG 02:26 · LAX 11:26 · JFK 14:26
    ♥ Do have faith in what you're doing.