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))
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
Relevant log output
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