From 9dde67b157b9d7f546bef2eac40c18830e0c3d91 Mon Sep 17 00:00:00 2001
From: Raffaele Gaetano <raffaele.gaetano@cirad.fr>
Date: Thu, 20 Jul 2023 11:02:40 +0200
Subject: [PATCH] FIX: use half of memory available for lsgrm.

---
 OBIA/segmentation.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/OBIA/segmentation.py b/OBIA/segmentation.py
index e08c9e4..78973fd 100644
--- a/OBIA/segmentation.py
+++ b/OBIA/segmentation.py
@@ -244,11 +244,11 @@ def lsgrm(input_image, params : LSGRMParams, out_seg, n_proc=None, memory=None,
     else:
         raise ValueError('Output type {} not recognized/supported.'.format(ext))
 
-    # 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
 
-- 
GitLab