[example] add caffe to pythonpath in all examples
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Tue, 29 Jul 2014 03:10:16 +0000 (20:10 -0700)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Tue, 5 Aug 2014 22:55:46 +0000 (15:55 -0700)
examples/imagenet_classification.ipynb
examples/net_surgery.ipynb

index e7fe9f8..40e69ae 100644 (file)
       "import matplotlib.pyplot as plt\n",
       "%matplotlib inline\n",
       "\n",
-      "import caffe\n",
-      "\n",
+      "# Make sure that caffe is on the python path:\n",
       "caffe_root = '../'  # this file is expected to be in {caffe_root}/examples\n",
+      "import sys\n",
+      "sys.path.insert(0, caffe_root + 'python')\n",
+      "\n",
+      "import caffe\n",
       "\n",
       "# Set the right path to your model definition file, pretrained model weights,\n",
       "# and the image you would like to classify.\n",
index 0a6e208..d64ae85 100644 (file)
      "cell_type": "code",
      "collapsed": false,
      "input": [
+      "# Make sure that caffe is on the python path:\n",
+      "caffe_root = '../'  # this file is expected to be in {caffe_root}/examples\n",
+      "import sys\n",
+      "sys.path.insert(0, caffe_root + 'python')\n",
+      "\n",
       "import caffe\n",
       "\n",
       "# Load the original network and extract the fully-connected layers' parameters.\n",
    "metadata": {}
   }
  ]
-}
+}
\ No newline at end of file