[GIS] Building confusion matrix for image classification using SAGA

confusion matriximage classificationsaga

I did a supervised classification of a Landsat image subset using my training data polygons. I used SAGA GIS for that and everything worked out fine. Now I am stuck since I have no clue how to prepare the confusion matrix using my test polygons!

I know that I need for each polygon the number of pixels of the different classes, i.e. a cross tabulation.

How could one achieve that?

And yes, I know that there is this semi-automatic image classification plugin for QGIS and so forth, but I would like to understand the process of generating the confusion matrix itself from scratch.

Best Answer

Given the case that you are trying to measure the accuracy of a supervised classification, then generally you also have test samples, usually polygons. In SAGA, one has to convert these polyons into a grid with:

Module: Grid - Gridding -- Shapes to grid

After that, one can use that new grid in the zonal statistic tool found in the module:

Spatial and Geostatistics - Grids -- Zonal Grid Statistics

That leads to a table having (at least) three columns, where one (count UCU) holds the number of cells/pixels per test class and classified class. This table can then be turned into the classical confusion matrix, from which Kappa etc can be calculated.

Related Question