Skip to content

Commit 7b5d47f

Browse files
authored
fix minor typo on the image segmentation tutorial
Just found that tf.keras.losses.CategoricalCrossentropy should be changed to tf.keras.losses.SparseCategoricalCrossentropy since the pixel classes (labels) are integers, not one-hot encoded. Code is written correct, but the markdown should fix to prevent potential confusion to readers.
1 parent 36b0a7d commit 7b5d47f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/en/tutorials/images/segmentation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@
452452
"\n",
453453
"Now, all that is left to do is to compile and train the model. \n",
454454
"\n",
455-
"Since this is a multiclass classification problem, use the `tf.keras.losses.CategoricalCrossentropy` loss function with the `from_logits` argument set to `True`, since the labels are scalar integers instead of vectors of scores for each pixel of every class.\n",
455+
"Since this is a multiclass classification problem, use the `tf.keras.losses.SparseCategoricalCrossentropy` loss function with the `from_logits` argument set to `True`, since the labels are scalar integers instead of vectors of scores for each pixel of every class.\n",
456456
"\n",
457457
"When running inference, the label assigned to the pixel is the channel with the highest value. This is what the `create_mask` function is doing."
458458
]

0 commit comments

Comments
 (0)