Skip to content

Commit 87afc30

Browse files
Change Keras preprocessing APIs to stable in the Image segmentation tutorial
PiperOrigin-RevId: 405699120
1 parent 911a9fc commit 87afc30

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

site/en/tutorials/images/segmentation.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
"outputs": [],
110110
"source": [
111111
"import tensorflow as tf\n",
112-
"from tensorflow.keras.layers.experimental import preprocessing \n",
113112
"\n",
114113
"import tensorflow_datasets as tfds"
115114
]
@@ -247,8 +246,8 @@
247246
" def __init__(self, seed=42):\n",
248247
" super().__init__()\n",
249248
" # both use the same seed, so they'll make the same random changes.\n",
250-
" self.augment_inputs = preprocessing.RandomFlip(mode=\"horizontal\", seed=seed)\n",
251-
" self.augment_labels = preprocessing.RandomFlip(mode=\"horizontal\", seed=seed)\n",
249+
" self.augment_inputs = tf.keras.layers.RandomFlip(mode=\"horizontal\", seed=seed)\n",
250+
" self.augment_labels = tf.keras.layers.RandomFlip(mode=\"horizontal\", seed=seed)\n",
252251
" \n",
253252
" def call(self, inputs, labels):\n",
254253
" inputs = self.augment_inputs(inputs)\n",
@@ -310,7 +309,7 @@
310309
" for i in range(len(display_list)):\n",
311310
" plt.subplot(1, len(display_list), i+1)\n",
312311
" plt.title(title[i])\n",
313-
" plt.imshow(tf.keras.preprocessing.image.array_to_img(display_list[i]))\n",
312+
" plt.imshow(tf.keras.utils.array_to_img(display_list[i]))\n",
314313
" plt.axis('off')\n",
315314
" plt.show()"
316315
]

0 commit comments

Comments
 (0)