Skip to content

Commit

Permalink
filter silence parameter removal
Browse files Browse the repository at this point in the history
  • Loading branch information
EyubogluMerve committed Jun 14, 2024
1 parent 01e5af3 commit 55fe241
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions datasets/kws20.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class KWS:
puts it in root directory. If dataset is already downloaded, it is not
downloaded again.
save_unquantized (bool, optional): If true, folded but unquantized data is saved.
filter_silence (bool, optional): If true, silence class will be eliminated from the dataset.
filter_libri (bool, optional): If true, librispeech class will be eliminated from the dataset.
benchmark (bool, optional): If true, benchmark dataset will be loaded.
Expand Down Expand Up @@ -98,16 +97,15 @@ class KWS:
'up', 'yes', 'SILENCE']

def __init__(self, root, classes, d_type, t_type, transform=None, quantization_scheme=None,
augmentation=None, download=False, save_unquantized=False, filter_silence=True,
filter_libri=False, benchmark=False):
augmentation=None, download=False, save_unquantized=False, filter_libri=False,
benchmark=False):

self.root = root
self.classes = classes
self.d_type = d_type
self.t_type = t_type
self.transform = transform
self.save_unquantized = save_unquantized
self.filter_silence = filter_silence
self.filter_libri = filter_libri
self.benchmark = benchmark

Expand All @@ -128,7 +126,7 @@ def __init__(self, root, classes, d_type, t_type, transform=None, quantization_s
print(f'\nProcessing {self.d_type}...')
self.__filter_dtype()

if self.filter_silence:
if 'SILENCE' not in self.classes:
self.__filter_silence()

if self.filter_libri:
Expand Down Expand Up @@ -878,7 +876,7 @@ def __gen_datasets(self, exp_len=16384):


def KWS_get_datasets(data, load_train=True, load_test=True, dataset_name='KWS', num_classes=6,
quantized=True, filter_silence=True, filter_libri=False, benchmark=False):
quantized=True, filter_libri=False, benchmark=False):
"""
Load the folded 1D version of SpeechCom dataset
Expand Down Expand Up @@ -925,7 +923,7 @@ def KWS_get_datasets(data, load_train=True, load_test=True, dataset_name='KWS',
transform=transform, t_type='keyword',
quantization_scheme=quantization_scheme,
augmentation=augmentation, download=True,
filter_silence=filter_silence, filter_libri=filter_libri,
filter_libri=filter_libri,
benchmark=benchmark)
else:
train_dataset = None
Expand All @@ -935,7 +933,7 @@ def KWS_get_datasets(data, load_train=True, load_test=True, dataset_name='KWS',
transform=transform, t_type='keyword',
quantization_scheme=quantization_scheme,
augmentation=augmentation, download=True,
filter_silence=filter_silence, filter_libri=filter_libri,
filter_libri=filter_libri,
benchmark=benchmark)

if args.truncate_testset:
Expand Down Expand Up @@ -1047,8 +1045,7 @@ def KWS_12_benchmark_get_datasets(data, load_train=True, load_test=True):
SILENCE + UNKNOWN.
"""
return KWS_get_datasets(data, load_train, load_test, dataset_name='KWS_12_benchmark',
num_classes=11, filter_silence=False, filter_libri=True,
benchmark=True)
num_classes=11, filter_libri=True, benchmark=True)


def MixedKWS_20_get_datasets_10dB(data, load_train=True, load_test=True,
Expand Down

0 comments on commit 55fe241

Please sign in to comment.