Unverified Commit 37b3b97d authored by Yasir Modak's avatar Yasir Modak Committed by GitHub
Browse files

Update mobilenet_example.ipynb (#10182)

* Update mobilenet_example.ipynb

fixes https://github.com/tensorflow/models/issues/10161

* Update mobilenet_example.ipynb

* Update mobilenet_example.ipynb

* Update mobilenet_example.ipynb
parent dfa64e52
...@@ -197,9 +197,10 @@ ...@@ -197,9 +197,10 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# setup path\n", "# setup path and install tf-slim\n",
"import sys\n", "import sys\n",
"sys.path.append('/content/models/research/slim')" "sys.path.append('/content/models/research/slim')"
"!pip install tf_slim",
] ]
}, },
{ {
...@@ -228,8 +229,10 @@ ...@@ -228,8 +229,10 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import tensorflow.compat.v1 as tf\n", "import tensorflow.compat.v1 as tf\n",
"import tf_slim as slim\n",
"from nets.mobilenet import mobilenet_v2\n", "from nets.mobilenet import mobilenet_v2\n",
"\n", "\n",
"tf.compat.v1.disable_eager_execution()\n"
"tf.reset_default_graph()\n", "tf.reset_default_graph()\n",
"\n", "\n",
"# For simplicity we just decode jpeg inside tensorflow.\n", "# For simplicity we just decode jpeg inside tensorflow.\n",
...@@ -244,7 +247,7 @@ ...@@ -244,7 +247,7 @@
"images = tf.image.resize_images(images, (224, 224))\n", "images = tf.image.resize_images(images, (224, 224))\n",
"\n", "\n",
"# Note: arg_scope is optional for inference.\n", "# Note: arg_scope is optional for inference.\n",
"with tf.contrib.slim.arg_scope(mobilenet_v2.training_scope(is_training=False)):\n", "with slim.arg_scope(mobilenet_v2.training_scope(is_training=False)):\n",
" logits, endpoints = mobilenet_v2.mobilenet(images)\n", " logits, endpoints = mobilenet_v2.mobilenet(images)\n",
" \n", " \n",
"# Restore using exponential moving average since it produces (1.5-2%) higher \n", "# Restore using exponential moving average since it produces (1.5-2%) higher \n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment