def __do_transform(self, signal): signal = signal.astype(self.precision) if self.transform: signal = tensor_to_numpy(self.transform(signal.reshape( (1, -1, 1)))) return signal
def __do_transform(self, signal): signal = signal.astype(self.precision) if self.transform: signal = tensor_to_numpy(self.transform(signal.reshape( (1, -1, 1)))) signal = np.repeat(signal, repeats=self.upsample_factor, axis=-1) return signal
def __getitem__(self, index): X, y, label_name = self.X[index], self.y[index], self.label_name[index] if self.transforms: X = tensor_to_numpy(self.transforms(X.reshape((1, -1, 1)))) if self.one_hot_labels: y = self.one_hot_encoder(y)[0, :] return {"sound": X, "class": y, "class_label": label_name}
def do_transform(self, sound): if self.transforms: trans_sig = self.transforms(sound.reshape((1, -1, 1))) sound = tensor_to_numpy(trans_sig) return sound