Manage not temporal indices with DL and external features
With the external features it is possible to compute indices with a freedom on dimension, only if the classifier is "a classic" one (RF or SVM from OTB).
For the deep learning (and then Gaussian Process), the only indices allowed are temporal ones, i.e it's possible to use the SOI index for each date but not cumulative NDVI for instance.
These not temporal indices are not compatible with the current data management in dataloaders and statistics computation, as they require the same number of features for each sensor.
A simple workaround is to duplicate the non-temporal feature as many times as there are dates in the time series.
For instance a function used with a RF:
def get_sum_B2(self):
import numpy as np
coef = np.sum(self.get_interpolated_Sentinel2_B2(), axis=2)
labels = ["Sentinel2_b2sum"]
return coef, labels
must be modified to be used with DL:
def get_sum_B2(self):
import numpy as np
dates = self.get_interpolated_dates()
coef_uni = np.sum(self.get_interpolated_Sentinel2_B2(), axis=2)
coef_uni = coef_uni[:, :, None] # ensure the 3D shape
list_coef = []
labels = []
for date in dates["Sentinel2"]:
list_coef.append(coef_uni)
labels.append(f"Sentinel2_sum_{date}")
coef = np.dstack(list_coef)
return coef, labels
Note the labels syntax which is mandatory to be associated with the corresponding sensor.
By this way, all steps in the workflow will correctly use the feature.
This workaround implies that the computed features will be processed with the standardisation than the other features. Therefore, if normalization by a constant is used, this must be taken into account when calculating the external indices
This issue is open for discussion on how these indices should be managed without going through the systematic duplication of features.