Here is a sample code to implement the preprocessing() method.
preprocessing() is called after the input data is loaded by load_dataset() method.
Loaded timeseries are stored in self.data property as dict, and you can get acceleration data by self.data[i].get("data").
You can implement preprocessing such as normalization or standardization by updating the data property within this method.
class OpenPackImu(optorch.data.datasets.OpenPackImu):
def preprocessing(self) -> None:
"""
* Normalize [-3G, +3G] into [0, 1].
"""
# NOTE: Normalize ACC data. ([-3G, +3G] -> [0, 1])
for seq_dict in self.data:
x = seq_dict.get("data")
x = np.clip(x, -3, +3)
x = (x + 3.) / 6.
seq_dict["data"] = x
Here is a sample code to implement the
preprocessing()method.preprocessing()is called after the input data is loaded byload_dataset()method.Loaded timeseries are stored in
self.dataproperty as dict, and you can get acceleration data byself.data[i].get("data").You can implement preprocessing such as normalization or standardization by updating the
dataproperty within this method.