Skip to content

Commit 403afe1

Browse files
committed
Use params.BASE_PATH closes #131
1 parent 2fb5b63 commit 403afe1

14 files changed

+26
-29
lines changed

asr/dataset_util/audio_sample_info.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020

2121
# noinspection PyUnresolvedReferences
2222
from asr.load_sample import load_sample, WIN_STEP
23+
from asr.params import BASE_PATH
2324

24-
DATASETS_PATH = '../datasets/speech_data'
25+
DATASETS_PATH = os.path.join(BASE_PATH, '../datasets/speech_data')
2526

2627

2728
def display_sample_info(file_path, label=''):
@@ -187,7 +188,7 @@ def display_sample_info(file_path, label=''):
187188

188189

189190
if __name__ == '__main__':
190-
_test_txt_path = os.path.join('./data', 'train.txt')
191+
_test_txt_path = os.path.join(BASE_PATH, 'data', 'train.txt')
191192

192193
# Display specific sample info's.
193194
with open(_test_txt_path, 'r') as f:
@@ -196,7 +197,7 @@ def display_sample_info(file_path, label=''):
196197
# _line = _lines[37748] # "The cat is on the roof"
197198
_line = _lines[375]
198199
_wav_path, txt = _line.split(' ', 1)
199-
_wav_path = os.path.join('../datasets/speech_data', _wav_path)
200+
_wav_path = os.path.join(DATASETS_PATH, _wav_path)
200201
_txt = txt.strip()
201202

202203
display_sample_info(_wav_path, label=_txt)

asr/dataset_util/common_voice_loader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
from tqdm import tqdm
1010
from scipy.io import wavfile
1111

12-
from asr.params import BASE_PATH
1312
from asr.util.storage import delete_file_if_exists
14-
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH
13+
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH, BASE_PATH
1514

1615

1716
# Path to the Mozilla Common Voice dataset.

asr/dataset_util/generate_txt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import os
3030
import re
3131

32+
from asr.params import BASE_PATH
3233
from asr.util import storage
3334
from asr.dataset_util.tatoeba_loader import tatoeba_loader
3435
from asr.dataset_util.timit_loader import timit_loader
@@ -38,7 +39,7 @@
3839

3940

4041
# Dataset base path.
41-
DATASET_PATH = '../datasets/speech_data'
42+
DATASET_PATH = os.path.join(BASE_PATH, '../datasets/speech_data')
4243

4344
# Where to generate the .txt files, e.g. /home/user/../data/<target>.txt
4445
TXT_TARGET_PATH = './data/'

asr/dataset_util/libri_speech_loeader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
from scipy.io import wavfile
66

7-
from asr.params import BASE_PATH
8-
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH
7+
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH, BASE_PATH
98

109

1110
# Path to the LibriSpeech ASR dataset.

asr/dataset_util/plot_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
plt.grid(visible=True)
1515
plt.ylabel('WER')
1616
plt.xlabel('Step')
17-
plt.title('AIDS', visible=False)
17+
plt.title('TITLE', visible=False)
1818
plt.show()

asr/dataset_util/sd_estimator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
from tqdm import tqdm
1212

1313
from asr.load_sample import load_sample
14+
from asr.params import BASE_PATH
1415

1516

16-
__DATASETS_PATH = '../datasets/speech_data'
17+
__DATASETS_PATH = os.path.join(BASE_PATH, '../datasets/speech_data')
1718
__FEATURE_TYPE = 'mel'
1819

1920

@@ -72,7 +73,7 @@ def __stat_calculator(line):
7273

7374
if __name__ == '__main__':
7475
# Path to `train.txt` file.
75-
_test_txt_path = os.path.join('./data', 'train.txt')
76+
_test_txt_path = os.path.join(BASE_PATH, 'data', 'train.txt')
7677

7778
# Display dataset stats.
7879
calculate_dataset_stats(_test_txt_path)

asr/dataset_util/sort_txt_by_seq_len.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
from asr.util import storage
1212
from asr.load_sample import load_sample
1313
from asr.util.matplotlib_helper import pyplot_display
14+
from asr.params import BASE_PATH
1415

1516

16-
__DATASETS_PATH = '../datasets/speech_data'
17+
__DATASETS_PATH = os.path.join(BASE_PATH, '../datasets/speech_data')
1718

1819

1920
def _sort_txt_by_seq_len(txt_path, num_buckets=64, max_length=1700):

asr/dataset_util/tatoeba_loader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
from tqdm import tqdm
1111
from scipy.io import wavfile
1212

13-
from asr.params import BASE_PATH
1413
from asr.util.storage import delete_file_if_exists
15-
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH
14+
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH, BASE_PATH
1615

1716

1817
# Path to the Taboeba dataset.

asr/dataset_util/tedlium_loader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
from tqdm import tqdm
1010
from scipy.io import wavfile
1111

12-
from asr.params import BASE_PATH, FLAGS
12+
from asr.params import FLAGS, MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH, BASE_PATH
1313
from asr.util.storage import delete_file_if_exists
14-
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH
1514

1615

1716
# Path to the Tedlium v2 dataset.

asr/dataset_util/timit_loader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
from scipy.io import wavfile
66

7-
from asr.params import BASE_PATH
8-
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH
7+
from asr.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH, BASE_PATH
98

109

1110
# Path to the TIMIT dataset.

0 commit comments

Comments
 (0)