MarcoForte / closed-form-matting

Python implementation of A. Levin D. Lischinski and Y. Weiss. A Closed Form Solution to Natural Image Matting. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), June 2006, New York
MIT License
435 stars 107 forks source link

SUPERLU_MALLOC fails for buf in intCalloc() #21

Closed wchstrife closed 3 years ago

wchstrife commented 3 years ago

When I use solve_foreground_background.py to process adobe matting data. This error will appear on some pictures:

Traceback (most recent call last): [0/149] File "solve_foreground_background.py", line 152, in main
foreground, background = solve_foreground_background(image, alpha) File "solve_foreground_background.py", line 123, in solve_foreground_background solution = scipy.sparse.linalg.spsolve(left_hand, right_hand).reshape(2, *image.shape)
File "/home/wangchenhao/anaconda3/lib/python3.8/site-packages/scipy/sparse/linalg/dsolve/linsolve.py", line 203, in spsolve
x, info = _superlu.gssv(N, A.nnz, A.data, A.indices, A.indptr,
RuntimeError: SUPERLU_MALLOC fails for buf in intCalloc() at line 159 in file scipy/sparse/linalg/dsolve/SuperLU/SRC/memory.c

merofeev commented 3 years ago

What is resolution of your image? Your problem is likely to be caused by too large number of unknown pixels, that led to allocation of too big matrix that could not fit to RAM of your PC.

wchstrife commented 3 years ago

I have double-checked these images. the resolution is 2K, there are many unknown areas on the image, thanks for your reply!

mexicantexan commented 2 years ago

@merofeev @MarcoForte if we do run into this issue, would just resizing the image smaller still work or is there an unwritten rule that this is a bad idea?

For context: I was working with 5k+ resolution images (>5120px × >2880px) and I'm working on a machine with >500GB of RAM, 40 Cores, and Linux 20.04. The process seems to only use about 9GB before this error was thrown.

Update: For anyone interested on the system hardware above, I was able to get up to ~2900. Although the RAM usage doesn't ever peak above 9GB.