Problem with Calibration: Error Caldata must be an object of class SOptim.Caldata

37 views
Skip to first unread message

Janik Hoffmann

unread,
Aug 26, 2021, 3:19:23 AM8/26/21
to SegOptim user group
Dear João / Dear community,

I would be so delighted if you could help fixing my problem! Thanks in advance for your nice and open communication and help with previous cases, that is amazing and pretty helpful.

I currently try to run the OBIA for Sentinel-2 VIS raster stack. Everything was fine until I reached the step about the calibration of the classifier. The output of my function "prepareCalData is not what it is supposed to be, it is just a empty value and not a data frame and especially not an object of class SOptim.CalData as the error is telling. 

My Code as follows:

segmObj <- segmentation_OTB_LSMS(inputRstPath= inputRstPath.path, 
                                 outputSegmRst= outputSegmRst.path, 
                                 SpectralRange=100, 
                                 SpatialRange=20, 
                                 MinSize=30, 
                                 lsms_maxiter=10, 
                                 tilesizex = 1416, 
                                 tilesizey = 1649, 
                                 otbBinPath= otbPath, 
                                 verbose=TRUE)

rstSegm <- raster(segmObj$segm)

print(rstSegm)
plot(rstSegm)



prepareCalData(rstSegm = rstSegm, trainData = trainDataRst, rstFeatures = classificationFeatures.path,  thresh = 0, 
               funs = c("mean","sd"), minImgSegm = 10, verbose = TRUE, progressBar = TRUE)

_________________ The output of prepare CalData______________with the error that comes for calibrate Classifier_____________

Screenshot 2021-08-26 at 09.15.35.png

calibrateClassifier(calData,
                    classificationMethod = "RF",
                    classificationMethodParams = NULL,
                    balanceTrainData = FALSE,
                    balanceMethod = "ubOver",
                    evalMethod = "HOCV",
                    evalMetric = "Kappa",
                    trainPerc = 0.8,
                    nRounds = 20,
                    minTrainCases = 30,
                    minCasesByClassTrain = 10,
                    minCasesByClassTest = 10,
                    runFullCalibration = TRUE)   
       
(see error message above in image)


I am not sure what the problem is. The segmentation worked and the training data seems to be okay, would appreciate if there is a solution, I really want it to work :D

Thanks João and greetings from Germany!

Janik Hoffmann
Reply all
Reply to author
Forward
0 new messages