Description Usage Arguments Value Author(s) Examples
calculates the amount of cells for class "trees" which overlap with TreeCrown Segments.
1 | classSegVal(pred, seg, classTree = NULL, reclass = NULL)
|
pred |
RasterLayer - Prediction to be validated |
seg |
PolygonLayer - Segments with TreeCrowns |
classTree |
numeric - The class representing Trees |
reclass |
optional - numeric value of class to merge into class "trees", for multiple classes to merge use reclass=c(x,y) |
returns the validation score
return and plot the "tree 1 and no tree 2" layer, will be reclassified if 'reclass' is used.
result table
nclass - amount of cells for class 'tree' (may differ if 'reclass' is used)
nseg - amount of cells for all TreeCrowns
overclass - amount of cells for classification not occuring in TreeCrowns (over classification)
underclass - amount of cells for TreeCrowns not occuring in the classification (under classification)
hit - amount of cells for classification occuring in TreeCrowns
hitrate - amount of hit in relation to total classification cells in %
rate underclass - amount of underclass in relation to total TreeCrown cells in %
rate overclass -amount of overclass in relation to total classification cells in %
validation score hitrate @ overrate + underrate
Andreas Schönberg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # load data
require(caret)
require(CAST)
require(doParallel)
require(raster)
require(IKARUS)
require(mapview)
lau_Stk <- raster::stack(system.file("extdata","lau_RGB.grd",package = "IKARUS"))
lau_tP <-rgdal::readOGR(system.file("extdata","lau_TrainPolygon.shp",package = "IKARUS"))
# handle CRS string
crs(lau_tP) <- crs(lau_Stk)
# load segments
lau_seg <-rgdal::readOGR(system.file("extdata","lau_TreeSeg.shp",package = "IKARUS"))
# handle CRS string
crs(lau_seg) <- crs(lau_Stk)
### extract values using 'exrct_Tdat' to generate training dataset
tDat <- exrct_Traindat(lau_tP,lau_Stk,"class")
# check for class column and predictor columns in input training dataset
head(tDat)
# classification
model1 <- RFclass(tDat = tDat,predCol = "default",predStk = lau_Stk,classCol = "class")
#check model and seg
plot(model1$prediction)
plot(lau_seg)
# test several combinations of classes for tress
tree <- classSegVal( pred=model1$prediction, seg=lau_seg, classTree=4, reclass=NULL)
tnsha <- classSegVal( pred=model1$prediction, seg=lau_seg, classTree=4, reclass=2)
tnshangras <- classSegVal( pred=model1$prediction, seg=lau_seg, classTree=4, reclass=c(2,3))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.