pydensecrf icon indicating copy to clipboard operation
pydensecrf copied to clipboard

terminate called after throwing an instance of 'std::length_error' what(): vector::_M_fill_insert Aborted (core dumped)

Open yaatsn3821 opened this issue 2 years ago • 0 comments

First of all, thanks a lot for packaging this! I tried this code.

import numpy as np
import pydensecrf.densecrf as dcrf
from pydensecrf.utils import unary_from_softmax, create_pairwise_bilateral

probs = np.random.rand((0,1),30000,30000)
probs = np.tile(probs[np.newaxis,:,:],(2,1,1))
probs[1,:,:] = 1 - probs[0,:,:]
U = unary_from_softmax(probs) 
img = np.zeros((30000,30000), np.uint8)
pairwise_energy = create_pairwise_bilateral(sdims=(10,10), schan=(0.01,), img=img, chdim=-1)
d = dcrf.DenseCRF2D(30000, 30000, 2)
d.setUnaryEnergy(U)
d.addPairwiseEnergy(pairwise_energy, compat=10)

but, got below error.

terminate called after throwing an instance of 'std::length_error'
  what():  vector::_M_fill_insert
Aborted (core dumped)

This is probably because img size is very large.Retried with about 10000x10000,it's no error. But, 30000x30000 size image need to be processed. Dividing image is the best solution? Could some one help me?

yaatsn3821 avatar Feb 20 '22 13:02 yaatsn3821