Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Update vad.py #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pororo/models/vad.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,18 @@ def smooth_predictions_v2(self, label):
def get_speech_intervals(self, data, label):

def get_speech_interval(labels):
seguence_length = 1024
sequence_length = 1024
speech_interval = [[0, 0]]
pre_label = 0

for idx, label in enumerate(labels):

if label:
if pre_label == 1:
speech_interval[-1][1] = (idx + 1) * seguence_length
speech_interval[-1][1] = (idx + 1) * sequence_length
else:
speech_interval.append([
idx * seguence_length, (idx + 1) * seguence_length
idx * sequence_length, (idx + 1) * sequence_length
])

pre_label = label
Expand All @@ -176,19 +176,19 @@ def get_speech_interval(labels):
return speech_intervals

def __call__(self, signal: np.ndarray, sample_rate: int = 16000):
seguence_signal = list()
sequence_signal = list()

self.sample_rate = sample_rate
start_pointer = 0
end_pointer = 1024

while end_pointer < len(signal):
seguence_signal.append(signal[start_pointer:end_pointer])
sequence_signal.append(signal[start_pointer:end_pointer])

start_pointer = end_pointer
end_pointer += 1024

feature = [self.extract_features(signal) for signal in seguence_signal]
feature = [self.extract_features(signal) for signal in sequence_signal]

feature = np.array(feature)
feature = np.expand_dims(feature, 1)
Expand Down