Skip to content

Commit

Permalink
Optimized loop and bugfix in SDE (NVIDIA#5573)
Browse files Browse the repository at this point in the history
- Fixed bug with loading custom data attributes from JSON in Speech Data Explorer

Signed-off-by: George Zelenfroynd <[email protected]>
  • Loading branch information
Jorjeous authored Dec 8, 2022
1 parent 584ca56 commit f091999
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tools/speech_data_explorer/data_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,15 @@ def append_data(
data[-1]['I'] = measures['insertions']
data[-1]['D'] = measures['deletions']
data[-1]['D-I'] = measures['deletions'] - measures['insertions']
else:
for k in item:
if k not in data[-1]:
data[-1][k] = item[k]
if estimate_audio:
filepath = absolute_audio_filepath(item['audio_filepath'], data_filename)
signal, sr = librosa.load(path=filepath, sr=None)
bw = eval_bandwidth(signal, sr)
item['freq_bandwidth'] = int(bw)
item['level_db'] = 20 * np.log10(np.max(np.abs(signal)))
for k in item:
if k not in data[-1]:
data[-1][k] = item[k]
if estimate_audio:
filepath = absolute_audio_filepath(item['audio_filepath'], data_filename)
signal, sr = librosa.load(path=filepath, sr=None)
bw = eval_bandwidth(signal, sr)
item['freq_bandwidth'] = int(bw)
item['level_db'] = 20 * np.log10(np.max(np.abs(signal)))
for k in item:
if k not in data[-1]:
data[-1][k] = item[k]

vocabulary_data = [{'word': word, 'count': vocabulary[word]} for word in vocabulary]
return (
Expand Down

0 comments on commit f091999

Please sign in to comment.