prepare CalData

45 views
Skip to first unread message

Emily Ernst

unread,
Jan 24, 2020, 11:55:01 AM1/24/20
to SegOptim user group
Hello. I'm working through the tutorial and when I reach section 4.7, I receive the following error:

> calData <- prepareCalData(rstSegm = segmRst, 
+                           trainData = trainDataRst, 
+                           rstFeatures = classificationFeatures, 
+                           thresh = 0.5, 
+                           funs = "mean", 
+                           minImgSegm = 30, 
+                           verbose = TRUE)
-> [1/3] Loading train data into image segments...
done.

-> [2/3] Calculating feature statistics for all image segments...
Error in calculateSegmentStats(rstFeatures = rstFeatures, rstSegm = rstSegm,  : 
  Not enough memory to process the input raster files! Modify option bylayer to TRUE
Warning message:
In prepareCalData(rstSegm = segmRst, trainData = trainDataRst, rstFeatures = classificationFeatures,  :
  An error occurred while calculating segmentation statistics for feature data!

Any recommendation on how to fix the memory issue? I'm working on MacBook.

João Gonçalves

unread,
Jan 24, 2020, 12:59:56 PM1/24/20
to SegOptim user group
Hi Emily,

Thanks for your message.

The fastest answer is try to run the function with bylayer = TRUE option. This way it takes a little more time but much less memory. Try it out and let me know how it goes.

calData <- prepareCalData(rstSegm = segmRst,

                           trainData
= trainDataRst,
                           rstFeatures
= classificationFeatures,
                           thresh
= 0.5,
                           funs
= "mean",
                           minImgSegm
= 30,
                           verbose
= TRUE,
                           bylayer
= TRUE)


The "prepareCalData" function is responsible for pushing the data in the classificationFeatures RasterStack and calculating aggregation statistics by image segment. So in that process it takes a lot of memory in order to be fast with calculations made by the data.table package.

Btw how much RAM memory do you have available in your MacBook? For SegOptim deffinetely more is merrier :-)

Cheers
João

Emily Ernst

unread,
Jan 24, 2020, 2:20:33 PM1/24/20
to SegOptim user group
Yep - that fixed it!

Thanks!
Reply all
Reply to author
Forward
0 new messages