From 58b6db524e8037b6d9bd0f02288535cc987fb660 Mon Sep 17 00:00:00 2001 From: Mani_Babapour Date: Sun, 30 Nov 2025 14:54:48 +0330 Subject: [PATCH] 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. --- site/en/tutorials/audio/simple_audio.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/en/tutorials/audio/simple_audio.ipynb b/site/en/tutorials/audio/simple_audio.ipynb index 9d79742fbb..85c813606b 100644 --- a/site/en/tutorials/audio/simple_audio.ipynb +++ b/site/en/tutorials/audio/simple_audio.ipynb @@ -825,7 +825,7 @@ "x = x[tf.newaxis,...]\n", "\n", "prediction = model(x)\n", - "x_labels = ['no', 'yes', 'down', 'go', 'left', 'up', 'right', 'stop']\n", + "x_labels = label_names\n", "plt.bar(x_labels, tf.nn.softmax(prediction[0]))\n", "plt.title('No')\n", "plt.show()\n",