Object-based classification using Random Forests: Issue(s)

115 views
Skip to first unread message

Ramiro Silveyra González

unread,
Nov 26, 2014, 4:48:08 AM11/26/14
to rsgislib...@googlegroups.com
Hi Everyone,

my name is Ramiro and I am a forestry master student at Freiburg University (Germany).
I just started my master thesis, which deals with Forest Stand Delineation, and
I decided to use RSGISLIB and also SPDLIB for developing my work.

As a previous step, I am testing different methodologies in a test area.
This week I am trying the Object-based classification using Random Forests mentioned at the blog SpectralDifferences.
I have all input data, with same size, resolution and projectionon and segmentation runs smoothly.
But something is not working properly with rastergis.populateRATWithStats(classfile, classfile, codestats)
I get the following error:
      "  _rastergis.error: The column Histogram could not be found 

Could anybody please tell what it means? And what might I be doing wrong?
Thanks in advance.


Cheers,

Ramiro


Daniel Clewley

unread,
Nov 26, 2014, 8:31:02 AM11/26/14
to Ramiro Silveyra González, RSGISLib Support
Hi Ramiro,

Try running:

rastergis.populateStats(classfile)

before:

rastergis.populateRATWithStats(classfile, classfile, codestats)

As this should force creation of the Histogram column.

Thanks,

Dan

--
You received this message because you are subscribed to the Google Groups "RSGISLib Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rsgislib-suppo...@googlegroups.com.
To post to this group, send email to rsgislib...@googlegroups.com.
Visit this group at http://groups.google.com/group/rsgislib-support.
For more options, visit https://groups.google.com/d/optout.

Ramiro Silveyra González

unread,
Nov 27, 2014, 7:50:37 AM11/27/14
to Daniel Clewley, RSGISLib Support
Hi Dan,
 
Thanks!! It worked out.

Unfortunately I get now another issue.
When I run populateImageStats on the clumpFile, it apparently works.
But when I run the classification the rat.readColumn cant find any of the columns by name.

I spent some time thinking about it and trying to figure out a way to fixed,
 but I still did not find any solution. I guess that when I run populateImageStats the band names aren't being
used for attribute names in the output RAT.
I am sure that band names are right, I named them with imageutils.setBandNames.

Do you have any idea on what my problem could be?

Cheers,

Ramiro



Daniel Clewley

unread,
Nov 27, 2014, 8:14:08 AM11/27/14
to Ramiro Silveyra González, RSGISLib Support
Hi Ramiro,

If you try viewing the RAT in TuiView are the columns named as expected? 

Dan

Ramiro Silveyra González

unread,
Nov 27, 2014, 8:34:43 AM11/27/14
to Daniel Clewley, RSGISLib Support
Hi Dan,

I am looking at the data in TuiView.
My classification stack has all band (12), while the clumpsFile (after adding attribute values from the classification-stack to the RAT)  has only one band.

Is it that what you meant?

Ramiro

Pete Bunting [pfb]

unread,
Nov 27, 2014, 10:02:52 AM11/27/14
to Ramiro Silveyra González, Daniel Clewley, RSGISLib Support
Using the crosshair query tool in tuiview what does it show for the single band clump file?

It should show up the attribute table, with columns and values.

Best wishes,

Pete

Sent from my iPhone

Ramiro Silveyra González

unread,
Nov 27, 2014, 11:13:51 AM11/27/14
to Pete Bunting [pfb], Daniel Clewley, RSGISLib Support
Hi Pete,

I just checked it.
It does show the attributes, preceded by the stats, e.g. meanNDVI or maxNDVI.
I guess then I have to set column names not to layer names as I did, but to those names from the attribute table.
I will try it now.

Thanks for the information.
I didn't think of looking at the attributes in tuiview.

Cheers,

Ramiro

Ramiro Silveyra González

unread,
Nov 27, 2014, 11:16:01 AM11/27/14
to Pete Bunting [pfb], Daniel Clewley, RSGISLib Support
*NDVIAvg or NDVIMax

Daniel Clewley

unread,
Nov 27, 2014, 11:31:13 AM11/27/14
to Ramiro Silveyra González, Daniel Clewley, RSGISLib Support, Pete Bunting [pfb]

Up to you, you probably want to use the object average though.

Dan

Ramiro Silveyra González

unread,
Nov 27, 2014, 1:23:12 PM11/27/14
to Daniel Clewley, RSGISLib Support, Pete Bunting [pfb]
Perfect!
Thank to your advice I managed to perform the classification with RandomForest (using average values)
I colored the classes and it looks quite good, I compared it to some already mapped habitat data I have.
I will have to tune some parameters and decide what data I feed to the segmentation and classification
to improve, but the output is good already.

I think is great that you developed all this tools and made them available as open source software,
It is also amazing that I can perform some tasks just my laptop.
And thanks for replying so rapidly to my emails.

I will probably write here once a while since I aim to develop my entire work based on spdlib, rsgislib, python and some additional libraries, and I am just at very beginning :).

Well, here is time for Feierabend...
Thanks for your answers.

Cheers,

Ramiro

Reply all
Reply to author
Forward
0 new messages