diff options
author | zxcqwe4906 <b00902042@ntu.edu.tw> | 2017-11-22 15:13:18 +0800 |
---|---|---|
committer | Gunhan Gulsoy <gunan@google.com> | 2017-11-21 23:13:18 -0800 |
commit | 5fbda9d8da7b98f62e83a392f047adf307b48b02 (patch) | |
tree | 6f0382b513af992e9f724d044a2275d52a0c201c /tensorflow/examples/udacity | |
parent | 4ddc2866e2ae1aa4ac4b345fccd97990b6ccca01 (diff) |
Change ndimage.imread to imageio.imread. (#14710)
Scipy will not support imread from 1.0.0 as its document says:
https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.misc.imread.html
Change to imageio.imread and add its correspond exception.
Diffstat (limited to 'tensorflow/examples/udacity')
-rw-r--r-- | tensorflow/examples/udacity/1_notmnist.ipynb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tensorflow/examples/udacity/1_notmnist.ipynb b/tensorflow/examples/udacity/1_notmnist.ipynb index 39674e1aa4..dffe5d37c6 100644 --- a/tensorflow/examples/udacity/1_notmnist.ipynb +++ b/tensorflow/examples/udacity/1_notmnist.ipynb @@ -46,13 +46,13 @@ "# These are all the modules we'll be using later. Make sure you can import them\n", "# before proceeding further.\n", "from __future__ import print_function\n", + "import imageio\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import os\n", "import sys\n", "import tarfile\n", "from IPython.display import display, Image\n", - "from scipy import ndimage\n", "from sklearn.linear_model import LogisticRegression\n", "from six.moves.urllib.request import urlretrieve\n", "from six.moves import cPickle as pickle\n", @@ -325,13 +325,13 @@ " for image in image_files:\n", " image_file = os.path.join(folder, image)\n", " try:\n", - " image_data = (ndimage.imread(image_file).astype(float) - \n", + " image_data = (imageio.imread(image_file).astype(float) - \n", " pixel_depth / 2) / pixel_depth\n", " if image_data.shape != (image_size, image_size):\n", " raise Exception('Unexpected image shape: %s' % str(image_data.shape))\n", " dataset[num_images, :, :] = image_data\n", " num_images = num_images + 1\n", - " except IOError as e:\n", + " except (IOError, ValueError) as e:\n", " print('Could not read:', image_file, ':', e, '- it\\'s ok, skipping.')\n", " \n", " dataset = dataset[0:num_images, :, :]\n", |