[GRASS-dev] i.segment gives different results in G72 and G73

Running `i.segment` on the same data in G72 and G73 gives different
results. Both commands should use the same method - G72 supports only
'region growing', G73 has this method as default one.

Region:

{{{
north: -1057730
south: -1058250
west: -713860
east: -712960
nsres: 0.25
ewres: 0.25
rows: 2080
cols: 3600
cells: 7488000
}}}

Command:

{{{
i.segment group=seg output=seg1 threshold=0.01 --o
}}}

G72:

{{{
...
Segmentation converged after 8 iterations
Writing out segment IDs...
i.segment complete. Number of segments created: 4367082
(Sun Dec 4 09:42:19 2016) Command finished (3 min 36 sec)
}}}

G73:

{{{
Segmentation converged after 14 iterations
Assigning region IDs to remaining single-cell regions...
Writing out segment IDs...
i.segment complete. Number of segments created: 4359666
}}}

Segmentation performed in G73 gives slightly different results and
takes longer time to finish.

Thanks for clarification in advance, Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Sun, Dec 4, 2016 at 9:56 AM, Martin Landa <landa.martin@gmail.com> wrote:

Running i.segment on the same data in G72 and G73 gives different
results. Both commands should use the same method - G72 supports only
‘region growing’, G73 has this method as default one.

Both versions use the same method by default. However, the G73 version of region growing in i.segment has been modified, it is now faster for larger objects (larger thresholds). A side effect is that objects might differ slightly between G72 and G73, but both results are correct in terms of the concept of region growing. The reason for the difference is when finding the most similar neighbor region, there can be several equally best neighbors. Which one is selected is more or less chance, to be precise, the order of visiting the neighbors, and this order of visiting changed.

Markus M

Region:

{{{
north: -1057730
south: -1058250
west: -713860
east: -712960
nsres: 0.25
ewres: 0.25
rows: 2080
cols: 3600
cells: 7488000
}}}

Command:

{{{
i.segment group=seg output=seg1 threshold=0.01 --o
}}}

G72:

{{{

Segmentation converged after 8 iterations
Writing out segment IDs…
i.segment complete. Number of segments created: 4367082
(Sun Dec 4 09:42:19 2016) Command finished (3 min 36 sec)
}}}

G73:

{{{
Segmentation converged after 14 iterations
Assigning region IDs to remaining single-cell regions…
Writing out segment IDs…
i.segment complete. Number of segments created: 4359666
}}}

Segmentation performed in G73 gives slightly different results and
takes longer time to finish.

Thanks for clarification in advance, Martin


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hi,

2016-12-05 8:54 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

Both versions use the same method by default. However, the G73 version of
region growing in i.segment has been modified, it is now faster for larger
objects (larger thresholds). A side effect is that objects might differ
slightly between G72 and G73, but both results are correct in terms of the
concept of region growing. The reason for the difference is when finding the
most similar neighbor region, there can be several equally best neighbors.
Which one is selected is more or less chance, to be precise, the order of
visiting the neighbors, and this order of visiting changed.

thanks for clarification. Could be probably good idea to explain it
also in manual pages. Can we take this paragraph as it is? Thanks,
Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi,

2016-12-05 9:09 GMT+01:00 Moritz Lennert <moritzlennert@posteo.net>:

What colleagues here have also noticed is that between the versions (but I can't remember if it was 7.0 vs 7.3 or 7.2 vs 7.3) quite different thresholds were needed to reach similar segmentation results. In 7.3 reasonable thresholds are often an order of magnitude lower, i.e. 0.001 instead of 0.01...

this wasn't my case. I am getting slightly different results in G72

i.segment complete. Number of segments created: 4367082
(Sun Dec 4 09:42:19 2016) Command finished (3 min 36 sec)

and G73

i.segment complete. Number of segments created: 4359666
(Mon Dec 5 13:45:41 2016) Command finished (4 min 44 sec)

But not so much. Segmentation process is also a little bit slower in
this case (and takes more iterations: 8->14). Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Mon, Dec 5, 2016 at 1:46 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2016-12-05 9:09 GMT+01:00 Moritz Lennert <moritzlennert@posteo.net>:

What colleagues here have also noticed is that between the versions (but I can’t remember if it was 7.0 vs 7.3 or 7.2 vs 7.3) quite different thresholds were needed to reach similar segmentation results. In 7.3 reasonable thresholds are often an order of magnitude lower, i.e. 0.001 instead of 0.01…

this wasn’t my case.

I am also getting very similar results with the same threshold. Can your colleagues provide an example where such different thresholds need to be used to obtain comparable results?

I am getting slightly different results in G72

i.segment complete. Number of segments created: 4367082
(Sun Dec 4 09:42:19 2016) Command finished (3 min 36 sec)

and G73

i.segment complete. Number of segments created: 4359666
(Mon Dec 5 13:45:41 2016) Command finished (4 min 44 sec)

But not so much. Segmentation process is also a little bit slower in
this case (and takes more iterations: 8->14). Ma

Strange. E.g. with ortho_2001_t792_1m from the NC dataset and a threshold of 0.25, G72 needs 20 min 29 sec while G73 needs only 6 min 14 sec. The speed gain of G73 is more prominent when there are large objects.

Markus M

On Mon, Dec 5, 2016 at 1:36 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2016-12-05 8:54 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

Both versions use the same method by default. However, the G73 version of
region growing in i.segment has been modified, it is now faster for larger
objects (larger thresholds). A side effect is that objects might differ
slightly between G72 and G73, but both results are correct in terms of the
concept of region growing. The reason for the difference is when finding the
most similar neighbor region, there can be several equally best neighbors.
Which one is selected is more or less chance, to be precise, the order of
visiting the neighbors, and this order of visiting changed.

thanks for clarification. Could be probably good idea to explain it
also in manual pages. Can we take this paragraph as it is? Thanks,
Martin

It’s very technical and explains differences between versions. I am not sure if this should go into the user manual. The concept of region growing is the same.

Markus M

Hi,

2016-12-05 15:00 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

It's very technical and explains differences between versions. I am not sure
if this should go into the user manual. The concept of region growing is the
same.

probably could be useful at least to explain that different version of
GRASS can give different results... Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On 05/12/16 14:52, Markus Metz wrote:

On Mon, Dec 5, 2016 at 1:46 PM, Martin Landa <landa.martin@gmail.com
<mailto:landa.martin@gmail.com>> wrote:

Hi,

2016-12-05 9:09 GMT+01:00 Moritz Lennert <moritzlennert@posteo.net

<mailto:moritzlennert@posteo.net>>:

> What colleagues here have also noticed is that between the versions

(but I can't remember if it was 7.0 vs 7.3 or 7.2 vs 7.3) quite
different thresholds were needed to reach similar segmentation results.
In 7.3 reasonable thresholds are often an order of magnitude lower, i.e.
0.001 instead of 0.01...

this wasn't my case.

I am also getting very similar results with the same threshold. Can your
colleagues provide an example where such different thresholds need to be
used to obtain comparable results?

I've asked them if they can prepare and exemple and maybe send it to you offlist.

Moritz

On Mon, Dec 5, 2016 at 3:01 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2016-12-05 15:00 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

It’s very technical and explains differences between versions. I am not sure
if this should go into the user manual. The concept of region growing is the
same.

probably could be useful at least to explain that different version of
GRASS can give different results… Ma

Different GRASS versions can give different results for some modules because of bug fixing and/or improvements. The explanation why the results of the same module might differ between GRASS versions is that these are different GRASS versions. We could add this information on the wiki to new or changed features in trunk.

Markus M

On Mon, Dec 5, 2016 at 10:56 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Mon, Dec 5, 2016 at 3:01 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2016-12-05 15:00 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

It’s very technical and explains differences between versions. I am not sure
if this should go into the user manual. The concept of region growing is the
same.

probably could be useful at least to explain that different version of
GRASS can give different results… Ma

Different GRASS versions can give different results for some modules because of bug fixing and/or improvements. The explanation why the results of the same module might differ between GRASS versions is that these are different GRASS versions. We could add this information on the wiki

on trac

to new or changed features in trunk.

Markus M

On 05/12/16 21:06, Moritz Lennert wrote:

On 05/12/16 14:52, Markus Metz wrote:

On Mon, Dec 5, 2016 at 1:46 PM, Martin Landa <landa.martin@gmail.com
<mailto:landa.martin@gmail.com>> wrote:

Hi,

2016-12-05 9:09 GMT+01:00 Moritz Lennert <moritzlennert@posteo.net

<mailto:moritzlennert@posteo.net>>:

> What colleagues here have also noticed is that between the versions

(but I can't remember if it was 7.0 vs 7.3 or 7.2 vs 7.3) quite
different thresholds were needed to reach similar segmentation results.
In 7.3 reasonable thresholds are often an order of magnitude lower, i.e.
0.001 instead of 0.01...

this wasn't my case.

I am also getting very similar results with the same threshold. Can your
colleagues provide an example where such different thresholds need to be
used to obtain comparable results?

Taïs has prepared an example and can send it by private mail, but he reminded me of the cause of the difference he observed: in G73 the threshold is calculated based on the entire image, whereas in G72 the threshold is calculated based on only the current computational region. We had asked for this for i.segment.uspo (parameter optimization) as this module works on small sample subregions, but if the threshold is calculated based on the region, then the "optimal" threshold values coming out of the uspo procedure are not comparable between sample regions.

See some discussion here: https://lists.osgeo.org/pipermail/grass-dev/2016-June/080592.html.

Moritz

On Wed, Dec 7, 2016 at 11:27 AM, Moritz Lennert <mlennert@club.worldonline.be> wrote:

On 05/12/16 21:06, Moritz Lennert wrote:

On 05/12/16 14:52, Markus Metz wrote:

On Mon, Dec 5, 2016 at 1:46 PM, Martin Landa <landa.martin@gmail.com
mailto:[landa.martin@gmail.com](mailto:landa.martin@gmail.com)> wrote:

Hi,

2016-12-05 9:09 GMT+01:00 Moritz Lennert <moritzlennert@posteo.net

mailto:[moritzlennert@posteo.net](mailto:moritzlennert@posteo.net)>:

What colleagues here have also noticed is that between the versions

(but I can’t remember if it was 7.0 vs 7.3 or 7.2 vs 7.3) quite
different thresholds were needed to reach similar segmentation results.
In 7.3 reasonable thresholds are often an order of magnitude lower, i.e.
0.001 instead of 0.01…

this wasn’t my case.

I am also getting very similar results with the same threshold. Can your
colleagues provide an example where such different thresholds need to be
used to obtain comparable results?

Taïs has prepared an example and can send it by private mail, but he reminded me of the cause of the difference he observed: in G73 the threshold is calculated based on the entire image, whereas in G72 the threshold is calculated based on only the current computational region. We had asked for this for i.segment.uspo (parameter optimization) as this module works on small sample subregions, but if the threshold is calculated based on the region, then the “optimal” threshold values coming out of the uspo procedure are not comparable between sample regions.

OK. Figuring out a reasonable threshold based on small sample regions is IMHO of general interest for i.segment, because you would expect similar results when you increase the region. Therefore I think the behaviour in G73 is an improvement.

Markus M

See some discussion here: https://lists.osgeo.org/pipermail/grass-dev/2016-June/080592.html.

Moritz

Hi,

2016-12-07 12:11 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

OK. Figuring out a reasonable threshold based on small sample regions is
IMHO of general interest for i.segment, because you would expect similar
results when you increase the region. Therefore I think the behaviour in G73
is an improvement.

sorry for bothering you, but is it documented somewhere (in the
manual). Thanks, Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On 07/12/16 12:13, Martin Landa wrote:

Hi,

2016-12-07 12:11 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

OK. Figuring out a reasonable threshold based on small sample regions is
IMHO of general interest for i.segment, because you would expect similar
results when you increase the region. Therefore I think the behaviour in G73
is an improvement.

sorry for bothering you, but is it documented somewhere (in the
manual).

Check r70032. Is that sufficient/correct ?

Moritz