Skip to content

Update audio_spec.py #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def _split(self, wav, label):
])
def _preprocess(self, x, label):
"""Preprocess the dataset to extract the spectrum."""
# Add small Gaussian noise to the input x to solve the potential "nan" problem of the preprocess_model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap this line. Python code is expected to have a max len = 80.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed this problem.

x = x + 1e-05 * tf.random.normal(x.shape)
# x has shape (1, EXPECTED_WAVEFORM_LENGTH)
spectrum = self._preprocess_model(x)
# y has shape (1, embedding_len)
Expand Down