Random Forest Classification

Hi, I am a new SNAP user trying to do a Random Forest Classification.
For that, I preprocessed the image I want to classify and I created a shapefile with the ROI in QGIS.
I am trying the train on vectors classification. For that, I have found the following problems or doubts:

  1. What do I need to put in -vector training , training vectors-? (which file and its format)
    I thought I should put my ROI shapefile or something like this, but, I cannot open any shapefile with the program. (please let me know how to open them)
    2- What do i need to put in -feature selection, feature bands-? (again file and format).

Thank you very much

you can import your vector as described here: Removing land by masking

It could be points, but polygons are better.

About the inputs, maybe this helps you: Rndom forest classification steps

Ok, Thank you :slight_smile:

After all, i ended up with this another error: javax.imageio.IIOException: 16-bit samples are not supported for Horizontal differencing Predictor what does it mean?

This error has been reported previously. A workaround is to decompress the file using a 3rd party application such as gdal.

1 Like

Hi, I have again one question:

To avoid the "javax.imageio.IIOException: 16-bit samples are not supported for Horizontal differencing Predictor " error I introduced all the individual bands I want to do the classification to (it is a total of 29 bands); then I imported my AOI (polygon shapefiles) while selecting one of those bands, then I finally was able to run the classification.

Everything seemed to work well except for the results; I ended up with 2 bands: LabeledClasses and Confidence. When I export this file into a tiff, I obtain a black image without data. The same happens in SNAP.

How can i do it better to interpret the results?

Thank you

@AnaV

Can you share somee screenshots to see your results?

If you want to export the classification, open it (LabeledClasses), go to File -> Export Image, select your output format and save it.

If you open this tiff in QGIS for example, you will have to change the style scheme that is used. Make sure you select “singleband pseudocolor”

@AnaV

Definetly, you RF did not work properly. Check that your preprocessing is okay and run again the classification. What are all the steps you are doing?

For the classification i am using 29 raster bands, belonging to 6 different rasters: NDVI, NDBI, NDWI percentil 50 and 90, sentinel 1 and sentinel 2 images and tasseled components images aswel.
The AOI are shapefile polygons created with QGIS and I am importing them into my first raster band

try working with orfeo QGIS or build your training rois directly on snap and export them to ESRI shapefile