[GRASS-SVN] r71079 - grass-addons/grass7/imagery/i.segment.uspo

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 12 05:36:51 PDT 2017


Author: mlennert
Date: 2017-05-12 05:36:51 -0700 (Fri, 12 May 2017)
New Revision: 71079

Modified:
   grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.html
   grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
Log:
i.segment.uspo: make non-hierarchical segmentation the default (makes more sense and allows better parallelization)


Modified: grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.html
===================================================================
--- grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.html	2017-05-11 19:43:49 UTC (rev 71078)
+++ grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.html	2017-05-12 12:36:51 UTC (rev 71079)
@@ -28,10 +28,12 @@
 href="https://en.wikipedia.org/wiki/Moran%27s_I">Moran's I</a> or <a
 href="https://en.wikipedia.org/wiki/Geary%27s_C">Geary's C</a>.
 
-<p> The user can chose between hierarchical and non-hierarchical segmentation
-using the <b>n</b> flag. The former uses each segmentation at a given threshold
-level as seed for the segmentation at the next threshold level within a given 
-minimum segment size.i
+<p>The user can chose between non-hierarchical (default) and hierarchical 
+segmentation using the <b>h</b> flag. The latter uses each segmentation at a 
+given threshold level as seed for the segmentation at the next threshold level
+within a given minimum segment size. Note that this leads to less optimal
+parallelization as for a given minsize, all segmentations have to be done
+sequentially (see below).
 
 <p>The <b>segment_map</b> parameter allows to provide a
 basename for keeping the <b>number_best</b> best segmentations for each given
@@ -40,7 +42,7 @@
 minsize and the rank of the map within the region according to its optimization
 criteria value.
 
-<p> The module uses high-level parallelisation (running different segmentations
+<p> The module uses high-level parallelization (running different segmentations
 in parallel and then running the collection of parameter values in parallel).
 The parameter <b>processes</b> allows to define how many processes should be run
 in parallel. Note that when using hierarchical segmentation the number of parallel 

Modified: grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py	2017-05-11 19:43:49 UTC (rev 71078)
+++ grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py	2017-05-12 12:36:51 UTC (rev 71079)
@@ -266,10 +266,15 @@
 #
 #%flag
 #% key: n
-#% description: Non-hierarchical segmentation
+#% description: Non-hierarchical segmentation (DEPRECATED: This is now the default setting)
 #%end
 #
 #%flag
+#% key: h
+#% description: Use hierarchical segmentation
+#%end
+#
+#%flag
 #% key: a
 #% description: Use adaptive spectral bandwidth (with mean shift)
 #% guisection: Mean Shift
@@ -647,6 +652,24 @@
     keep = False
     if flags['k']:
         keep = True
+    hierarchical_segmentation = False
+    if not flags['n'] and not flags['h']:
+        message = "There has been a change in API:\n"
+        message += "Non-hierarchical segmentation is now default.\n"
+        message += "If you want hierarchical segmentation, use the 'h' flag."
+        gscript.warning(message)
+    if flags['n']:
+        message = "The 'n' flag is deprecated.\n"
+        message += "Non-hierarchical segmentation is now the default.\n"
+        message += "For hierarchical segmentation set the '-h' flag.\n"
+        message += "The '-n' flag will soon be removed."
+        gscript.warning(message)
+    if flags['h']:
+        hierarchical_segmentation = True
+        message = "INFO: Using hierarchical segmentation.\n"
+        message += "INFO: Note that this leads to less optimal parallization."
+        gscript.info(message)
+        
 
     check_progs()
 
@@ -759,7 +782,7 @@
     	processes_list = []
     	result_queue = Queue()
         if rg:
-            if not flags['n']:
+            if hierarchical_segmentation:
                 minsize_queue = Queue()
                 for minsize in minsizes:
                     minsize_queue.put(minsize)



More information about the grass-commit mailing list