diff --git a/dnn/torch/fargan/dataset.py b/dnn/torch/fargan/dataset.py index 0f2e4a819..2dfbb0b56 100644 --- a/dnn/torch/fargan/dataset.py +++ b/dnn/torch/fargan/dataset.py @@ -36,7 +36,7 @@ def __init__(self, self.features = np.lib.stride_tricks.as_strided(self.features, shape=(self.nb_sequences, self.sequence_length*2+4, nb_features), strides=(self.sequence_length*self.nb_features*sizeof, self.nb_features*sizeof, sizeof)) #self.periods = np.round(50*self.features[:,:,self.nb_used_features-2]+100).astype('int') - self.periods = np.round(256./2**(self.features[:,:,self.nb_used_features-2]+1.5)).astype('int') + self.periods = np.round(np.clip(256./2**(self.features[:,:,self.nb_used_features-2]+1.5), 32, 255)).astype('int') self.lpc = self.features[:, :, self.nb_used_features:] self.features = self.features[:, :, :self.nb_used_features] diff --git a/dnn/torch/fargan/fargan.py b/dnn/torch/fargan/fargan.py index 84053fd08..39b5ddaf7 100644 --- a/dnn/torch/fargan/fargan.py +++ b/dnn/torch/fargan/fargan.py @@ -157,7 +157,7 @@ def __init__(self, feature_dim=20, cond_size=256, pembed_dims=12): self.feature_dim = feature_dim self.cond_size = cond_size - self.pembed = nn.Embedding(225, pembed_dims) + self.pembed = nn.Embedding(224, pembed_dims) self.fdense1 = nn.Linear(self.feature_dim + pembed_dims, 64, bias=False) self.fconv1 = nn.Conv1d(64, 128, kernel_size=3, padding='valid', bias=False) self.fconv2 = nn.Conv1d(128, 80*4, kernel_size=3, padding='valid', bias=False) diff --git a/dnn/torch/fargan/test_fargan.py b/dnn/torch/fargan/test_fargan.py index eb12aca8f..d47400f86 100644 --- a/dnn/torch/fargan/test_fargan.py +++ b/dnn/torch/fargan/test_fargan.py @@ -49,7 +49,7 @@ lpc = features[:,4-1:-1,nb_used_features:] features = features[:, :, :nb_used_features] #periods = np.round(50*features[:,:,nb_used_features-2]+100).astype('int') -periods = np.round(256./2**(features[:,:,nb_used_features-2]+1.5)).astype('int') +periods = np.round(np.clip(256./2**(features[:,:,nb_used_features-2]+1.5), 32, 255)).astype('int') nb_frames = features.shape[1]