diff --git a/OBIA/segmentation.py b/OBIA/segmentation.py index 78973fdd84356874f5ac4986d05db4f5fbac8690..cb68a62c90579d0d515384a9b30a9b206a1a0592 100644 --- a/OBIA/segmentation.py +++ b/OBIA/segmentation.py @@ -15,7 +15,8 @@ from tqdm import tqdm import numpy as np # GLOBAL -node_size = 700 # size of a graph node (=pixel) in GRM +# changed from the original 700 to limit OOM multiprocessing bug +node_size = 1000 # size of a graph node (=pixel) in GRM @dataclass class LSGRMParams: @@ -76,8 +77,9 @@ def grm_process_tile(input_image, params : LSGRMParams, tile_width, tile_height, op = regionprops(seg['array'][:,:,0].astype(np.int32)) to_del = [] for o in op: - if not (tie_lines[0] <= o.bbox[0] < tie_lines[2] - and tie_lines[1] <= o.bbox[1] < tie_lines[3]): + if not (tie_lines[0] <= o.bbox[0]# < tie_lines[2] + and tie_lines[1] <= o.bbox[1]):# < tie_lines[3]): + # to_del.append(o.label) # This one to check if a potentially deleted object trespass the overlap area, # in which case it is kept. if not (2*params.margin <= o.bbox[2] < tile_height and diff --git a/Workflows/operations.py b/Workflows/operations.py index 4b97e5cd321bfb8f843496ac67160e4200f579c3..43c8f964e47335fea17c1086e07ab07feed6dd4a 100644 --- a/Workflows/operations.py +++ b/Workflows/operations.py @@ -11,7 +11,7 @@ def run_segmentation(img, threshold, cw, sw , out_seg, os.makedirs(os.path.dirname(out_seg)) params = OBIA.segmentation.LSGRMParams(threshold, cw, sw, n_first_iter, margin) if light: - OBIA.segmentation.lsgrm_light(img, params, out_seg, n_proc, memory, roi, force_parallel) + OBIA.segmentation.lsgrm_light(img, params, out_seg, n_proc, memory, roi, force_parallel, remove_graph) else: OBIA.segmentation.lsgrm(img, params, out_seg, n_proc, memory, roi, remove_graph, force_parallel) return out_seg