Skip to content
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

Bug: Why is the TensorFlow audio classification tutorial no longer providing accurate predictions? #921

Open
austrisu opened this issue Aug 26, 2024 · 1 comment
Labels

Comments

@austrisu
Copy link

What happened?

I've been experimenting with TensorFlow by following the tutorial available here. However, I noticed that the model's predictions seem to be inaccurate. Specifically, when I run the example in Google Colab, the predictions are off.

The tutorial mentions that the audio prediction should work as expected, but the graph provided here shows that the predictions are significantly incorrect.

I checked the Wayback Machine and found that this example was working correctly two years ago (link). It seems like it hasn't been functioning as intended since then.

My question is: Am I missing something, or is there a way to run this example correctly to generate a model that can accurately predict voice commands? Or could this issue be related to changes in TensorFlow versions?

Relevant code

x = data_dir/'no/01bb6a2a_nohash_0.wav'
x = tf.io.read_file(str(x))
x, sample_rate = tf.audio.decode_wav(x, desired_channels=1, desired_samples=16000,)
x = tf.squeeze(x, axis=-1)
waveform = x
x = get_spectrogram(x)
x = x[tf.newaxis,...]

prediction = model(x)
x_labels = ['no', 'yes', 'down', 'go', 'left', 'up', 'right', 'stop']
plt.bar(x_labels, tf.nn.softmax(prediction[0]))
plt.title('No')
plt.show()

display.display(display.Audio(waveform, rate=16000))

Relevant log output

https://www.tensorflow.org/static/tutorials/audio/simple_audio_files/output_zRxauKMdhofU_1.png

tensorflow_hub Version

0.13.0.dev (unstable development build)

TensorFlow Version

2.8 (latest stable release)

Other libraries

No response

Python Version

3.x

OS

Linux

@austrisu austrisu changed the title Bug: Bug: Why is the TensorFlow audio classification tutorial no longer providing accurate predictions? Aug 26, 2024
@austrisu
Copy link
Author

austrisu commented Sep 3, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@austrisu and others