Skip to content

Commit

Permalink
✍️ fixing typos
Browse files Browse the repository at this point in the history
  • Loading branch information
nglehuy committed Apr 28, 2021
1 parent 11a50e5 commit 74de9fc
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion examples/conformer/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: ./vocabularies/librispeech/librispeech_train_4_1030.subwords
Expand Down
2 changes: 1 addition & 1 deletion examples/contextnet/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down
2 changes: 1 addition & 1 deletion examples/deepspeech2/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down
2 changes: 1 addition & 1 deletion examples/jasper/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down
4 changes: 3 additions & 1 deletion examples/rnn_transducer/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: True
center: False
top_db: null

decoder_config:
vocabulary: null
Expand Down
2 changes: 1 addition & 1 deletion notebooks/conformer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
" \"preemphasis\": 0.97,\n",
" \"normalize_signal\": True,\n",
" \"normalize_feature\": True,\n",
" \"normalize_per_feature\": False,\n",
" \"normalize_per_frame\": False,\n",
" },\n",
" \"decoder_config\": {\n",
" \"vocabulary\": None,\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/contextnet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
" \"preemphasis\": 0.97,\n",
" \"normalize_signal\": True,\n",
" \"normalize_feature\": True,\n",
" \"normalize_per_feature\": False,\n",
" \"normalize_per_frame\": False,\n",
" },\n",
" \"decoder_config\": {\n",
" \"vocabulary\": None,\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/rnn_transducer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
" \"preemphasis\": 0.97,\n",
" \"normalize_signal\": True,\n",
" \"normalize_feature\": True,\n",
" \"normalize_per_feature\": False,\n",
" \"normalize_per_frame\": False,\n",
" },\n",
" \"decoder_config\": {\n",
" \"vocabulary\": None,\n",
Expand Down
8 changes: 4 additions & 4 deletions tensorflow_asr/featurizers/speech_featurizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def __init__(self, speech_config: dict):
"pitch": bool,
"normalize_signal": bool,
"normalize_feature": bool,
"normalize_per_feature": bool
"normalize_per_frame": bool
}
"""
# Samples
Expand Down Expand Up @@ -320,21 +320,21 @@ def extract(self, signal: np.ndarray) -> np.ndarray:
if self.delta:
delta = librosa.feature.delta(original_features.T).T
if self.normalize_feature:
delta = normalize_audio_feature(delta, per_feature=self.normalize_per_feature)
delta = normalize_audio_feature(delta, per_frame=self.normalize_per_frame)
features = np.concatenate([features, np.expand_dims(delta, axis=-1)], axis=-1)

if self.delta_delta:
delta_delta = librosa.feature.delta(original_features.T, order=2).T
if self.normalize_feature:
delta_delta = normalize_audio_feature(
delta_delta, per_feature=self.normalize_per_feature)
delta_delta, per_frame=self.normalize_per_frame)
features = np.concatenate([features, np.expand_dims(delta_delta, axis=-1)], axis=-1)

if self.pitch:
pitches = self.compute_pitch(signal)
if self.normalize_feature:
pitches = normalize_audio_feature(
pitches, per_feature=self.normalize_per_feature)
pitches, per_frame=self.normalize_per_frame)
features = np.concatenate([features, np.expand_dims(pitches, axis=-1)], axis=-1)

return features
Expand Down
2 changes: 1 addition & 1 deletion tests/conformer/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down
2 changes: 1 addition & 1 deletion tests/contextnet/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down
2 changes: 1 addition & 1 deletion tests/deepspeech2/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down
6 changes: 3 additions & 3 deletions tests/featurizer/test_sentencepiece.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_featurizer():
"preemphasis": 0.97,
"normalize_signal": True,
"normalize_feature": True,
"normalize_per_feature": False}
"normalize_per_frame": False}

text_featurizer_sentencepiece = SentencePieceFeaturizer.load_from_file(config, None)
subwords_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_iextract():
"preemphasis": 0.97,
"normalize_signal": True,
"normalize_feature": True,
"normalize_per_feature": False}
"normalize_per_frame": False}

text_featurizer_sentencepiece = SentencePieceFeaturizer.load_from_file(config, None)
speech_featurizer = TFSpeechFeaturizer(config_speech)
Expand All @@ -124,7 +124,7 @@ def test_iextract():
print(file_path)
with open(file_path, "r") as f:
lines = f.read().splitlines()
m=re.search(r"[0-9]+-[0-9]+-[0-9]+\s+([\w\s]+)",lines[0])
m = re.search(r"[0-9]+-[0-9]+-[0-9]+\s+([\w\s]+)", lines[0])
transcript = m.groups(1)[0].lower()

assert(labels == transcript)
2 changes: 1 addition & 1 deletion tests/jasper/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down
2 changes: 1 addition & 1 deletion tests/rnn_transducer/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ speech_config:
preemphasis: 0.97
normalize_signal: True
normalize_feature: True
normalize_per_feature: False
normalize_per_frame: False

decoder_config:
vocabulary: null
Expand Down

0 comments on commit 74de9fc

Please sign in to comment.