how to label a big image using chunks?

40 Views Asked by At

I try to label a huge image (69940, 70935) using ndimage.label. Label thus try to allocate a int64 ndarray (37 GiB) which is too big for my computer.

import rasterio as rio 
import ndimage as ndi

with rio.open(src) as f:
    label = ndi.label(f.read(1) == feature, structure = struct)[0]

Unable to allocate 37.0 GiB for an array with shape (69940, 70936) and data type uint64

Is there a way to perform this analysis using split chunks ?

0

There are 0 best solutions below