You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I worked through the python notebooks and I got it to work the way I wanted. So a big thanks for sharing it!
In the process, I thought of something which would be particularly useful, and that is a class which performs the prediction on a patch basis instead of on the reshaped raster for the entire AOI. The problem is that if the time series used is very long, and the AOI is very large, MemoryError is almost guaranteed.
I came up with this instead:
class PredictOutput(EOTask):
"""
The task performs the ML prediction patch-wise.
"""
def __init__(self, model):
self.model = model
def execute(self, eopatch):
feature = eopatch.data['FEATURES']
t, w, h, f = feature.shape
feature = np.swapaxes(feature,0,2).reshape(h*w,t*f)
plabels = self.model.predict(feature)
plabels = np.swapaxes(plabels.reshape(h,w),0,1)
plabels = plabels[...,np.newaxis]
eopatch.add_feature(FeatureType.DATA_TIMELESS, 'PRED', plabels)
return eopatch
I do not know if you think it is worth including in the eo-learn framework, or should just be included in the notebook as a way to show how to implement patch-wise prediction. Of course, only 9 patches were predicted, so there is no real need for it in the notebook, but they are all about showcasing what eo-learn is capable of.
Regards
The text was updated successfully, but these errors were encountered:
wouellette
changed the title
Class to predict classifications per patch
Class to predict per patch
Oct 29, 2018
This was planned to be implemented, but we were pressed with time and wanted to work on this a bit later, but since you shared this code, we can already use it to update the example :)
I added the prediction task in the LULC example, but probably this is too specific to the model and the task at hand to add it to the code, I guess (perhaps some custom code would still be needed to clean some features or idk what)
I worked through the python notebooks and I got it to work the way I wanted. So a big thanks for sharing it!
In the process, I thought of something which would be particularly useful, and that is a class which performs the prediction on a patch basis instead of on the reshaped raster for the entire AOI. The problem is that if the time series used is very long, and the AOI is very large, MemoryError is almost guaranteed.
I came up with this instead:
I do not know if you think it is worth including in the eo-learn framework, or should just be included in the notebook as a way to show how to implement patch-wise prediction. Of course, only 9 patches were predicted, so there is no real need for it in the notebook, but they are all about showcasing what eo-learn is capable of.
Regards
The text was updated successfully, but these errors were encountered: