[GRASS-dev] i.segment: invalid region id 0

Proxmox(Openvz) container running Debian testing, 200GB disk space, 10GB RAM, 4 i7 CPUs

> g.region -p
projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: wgs84
north: 4876400
south: 4849792
west: 610056
east: 634648
nsres: 0.5
ewres: 0.5
rows: 53216
cols: 49184
cells: 2617375744

> r.univar 2013_04_24_orthorectified_mosaic_PAN_img02
  100%
total null and non-null cells: 2617375744
total null cells: 2061647833

Of the non-null cells:
----------------------
n: 555727911

> i.group -l pan_r_ir
group <pan_r_ir> references the following raster maps
-------------
<2013_04_24_orthorectified_mosaic_PAN_img02@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.5@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.7@PERMANENT>

> time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir threshold=0.01 memory=8192
Loading input bands...
Pass 1:
ERROR: Invalid region id 0

I still have over 100GB of disk space available.

What could be the problem ?

Moritz

On Fri, Jul 12, 2013 at 4:36 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

Proxmox(Openvz) container running Debian testing, 200GB disk space, 10GB
RAM, 4 i7 CPUs

g.region -p

projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: wgs84
north: 4876400
south: 4849792
west: 610056
east: 634648
nsres: 0.5
ewres: 0.5
rows: 53216
cols: 49184
cells: 2617375744

r.univar 2013_04_24_orthorectified_mosaic_PAN_img02

100%
total null and non-null cells: 2617375744
total null cells: 2061647833

Of the non-null cells:
----------------------
n: 555727911

i.group -l pan_r_ir

group <pan_r_ir> references the following raster maps
-------------
<2013_04_24_orthorectified_mosaic_PAN_img02@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.5@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.7@PERMANENT>

time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir threshold=0.01
memory=8192

Loading input bands...
Pass 1:
ERROR: Invalid region id 0

Please try r57074.

Markus M

I still have over 100GB of disk space available.

What could be the problem ?

Moritz

On Fri, July 12, 2013 21:59, Markus Metz wrote:

On Fri, Jul 12, 2013 at 4:36 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

Proxmox(Openvz) container running Debian testing, 200GB disk space, 10GB
RAM, 4 i7 CPUs

g.region -p

projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: wgs84
north: 4876400
south: 4849792
west: 610056
east: 634648
nsres: 0.5
ewres: 0.5
rows: 53216
cols: 49184
cells: 2617375744

r.univar 2013_04_24_orthorectified_mosaic_PAN_img02

100%
total null and non-null cells: 2617375744
total null cells: 2061647833

Of the non-null cells:
----------------------
n: 555727911

i.group -l pan_r_ir

group <pan_r_ir> references the following raster maps
-------------
<2013_04_24_orthorectified_mosaic_PAN_img02@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.5@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.7@PERMANENT>

time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir
threshold=0.01
memory=8192

Loading input bands...
Pass 1:
ERROR: Invalid region id 0

Please try r57074.

I still get exactly the same error. Anything I can do to debug ?

Moritz

P.S. I'll be offline between this afternoon and Thursday morning.

On Mon, Jul 15, 2013 at 10:04 AM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On Fri, July 12, 2013 21:59, Markus Metz wrote:

On Fri, Jul 12, 2013 at 4:36 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

Proxmox(Openvz) container running Debian testing, 200GB disk space, 10GB
RAM, 4 i7 CPUs

g.region -p

projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: wgs84
north: 4876400
south: 4849792
west: 610056
east: 634648
nsres: 0.5
ewres: 0.5
rows: 53216
cols: 49184
cells: 2617375744

r.univar 2013_04_24_orthorectified_mosaic_PAN_img02

100%
total null and non-null cells: 2617375744
total null cells: 2061647833

Of the non-null cells:
----------------------
n: 555727911

i.group -l pan_r_ir

group <pan_r_ir> references the following raster maps
-------------
<2013_04_24_orthorectified_mosaic_PAN_img02@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.5@PERMANENT>
<2013_04_24_orthorectified_mosaic_XS_img02.7@PERMANENT>

time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir
threshold=0.01
memory=8192

Loading input bands...
Pass 1:
ERROR: Invalid region id 0

Please try r57074.

I still get exactly the same error. Anything I can do to debug ?

You will need to add loops that go through the segment ids and check
if any id is set to zero.

Another possibility is that the region growing algorithm does not find
a best neighbor for a given region, which it should. There should
always be a valid best neighbor.

I can prepare a patch for you with additional debug tests, hopefully
until this afternoon, then you could have a chance to start the module
again before you go offline.

Markus M

Moritz

P.S. I'll be offline between this afternoon and Thursday morning.

Moritz Lennert wrote:

[..]

> time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir

threshold=0.01 memory=8192
Loading input bands...
Pass 1:
ERROR: Invalid region id 0

[..]

What could be the problem ?

Moritz, Markus,

the same error today while performing a "random" test. Disk capacity and RAM
plenty here.

time i.segment group=pan out=pan_segmented_plantations_area_threshold_1
threshold=0.99

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Pass 13:
ERROR: Invalid region id 0

real 40m44.339s
user 37m34.357s
sys 0m0.380s

Details

projection: 1 (UTM)
zone: 38
datum: wgs84
ellipsoid: wgs84
north: -2571782.5
south: -2574924.5
west: 359153.5
east: 359525
nsres: 0.5
ewres: 0.5
rows: 6284
cols: 743
cells: 4669012

Let me know how I can help.

On Tuesday 16 of July 2013 00:09:44 Nikos Alexandris wrote:

Moritz Lennert wrote:

[..]

> > time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir
>
> threshold=0.01 memory=8192
> Loading input bands...
> Pass 1:
> ERROR: Invalid region id 0

[..]

> What could be the problem ?

Moritz, Markus,

the same error today while performing a "random" test. Disk capacity and RAM
plenty here.

time i.segment group=pan out=pan_segmented_plantations_area_threshold_1
threshold=0.99

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Pass 13:
ERROR: Invalid region id 0

real 40m44.339s
user 37m34.357s
sys 0m0.380s

Details

projection: 1 (UTM)
zone: 38
datum: wgs84
ellipsoid: wgs84
north: -2571782.5
south: -2574924.5
west: 359153.5
east: 359525
nsres: 0.5
ewres: 0.5
rows: 6284
cols: 743
cells: 4669012

Let me know how I can help.

The "same" process, that is i.segment on a single Panchromatic band
(WorldView-1), in a region composed by 4669012 cells, however, with a
threshold of "=0.5", took 20 minutes to complete successfully.

# exact instruction -- includes memory=13000
i.segment group=pan out=pan_segmented_plantations_region threshold=0.5
memory=13000

What is positive (maybe too much!) is that i.segment respects memory and CPU
resources. Keeping an eye on the process running via KDE's System Activity
app, the process kept only one core busy at 100% and occupied no more than
120MB of memory! (?)

I will repeat the above "failed" process with memory=Something and report
back.

Nikos
Nikos

On Mon, Jul 15, 2013 at 11:09 PM, Nikos Alexandris
<nik@nikosalexandris.net> wrote:

Moritz Lennert wrote:

[..]

> time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir

threshold=0.01 memory=8192
Loading input bands...
Pass 1:
ERROR: Invalid region id 0

[..]

What could be the problem ?

Moritz, Markus,

the same error today while performing a "random" test. Disk capacity and RAM
plenty here.

time i.segment group=pan out=pan_segmented_plantations_area_threshold_1
threshold=0.99

In most cases, this threshold is too large. It should be between 0 and
1, and rather close to zero.

[...]

Pass 13:
ERROR: Invalid region id 0

real 40m44.339s
user 37m34.357s
sys 0m0.380s

Details

projection: 1 (UTM)
zone: 38
datum: wgs84
ellipsoid: wgs84
north: -2571782.5
south: -2574924.5
west: 359153.5
east: 359525
nsres: 0.5
ewres: 0.5
rows: 6284
cols: 743
cells: 4669012

Let me know how I can help.

Can you make the dataset available (off-list if need be)? I can not
reproduce this error with the datasets I have.

Markus M

[previous discussion(s) erased]

A series of tests completed successfully for thresholds 0.1, 0.3, 0.5, 0.7,
0.9, no matter if memory= 300 or 30000. For the extreme case threshold=0.99,
the process failed for both memory= 300 or 30000 settings.

Note, all tests reported below were performed in a data base stored in an
external USB 3.0 HDD.

# grass version
g.version -g

version=7.0.svn
date=2013
revision=57074
build_date=2013-06-12

First the two failure cases:

# threshold 0.99, memory=300 (default setting)
time i.segment group=pan out=pan_segmented_threshold_0.99_memory_300
threshold=0.99

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Pass 13:
ERROR: Invalid region id 0

and

# threshold 0.99, memory=30000 --- This is what I have previously reported
time i.segment group=pan out=pan_segmented_threshold_0.99_memory_30000
threshold=0.99 memory=30000
Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Pass 13:
ERROR: Invalid region id 0

real 37m24.352s
user 37m14.000s
sys 0m0.784s

# ###################################
# A series of tests using default RAM

# threshold 0.1
time i.segment group=pan out=pan_segmented_threshold_0.1_memory_300
threshold=0.1

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Segmentation converged after 11 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 25407

real 8m9.122s
user 8m5.582s
sys 0m0.296s

# threshold 0.3
time i.segment group=pan out=pan_segmented_threshold_0.3_memory_300
threshold=0.3

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Segmentation converged after 11 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 11684

real 12m20.273s
user 12m19.466s
sys 0m0.256s

# threshold 0.5
time i.segment group=pan out=pan_segmented_threshold_0.5_memory_300
threshold=0.5

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Segmentation converged after 12 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 5495

real 17m35.330s
user 17m34.302s
sys 0m0.264s

# threshold 0.7
time i.segment group=pan out=pan_segmented_threshold_0.7_memory_300
threshold=0.7

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Segmentation converged after 12 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 4911

real 18m15.143s
user 18m11.188s
sys 0m0.300s

# threshold 0.9
time i.segment group=pan out=pan_segmented_threshold_0.9_memory_300
threshold=0.9

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Pass 13:
Segmentation converged after 13 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 1276

real 30m30.619s
user 30m29.010s
sys 0m0.272s

# ####################
# Tests using max. RAM

# threshold 0.1
time i.segment group=pan out=pan_segmented_threshold_01 threshold=0.1
memory=30000

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Segmentation converged after 11 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 25407

real 8m5.619s
user 8m2.218s
sys 0m0.252s

# threshold 0.9
time i.segment group=pan out=pan_segmented_threshold_0.9_memory_30000
threshold=0.9 memory=30000

Loading input band...
Pass 1:
Pass 2:
Pass 3:
Pass 4:
Pass 5:
Pass 6:
Pass 7:
Pass 8:
Pass 9:
Pass 10:
Pass 11:
Pass 12:
Pass 13:
Segmentation converged after 13 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 1276

Nikos

Moritz Lennert wrote:

> [..]
>> > time i.segment -w group=pan_r_ir out=seg_weighted_pan_r_ir
>> threshold=0.01 memory=8192
>> Loading input bands...
>> Pass 1:
>> ERROR: Invalid region id 0
> [..]
>> What could be the problem ?

Nikos Alexandris:

> the same error today while performing a "random" test. Disk capacity and
> RAM plenty here.

> time i.segment group=pan out=pan_segmented_plantations_area_threshold_1
> threshold=0.99

Markus Metz:

In most cases, this threshold is too large. It should be between 0 and
1, and rather close to zero.

Testing up to the limits here... :slight_smile:

> Pass 13:
> ERROR: Invalid region id 0

> real 40m44.339s
> user 37m34.357s
> sys 0m0.380s

> Details

> projection: 1 (UTM)
> zone: 38
> datum: wgs84
> ellipsoid: wgs84
> north: -2571782.5
> south: -2574924.5
> west: 359153.5
> east: 359525
> nsres: 0.5
> ewres: 0.5
> rows: 6284
> cols: 743
> cells: 4669012

This region is used for all test I am doing (posted earlier).

> Let me know how I can help.

Can you make the dataset available (off-list if need be)? I can not
reproduce this error with the datasets I have.

I think not -- will ask though.

Nikos

Below kept only timings and number of created segments (from previously posted
tests as well as a few new ones), just as a reference.

All tests above threshold=0.95 fail to deliver. The extreme instruction
threshold=0.95 derives 70 segments. Above this, I think that everything would
be merged in one segment, a result for which i.segment is not required anyway.

How this is related with the error message... ?

In any case, if wanted, I will try during the weekend to replicate a Huge
region, as the one Moritz tested with a "rational" threshold (close to zero).

Thank you for this wonderful module!
Nikos

Nikos Alexandris wrote:

# ###################################
# A series of tests using default RAM

# threshold 0.1

Segmentation converged after 11 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 25407

real 8m9.122s
user 8m5.582s
sys 0m0.296s

# threshold 0.3

Segmentation converged after 11 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 11684

real 12m20.273s
user 12m19.466s
sys 0m0.256s

# threshold 0.5

Segmentation converged after 12 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 5495

real 17m35.330s
user 17m34.302s
sys 0m0.264s

# threshold 0.7

Segmentation converged after 12 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 4911

real 18m15.143s
user 18m11.188s
sys 0m0.300s

# threshold 0.9

Segmentation converged after 13 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 1276

real 30m30.619s
user 30m29.010s
sys 0m0.272s

# threshold 0.95
time i.segment group=pan out=pan_segmented_threshold_0.95_memory_30000
threshold=0.95 memory=30000
..
Segmentation converged after 13 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 70

real 45m48.901s
user 45m45.064s
sys 0m0.512s

# threshold 0.955 (I guess identical to 0.95)
time i.segment group=pan out=pan_segmented_threshold_0.955_memory_30000
threshold=0.955 memory=30000
..
Segmentation converged after 13 iterations.
Writing out segment IDs
i.segment complete. Number of segments created: 70

real 45m59.356s
user 45m55.280s
sys 0m0.584s

# threshold 0.96
time i.segment group=pan out=pan_segmented_threshold_0.96_memory_30000
threshold=0.96 memory=30000
..
Pass 13:
ERROR: Invalid region id 0

real 48m0.629s
user 47m56.724s
sys 0m0.472s

# threshold 0.97
time i.segment group=pan out=pan_segmented_threshold_0.97_memory_30000
threshold=0.97 memory=30000
..
Pass 11:
  40% Pass 12:
Pass 13:
ERROR: Invalid region id 0

real 47m58.069s
user 47m53.976s
sys 0m0.628s

# threshold 0.99
time i.segment group=pan out=pan_segmented_threshold_0.99_memory_30000
threshold=0.99 memory=30000

..
Pass 13:
ERROR: Invalid region id 0

real 37m24.352s
user 37m14.000s
sys 0m0.784s

time i.segment group=pan out=pan_segmented_threshold_0.99_memory_300
threshold=0.99

..
Pass 13:
ERROR: Invalid region id 0

real 41m42.828s
user 41m39.932s
sys 0m0.680s

On Wednesday 17 of July 2013 12:56:58 Nikos Alexandris wrote:

In any case, if wanted, I will try during the weekend to replicate a Huge
region, as the one Moritz tested with a "rational" threshold (close to
zero).

I couldn't make it -- my machine was under some sort of heavy reconstruction
during the last weekend. Is this still of interest? Let a machine to chew-up
a big region with i.segment?

Thanks, Nikos

On 26/07/13 15:17, Nikos Alexandris wrote:

On Wednesday 17 of July 2013 12:56:58 Nikos Alexandris wrote:

In any case, if wanted, I will try during the weekend to replicate a Huge
region, as the one Moritz tested with a "rational" threshold (close to
zero).

I couldn't make it -- my machine was under some sort of heavy reconstruction
during the last weekend. Is this still of interest? Let a machine to chew-up
a big region with i.segment?

Markus and I have been busy testing in the last weeks and thanks to Markus' rapid reaction in correcting some bugs, we've been able to segment an image with 555,727,911 non-null cells in a region with 2,617,375,744 total cells. Markus' machine did this in just 15 hours ! On mine it took much longer, but this is probably in large parts due to a software raid 5 that makes disk io really slow.

Moritz

On Friday 26 of July 2013 15:41:25 Moritz Lennert wrote:

On 26/07/13 15:17, Nikos Alexandris wrote:
> On Wednesday 17 of July 2013 12:56:58 Nikos Alexandris wrote:
>> In any case, if wanted, I will try during the weekend to replicate a Huge
>> region, as the one Moritz tested with a "rational" threshold (close to
>> zero).
>
> I couldn't make it -- my machine was under some sort of heavy
> reconstruction during the last weekend. Is this still of interest? Let
> a machine to chew-up a big region with i.segment?

Markus and I have been busy testing in the last weeks and thanks to
Markus' rapid reaction in correcting some bugs, we've been able to
segment an image with 555,727,911 non-null cells in a region with
2,617,375,744 total cells. Markus' machine did this in just 15 hours !
On mine it took much longer, but this is probably in large parts due to
a software raid 5 that makes disk io really slow.

WoW! Great news! Lot of work behind the scenes I guess. Thanks a million...
Let me know if and what I can test (besides my on-going work in which I do use
i.segment).

Nikos

On 27/07/13 00:19, Nikos Alexandris wrote:

On Friday 26 of July 2013 15:41:25 Moritz Lennert wrote:

On 26/07/13 15:17, Nikos Alexandris wrote:

On Wednesday 17 of July 2013 12:56:58 Nikos Alexandris wrote:

In any case, if wanted, I will try during the weekend to replicate a Huge
region, as the one Moritz tested with a "rational" threshold (close to
zero).

I couldn't make it -- my machine was under some sort of heavy
reconstruction during the last weekend. Is this still of interest? Let
a machine to chew-up a big region with i.segment?

Markus and I have been busy testing in the last weeks and thanks to
Markus' rapid reaction in correcting some bugs, we've been able to
segment an image with 555,727,911 non-null cells in a region with
2,617,375,744 total cells. Markus' machine did this in just 15 hours !
On mine it took much longer, but this is probably in large parts due to
a software raid 5 that makes disk io really slow.

WoW! Great news! Lot of work behind the scenes I guess. Thanks a million...
Let me know if and what I can test (besides my on-going work in which I do use
i.segment).

Any feedback on your on-going work would already be helpful. Infos about performance (speed, quality of segmentation, etc). Tests of hierarchical segmentation with increasing thresholds.

Moritz

Any of you guys have code around to do hierarchical segmentation?
Tried to do it in Python a few months ago, but failed (I'm not exactly
a great Python coder it seems!).

Cheers,

Pierre

2013/7/31 Moritz Lennert <mlennert@club.worldonline.be>:

On 27/07/13 00:19, Nikos Alexandris wrote:

On Friday 26 of July 2013 15:41:25 Moritz Lennert wrote:

On 26/07/13 15:17, Nikos Alexandris wrote:

On Wednesday 17 of July 2013 12:56:58 Nikos Alexandris wrote:

In any case, if wanted, I will try during the weekend to replicate a
Huge
region, as the one Moritz tested with a "rational" threshold (close to
zero).

I couldn't make it -- my machine was under some sort of heavy
reconstruction during the last weekend. Is this still of interest? Let
a machine to chew-up a big region with i.segment?

Markus and I have been busy testing in the last weeks and thanks to
Markus' rapid reaction in correcting some bugs, we've been able to
segment an image with 555,727,911 non-null cells in a region with
2,617,375,744 total cells. Markus' machine did this in just 15 hours !
On mine it took much longer, but this is probably in large parts due to
a software raid 5 that makes disk io really slow.

WoW! Great news! Lot of work behind the scenes I guess. Thanks a
million...
Let me know if and what I can test (besides my on-going work in which I do
use
i.segment).

Any feedback on your on-going work would already be helpful. Infos about
performance (speed, quality of segmentation, etc). Tests of hierarchical
segmentation with increasing thresholds.

Moritz

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

--
Scientist
Landcare Research, New Zealand

Hi Pierre,

On Wed, Jul 31, 2013 at 4:35 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Any of you guys have code around to do hierarchical segmentation?

I'm working to develop a module that use several machine learning
technique to classify the segments results...
the part concerning the hierarchical segmentation is working quite well...

ml.classify group=rgb seg_thresholds=0.02,0.05,0.1
seg_opts="method=region_growing,similarity=euclidean,minsize=2"
seg_name=seg__%.2f -s

If you think that could be useful, perhaps I could split into a
separate module.

Pietro

On 31/07/13 10:01, Pietro wrote:

Hi Pierre,

On Wed, Jul 31, 2013 at 4:35 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Any of you guys have code around to do hierarchical segmentation?

I'm working to develop a module that use several machine learning
technique to classify the segments results...
the part concerning the hierarchical segmentation is working quite well...

ml.classify group=rgb seg_thresholds=0.02,0.05,0.1
seg_opts="method=region_growing,similarity=euclidean,minsize=2"
seg_name=seg__%.2f -s

If you think that could be useful, perhaps I could split into a
separate module.

+1

I think it's always best to have one module do one thing well. And people might want to hierarchical segmentation for other purposes than classification.

And don't hesitate to publish your classification module as early as possible in addons. This way we can all test and contribute.

Moritz

On 31/07/13 05:35, Pierre Roudier wrote:

Any of you guys have code around to do hierarchical segmentation?
Tried to do it in Python a few months ago, but failed (I'm not exactly
a great Python coder it seems!).

It should just be a question of creating a loop. Something like this (untested):

seeds = ''

for thresh in [0.01, 0.05, 0.1, 0.2, 0.5]:

     outname = mapname + '_' + str(thresh)

     if seeds:
        grass.run_command('i.segment', [all your parameters], threshold=thresh, seeds=seeds)
     else:
        grass.run_command('i.segment', [all your parameters], threshold=thresh)

     seeds = outname

Moritz

On Wed, Jul 31, 2013 at 12:10 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

If you think that could be useful, perhaps I could split into a
separate module.

+1

I think it's always best to have one module do one thing well. And people
might want to hierarchical segmentation for other purposes than
classification.

And don't hesitate to publish your classification module as early as
possible in addons. This way we can all test and contribute.

ok, I can do it... which name should I use for the hierarchical module?

Pietro

On 31/07/13 13:22, Pietro wrote:

On Wed, Jul 31, 2013 at 12:10 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

If you think that could be useful, perhaps I could split into a
separate module.

+1

I think it's always best to have one module do one thing well. And people
might want to hierarchical segmentation for other purposes than
classification.

And don't hesitate to publish your classification module as early as
possible in addons. This way we can all test and contribute.

ok, I can do it... which name should I use for the hierarchical module?

i.segment.hierarchical ?

Moritz