[GRASS-dev] i.segment: possible to cache results of open_files() for several runs of i.segment ?

Markus Metz markus.metz.giswork at gmail.com
Wed Aug 2 12:43:00 PDT 2017


Hi Moritz,

On Wed, Aug 2, 2017 at 2:52 PM, Moritz Lennert <mlennert at club.worldonline.be>
wrote:
>
> Hi MarkusM,
>
> Working on segmentation parameter optimization with fairly large images
we have stumbled upon some questions (ISTR that we've discussed this
before, but I cannot find traces of that discussion). As a reminder,
i.segment.uspo works by looping through a series of threshold parameter
values, segmenting a series of test regions at each parameter value and
then comparing the results in order to identify the "optimal" threshold.
>
> Two issues have popped up:
>
> - One approach we tried was to optimize thresholds separately for
different types of morphological zones. For each type we have several
polygons distributed across the image. These polygons are used as input for
a mask. However, it does seem that even if most of the image is masked,
open_files() takes a long time, as if it does read the entire image. Is
this expected / normal ? Would it be possible to reduce the read time when
most of the area is masked ?

You could reduce the read time by zooming to the current mask with g.region
zoom=current_mask

>
> - More generally: for every i.segment call, open_files() goes through the
reading of the input files and, AFAIU, checks for min/max values and
creates the seglib temp files (+ possibly other operations). When
segmenting the same image several times just using different thresholds, it
would seem that most of what open_files() does is repeated in exactly the
same manner at each call. Would it be possible to cache that information
somehow and to instruct i.segment to reuse that info each time it is called
on the same image and region ?

The most time (and disk space) consuming part of open_files() is creating
temporary files for the input files and the current region and the current
mask. These temporary files are temporary because too many things can
change between two consecutive runs of any module using the segment
library. First of all, the input files could change (same name, but
different cell values), then region and mask settings could change.

>
> Just trying to crunch larger and larger images... :-)

As in, it's working but a bit slow?

I have one or two ideas about how to speed up i.segment a little bit, but
unfortunately no time to implement them right now :-(

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20170802/bbed1162/attachment.html>


More information about the grass-dev mailing list