Skip to content

Commit 2d80e07

Browse files
author
Itamar Turner-Trauring
authored
Merge pull request #6 from dotmesh-io/update-to-tensorflow-2
Update to Tensorflow 2.1 APIs.
2 parents bb5ee1f + cfea96b commit 2d80e07

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

roadsigns.ipynb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,12 @@
309309
" #print(\"[preprocess_and_decode] got %s\" % (img_str,))\n",
310310
" img = tf.io.decode_base64(img_str)\n",
311311
" img = tf.image.decode_jpeg(img, channels=1)\n",
312-
" img = tf.image.resize_images(img, (32, 32))\n",
312+
" img = tf.image.resize(img, (32, 32))\n",
313313
" img = tf.cast(img, tf.float32)\n",
314314
" #img = preprocess(tf.Tensor([img]))\n",
315315
" return img\n",
316316
" \n",
317-
"InputLayer = tf.keras.Input(shape = (1,),dtype=\"string\")\n",
317+
"InputLayer = tf.keras.Input(shape = (1,),dtype=\"string\",name=\"input_image_bytes\")\n",
318318
"OutputLayer = tf.keras.layers.Lambda(lambda img : tf.map_fn(lambda im : preprocess_and_decode(im[0]), img, dtype=\"float32\"))(InputLayer)\n",
319319
"base64_model = tf.keras.Model(InputLayer, OutputLayer)\n"
320320
]
@@ -443,11 +443,7 @@
443443
" print('\\nAlready saved a model, cleaning up\\n')\n",
444444
" !rm -r {export_path}\n",
445445
"\n",
446-
"tf.saved_model.simple_save(\n",
447-
" tf.keras.backend.get_session(),\n",
448-
" export_path,\n",
449-
" inputs={'input_image_bytes': model.input}, \n",
450-
" outputs={t.name:t for t in model.outputs})\n",
446+
"tf.saved_model.save(model, export_path)\n",
451447
"\n",
452448
"print('\\nSaved model:')\n",
453449
"!ls -l {export_path}"
@@ -533,4 +529,4 @@
533529
},
534530
"nbformat": 4,
535531
"nbformat_minor": 4
536-
}
532+
}

0 commit comments

Comments
 (0)