Commit 88f4d2b9 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

debug

parent 4b5a23ba
......@@ -67,9 +67,9 @@ class PreEmphasis(torch.nn.Module):
:param input_signal: the input signal
:return: the filtered signal
"""
assert len(input.size()) == 2, 'The number of dimensions of input tensor must be 2!'
assert len(input_signal.size()) == 2, 'The number of dimensions of input tensor must be 2!'
# reflect padding to match lengths of in/out
input_signal = input.unsqueeze(1)
input_signal = input_signal.unsqueeze(1)
input_signal = torch.nn.functional.pad(input_signal, (1, 0), 'reflect')
return torch.nn.functional.conv1d(input_signal, self.flipped_filter).squeeze(1)
......
......@@ -425,7 +425,6 @@ class IdMapSet(Dataset):
middle = start + duration // 2
start = int(max(0, int(middle - (self.min_duration * self.sample_rate / 2))))
duration = int(self.min_duration * self.sample_rate)
speech, speech_fs = torchaudio.load(f"{self.data_path}/{self.idmap.rightids[index]}.{self.file_extension}",
frame_offset=start,
num_frames=duration)
......@@ -455,6 +454,7 @@ class IdMapSet(Dataset):
noise_df=self.noise_df,
rir_df=self.rir_df)
speech = speech.squeeze()
return speech, self.idmap.leftids[index], self.idmap.rightids[index], start, stop
......
......@@ -1775,14 +1775,14 @@ def extract_embeddings(idmap_name,
tmp_start = numpy.arange(0, data.shape[0] * win_shift, win_shift)
starts.extend(tmp_start * sample_rate + start.detach().cpu().numpy())
else:
starts.append(start)
starts.append(start.numpy())
embeddings = StatServer()
embeddings.stat1 = numpy.concatenate(embed)
embeddings.modelset = numpy.array(modelset).astype('>U')
embeddings.segset = numpy.array(segset).astype('>U')
embeddings.start = numpy.array(starts)
embeddings.stop = numpy.array(starts) + win_duration
embeddings.start = numpy.array(starts).squeeze()
embeddings.stop = embeddings.start + win_duration
embeddings.stat0 = numpy.ones((embeddings.modelset.shape[0], 1))
return embeddings
......
Supports Markdown
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