Skip to content

Commit 58b6db5

Browse files
committed
fix: use dynamic label names for inference to match training dataset
Previously, the inference section used a hardcoded list of labels: ['no', 'yes', 'down', 'go', 'left', 'up', 'right', 'stop'], which may not match the order of class names in `train_ds.class_names`. This could lead to incorrect labeling in prediction visualizations. This commit replaces the hardcoded labels with `label_names` from the training dataset to ensure the model's outputs are correctly mapped to their respective labels.
1 parent 0e030eb commit 58b6db5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/en/tutorials/audio/simple_audio.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@
825825
"x = x[tf.newaxis,...]\n",
826826
"\n",
827827
"prediction = model(x)\n",
828-
"x_labels = ['no', 'yes', 'down', 'go', 'left', 'up', 'right', 'stop']\n",
828+
"x_labels = label_names\n",
829829
"plt.bar(x_labels, tf.nn.softmax(prediction[0]))\n",
830830
"plt.title('No')\n",
831831
"plt.show()\n",

0 commit comments

Comments
 (0)