diff --git a/OBIA/segmentation.py b/OBIA/segmentation.py index fc205303dceb422cc1c426de6f75fc39fc8204d9..e08c9e4cb8be391085576e0dfa1c273c9ea3c693 100644 --- a/OBIA/segmentation.py +++ b/OBIA/segmentation.py @@ -127,11 +127,11 @@ def lsgrm_process_tile(input_image, params : LSGRMParams, tile_width, tile_heigh out_graph + '_edgeMargin_{}_{}.bin'.format(tile_idx[1], tile_idx[0])] def get_ls_seg_parameter(input_image, roi=None, margin=0, n_proc=None, memory=None, force_parallel=False): - # Define default number of threads (half) and memory amount (3/4 of available) + # Define default number of threads (half) and memory amount (1/2 of available) if n_proc is None: n_proc = round(mp.cpu_count() / 2) if memory is None: - memory = round(psutil.virtual_memory().available * 0.75) + memory = round(psutil.virtual_memory().available * 0.5) else: memory *= 1e6 @@ -196,7 +196,7 @@ def lsgrm_light(input_image, params : LSGRMParams, out_seg, n_proc=None, memory= else: tile_index_list = product(range(n_tiles_x), range(n_tiles_y)) arg_list = [(input_image, params, nominal_tw, nominal_th, x, out_seg, roi) for x in tile_index_list] - with mp.get_context("spawn").Pool(n_proc) as p: + with mp.Pool(n_proc) as p: out_tiles = p.starmap(grm_process_tile, arg_list) cumul_label = 0 for f,l in out_tiles: