Commit 1dab5c76 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

cleaning

parent df8df81b
......@@ -525,21 +525,8 @@ class PreResNet34(torch.nn.Module):
def __init__(self, block=BasicBlock, num_blocks=[3, 1, 3, 1, 5, 1, 2], speaker_number=10):
super(PreResNet34, self).__init__()
self.in_planes = 128
self.speaker_number = speaker_number
# Feature extraction
#n_fft = 2048
#win_length = None
#hop_length = 512
#n_mels = 80
#n_mfcc = 80
#self.MFCC = torchaudio.transforms.MFCC(
# sample_rate=16000,
# n_mfcc=n_mfcc, melkwargs={'n_fft': n_fft, 'n_mels': n_mels, 'hop_length': hop_length})
#self.CMVN = torch.nn.InstanceNorm1d(80)
self.speaker_number = speaker_number
self.conv1 = torch.nn.Conv2d(1, 128, kernel_size=3,
stride=1, padding=1, bias=False)
......@@ -564,8 +551,6 @@ class PreResNet34(torch.nn.Module):
return torch.nn.Sequential(*layers)
def forward(self, x):
out = self.MFCC(x)
out = self.CMVN(out)
out = out.unsqueeze(1)
out = torch.nn.functional.relu(self.bn1(self.conv1(out)))
out = self.layer1(out)
......@@ -588,19 +573,6 @@ class PreFastResNet34(torch.nn.Module):
self.in_planes = 16
self.speaker_number = speaker_number
# Feature extraction
n_fft = 2048
win_length = None
hop_length = 512
n_mels = 80
n_mfcc = 60
self.MFCC = torchaudio.transforms.MFCC(
sample_rate=16000,
n_mfcc=n_mfcc, melkwargs={'n_fft': n_fft, 'n_mels': n_mels, 'hop_length': hop_length})
self.CMVN = torch.nn.InstanceNorm1d(60)
self.conv1 = torch.nn.Conv2d(1, 16, kernel_size=7,
stride=(2, 1), padding=3, bias=False)
self.bn1 = torch.nn.BatchNorm2d(16)
......
......@@ -356,15 +356,14 @@ class MfccFrontEnd(torch.nn.Module):
self.PreEmphasis = PreEmphasis(self.pre_emphasis)
self.melkwargs = {sample_rate:self.sample_rate,
n_fft:self.n_fft,
f_min:self.f_min,
f_max:self.f_max,
win_length:self.win_length,
window_fn:self.window_fn,
hop_length:self.hop_length,
power:self.power,
n_mels:self.n_mels}
self.melkwargs = {"n_fft":self.n_fft,
"f_min":self.f_min,
"f_max":self.f_max,
"win_length":self.win_length,
"window_fn":self.window_fn,
"hop_length":self.hop_length,
"power":self.power,
"n_mels":self.n_mels}
self.MFCC = torchaudio.transforms.MFCC(
sample_rate=self.sample_rate,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment