New classification modes

Has anyone tested the new supervised classification modes? I keep getting an NullPoiterException throughout most of them (Maximum Likelihood as well as Random Forest)

I have a stack consisting of serveral bands (different scaling, therefore RF was preferred)
I imported a polygon shapefile with class trainig areas and saved it into the stack.

These are correctly identified in the classification module

I tried both Labels “Vector node name” and “id” but each time i get an error after several seconds, no additional information.

I got it working once for Random Forest but can’t reproduce it. Nor can I find anything that was different.

Is there anything I should keep an eye on while preparing the data?

There have been some fixes done since 4.0 I’ll create the module update soon.

1 Like

great, thanks for the information!

thanks for the fix, problem seems to be solved!

hm, still happens for certain files, when I add a stack of GLCM textures for example. Any idea?

Do I have to stack all layers before training the classifier? Edit: Apparently, it makes no difference.

Another question: I am using ALOS2 data and some textures, imported 14 training classes through a shapefile and want to apply a Random Forest classifier. However, I keep getting the error message bound must be positive after a few seconds.
Other classifiers seem to work.

What is meant with ‘bound’ so I could figure out where to fix it?
If I only use the original data without textures it seems to work.
I replaced the textures by polarimetric parameters and the problem comes up again.

still getting this error, regardless of data (Landsat, Sentinel) or location (Europe, Asia).
I use training areas digitized in SNAP.

Could you a link to a subset dataset with the training vectors? How many labels are used?

I used 4 classes.

You can have a look at the data here. The training areas are relatively small but the error also occurs with larger ones.

Ok it should be fixed now. The problem was that it wasn’t handling the projection from the vectors properly so it never found them to intersect with the current tile. The ‘bound must be positive’ error comes from RF when the training set is empty. I’ll add this to be released in the next update.


That’s fantastic, thanks so much, @lveci!

How did you fixed it @lveci ?
I am having the same problem with my sentinel2-data. The data is allready been projected. But it still does not work. I have also the last version of SNAP. Should I project the vector data? and if, how?


are raster and vector data projected in the same coordinate reference system?


How did you fix bound must be positive error? I am getting the same error in my classification random forest as well.

did you import the training vectors from a shapefile/CSV or did you digitize them directly in SNAP?

1 Like

I digitised them directly in SNAP.

Is your data projected to a coordinate system?

Yes. on WGS-84 coordinate system

Please have a look at the coordinates of your training data. You can see them by double clicking it and looking at the entry in the table. It is in WKT format and starts with POLYGON(…
The coordinates in there should range within the latitudes and longitudes of your data.